I have written a C++ program in Code::Blocks which reads REG_NONE type value from registry.
Here are my codes:
#define KEY_WOW64_64KEY 0x0100
#include "string"
#include "windows.h"
using namespace std;
int main()
{
HKEY hKey;
long longErrorCode;
string strErrorCaption = "Hata";
string strErrorMessage;
string strSubKey = "Software\\DownloadManager\\Scheduler";
longErrorCode = RegOpenKeyEx(HKEY_CURRENT_USER, strSubKey.c_str(), 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hKey);
if (longErrorCode != ERROR_SUCCESS)
{
strErrorMessage = "Anahtar açılamadı.";
MessageBox(NULL, strErrorMessage.c_str(), strErrorCaption.c_str(), MB_OK | MB_ICONERROR);
return 0;
}
else
{
DWORD dwSize = MAX_PATH;
DWORD dwValueContent;
DWORD dwValueType = REG_NONE;
string strValueName = "startDay";
longErrorCode = RegQueryValueEx(hKey, strValueName.c_str(), 0, &dwValueType, (LPBYTE)&dwValueContent, &dwSize);
if (longErrorCode != ERROR_SUCCESS)
{
RegCloseKey(hKey);
strErrorMessage = "Değer açılamadı.";
MessageBox(NULL, strErrorMessage.c_str(), strErrorCaption.c_str(), MB_OK | MB_ICONERROR);
return 0;
}
else
{
string strValueContent = to_string(dwValueContent);
RegCloseKey(hKey);
strErrorCaption = "Başarılı!";
MessageBox(NULL, strValueContent.c_str(), strErrorCaption.c_str(), MB_OK | MB_ICONINFORMATION);
return 0;
}
}
}
The real value of the registry key which I tried to read is "f5 68 4b 5c".
But the problem is I got "1548445941". I also tried stringstream; but it didn't work.
So, what should I do in order to fix this issue?