我正在尝试读取 C++ 中的注册表项,这是我的功能:
DWORD regkey()
{
HKEY hKey;
DWORD dwDisp = REG_BINARY;
DWORD dwSize = sizeof(dwDisp);
DWORD dwValue = 0;
DWORD dwReturn;
DWORD dwBufSize = sizeof(dwDisp);
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"HERE\\IS\\THE\\REGKEY",0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
DWORD error = RegQueryValueEx(hKey,L"key",0,0, (LPBYTE)&dwReturn, &dwBufSize);
if(error == ERROR_SUCCESS)
{
return dwReturn;
}
}
RegCloseKey(hKey);
return 0;
}
但它什么也没返回...请帮助我。