Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (53 sloc) 1.77 KB
All CopyRights Reserved.
Created by emailme to:
this source are under GNU/GPL (General Public Licence)
by unmanarc.
thanks to all.
enjoy ;)
#include "StdAfx.h"
#include ".\registry.h"
BOOL Cregistry::PutKey( HKEY motherkey, LPCSTR directory, LPCSTR keyname, LPCSTR strtoput )
//extracted idea from sample code.:
//and re-writed to my own puorporses
LPCSTR strValue = strtoput;
HKEY handletokey;
DWORD error,dsp;
error = RegCreateKeyEx(motherkey,directory,0,"",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&handletokey,&dsp);
if ( error != ERROR_SUCCESS ) return FALSE;
RegSetValueEx( handletokey,keyname,NULL,REG_SZ,(LPBYTE)strtoput,lstrlen( strtoput ));
RegCloseKey( handletokey );
return (error==ERROR_SUCCESS);
bool Cregistry::GetKey( HKEY motherkey, LPCSTR directory, LPCSTR keyname, LPCSTR stroutput,DWORD dwBufLen)
LONG lRet;
HKEY hKey;
if(RegOpenKeyEx(motherkey,directory,0,KEY_QUERY_VALUE,&hKey) != ERROR_SUCCESS) return false;
lRet = RegQueryValueEx(hKey,keyname,NULL,NULL,(LPBYTE)stroutput,&dwBufLen);
if(lRet != ERROR_SUCCESS) return false;
return true;
bool Cregistry::DelKey(HKEY motherkey,LPCSTR directory,LPCSTR Valuetodel)
HKEY todel=NULL;
if (RegOpenKeyEx( motherkey,directory,0,KEY_WRITE,&todel)!= ERROR_SUCCESS) return false;
rc = RegDeleteValue( todel, Valuetodel );
if(rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND) return false;
return true;
You can’t perform that action at this time.