I use CodeBlocks version 20.03 (x86) as IDE.
Here are my codes:
#include "iostream"
#include "windows.h"
using namespace std;
int main()
{
HKEY hkRegedit;
long longHataKodu;
longHataKodu = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Chkdsk", 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hkRegedit);
cout << longHataKodu;
getchar();
return 0;
}
But the problem is even I run my program without administrator privileges, my program returns 0.
Here is the screenshot of my program:
How is that possible even I have written HKEY_LOCAL_MACHINE and KEY_ALL_ACCESS?
As far as I know, value 0 means ERROR_SUCCESS.

RegOpenKeyExreturns when it's successful. What else do you expect it to return?ERROR_SUCCESSis 0.