I am adding a registry key using the following code:
var key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(key);
Within my code I can read back the value find, even in between runs. However, the key never shows in regedit and the other program that should be reading the key can't see it.
The program is running on Vista with elevated priviledges.
Best Answer
Vista introduced registry virtualization; "global" registry changes are, in some cases, redirected to user-specific locations:
You can disable this by customizing your application manifest, or you can modify policy for just the key you're touching.
WOW64 (are you running a 64-bit edition of Vista?) also does registry redirection. This has bitten me in annoying ways.
See the MSDN article on registry virtualization.