Okey, ive done a couple of things...
Fixed the HKEY key to HKEY key = HKEY_LOCAL_MACHINE
Added return check
and used strcmp() with the string comparison, thanks
i got this now
Code:
if (OpenKey == IDYES) {
if (RegOpenKeyEx(
key,
"Software\\Nephiroth",
0,
NULL,
&buffer
) == ERROR_ACCESS_DENIED) {
MessageBox(
NULL,
"There was an error, opening the registry key",
"Error",
MB_ICONERROR|MB_OK
);
}
RegQueryValueEx(key, "Test", 0, NULL, (BYTE *)bufGet, &iNumGet);
RegCloseKey(key);
if (strcmp (bufGet,"texst") == 0) {
MessageBox(
NULL,
"works",
"test",
MB_OK
);
} else {
MessageBox(
NULL,
"Nope",
"test",
MB_OK
);
}
} else if (OpenKey == IDNO) {
//stuff here
}
I did some testing with the return values, and there comes out ACCES DENIED.Kinda weird actually, as i have made a key before.
EDIT:
Added KEY_READ and KEY_QUERY_VALUE as parameters..no errors now.But isnt giving right answer