I am trying to retrieve some values from the registry. Here is the full path: [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes] "ThemeChangesMousePointers"=0x00000001 (1)
And here is my code:
HKEY hKey;
DWORD dwDisp = REG_DWORD;
DWORD dwType;
DWORD dwSize = sizeof(DWORD);
DWORD dwValue = 0;
DWORD dwReturn;
char buffer[255] = {0};
//char* buffer;
//DWORD buffer = 0;
DWORD dwBufSize = sizeof(buffer);
if( RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes")
,&hKey) == ERROR_SUCCESS)
{
dwType = REG_DWORD;
if( RegQueryValueEx(hKey,_T("ThemeChangesMousePointers"),0, &dwType, (LPBYTE) buffer, &dwBufSize) == ERROR_SUCCESS)
{
printf("Key value is: %d \n", buffer);
printf("GetLastError reports %d \n", GetLastError());
}
else
{
printf("Cannot query for key value \n");
}
}
I have tried debugging and it seems like my buffer output variable is giving me a weird output:
Key value is: 2554292 Error is 0
Every time I run the code again, I get different values. How can I get the real value and not a different one?
EDIT: Post above has been edited to ask a different question.
Also, if this isn't enough code, I can add more.