http://user.qzone.qq.com/810087456/infocenter

ymecho

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
// 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;
}

posted on 2013-11-28 11:14  ymecho  阅读(217)  评论(0编辑  收藏  举报