HKEY_LOCAL_MACHINE/Software/YourSoftware
, needs Admin permissions and is for install-time data, or HKEY_CURRENT_USER/Software/YourSoftware
, which is for data pertinent to this environment only (this user, this profile etc.)
EDIT: An alternative would be storing a config file and setting the right permissions at install time.
2nd EDIT: I've read in another comment that you want to be sure only your application modified some file, so you store the modification times. Workarounds:
- encrypt the file-not-to-be-modified, best is with a user-generated key
- make a service, install with a special user under which it runs, and make the permissions so, that only this service can access the file
My gut feeling says your requirement to modify a file only by your app, but under any account is very wrong but the more or less correct solutions have to impose additional complexity. Your decision: review your requirements and possibly your design, or add a layer of complexity and possibly cruft.
3rd EDIT: Split your app, have an admin application, which can with admin rights write to HKLM
and set the settings. Normal user rights should suffice to read HKLM