ReactOS  0.4.14-dev-1338-g0d187f7
fbtreg.h
Go to the documentation of this file.
1 #ifndef REG_H
2 #define REG_H
3 
4 class CReg
5 {
6  public:
7  // Constructor
8  CReg(LPCSTR lpszSubKey, HKEY hRootKey=HKEY_CURRENT_USER, REGSAM regSam=KEY_ALL_ACCESS, BOOL bCreate=TRUE);
9 
10  // Destructor
11  ~CReg();
12 
13  // Get the specified registry value
14  BOOL GetValue(LPCSTR lpszValueName, LPVOID lpvData, DWORD *dwBuffSize=NULL, DWORD *dwDataType=NULL);
15  BOOL GetValue(LPCSTR lpszValueName, LPSTR lpszValue, DWORD dwBalueSize);
16 // BOOL GetValue(LPCSTR lpszValueName, CString &szData, DWORD *dwDataType=NULL);
17  BOOL GetValue(LPCSTR lpszValueName, DWORD &dwData);
18  BOOL GetValue(LPCSTR lpszValueName, BOOL &bData);
19 
20  // Set the specified registry value
21  BOOL SetValue(LPCSTR lpszValueName, const LPVOID lpvData, DWORD dwDataSize, DWORD dwDataType=REG_SZ);
22  BOOL SetValue(LPCSTR lpszValueName, LPCSTR lpszValue, DWORD dwDataSize=0, DWORD dwDataType=REG_SZ);
23  BOOL SetValue(LPCSTR lpszValueName, LPSTR lpszValue, DWORD dwValueSize);
24 // BOOL SetValue(LPCSTR lpszValueName, CString &szData, DWORD dwDataSize=0, DWORD dwDataType=REG_SZ);
25  BOOL SetValue(LPCSTR lpszValueName, DWORD dwData);
26  BOOL SetValue(LPCSTR lpszValueName, BOOL bData);
27 
28  // Delete a value in the key
29  BOOL DeleteValue(LPCSTR lpszValueName);
30 
31  // Delete all the values in the key
33 
34  // Delete a sub key
35  BOOL DeleteKey(LPCSTR lpszKeyName);
36 
37  // Retrieve the names of the values in the key
38 // BOOL EnumerateValues(CStringArray &nszValueNames);
39 
40  BOOL IsValid() {return m_hKey!=NULL;}
41 
42  protected:
43  // Create a new registry key
44  LONG Create(LPCSTR lpszSubKey, HKEY hRootKey, HKEY *hKey=NULL, REGSAM regSam=NULL);
45 
46  // Open the specified registry key (creates if non-existant)
47  LONG Open(LPCSTR lpszSubKey, HKEY hRootKey, HKEY *hKey=NULL, REGSAM regSam=NULL, BOOL bCreate=TRUE);
48 
49  BOOL DeleteKey(HKEY hRootKey, HKEY hKey, LPCSTR szKey, LPCSTR szSubKey);
50 
51 // CString m_szKey; // Name of key this object wraps
52  char m_szKey[1024]; // Name of key this object wraps
53  HKEY m_hRootKey; // Root key of the wrapped key
54  HKEY m_hKey; // Key generated by Open/Create
55 
56 };
57 
58 #endif
#define TRUE
Definition: types.h:120
CReg(LPCSTR lpszSubKey, HKEY hRootKey=HKEY_CURRENT_USER, REGSAM regSam=KEY_ALL_ACCESS, BOOL bCreate=TRUE)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static HANDLE ULONG_PTR dwData
Definition: file.c:35
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
HKEY m_hRootKey
Definition: fbtreg.h:53
Definition: fbtreg.h:4
LONG Create(LPCSTR lpszSubKey, HKEY hRootKey, HKEY *hKey=NULL, REGSAM regSam=NULL)
unsigned long DWORD
Definition: ntddk_ex.h:95
HKEY m_hKey
Definition: fbtreg.h:54
LONG Open(LPCSTR lpszSubKey, HKEY hRootKey, HKEY *hKey=NULL, REGSAM regSam=NULL, BOOL bCreate=TRUE)
BOOL DeleteValue(LPCSTR lpszValueName)
BOOL DeleteValues()
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1443
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
BOOL DeleteKey(LPCSTR lpszKeyName)
ACCESS_MASK REGSAM
Definition: winreg.h:69
BOOL GetValue(LPCSTR lpszValueName, LPVOID lpvData, DWORD *dwBuffSize=NULL, DWORD *dwDataType=NULL)
char m_szKey[1024]
Definition: fbtreg.h:52
BOOL IsValid()
Definition: fbtreg.h:40
BOOL SetValue(LPCSTR lpszValueName, const LPVOID lpvData, DWORD dwDataSize, DWORD dwDataType=REG_SZ)
#define REG_SZ
Definition: layer.c:22