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.

Registry virtualization is a compatibility shim for old applications that redirects writes to
HKEY_USERS\<User SID>_Classes\VirtualStoreinstead of causing access denied errors.To turn it off, add a manifest to your application with a
requestedExecutionLevelnode to mark yourself Vista/UAC compatible.