Where can I record data in Windows Vista using any account and view it from all other accounts?

I need to write some registration data (a unique computer number and the corresponding activation code).

The computer number must be visible from other programs and all accounts ({Admin | Non Admin} with enabled user access control {On | Off})

It is permissible to write down the computer number and activation code only from the administrator account, but it should be accessible for reading from other accounts.

Currently (and I need to check this more) it seems that if CN and activation code are written from UAC, then when the user switches UAC ON, the computer number is not displayed.

+4
source share
2 answers

During the installation time, you can write it to your program installation folder, because, apparently, it will not change (you need write access) later. You should still have read access as a standard user. Otherwise, how to run the program? :)

Or you can use the "All User Data" folder. In XP, this is usually displayed on C:\Documents and Settings\All Users\Application Data\YourApp\ . I don’t have Vista in front of me, so I can’t give you the exact location at the moment, but this should be a fairly simple mapping.

+3
source

Location returned

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)

This is the same place that Joel mentioned in his post, but this is the right way to get this value (which changed location between XP and Vista and could change again).

(This, of course, is for .NET. For Win32, you want to use the SHGetFolderPath function with CSIDL_COMMON_APPDATA)

+3
source

All Articles