Search code examples
winapiwxwidgetsregistry

Can't read certain registry keys programmatically


I have a little app which reads registry key string values. It works well but for some reason it fails on this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductId Despite working on other values of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\

It also fails on `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid'

I am running as an admin, is this a factor? I'm running W7 64bit, another W7 machine and Vista machine both work fine. My only guesses are some permissioning issue, or related to me running 64-bit.

update: It appears to be something to do with my system running Windows 64bit, and \Software\Wow6432Node\. I don't know what that is though. I have both \Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\ and \Software\Microsoft\Windows NT\CurrentVersion\ but only the latter contains ProductId value... for some reason when I ask for the key Windows is apparently looking in the Wow6432Node

We're using wxWidgets but could probably use some win32 code directly if needed... our app is a 32bit application but target PCs could be running 32 or 64 bit versions of Windows


Solution

  • It's due to WOW64. This other question focuses on the details.