I changed your program to call RegQueryKeyEx() and it works now
int main(int argc, char *argv[])
{
HKEY MyKey = 0;
BYTE szBuff[255] = {0};
DWORD cb = 0;
DWORD dwType = REG_SZ;
LONG rval;
if (RegOpenKey(HKEY_CURRENT_USER, "Software\\Random\\Program", &MyKey) == ERROR_SUCCESS)
{
cout << "Program is installed\n";
cb = sizeof(szBuff);
//Debug info, this normally isn't here!
if((rval = RegQueryValueEx(MyKey, "hexData", 0, &dwType, szBuff, &cb)) == ERROR_SUCCESS)
{
cout << "Program has been run once\n";
printf((char *)szBuff);
}
printf("%d",rval);
cout << '\n';
RegCloseKey(MyKey);
}
system("PAUSE");
return EXIT_SUCCESS;
}
And the output is
Quote:
Program is installed
Program has been run once
0611623CA8EFE3D880FF72E0F9A5AACDE5D9C171EAE2C6FDB6888BF7B5386DEE0
Press any key to continue . . .
|