Don’t Write User Files to \Program Files
Writing to the \Program Files directory requires the user to be an administrator because the access control entry (ACE) for a user is Read, Execute, and List Folder Contents. Requiring administrator privileges defeats the principle of least privilege. If you must store data for the user, store it in the user’s profile: %USERPROFILE%\My Documents, where the user has full control. If you want to store data for all users on a computer, write the data to \Documents and Settings\ All Users\Application Data\dir.
Writing to \Program Files is one of the two main reasons why so many applications ported from Windows 95 to Windows NT and later require the user to be an administrator. The other reason is writing to the HKEY_LOCAL_MACHINE portion of the system registry, and that’s next.
------
Don’t Write User Data to HKLM
As with writing to \Program Files, writing to HKEY_LOCAL_MACHINE is also not recommended for user application information because the ACL on this registry hive allows users (actually, Everyone) read access. This is the second reason so many applications ported from Windows 95 to Windows NT and later require the user to be an administrator. If you must store data for the user in the registry, store it in HKEY_CURRENT_USER, where the user has full control.
Don’t Write User Files to ...
-
- Enthusiast
- Posts: 792
- Joined: Sat Aug 09, 2003 3:13 am
- Location: 90-61-92 // EU or ASIA
- Contact:
Don’t Write User Files to ...
I am reading a book, and has some useful info so i put it here:
Re: Don’t Write User Files to ...
> If you must store data for the user, store it in the user’s profile: %USERPROFILE%\My Documents
ARGHHHHH!!!!!!!!!!!! DON'T DO THIS! I HATE THIS! (And don't write in the regestry)
And by the way: On my system no My Documents exist.
>\Documents and Settings\ All Users\Application Data\dir.
Same here
Don't not use fixed-System-Paths. Always ask the correct path with api-commands.
GPI
ARGHHHHH!!!!!!!!!!!! DON'T DO THIS! I HATE THIS! (And don't write in the regestry)
And by the way: On my system no My Documents exist.
>\Documents and Settings\ All Users\Application Data\dir.
Same here
Don't not use fixed-System-Paths. Always ask the correct path with api-commands.
GPI
- Don't write to the registry.
- All configuration stuff should be in the program directory (ie. where the user has installed your program)
- All the data should either be put in the program directory (perhaps in a subfolder), OR to a directory which the user has specified.
This way I know where everything is placed, and in addition, I can move the app to another HDD if I want to , and it would still work.
My 2 cents.
- All configuration stuff should be in the program directory (ie. where the user has installed your program)
- All the data should either be put in the program directory (perhaps in a subfolder), OR to a directory which the user has specified.
This way I know where everything is placed, and in addition, I can move the app to another HDD if I want to , and it would still work.
My 2 cents.
AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Re: Don’t Write User Files to ...
Yep, hate it too! Really! I hate it so much that i wrote a simple .BAT that deletes every "My Videos" "My Music" "My Whatever" folder during booting.GPI wrote:> If you must store data for the user, store it in the user’s profile: %USERPROFILE%\My Documents
ARGHHHHH!!!!!!!!!!!! DON'T DO THIS! I HATE THIS! (And don't write in the regestry)
And by the way: On my system no My Documents exist.
>\Documents and Settings\ All Users\Application Data\dir.
Same here
Don't not use fixed-System-Paths. Always ask the correct path with api-commands.
GPI
When will they ever learn...

Some do code in sweet delight, some do code in endless night
-
- Enthusiast
- Posts: 218
- Joined: Sat Apr 26, 2003 4:47 am
- Location: Dullsville..population: me
- Contact:
Re: Don’t Write User Files to ...
Years ago, I did a similar batch file to clean up winblows on startup.
When I tried it, it seemed to take forever to finish..then I noticed my C:\windows\ dir was now empty
When I tried it, it seemed to take forever to finish..then I noticed my C:\windows\ dir was now empty
