I wrote an application that stores several things in the registry. When I first started, I added them to HKEY_LOCAL_MACHINE, but kept getting permission errors writing to the. So, it was suggested that I use HKEY_CURRENT_USER, that worked until I realized that I am not able to access them from another account. How can I write to the registry but allow all accounts to access read and write to it?
I used the Python module _winreg.
HKEY_LOCAL_MACHINE/Software/YourSoftware, needs Admin permissions and is for install-time data, orHKEY_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:
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
HKLMand set the settings. Normal user rights should suffice to readHKLM