Where does Windows 10 keep its virtual registry keys?
I'm writing my first C# Project in Visual Studio and found out that when I write a key inside HKEY_LOCAL_MACHINE, Windows 10 actually writes the key elsewhere as part a virtualization process. I need to know where that elsewhere is.
It's not in the virtual store as someone notes in the background article https://social.technet.microsoft.com/Forums/windows/en-US/2125a783-12bb-4fce-8005-0c4b5d1edbad/hidden-registry-keys?forum=w7itproappcompat.
Loading
Mark WillisPosted Mar 18, 2018, 2:53 PM
The registry has in effect two local machines. The non-virtualized local machine is viewable from RegEdit, while the virtualized local machine is viewable from C# code. These two overlap, but not for custom keys. We already gave the example that if the Oyster key is written to the local machine with C# code, then it is it is not accessible by RegEdit. The converse also holds. If you write the oyster key to local machine in RegEdit,then C# code cannot access it.
This is some cases produces a dilemma! Which local machine should a custom key be written to? If the operating system needs to see the key, write the key in RegEdit. If your C# needs to see the key, write the key in C# code. You can't have it both ways where both the system and your code see the key!! There’s no way that isn’t a big bummer.
Mark WillisPosted Dec 24, 2017, 8:40 PM
For example, let's write the "Oyster" Key under HKEY_LOCAL_MACHINE\Software:
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
RegistryKey newkey = key.CreateSubKey("Oyster");
You will not find the "Oyster" key in regedit, but the key still exists. I did a C# search of the registry and could not find the key anywhere else except at HKEY_LOCAL_MACHINE\Software\Oyster, where it was originally written. So finding the key under the virtual store at HKCU\Softwate\Classes\VirtualStore is a thing that happens only in older versions of Windows.