|
|
//Copyright (c) 1998 - 1999 Microsoft Corporation
/*--------------------------------------------------------------------------------------------------------
* * Module Name: * * Registry.h * * Abstract: * * declaration of a simple registry class CRegistry. * * * * Author: * * Makarand Patwardhan - April 9, 1997 * * -------------------------------------------------------------------------------------------------------*/
#if !defined(AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_)
#define AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <winreg.h>
class CRegistry { private:
LPBYTE m_pMemBlock; HKEY m_hKey; int m_iEnumIndex; int m_iEnumValueIndex;
DWORD ReadReg (LPCTSTR lpValue, LPBYTE *lppbyte, DWORD *pdw, DWORD dwDatatype); void * Allocate (DWORD dwSize);
//
// This class is not designed to allow copy constructors, = assignments,
// therefore we should ensure that copy ctor, assignment operator are not
// generated by compiler. we do that by declaring these functions private
// and not implementing them. This will ensure that these functions are
// not generated by compilers, and caller will get error if he tries to
// use them.
//
CRegistry (const CRegistry ®); // copy ctor
CRegistry & operator= (const CRegistry ®); // = oprerator
#ifdef DBG
DWORD m_dwSizeDebugOnly; #endif
public: CRegistry (); CRegistry (HKEY hKey);
virtual ~CRegistry ();
void Release ();
operator HKEY () {return m_hKey;}
DWORD OpenKey (HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS, LPCTSTR lpMachineName = NULL); DWORD CreateKey (HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS, DWORD *pDisposition = NULL, LPSECURITY_ATTRIBUTES lpSecAttr = NULL );
DWORD DeleteValue (LPCTSTR lpValue); DWORD RecurseDeleteKey (LPCTSTR lpSubKey); DWORD CopyTree (CRegistry ®Src);
DWORD ReadRegString (LPCTSTR lpValue, LPTSTR *lppStr, DWORD *pdw); DWORD ReadRegDWord (LPCTSTR lpValue, DWORD *pdw); DWORD ReadRegMultiString (LPCTSTR lpValue, LPTSTR *lppStr, DWORD *pdw); DWORD ReadRegBinary (LPCTSTR lpValue, LPBYTE *lppByte, DWORD *pdw);
DWORD WriteRegString (LPCTSTR lpValueName, LPCTSTR lpStr); DWORD WriteRegExpString (LPCTSTR lpValueName, LPCTSTR lpStr); DWORD WriteRegDWord (LPCTSTR lpValueName, DWORD dwValue); DWORD WriteRegDWordNoOverWrite (LPCTSTR lpValueName, DWORD dwValue); // if value exists, do not overwrite
DWORD WriteRegMultiString (LPCTSTR lpValueName, LPCTSTR lpStr, DWORD dwSize); DWORD WriteRegBinary (LPCTSTR lpValueName, LPBYTE lpData, DWORD dwSize); DWORD ExistInMultiString (LPCTSTR lpValueName, LPCTSTR lpCheckForStr, BOOL *pbExists); DWORD AppendToMultiString (LPCTSTR lpValueName, LPCTSTR lpStr);
DWORD GetFirstSubKey (LPTSTR *lppStr, DWORD *pdw); DWORD GetNextSubKey (LPTSTR *lppStr, DWORD *pdw);
DWORD GetFirstValue (LPTSTR *lppStr, DWORD *pdw, DWORD *pDataType); DWORD GetNextValue (LPTSTR *lppStr, DWORD *pdw, DWORD *pDataType);
DWORD GetSecurity (PSECURITY_DESCRIPTOR *ppSec, SECURITY_INFORMATION SecurityInformation, DWORD *pdwSize); DWORD SetSecurity (PSECURITY_DESCRIPTOR pSec, SECURITY_INFORMATION SecurityInformation);
};
#endif // !defined(AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_)
//EOF
|