DWORD dwType = REG_SZ;
TCHAR keyData[1024];
DWORD keyDataLength = 1024;
cchValue = MAX_VALUE_NAME;
achValue[0] = '\0';
HKEY currentKey;
long err = RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"), NULL, KEY_READ, ¤tKey);
_tprintf(TEXT("OpenKey Error Code: %d\n"), err);
err = RegQueryValueEx(currentKey, TEXT("STEAM"), NULL, NULL, (LPBYTE)&keyData, &keyDataLength);
_tprintf(TEXT("QueryKey Error Code: %d\n"), err);
_tprintf(TEXT("Data: %d\n"), keyData);
上面的代码产生以下结果:
OpenKey Error Code: 0
QueryKey Error Code: 0
Data: 15332432
如何让 keyData 显示正确的结果?我在网上看了很长时间,这几乎是我在网上找到的工作示例的副本......它设置为 UNICODE,我不想切换字符集。