// 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 ! "); } else { printf("open failed! "); } /**********打开注册表*********/ if( RegSetValueEx(hKey,"FirstSetup",0,REG_DWORD,(BYTE *) &initVlue,sizeof(result)) !=ERROR_SUCCESS) { printf("set error ! "); } else { printf("set success "); } /**********打开注册表*********/ if( RegQueryValueEx(hKey,"FirstSetup",0,NULL,(BYTE *)result,(LPDWORD)&dwSize) !=ERROR_SUCCESS) { printf("getvalue error ! "); } else { printf("%d ",result); } /**********打开注册表*********/ if(RegCloseKey(hKey)==0) { printf("close success! "); } else{ printf("close failed! "); } return 0; }