CXL
CXL

Reputation: 1112

I can't access certain subkeys in an entry in the registry

I'm trying to get to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\, but the only subkey being returned in C# is MachineSettings - even though there are additional subkeys, including Games and several keys named for different user SIDs. How can I access these other keys? Even a standard user account can read the content of both Games and that account's own SID (when looking in regedit)...

Upvotes: 1

Views: 2500

Answers (1)

CXL
CXL

Reputation: 1112

So the issue was related to running a 32-bit application in a 64-bit Windows environment. 64-bit Windows sandboxes 32-bit content (which is why there's a C:\Program Files (x86)) in a way that is transparent to applications. 32-bit applications that use the registry access a sandboxed hive inside HKLM\WOW6423Node, which is why I wasn't seeing the expected result when querying a key inside HKLM.

Fortunately, .NET 4.0 (introduced with VS.NET 2010 and its Express Edition counterparts) includes a super easy function that lets a 32-bit application see and use the 64-bit registry (and vice versa).

Answer is here: Create 64 bit registry key (non-WOW64) from a 32 bit application

Upvotes: 5

Related Questions