Windows – write data to on Windows Vista using any account and be viewable from all other accounts

uacwindows-vista

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

The Computer Number needs to be visible from other programs and all accounts ({Admin|Non Admin} with User Access Control turned {On|Off} )

It's acceptable to write the Computer Number and Activation Code only from an Admin account, but it needs to be readable from any of the other accounts.

Currently (and I need to test this more) it seems that if the the CN and Activation Code are written with UAC off then when the user switches UAC ON the Computer Number isn't visible.

Best Answer

During install time you can write it to your program's install folder, since presumably it won't change (require write access) later. You should still have read access there as a standard user. Otherwise, how would run the program? :)

Or you can use the All Users Application Data folder. In XP, that would normally map to 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 it should be a pretty simple mapping.