I agree that it would be nice if we could import the registry as a nested association. This is really not an answer to that, but I thought it might still be useful to others.
I discovered this post in a search. I was looking for a way to read the value of a registry key from Mathematica. (I needed the path to a data directory of a particular installed software tool.) After a bit of hunting, I came upon the fact that Microsoft .NET includes a class named Registry which provides static methods for manipulating the registry. I found the assembly containing that class on my computer.
The code below uses Mathematica's NET/Link to interface with that class and read the value of a registry key. (I used a common key for this post, so others can run the code.)
Information on NET/Link can be found here.
Information on the Registry class can be found here.
And here is the code: (There are a few continuation \ to remove. )
(* Install NETLink *)
Needs["NETLink`"]
InstallNET[];
(* Load the assembly that contains the Registry class *)
(* I found the location by searching for it on my computer *)
asmName =
"C:\\Program \
Files\\dotnet\\shared\\Microsoft.NETCore.App\\2.1.11\\Microsoft.Win32.\
Registry.dll";
asm = LoadNETAssembly[asmName];
(* Since this we will use static methods we will not insantiate a \
Registry object, so we need to load the type explicitly *)
registryType = LoadNETType["Microsoft.Win32.Registry"];
(* we can use NETTypeInfo to see the fields and methods *)
(* I deleted the output before posting because its lengthy *)
NETTypeInfo@registryType
(* output deleted *)
(* one of the functions is GetValue *)
(* here we use it to get the value of a key *)
key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows \
NT\\CurrentVersion";
valueName = "SystemRoot";
systemRootPath = Registry`GetValue[key, valueName, -1]
(* "C:\\windows" *)
?Developer`*Registry*
, for exampleDeveloper`EnumerateRegistrySubkeys["HKEY_CLASSES_ROOT"]
. $\endgroup$