I'm writing a winforms app in C# and for part of it I want to store data in the registry. The data are licence keys and the app I've written is running with elevated (Administrator) permissions. The location where I want to store the values is: HKEY_LOCAL_MACHINE\SOFTWARE\MyCompanyName\MyAppName\Licences
. I want it stored in LOCAL_MACHINE and not CURRENT_USER because I'm licencing the machine, not the user.
When inspecting the registry I am using %systemroot%\syswow64\regedit
and running with Administrator permissions. I've additionally checked with c:\Windows\regedit
too. For both the following is true. I'm running 64 bit Windows 8.1 Pro (don't laugh).
The code runs without error and stores the data. It also reads it back correctly too. However, the value is not created at the key location. Instead, having searched the registry for the value I created, it is being created at four places:
HKEY_CLASSES_ROOT\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\MyCompanyName\MyAppName\Licences
HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\MyCompanyName\MyAppName\Licences
HKEY_USERS\S-1-5-21-1518458450-3113483475-3039049429-1106\Software\Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\MyCompanyName\MyAppName\Licences
HKEY_USERS\S-1-5-21-1518458450-3113483475-3039049429-1106_Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\MyCompanyName\MyAppName\Licences
So, a few questions. Am I using the right version of regedit? If so, how do I get my licences to write to the location I require? Why are they turning up in these other places?
Thank you for any assistance rendered.