// regedit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
#define RRF_RT_ANY 0x0000ffff;
int main(int argc, char* argv[])
{
char *buff="Software\\11gamereg";
LPDWORD dwSize;
BYTE result[100]={0};
int initVlue=33;
HKEY hKey;
/**********打开注册表*********/
if( RegOpenKey(HKEY_LOCAL_MACHINE,buff,&hKey)==0)
{
printf("open success !\n");
}
else
{
printf("open failed!\n");
}
/**********打开注册表*********/
if( RegSetValueEx(hKey,"FirstSetup",0,REG_DWORD,(BYTE *) &initVlue,sizeof(result)) !=ERROR_SUCCESS)
{
printf("set error !\n");
}
else
{
printf("set success\n");
}
/**********打开注册表*********/
if( RegQueryValueEx(hKey,"FirstSetup",0,NULL,(BYTE *)result,(LPDWORD)&dwSize) !=ERROR_SUCCESS)
{
printf("getvalue error !\n");
}
else
{
printf("%d \n",result);
}
/**********打开注册表*********/
if(RegCloseKey(hKey)==0)
{
printf("close success!\n");
}
else{
printf("close failed!\n");
}
return 0;
}
![]()