aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/Registry.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Windows/Registry.h
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-21.07.tar.gz
7zip-21.07.tar.bz2
7zip-21.07.zip
'21.07'21.07
Diffstat (limited to 'CPP/Windows/Registry.h')
-rw-r--r--CPP/Windows/Registry.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/CPP/Windows/Registry.h b/CPP/Windows/Registry.h
new file mode 100644
index 0000000..ca79dfe
--- /dev/null
+++ b/CPP/Windows/Registry.h
@@ -0,0 +1,84 @@
1// Windows/Registry.h
2
3#ifndef __WINDOWS_REGISTRY_H
4#define __WINDOWS_REGISTRY_H
5
6#include "../Common/MyBuffer.h"
7#include "../Common/MyString.h"
8
9namespace NWindows {
10namespace NRegistry {
11
12LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value);
13
14class CKey
15{
16 HKEY _object;
17public:
18 CKey(): _object(NULL) {}
19 ~CKey() { Close(); }
20
21 operator HKEY() const { return _object; }
22 void Attach(HKEY key) { _object = key; }
23 HKEY Detach()
24 {
25 HKEY key = _object;
26 _object = NULL;
27 return key;
28 }
29
30 LONG Create(HKEY parentKey, LPCTSTR keyName,
31 LPTSTR keyClass = REG_NONE, DWORD options = REG_OPTION_NON_VOLATILE,
32 REGSAM accessMask = KEY_ALL_ACCESS,
33 LPSECURITY_ATTRIBUTES securityAttributes = NULL,
34 LPDWORD disposition = NULL) throw();
35 LONG Open(HKEY parentKey, LPCTSTR keyName, REGSAM accessMask = KEY_ALL_ACCESS) throw();
36
37 LONG Close() throw();
38
39 LONG DeleteSubKey(LPCTSTR subKeyName) throw();
40 LONG RecurseDeleteKey(LPCTSTR subKeyName) throw();
41
42 LONG DeleteValue(LPCTSTR name) throw();
43 #ifndef _UNICODE
44 LONG DeleteValue(LPCWSTR name);
45 #endif
46
47 LONG SetValue(LPCTSTR valueName, UInt32 value) throw();
48 LONG SetValue(LPCTSTR valueName, bool value) throw();
49 LONG SetValue(LPCTSTR valueName, LPCTSTR value) throw();
50 // LONG SetValue(LPCTSTR valueName, const CSysString &value);
51 #ifndef _UNICODE
52 LONG SetValue(LPCWSTR name, LPCWSTR value);
53 // LONG SetValue(LPCWSTR name, const UString &value);
54 #endif
55
56 LONG SetValue(LPCTSTR name, const void *value, UInt32 size) throw();
57
58 LONG SetValue_Strings(LPCTSTR valueName, const UStringVector &strings);
59 LONG GetValue_Strings(LPCTSTR valueName, UStringVector &strings);
60
61 LONG SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value) throw();
62
63 LONG QueryValue(LPCTSTR name, UInt32 &value) throw();
64 LONG QueryValue(LPCTSTR name, bool &value) throw();
65 LONG QueryValue(LPCTSTR name, LPTSTR value, UInt32 &dataSize) throw();
66 LONG QueryValue(LPCTSTR name, CSysString &value);
67
68 LONG GetValue_IfOk(LPCTSTR name, UInt32 &value) throw();
69 LONG GetValue_IfOk(LPCTSTR name, bool &value) throw();
70
71 #ifndef _UNICODE
72 LONG QueryValue(LPCWSTR name, LPWSTR value, UInt32 &dataSize);
73 LONG QueryValue(LPCWSTR name, UString &value);
74 #endif
75
76 LONG QueryValue(LPCTSTR name, void *value, UInt32 &dataSize) throw();
77 LONG QueryValue(LPCTSTR name, CByteBuffer &value, UInt32 &dataSize);
78
79 LONG EnumKeys(CSysStringVector &keyNames);
80};
81
82}}
83
84#endif