I am trying to read from the registry and there is issues with trying to query it, it can get to where the value is located but it can't find the value for some odd reason. Here is the code I am currently running.
#include <cstdlib>
#include <iostream>
#include "windows.h"
#include "winnt.h"
#include "winreg.h"
using namespace std;
int main(int argc, char *argv[])
{
HKEY MyKey;
char szBuff[80];
LONG cb;
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!
printf("%d",RegQueryValue(MyKey, "hexData", szBuff, &cb) );
cout << '\n';
if(RegQueryValue(MyKey, "hexData, szBuff, &cb) == ERROR_SUCCESS)
{
cout << "Program has been run once\n";
printf(szBuff);
}
RegCloseKey(MyKey);
}
system("PAUSE");
return EXIT_SUCCESS;
}
The value that it should be printing out 0611623CA8EFE3D880FF72E0F9A5AACDE5D9C171EAE2C6FDB6888BF7B5386DEE , however it can't find it even though it should be there. Any help with this?