Location for common data
-
My app creates some common data that must be created only once and then be accessible by all users of the machine. I used to dump the data into the registry, but Vista foiled those plans by virtualizing the registry unless you had admin privileges, which meant the data was no longer common to all users. So I tried saving the data into the Environment.SpecialFolder.CommonApplicationData folder (which ends up pointing to C:\ProgramData). Foiled again! This folder also requires admin privileges if you are to avoid virtualization! Where can I save data that my app can use regardless of what user is signed on? Thanks for any help!
-
My app creates some common data that must be created only once and then be accessible by all users of the machine. I used to dump the data into the registry, but Vista foiled those plans by virtualizing the registry unless you had admin privileges, which meant the data was no longer common to all users. So I tried saving the data into the Environment.SpecialFolder.CommonApplicationData folder (which ends up pointing to C:\ProgramData). Foiled again! This folder also requires admin privileges if you are to avoid virtualization! Where can I save data that my app can use regardless of what user is signed on? Thanks for any help!
-
You can store in "Settings". Application Settings[^]
-
My app creates some common data that must be created only once and then be accessible by all users of the machine. I used to dump the data into the registry, but Vista foiled those plans by virtualizing the registry unless you had admin privileges, which meant the data was no longer common to all users. So I tried saving the data into the Environment.SpecialFolder.CommonApplicationData folder (which ends up pointing to C:\ProgramData). Foiled again! This folder also requires admin privileges if you are to avoid virtualization! Where can I save data that my app can use regardless of what user is signed on? Thanks for any help!
The recommended thing to do is have your installer give your common app data folder the required permissions. This same requirement applied to Windows 2000/XP as well, and is documented in the Designed for Windows XP Application Specification 2.3 Document[^] (See section 3.0). Also section 2.3 of the Requirements for the Windows Vista Logo Program for Software[^] Here's a little bit more info on setting the ACL from code: Windows Vista : Application Certification and Compatibility: Test Case 15: Verify application installs to the correct folders by default (Req:2.3)[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
The recommended thing to do is have your installer give your common app data folder the required permissions. This same requirement applied to Windows 2000/XP as well, and is documented in the Designed for Windows XP Application Specification 2.3 Document[^] (See section 3.0). Also section 2.3 of the Requirements for the Windows Vista Logo Program for Software[^] Here's a little bit more info on setting the ACL from code: Windows Vista : Application Certification and Compatibility: Test Case 15: Verify application installs to the correct folders by default (Req:2.3)[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I really appreciate it! I didn't know about having the installer set the permissions. I guess Vista is finally forcing me to do things right. :)
Winkles wrote:
I guess Vista is finally forcing me to do things right
A lot of us :)
Winkles wrote:
having the installer set the permissions
I didn't mention this, but the permissions can be set manually as well, of course. Cheers, Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
My app creates some common data that must be created only once and then be accessible by all users of the machine. I used to dump the data into the registry, but Vista foiled those plans by virtualizing the registry unless you had admin privileges, which meant the data was no longer common to all users. So I tried saving the data into the Environment.SpecialFolder.CommonApplicationData folder (which ends up pointing to C:\ProgramData). Foiled again! This folder also requires admin privileges if you are to avoid virtualization! Where can I save data that my app can use regardless of what user is signed on? Thanks for any help!
I haven't programmed in Vista for about 9 months. But if you want to store your data in the registry, if you place it into HKEY_LOCAL_MACHINE, vista will not allow that. It creates a copy in the current user's node only. Try using HKEY_ROOT instead. If you want to place the data on disk, Vista has a folder called Program Data, similar to Program Files. Place your data there instead of program files.