Professional Webmasters Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Connect registry via C++

Go down

Connect registry via C++ Empty Connect registry via C++

Post  andry Fri May 14, 2010 12:19 am

Since a long time I am searching out a program with which I may access registry files through a C++ program. Rather it was a quite typical job to do but finally I found out with this final result. So enjoy this.


#include <windows.h>
#include <iostream>
using namespace std;

int main () {
HKEY keyHandle;
char rgValue [1024];

LPCTSTR regPath = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
LPCTSTR regReq = "FeatureSet";

DWORD size1 = sizeof(rgValue);
DWORD Type;

if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, regPath,0, KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS) {
RegQueryValueEx( keyHandle, regReq, NULL, &Type, (LPBYTE)rgValue,&size1);
}
RegCloseKey(keyHandle);

std::cout << "Returned: -->" << rgValue << "<-- (at least I think so) \n\n";
system("Pause");
}
andry
andry
Moderator
Moderator

Posts : 467
Join date : 2010-05-07

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum