// regedit_find.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <sstream>
using namespace std;
const int BUFFER_SIE = 1000;
int _tmain(int argc, _TCHAR* argv[])
{
long lRet;
HKEY hKey;
TCHAR tchData[BUFFER_SIE];
DWORD dwSize;
// 打开注册表(if open the regedit succeed,the function return ERROR_SUCCESS which define
// in WINERROR.H and equal to 0);
// 如果函数调用成功,则返回0(ERROR_SUCCESS)。
// 否则,返回值为文件WINERROR.h中定义的一个非零的错误代码。
lRet = RegOpenKeyEx(
HKEY_LOCAL_MACHINE, // 主键 PrimaryKey
_T("Hardware\\Description\\System\\CentralProcessor\\0"), //子健 subkey
0,
KEY_QUERY_VALUE, // 允许查询子健 allow to query the subkey
&hKey
);
if (lRet == ERROR_SUCCESS)
{
// 查询注册表(Query the regedit)
dwSize = BUFFER_SIE; // 这里是预留大小,不然会溢出造成 RegQueryValueExW return 234; if dwSize is not big enough,RegQueryValueExW will return 234;
c++ 读注册表信息 读取CPU信息
最新推荐文章于 2022-12-07 17:42:02 发布