简体   繁体   English

获取Windows ID c ++

[英]Get Windows ID c++

I would like read the Windows ID in my program. 我想在程序中读取Windows ID。 So I use RegGetValue in 所以我在使用RegGetValue

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" 我的问题是,在64位OS中,该函数读取文件夹“ SOFTWARE \\ Wow6432Node \\ Microsoft \\ Windows NT \\ CurrentVersion”,而不是“ 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 不幸的是,ProductID和DigialProductID不在64寄存器中。如何强制读取或获取Window ID

Best Regards 最好的祝福

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM