Reputation: 51
I would like read the Windows ID in my program. So I use RegGetValue in
TCHAR value[255];
DWORD BufferSize = 255;
int a=RegGetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId", RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize);
My problem is that in 64 bits OS the function read the folder "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion" and not "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
Unfortunetaly ProductID and DigialProductID is not in the 64 register.. How I could force the read or obtains the Window ID
Best Regards
Upvotes: 0
Views: 2731
Reputation: 308130
HKEY key = NULL;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &key);
int a = RegGetValue(key, "", "ProductId", RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize);
Upvotes: 1