aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/Registry.h
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Windows/Registry.h')
-rw-r--r--CPP/Windows/Registry.h48
1 files changed, 30 insertions, 18 deletions
diff --git a/CPP/Windows/Registry.h b/CPP/Windows/Registry.h
index 0d3b4fc..74ee919 100644
--- a/CPP/Windows/Registry.h
+++ b/CPP/Windows/Registry.h
@@ -14,6 +14,13 @@ LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value)
14class CKey 14class CKey
15{ 15{
16 HKEY _object; 16 HKEY _object;
17
18 LONG QueryValueEx(LPCTSTR lpValueName, LPDWORD lpType,
19 LPBYTE lpData, LPDWORD lpcbData)
20 {
21 return RegQueryValueEx(_object, lpValueName, NULL, lpType, lpData, lpcbData);
22 }
23
17public: 24public:
18 CKey(): _object(NULL) {} 25 CKey(): _object(NULL) {}
19 ~CKey() { Close(); } 26 ~CKey() { Close(); }
@@ -22,13 +29,14 @@ public:
22 void Attach(HKEY key) { _object = key; } 29 void Attach(HKEY key) { _object = key; }
23 HKEY Detach() 30 HKEY Detach()
24 { 31 {
25 HKEY key = _object; 32 const HKEY key = _object;
26 _object = NULL; 33 _object = NULL;
27 return key; 34 return key;
28 } 35 }
29 36
30 LONG Create(HKEY parentKey, LPCTSTR keyName, 37 LONG Create(HKEY parentKey, LPCTSTR keyName,
31 LPTSTR keyClass = REG_NONE, DWORD options = REG_OPTION_NON_VOLATILE, 38 LPTSTR keyClass = REG_NONE,
39 DWORD options = REG_OPTION_NON_VOLATILE,
32 REGSAM accessMask = KEY_ALL_ACCESS, 40 REGSAM accessMask = KEY_ALL_ACCESS,
33 LPSECURITY_ATTRIBUTES securityAttributes = NULL, 41 LPSECURITY_ATTRIBUTES securityAttributes = NULL,
34 LPDWORD disposition = NULL) throw(); 42 LPDWORD disposition = NULL) throw();
@@ -40,18 +48,18 @@ public:
40 LONG RecurseDeleteKey(LPCTSTR subKeyName) throw(); 48 LONG RecurseDeleteKey(LPCTSTR subKeyName) throw();
41 49
42 LONG DeleteValue(LPCTSTR name) throw(); 50 LONG DeleteValue(LPCTSTR name) throw();
43 #ifndef _UNICODE 51#ifndef _UNICODE
44 LONG DeleteValue(LPCWSTR name); 52 LONG DeleteValue(LPCWSTR name);
45 #endif 53#endif
46 54
47 LONG SetValue(LPCTSTR valueName, UInt32 value) throw(); 55 LONG SetValue(LPCTSTR valueName, UInt32 value) throw();
48 LONG SetValue(LPCTSTR valueName, bool value) throw(); 56 LONG SetValue(LPCTSTR valueName, bool value) throw();
49 LONG SetValue(LPCTSTR valueName, LPCTSTR value) throw(); 57 LONG SetValue(LPCTSTR valueName, LPCTSTR value) throw();
50 // LONG SetValue(LPCTSTR valueName, const CSysString &value); 58 // LONG SetValue(LPCTSTR valueName, const CSysString &value);
51 #ifndef _UNICODE 59#ifndef _UNICODE
52 LONG SetValue(LPCWSTR name, LPCWSTR value); 60 LONG SetValue(LPCWSTR name, LPCWSTR value);
53 // LONG SetValue(LPCWSTR name, const UString &value); 61 // LONG SetValue(LPCWSTR name, const UString &value);
54 #endif 62#endif
55 63
56 LONG SetValue(LPCTSTR name, const void *value, UInt32 size) throw(); 64 LONG SetValue(LPCTSTR name, const void *value, UInt32 size) throw();
57 65
@@ -60,21 +68,25 @@ public:
60 68
61 LONG SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value) throw(); 69 LONG SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value) throw();
62 70
63 LONG QueryValue(LPCTSTR name, UInt32 &value) throw(); 71 // GetValue_[type]_IfOk():
64 LONG QueryValue(LPCTSTR name, bool &value) throw(); 72 // if (return_result == ERROR_SUCCESS), (value) variable was read from registry
65 LONG QueryValue(LPCTSTR name, LPTSTR value, UInt32 &dataSize) throw(); 73 // if (return_result != ERROR_SUCCESS), (value) variable was not changed
66 LONG QueryValue(LPCTSTR name, CSysString &value); 74 LONG GetValue_UInt32_IfOk(LPCTSTR name, UInt32 &value) throw();
67 75 LONG GetValue_UInt64_IfOk(LPCTSTR name, UInt64 &value) throw();
68 LONG GetValue_IfOk(LPCTSTR name, UInt32 &value) throw(); 76 LONG GetValue_bool_IfOk(LPCTSTR name, bool &value) throw();
69 LONG GetValue_IfOk(LPCTSTR name, bool &value) throw();
70 77
71 #ifndef _UNICODE 78 // QueryValue():
72 LONG QueryValue(LPCWSTR name, LPWSTR value, UInt32 &dataSize); 79 // if (return_result == ERROR_SUCCESS), (value) string was read from registry
80 // if (return_result != ERROR_SUCCESS), (value) string was cleared
81 LONG QueryValue(LPCTSTR name, CSysString &value);
82#ifndef _UNICODE
73 LONG QueryValue(LPCWSTR name, UString &value); 83 LONG QueryValue(LPCWSTR name, UString &value);
74 #endif 84#endif
75 85
76 LONG QueryValue(LPCTSTR name, void *value, UInt32 &dataSize) throw(); 86 // QueryValue_Binary():
77 LONG QueryValue(LPCTSTR name, CByteBuffer &value, UInt32 &dataSize); 87 // if (return_result == ERROR_SUCCESS), (value) buffer was read from registry (BINARY data)
88 // if (return_result != ERROR_SUCCESS), (value) buffer was cleared
89 LONG QueryValue_Binary(LPCTSTR name, CByteBuffer &value);
78 90
79 LONG EnumKeys(CSysStringVector &keyNames); 91 LONG EnumKeys(CSysStringVector &keyNames);
80}; 92};