Differences From Artifact [76d5fcec592c7fdf]:
- File
src/win32/winreg.d
- 2011-02-23 12:53:16 - part of checkin [c2b7a98c21] on branch trunk - Initial import (user: kinaba) [annotate]
To Artifact [e5d43e62c628c0b0]:
- File
src/win32/winreg.d
- 2015-04-21 10:46:55 - part of checkin [4e2933c620] on branch trunk - Rebased to the latest verson dmd 2.067. Not yet verified the outcome. (user: kinaba) [annotate]
1 +/***********************************************************************\
2 +* winreg.d *
3 +* *
4 +* Windows API header module *
5 +* *
6 +* Translated from MinGW Windows headers *
7 +* by Stewart Gordon *
8 +* *
9 +* Placed into public domain *
10 +\***********************************************************************/
1 11 module win32.winreg;
2 -
3 -// Translated from Microsoft Platform SDK August 2001 Edition
4 -// by Y.Tomino (demoonlit@inter7.jp)
5 -
6 -import win32.winnt, win32.winbase;
7 -
8 -// #ifndef _WINREG_
9 -// #define _WINREG_
10 -
11 -// #ifdef _MAC
12 -// #...
13 -// #endif
14 -
15 -// #ifdef __cplusplus
16 -// extern "C" {
17 -// #endif
18 -
19 -// #ifndef WINVER
20 -// #...
21 -// #endif /* !WINVER */
12 +pragma(lib, "advapi32.lib");
13 +
14 +private import win32.w32api, win32.winbase, win32.windef;
15 +
16 +const HKEY
17 + HKEY_CLASSES_ROOT = cast(HKEY) 0x80000000,
18 + HKEY_CURRENT_USER = cast(HKEY) 0x80000001,
19 + HKEY_LOCAL_MACHINE = cast(HKEY) 0x80000002,
20 + HKEY_USERS = cast(HKEY) 0x80000003,
21 + HKEY_PERFORMANCE_DATA = cast(HKEY) 0x80000004,
22 + HKEY_CURRENT_CONFIG = cast(HKEY) 0x80000005,
23 + HKEY_DYN_DATA = cast(HKEY) 0x80000006;
24 +
25 +enum : DWORD {
26 + REG_OPTION_NON_VOLATILE,
27 + REG_OPTION_VOLATILE
28 +}
29 +
30 +enum : DWORD {
31 + REG_CREATED_NEW_KEY = 1,
32 + REG_OPENED_EXISTING_KEY
33 +}
34 +
35 +enum : DWORD {
36 + REG_NONE = 0,
37 + REG_SZ,
38 + REG_EXPAND_SZ,
39 + REG_BINARY,
40 + REG_DWORD_LITTLE_ENDIAN,
41 + REG_DWORD = REG_DWORD_LITTLE_ENDIAN,
42 + REG_DWORD_BIG_ENDIAN,
43 + REG_LINK,
44 + REG_MULTI_SZ,
45 + REG_RESOURCE_LIST,
46 + REG_FULL_RESOURCE_DESCRIPTOR,
47 + REG_RESOURCE_REQUIREMENTS_LIST,
48 + REG_QWORD_LITTLE_ENDIAN,
49 + REG_QWORD = REG_QWORD_LITTLE_ENDIAN
50 +}
51 +
52 +const DWORD
53 + REG_NOTIFY_CHANGE_NAME = 1,
54 + REG_NOTIFY_CHANGE_ATTRIBUTES = 2,
55 + REG_NOTIFY_CHANGE_LAST_SET = 4,
56 + REG_NOTIFY_CHANGE_SECURITY = 8;
22 57
23 58 alias ACCESS_MASK REGSAM;
24 59
25 -const HKEY HKEY_CLASSES_ROOT = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000000) ;
26 -const HKEY HKEY_CURRENT_USER = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000001) ;
27 -const HKEY HKEY_LOCAL_MACHINE = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000002) ;
28 -const HKEY HKEY_USERS = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000003) ;
29 -const HKEY HKEY_PERFORMANCE_DATA = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000004) ;
30 -const HKEY HKEY_PERFORMANCE_TEXT = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000050) ;
31 -const HKEY HKEY_PERFORMANCE_NLSTEXT = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000060) ;
32 -// #if(WINVER >= 0x0400)
33 -const HKEY HKEY_CURRENT_CONFIG = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000005) ;
34 -const HKEY HKEY_DYN_DATA = cast(HKEY)cast(ULONG_PTR)(cast(LONG)0x80000006) ;
60 +struct VALENTA {
61 + LPSTR ve_valuename;
62 + DWORD ve_valuelen;
63 + DWORD ve_valueptr;
64 + DWORD ve_type;
65 +}
66 +alias VALENTA* PVALENTA;
67 +
68 +struct VALENTW {
69 + LPWSTR ve_valuename;
70 + DWORD ve_valuelen;
71 + DWORD ve_valueptr;
72 + DWORD ve_type;
73 +}
74 +alias VALENTW* PVALENTW;
35 75
36 -// #ifndef _PROVIDER_STRUCTS_DEFINED
37 -// #define _PROVIDER_STRUCTS_DEFINED
38 -
39 -enum : uint { PROVIDER_KEEPS_VALUE_LENGTH = 0x1 }
40 -struct val_context {
41 - int valuelen;
42 - LPVOID value_context;
43 - LPVOID val_buff_ptr;
76 +// RRF - Registry Routine Flags (for RegGetValue)
77 +static if (WINVER >= 0x600) {
78 + enum : DWORD {
79 + RRF_RT_REG_NONE = 0x00000001,
80 + RRF_RT_REG_SZ = 0x00000002,
81 + RRF_RT_REG_EXPAND_SZ = 0x00000004,
82 + RRF_RT_REG_BINARY = 0x00000008,
83 + RRF_RT_REG_DWORD = 0x00000010,
84 + RRF_RT_REG_MULTI_SZ = 0x00000020,
85 + RRF_RT_REG_QWORD = 0x00000040,
86 + RRF_RT_DWORD = RRF_RT_REG_BINARY | RRF_RT_REG_DWORD,
87 + RRF_RT_QWORD = RRF_RT_REG_BINARY | RRF_RT_REG_QWORD,
88 + RRF_RT_ANY = 0x0000FFFF,
89 + RRF_NOEXPAND = 0x10000000,
90 + RRF_ZEROONFAILURE = 0x20000000
91 + }
44 92 }
45 93
46 -alias val_context* PVALCONTEXT;
94 +extern (Windows) {
95 + LONG RegCloseKey(HKEY);
96 + LONG RegConnectRegistryA(LPCSTR, HKEY, PHKEY);
97 + LONG RegConnectRegistryW(LPCWSTR, HKEY, PHKEY);
98 + LONG RegCreateKeyExA(HKEY, LPCSTR, DWORD, LPSTR, DWORD, REGSAM,
99 + LPSECURITY_ATTRIBUTES, PHKEY, PDWORD);
100 + LONG RegCreateKeyExW(HKEY, LPCWSTR, DWORD, LPWSTR, DWORD, REGSAM,
101 + LPSECURITY_ATTRIBUTES, PHKEY, PDWORD);
102 + LONG RegDeleteKeyA(HKEY, LPCSTR);
103 + LONG RegDeleteKeyW(HKEY, LPCWSTR);
104 + LONG RegDeleteValueA(HKEY, LPCSTR);
105 + LONG RegDeleteValueW(HKEY, LPCWSTR);
106 + LONG RegEnumKeyExA(HKEY, DWORD, LPSTR, PDWORD, PDWORD, LPSTR, PDWORD,
107 + PFILETIME);
108 + LONG RegEnumKeyExW(HKEY, DWORD, LPWSTR, PDWORD, PDWORD, LPWSTR, PDWORD,
109 + PFILETIME);
110 + LONG RegEnumValueA(HKEY, DWORD, LPSTR, PDWORD, PDWORD, PDWORD, LPBYTE,
111 + PDWORD);
112 + LONG RegEnumValueW(HKEY, DWORD, LPWSTR, PDWORD, PDWORD, PDWORD, LPBYTE,
113 + PDWORD);
114 + LONG RegFlushKey(HKEY);
115 + LONG RegLoadKeyA(HKEY, LPCSTR, LPCSTR);
116 + LONG RegLoadKeyW(HKEY, LPCWSTR, LPCWSTR);
117 + LONG RegOpenKeyExA(HKEY, LPCSTR, DWORD, REGSAM, PHKEY);
118 + LONG RegOpenKeyExW(HKEY, LPCWSTR, DWORD, REGSAM, PHKEY);
119 + LONG RegQueryInfoKeyA(HKEY, LPSTR, PDWORD, PDWORD, PDWORD, PDWORD,
120 + PDWORD, PDWORD, PDWORD, PDWORD, PDWORD, PFILETIME);
121 + LONG RegQueryInfoKeyW(HKEY, LPWSTR, PDWORD, PDWORD, PDWORD, PDWORD,
122 + PDWORD, PDWORD, PDWORD, PDWORD, PDWORD, PFILETIME);
123 + LONG RegQueryMultipleValuesA(HKEY, PVALENTA, DWORD, LPSTR, LPDWORD);
124 + LONG RegQueryMultipleValuesW(HKEY, PVALENTW, DWORD, LPWSTR, LPDWORD);
125 + LONG RegQueryValueExA(HKEY, LPCSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
126 + LONG RegQueryValueExW(HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
127 + LONG RegReplaceKeyA(HKEY, LPCSTR, LPCSTR, LPCSTR);
128 + LONG RegReplaceKeyW(HKEY, LPCWSTR, LPCWSTR, LPCWSTR);
129 + LONG RegSaveKeyA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES);
130 + LONG RegSaveKeyW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES);
131 + LONG RegSetKeySecurity(HKEY, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR);
132 + LONG RegSetValueExA(HKEY, LPCSTR, DWORD, DWORD, CPtr!(BYTE), DWORD);
133 + LONG RegSetValueExW(HKEY, LPCWSTR, DWORD, DWORD, CPtr!(BYTE), DWORD);
134 + LONG RegUnLoadKeyA(HKEY, LPCSTR);
135 + LONG RegUnLoadKeyW(HKEY, LPCWSTR);
136 + static if (_WIN32_WINDOWS >= 0x410) {
137 + LONG RegNotifyChangeKeyValue(HKEY, BOOL, DWORD, HANDLE, BOOL);
138 + }
139 +
140 + static if (_WIN32_WINNT_ONLY) {
141 + BOOL AbortSystemShutdownA(LPCSTR);
142 + BOOL AbortSystemShutdownW(LPCWSTR);
143 + BOOL InitiateSystemShutdownA(LPSTR, LPSTR, DWORD, BOOL, BOOL);
144 + BOOL InitiateSystemShutdownW(LPWSTR, LPWSTR, DWORD, BOOL, BOOL);
145 + LONG RegGetKeySecurity(HKEY, SECURITY_INFORMATION,
146 + PSECURITY_DESCRIPTOR, PDWORD);
147 + LONG RegRestoreKeyA(HKEY, LPCSTR, DWORD);
148 + LONG RegRestoreKeyW(HKEY, LPCWSTR, DWORD);
149 + LONG RegSetKeySecurity(HKEY, SECURITY_INFORMATION,
150 + PSECURITY_DESCRIPTOR);
47 151
48 -struct pvalueA {
49 - LPSTR pv_valuename;
50 - int pv_valuelen;
51 - LPVOID pv_value_context;
52 - DWORD pv_type;
53 -}
54 -alias pvalueA PVALUEA;
55 -alias pvalueA* PPVALUEA;
152 + static if (_WIN32_WINNT >= 0x500) {
153 + LONG RegDisablePredefinedCache();
154 + LONG RegOpenCurrentUser(REGSAM, PHKEY);
155 + LONG RegOpenUserClassesRoot(HANDLE, DWORD, REGSAM, PHKEY);
156 + }
56 157
57 -struct pvalueW {
58 - LPWSTR pv_valuename;
59 - int pv_valuelen;
60 - LPVOID pv_value_context;
61 - DWORD pv_type;
62 -}
63 -alias pvalueW PVALUEW;
64 -alias pvalueW* PPVALUEW;
158 + static if (_WIN32_WINNT >= 0x501) {
159 + LONG RegSaveKeyExA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES, DWORD);
160 + LONG RegSaveKeyExW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES, DWORD);
161 + }
65 162
66 -// #ifdef UNICODE
67 -alias PVALUEW PVALUE;
68 -alias PPVALUEW PPVALUE;
69 -// #else
70 -// ...
71 -// #endif // UNICODE
163 + static if (_WIN32_WINNT >= 0x600) {
164 + LONG RegGetValueA(HKEY hkey, LPCSTR lpSubKey, LPCSTR lpValue,
165 + DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData);
166 + LONG RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue,
167 + DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData);
168 + }
169 + }
72 170
73 -// typedef DWORD _cdecl QUERYHANDLER (LPVOID keycontext, PVALCONTEXT val_list, DWORD num_vals, LPVOID outputbuffer, DWORD FAR *total_outlen, DWORD input_blen);
74 -
75 -extern(Windows) alias DWORD function(LPVOID keycontext, PVALCONTEXT val_list, DWORD num_vals, LPVOID outputbuffer, DWORD* total_outlen, DWORD input_blen) PQUERYHANDLER;
76 -
77 -struct provider_info {
78 - PQUERYHANDLER pi_R0_1val;
79 - PQUERYHANDLER pi_R0_allvals;
80 - PQUERYHANDLER pi_R3_1val;
81 - PQUERYHANDLER pi_R3_allvals;
82 - DWORD pi_flags;
83 - LPVOID pi_key_context;
84 -}
85 -alias provider_info REG_PROVIDER;
86 -
87 -alias provider_info* PPROVIDER;
88 -
89 -struct value_entA {
90 - LPSTR ve_valuename;
91 - DWORD ve_valuelen;
92 - DWORD_PTR ve_valueptr;
93 - DWORD ve_type;
171 + deprecated {
172 + LONG RegCreateKeyA(HKEY, LPCSTR, PHKEY);
173 + LONG RegCreateKeyW(HKEY, LPCWSTR, PHKEY);
174 + LONG RegEnumKeyA(HKEY, DWORD, LPSTR, DWORD);
175 + LONG RegEnumKeyW(HKEY, DWORD, LPWSTR, DWORD);
176 + LONG RegOpenKeyA(HKEY, LPCSTR, PHKEY);
177 + LONG RegOpenKeyW(HKEY, LPCWSTR, PHKEY);
178 + LONG RegQueryValueA(HKEY, LPCSTR, LPSTR, PLONG);
179 + LONG RegQueryValueW(HKEY, LPCWSTR, LPWSTR, PLONG);
180 + LONG RegSetValueA(HKEY, LPCSTR, DWORD, LPCSTR, DWORD);
181 + LONG RegSetValueW(HKEY, LPCWSTR, DWORD, LPCWSTR, DWORD);
182 + }
94 183 }
95 -alias value_entA VALENTA;
96 -alias value_entA* PVALENTA;
97 184
98 -struct value_entW {
99 - LPWSTR ve_valuename;
100 - DWORD ve_valuelen;
101 - DWORD_PTR ve_valueptr;
102 - DWORD ve_type;
103 -}
104 -alias value_entW VALENTW;
105 -alias value_entW* PVALENTW;
106 -
107 -// #ifdef UNICODE
108 -alias VALENTW VALENT;
109 -alias PVALENTW PVALENT;
110 -// #else
111 -// ...
112 -// #endif // UNICODE
113 -
114 -// #endif // not(_PROVIDER_STRUCTS_DEFINED)
115 -
116 -// #endif /* WINVER >= 0x0400 */
117 -
118 -alias NULL WIN31_CLASS;
119 -
120 -extern(Windows) export LONG RegCloseKey(
121 - HKEY hKey);
122 -
123 -extern(Windows) export LONG RegOverridePredefKey(
124 - HKEY hKey,
125 - HKEY hNewHKey);
126 -
127 -extern(Windows) export LONG RegOpenUserClassesRoot(
128 - HANDLE hToken,
129 - DWORD dwOptions,
130 - REGSAM samDesired,
131 - PHKEY phkResult);
132 -
133 -extern(Windows) export LONG RegOpenCurrentUser(
134 - REGSAM samDesired,
135 - PHKEY phkResult);
136 -
137 -extern(Windows) export LONG RegDisablePredefinedCache();
138 -
139 -extern(Windows) export LONG RegConnectRegistryA(
140 - LPCSTR lpMachineName,
141 - HKEY hKey,
142 - PHKEY phkResult);
143 -extern(Windows) export LONG RegConnectRegistryW(
144 - LPCWSTR lpMachineName,
145 - HKEY hKey,
146 - PHKEY phkResult);
147 -// #ifdef UNICODE
148 -alias RegConnectRegistryW RegConnectRegistry;
149 -// #else
150 -// #...
151 -// #endif // !UNICODE
185 +version (Unicode) {
186 + alias VALENTW VALENT;
187 + alias RegConnectRegistryW RegConnectRegistry;
188 + alias RegCreateKeyExW RegCreateKeyEx;
189 + alias RegDeleteKeyW RegDeleteKey;
190 + alias RegDeleteValueW RegDeleteValue;
191 + alias RegEnumKeyExW RegEnumKeyEx;
192 + alias RegEnumValueW RegEnumValue;
193 + alias RegLoadKeyW RegLoadKey;
194 + alias RegOpenKeyExW RegOpenKeyEx;
195 + alias RegQueryInfoKeyW RegQueryInfoKey;
196 + alias RegQueryMultipleValuesW RegQueryMultipleValues;
197 + alias RegQueryValueExW RegQueryValueEx;
198 + alias RegReplaceKeyW RegReplaceKey;
199 + alias RegSaveKeyW RegSaveKey;
200 + alias RegSetValueExW RegSetValueEx;
201 + alias RegUnLoadKeyW RegUnLoadKey;
152 202
153 -extern(Windows) export LONG RegCreateKeyA(
154 - HKEY hKey,
155 - LPCSTR lpSubKey,
156 - PHKEY phkResult);
157 -extern(Windows) export LONG RegCreateKeyW(
158 - HKEY hKey,
159 - LPCWSTR lpSubKey,
160 - PHKEY phkResult);
161 -// #ifdef UNICODE
162 -alias RegCreateKeyW RegCreateKey;
163 -// #else
164 -// #...
165 -// #endif // !UNICODE
166 -
167 -extern(Windows) export LONG RegCreateKeyExA(
168 - HKEY hKey,
169 - LPCSTR lpSubKey,
170 - DWORD Reserved,
171 - LPSTR lpClass,
172 - DWORD dwOptions,
173 - REGSAM samDesired,
174 - LPSECURITY_ATTRIBUTES lpSecurityAttributes,
175 - PHKEY phkResult,
176 - LPDWORD lpdwDisposition);
177 -extern(Windows) export LONG RegCreateKeyExW(
178 - HKEY hKey,
179 - LPCWSTR lpSubKey,
180 - DWORD Reserved,
181 - LPWSTR lpClass,
182 - DWORD dwOptions,
183 - REGSAM samDesired,
184 - LPSECURITY_ATTRIBUTES lpSecurityAttributes,
185 - PHKEY phkResult,
186 - LPDWORD lpdwDisposition);
187 -// #ifdef UNICODE
188 -alias RegCreateKeyExW RegCreateKeyEx;
189 -// #else
190 -// #...
191 -// #endif // !UNICODE
192 -
193 -extern(Windows) export LONG RegDeleteKeyA(
194 - HKEY hKey,
195 - LPCSTR lpSubKey);
196 -extern(Windows) export LONG RegDeleteKeyW(
197 - HKEY hKey,
198 - LPCWSTR lpSubKey);
199 -// #ifdef UNICODE
200 -alias RegDeleteKeyW RegDeleteKey;
201 -// #else
202 -// #...
203 -// #endif // !UNICODE
204 -
205 -extern(Windows) export LONG RegDeleteValueA(
206 - HKEY hKey,
207 - LPCSTR lpValueName);
208 -extern(Windows) export LONG RegDeleteValueW(
209 - HKEY hKey,
210 - LPCWSTR lpValueName);
211 -// #ifdef UNICODE
212 -alias RegDeleteValueW RegDeleteValue;
213 -// #else
214 -// #...
215 -// #endif // !UNICODE
216 -
217 -extern(Windows) export LONG RegEnumKeyA(
218 - HKEY hKey,
219 - DWORD dwIndex,
220 - LPSTR lpName,
221 - DWORD cbName);
222 -extern(Windows) export LONG RegEnumKeyW(
223 - HKEY hKey,
224 - DWORD dwIndex,
225 - LPWSTR lpName,
226 - DWORD cbName);
227 -// #ifdef UNICODE
228 -alias RegEnumKeyW RegEnumKey;
229 -// #else
230 -// #...
231 -// #endif // !UNICODE
232 -
233 -extern(Windows) export LONG RegEnumKeyExA(
234 - HKEY hKey,
235 - DWORD dwIndex,
236 - LPSTR lpName,
237 - LPDWORD lpcbName,
238 - LPDWORD lpReserved,
239 - LPSTR lpClass,
240 - LPDWORD lpcbClass,
241 - PFILETIME lpftLastWriteTime);
242 -extern(Windows) export LONG RegEnumKeyExW(
243 - HKEY hKey,
244 - DWORD dwIndex,
245 - LPWSTR lpName,
246 - LPDWORD lpcbName,
247 - LPDWORD lpReserved,
248 - LPWSTR lpClass,
249 - LPDWORD lpcbClass,
250 - PFILETIME lpftLastWriteTime);
251 -// #ifdef UNICODE
252 -alias RegEnumKeyExW RegEnumKeyEx;
253 -// #else
254 -// #...
255 -// #endif // !UNICODE
256 -
257 -extern(Windows) export LONG RegEnumValueA(
258 - HKEY hKey,
259 - DWORD dwIndex,
260 - LPSTR lpValueName,
261 - LPDWORD lpcbValueName,
262 - LPDWORD lpReserved,
263 - LPDWORD lpType,
264 - LPBYTE lpData,
265 - LPDWORD lpcbData);
266 -extern(Windows) export LONG RegEnumValueW(
267 - HKEY hKey,
268 - DWORD dwIndex,
269 - LPWSTR lpValueName,
270 - LPDWORD lpcbValueName,
271 - LPDWORD lpReserved,
272 - LPDWORD lpType,
273 - LPBYTE lpData,
274 - LPDWORD lpcbData);
275 -// #ifdef UNICODE
276 -alias RegEnumValueW RegEnumValue;
277 -// #else
278 -// #...
279 -// #endif // !UNICODE
203 + static if (_WIN32_WINNT_ONLY) {
204 + alias AbortSystemShutdownW AbortSystemShutdown;
205 + alias InitiateSystemShutdownW InitiateSystemShutdown;
206 + alias RegRestoreKeyW RegRestoreKey;
207 + static if (_WIN32_WINNT >= 0x501) {
208 + alias RegSaveKeyExA RegSaveKeyEx;
209 + }
210 + static if (_WIN32_WINNT >= 0x600) {
211 + alias RegGetValueW RegGetValue;
212 + }
213 + }
214 + deprecated {
215 + alias RegCreateKeyW RegCreateKey;
216 + alias RegEnumKeyW RegEnumKey;
217 + alias RegOpenKeyW RegOpenKey;
218 + alias RegQueryValueW RegQueryValue;
219 + alias RegSetValueW RegSetValue;
220 + }
221 +} else {
222 + alias VALENTA VALENT;
223 + alias RegConnectRegistryA RegConnectRegistry;
224 + alias RegCreateKeyExA RegCreateKeyEx;
225 + alias RegDeleteKeyA RegDeleteKey;
226 + alias RegDeleteValueA RegDeleteValue;
227 + alias RegEnumKeyExA RegEnumKeyEx;
228 + alias RegEnumValueA RegEnumValue;
229 + alias RegLoadKeyA RegLoadKey;
230 + alias RegOpenKeyExA RegOpenKeyEx;
231 + alias RegQueryInfoKeyA RegQueryInfoKey;
232 + alias RegQueryMultipleValuesA RegQueryMultipleValues;
233 + alias RegQueryValueExA RegQueryValueEx;
234 + alias RegReplaceKeyA RegReplaceKey;
235 + alias RegSaveKeyA RegSaveKey;
236 + alias RegSetValueExA RegSetValueEx;
237 + alias RegUnLoadKeyA RegUnLoadKey;
238 + static if (_WIN32_WINNT_ONLY) {
239 + alias AbortSystemShutdownA AbortSystemShutdown;
240 + alias InitiateSystemShutdownA InitiateSystemShutdown;
241 + alias RegRestoreKeyW RegRestoreKey;
242 + static if (_WIN32_WINNT >= 0x501) {
243 + alias RegSaveKeyExA RegSaveKeyEx;
244 + }
245 + static if (_WIN32_WINNT >= 0x600) {
246 + alias RegGetValueA RegGetValue;
247 + }
248 + }
249 + deprecated {
250 + alias RegCreateKeyA RegCreateKey;
251 + alias RegEnumKeyA RegEnumKey;
252 + alias RegOpenKeyA RegOpenKey;
253 + alias RegQueryValueA RegQueryValue;
254 + alias RegSetValueA RegSetValue;
255 + }
256 +}
280 257
281 -extern(Windows) export LONG RegFlushKey(
282 - HKEY hKey);
283 -
284 -extern(Windows) export LONG RegGetKeySecurity(
285 - HKEY hKey,
286 - SECURITY_INFORMATION SecurityInformation,
287 - PSECURITY_DESCRIPTOR pSecurityDescriptor,
288 - LPDWORD lpcbSecurityDescriptor);
289 -
290 -extern(Windows) export LONG RegLoadKeyA(
291 - HKEY hKey,
292 - LPCSTR lpSubKey,
293 - LPCSTR lpFile);
294 -extern(Windows) export LONG RegLoadKeyW(
295 - HKEY hKey,
296 - LPCWSTR lpSubKey,
297 - LPCWSTR lpFile);
298 -// #ifdef UNICODE
299 -alias RegLoadKeyW RegLoadKey;
300 -// #else
301 -// #...
302 -// #endif // !UNICODE
303 -
304 -extern(Windows) export LONG RegNotifyChangeKeyValue(
305 - HKEY hKey,
306 - BOOL bWatchSubtree,
307 - DWORD dwNotifyFilter,
308 - HANDLE hEvent,
309 - BOOL fAsynchronus);
310 -
311 -extern(Windows) export LONG RegOpenKeyA(
312 - HKEY hKey,
313 - LPCSTR lpSubKey,
314 - PHKEY phkResult);
315 -extern(Windows) export LONG RegOpenKeyW(
316 - HKEY hKey,
317 - LPCWSTR lpSubKey,
318 - PHKEY phkResult);
319 -// #ifdef UNICODE
320 -alias RegOpenKeyW RegOpenKey;
321 -// #else
322 -// #...
323 -// #endif // !UNICODE
324 -
325 -extern(Windows) export LONG RegOpenKeyExA(
326 - HKEY hKey,
327 - LPCSTR lpSubKey,
328 - DWORD ulOptions,
329 - REGSAM samDesired,
330 - PHKEY phkResult);
331 -extern(Windows) export LONG RegOpenKeyExW(
332 - HKEY hKey,
333 - LPCWSTR lpSubKey,
334 - DWORD ulOptions,
335 - REGSAM samDesired,
336 - PHKEY phkResult);
337 -// #ifdef UNICODE
338 -alias RegOpenKeyExW RegOpenKeyEx;
339 -// #else
340 -// #...
341 -// #endif // !UNICODE
342 -
343 -extern(Windows) export LONG RegQueryInfoKeyA(
344 - HKEY hKey,
345 - LPSTR lpClass,
346 - LPDWORD lpcbClass,
347 - LPDWORD lpReserved,
348 - LPDWORD lpcSubKeys,
349 - LPDWORD lpcbMaxSubKeyLen,
350 - LPDWORD lpcbMaxClassLen,
351 - LPDWORD lpcValues,
352 - LPDWORD lpcbMaxValueNameLen,
353 - LPDWORD lpcbMaxValueLen,
354 - LPDWORD lpcbSecurityDescriptor,
355 - PFILETIME lpftLastWriteTime);
356 -extern(Windows) export LONG RegQueryInfoKeyW(
357 - HKEY hKey,
358 - LPWSTR lpClass,
359 - LPDWORD lpcbClass,
360 - LPDWORD lpReserved,
361 - LPDWORD lpcSubKeys,
362 - LPDWORD lpcbMaxSubKeyLen,
363 - LPDWORD lpcbMaxClassLen,
364 - LPDWORD lpcValues,
365 - LPDWORD lpcbMaxValueNameLen,
366 - LPDWORD lpcbMaxValueLen,
367 - LPDWORD lpcbSecurityDescriptor,
368 - PFILETIME lpftLastWriteTime);
369 -// #ifdef UNICODE
370 -alias RegQueryInfoKeyW RegQueryInfoKey;
371 -// #else
372 -// #...
373 -// #endif // !UNICODE
374 -
375 -extern(Windows) export LONG RegQueryValueA(
376 - HKEY hKey,
377 - LPCSTR lpSubKey,
378 - LPSTR lpValue,
379 - PLONG lpcbValue);
380 -extern(Windows) export LONG RegQueryValueW(
381 - HKEY hKey,
382 - LPCWSTR lpSubKey,
383 - LPWSTR lpValue,
384 - PLONG lpcbValue);
385 -// #ifdef UNICODE
386 -alias RegQueryValueW RegQueryValue;
387 -// #else
388 -// #...
389 -// #endif // !UNICODE
390 -
391 -// #if(WINVER >= 0x0400)
392 -extern(Windows) export LONG RegQueryMultipleValuesA(
393 - HKEY hKey,
394 - PVALENTA val_list,
395 - DWORD num_vals,
396 - LPSTR lpValueBuf,
397 - LPDWORD ldwTotsize);
398 -extern(Windows) export LONG RegQueryMultipleValuesW(
399 - HKEY hKey,
400 - PVALENTW val_list,
401 - DWORD num_vals,
402 - LPWSTR lpValueBuf,
403 - LPDWORD ldwTotsize);
404 -// #ifdef UNICODE
405 -alias RegQueryMultipleValuesW RegQueryMultipleValues;
406 -// #else
407 -// #...
408 -// #endif // !UNICODE
409 -// #endif /* WINVER >= 0x0400 */
410 -
411 -extern(Windows) export LONG RegQueryValueExA(
412 - HKEY hKey,
413 - LPCSTR lpValueName,
414 - LPDWORD lpReserved,
415 - LPDWORD lpType,
416 - LPBYTE lpData,
417 - LPDWORD lpcbData);
418 -extern(Windows) export LONG RegQueryValueExW(
419 - HKEY hKey,
420 - LPCWSTR lpValueName,
421 - LPDWORD lpReserved,
422 - LPDWORD lpType,
423 - LPBYTE lpData,
424 - LPDWORD lpcbData);
425 -// #ifdef UNICODE
426 -alias RegQueryValueExW RegQueryValueEx;
427 -// #else
428 -// #...
429 -// #endif // !UNICODE
430 -
431 -extern(Windows) export LONG RegReplaceKeyA(
432 - HKEY hKey,
433 - LPCSTR lpSubKey,
434 - LPCSTR lpNewFile,
435 - LPCSTR lpOldFile);
436 -extern(Windows) export LONG RegReplaceKeyW(
437 - HKEY hKey,
438 - LPCWSTR lpSubKey,
439 - LPCWSTR lpNewFile,
440 - LPCWSTR lpOldFile);
441 -// #ifdef UNICODE
442 -alias RegReplaceKeyW RegReplaceKey;
443 -// #else
444 -// #...
445 -// #endif // !UNICODE
446 -
447 -extern(Windows) export LONG RegRestoreKeyA(
448 - HKEY hKey,
449 - LPCSTR lpFile,
450 - DWORD dwFlags);
451 -extern(Windows) export LONG RegRestoreKeyW(
452 - HKEY hKey,
453 - LPCWSTR lpFile,
454 - DWORD dwFlags);
455 -// #ifdef UNICODE
456 -alias RegRestoreKeyW RegRestoreKey;
457 -// #else
458 -// #...
459 -// #endif // !UNICODE
460 -
461 -extern(Windows) export LONG RegSaveKeyA(
462 - HKEY hKey,
463 - LPCSTR lpFile,
464 - LPSECURITY_ATTRIBUTES lpSecurityAttributes);
465 -extern(Windows) export LONG RegSaveKeyW(
466 - HKEY hKey,
467 - LPCWSTR lpFile,
468 - LPSECURITY_ATTRIBUTES lpSecurityAttributes);
469 -// #ifdef UNICODE
470 -alias RegSaveKeyW RegSaveKey;
471 -// #else
472 -// #...
473 -// #endif // !UNICODE
474 -
475 -extern(Windows) export LONG RegSetKeySecurity(
476 - HKEY hKey,
477 - SECURITY_INFORMATION SecurityInformation,
478 - PSECURITY_DESCRIPTOR pSecurityDescriptor);
479 -
480 -extern(Windows) export LONG RegSetValueA(
481 - HKEY hKey,
482 - LPCSTR lpSubKey,
483 - DWORD dwType,
484 - LPCSTR lpData,
485 - DWORD cbData);
486 -extern(Windows) export LONG RegSetValueW(
487 - HKEY hKey,
488 - LPCWSTR lpSubKey,
489 - DWORD dwType,
490 - LPCWSTR lpData,
491 - DWORD cbData);
492 -// #ifdef UNICODE
493 -alias RegSetValueW RegSetValue;
494 -// #else
495 -// #...
496 -// #endif // !UNICODE
497 -
498 -extern(Windows) export LONG RegSetValueExA(
499 - HKEY hKey,
500 - LPCSTR lpValueName,
501 - DWORD Reserved,
502 - DWORD dwType,
503 - BYTE* lpData,
504 - DWORD cbData);
505 -extern(Windows) export LONG RegSetValueExW(
506 - HKEY hKey,
507 - LPCWSTR lpValueName,
508 - DWORD Reserved,
509 - DWORD dwType,
510 - BYTE* lpData,
511 - DWORD cbData);
512 -// #ifdef UNICODE
513 -alias RegSetValueExW RegSetValueEx;
514 -// #else
515 -// #...
516 -// #endif // !UNICODE
517 -
518 -extern(Windows) export LONG RegUnLoadKeyA(
519 - HKEY hKey,
520 - LPCSTR lpSubKey);
521 -extern(Windows) export LONG RegUnLoadKeyW(
522 - HKEY hKey,
523 - LPCWSTR lpSubKey);
524 -// #ifdef UNICODE
525 -alias RegUnLoadKeyW RegUnLoadKey;
526 -// #else
527 -// #...
528 -// #endif // !UNICODE
529 -
530 -extern(Windows) export BOOL InitiateSystemShutdownA(
531 - LPSTR lpMachineName,
532 - LPSTR lpMessage,
533 - DWORD dwTimeout,
534 - BOOL bForceAppsClosed,
535 - BOOL bRebootAfterShutdown);
536 -extern(Windows) export BOOL InitiateSystemShutdownW(
537 - LPWSTR lpMachineName,
538 - LPWSTR lpMessage,
539 - DWORD dwTimeout,
540 - BOOL bForceAppsClosed,
541 - BOOL bRebootAfterShutdown);
542 -// #ifdef UNICODE
543 -alias InitiateSystemShutdownW InitiateSystemShutdown;
544 -// #else
545 -// #...
546 -// #endif // !UNICODE
547 -
548 -extern(Windows) export BOOL AbortSystemShutdownA(
549 - LPSTR lpMachineName);
550 -extern(Windows) export BOOL AbortSystemShutdownW(
551 - LPWSTR lpMachineName);
552 -// #ifdef UNICODE
553 -alias AbortSystemShutdownW AbortSystemShutdown;
554 -// #else
555 -// #...
556 -// #endif // !UNICODE
557 -
558 -// inline #include <reason.h>
559 -// ----
560 -
561 -// #if !defined SENTINEL_Reason
562 -// # define SENTINEL_Reason
563 -
564 -enum : uint { SHTDN_REASON_FLAG_COMMENT_REQUIRED = 0x01000000 }
565 -enum : uint { SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED = 0x02000000 }
566 -enum : uint { SHTDN_REASON_FLAG_CLEAN_UI = 0x04000000 }
567 -enum : uint { SHTDN_REASON_FLAG_DIRTY_UI = 0x08000000 }
568 -
569 -enum : uint { SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000 }
570 -enum : uint { SHTDN_REASON_FLAG_PLANNED = 0x80000000 }
571 -
572 -enum : uint { SHTDN_REASON_MAJOR_OTHER = 0x00000000 }
573 -enum : uint { SHTDN_REASON_MAJOR_NONE = 0x00000000 }
574 -enum : uint { SHTDN_REASON_MAJOR_HARDWARE = 0x00010000 }
575 -enum : uint { SHTDN_REASON_MAJOR_OPERATINGSYSTEM = 0x00020000 }
576 -enum : uint { SHTDN_REASON_MAJOR_SOFTWARE = 0x00030000 }
577 -enum : uint { SHTDN_REASON_MAJOR_APPLICATION = 0x00040000 }
578 -enum : uint { SHTDN_REASON_MAJOR_SYSTEM = 0x00050000 }
579 -enum : uint { SHTDN_REASON_MAJOR_POWER = 0x00060000 }
580 -
581 -enum : uint { SHTDN_REASON_MINOR_OTHER = 0x00000000 }
582 -enum : uint { SHTDN_REASON_MINOR_NONE = 0x000000ff }
583 -enum : uint { SHTDN_REASON_MINOR_MAINTENANCE = 0x00000001 }
584 -enum : uint { SHTDN_REASON_MINOR_INSTALLATION = 0x00000002 }
585 -enum : uint { SHTDN_REASON_MINOR_UPGRADE = 0x00000003 }
586 -enum : uint { SHTDN_REASON_MINOR_RECONFIG = 0x00000004 }
587 -enum : uint { SHTDN_REASON_MINOR_HUNG = 0x00000005 }
588 -enum : uint { SHTDN_REASON_MINOR_UNSTABLE = 0x00000006 }
589 -enum : uint { SHTDN_REASON_MINOR_DISK = 0x00000007 }
590 -enum : uint { SHTDN_REASON_MINOR_PROCESSOR = 0x00000008 }
591 -enum : uint { SHTDN_REASON_MINOR_NETWORKCARD = 0x00000009 }
592 -enum : uint { SHTDN_REASON_MINOR_POWER_SUPPLY = 0x0000000a }
593 -enum : uint { SHTDN_REASON_MINOR_CORDUNPLUGGED = 0x0000000b }
594 -enum : uint { SHTDN_REASON_MINOR_ENVIRONMENT = 0x0000000c }
595 -enum : uint { SHTDN_REASON_MINOR_HARDWARE_DRIVER = 0x0000000d }
596 -enum : uint { SHTDN_REASON_MINOR_OTHERDRIVER = 0x0000000e }
597 -enum : uint { SHTDN_REASON_MINOR_BLUESCREEN = 0x0000000F }
598 -
599 -alias SHTDN_REASON_MINOR_NONE SHTDN_REASON_UNKNOWN;
600 -
601 -enum : uint { SHTDN_REASON_VALID_BIT_MASK = 0xc0ffffff }
602 -
603 -enum : uint { PCLEANUI = SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_CLEAN_UI }
604 -enum : uint { UCLEANUI = SHTDN_REASON_FLAG_CLEAN_UI }
605 -enum : uint { UDIRTYUI = SHTDN_REASON_FLAG_DIRTY_UI }
606 -
607 -enum : uint { MAX_REASON_NAME_LEN = 64 }
608 -enum : uint { MAX_REASON_DESC_LEN = 256 }
609 -enum : uint { MAX_REASON_BUGID_LEN = 32 }
610 -enum : uint { MAX_REASON_COMMENT_LEN = 4096 }
611 -
612 -// #endif // !defined SENTINEL_Reason
613 -// ----
614 -
615 -enum : uint { REASON_SWINSTALL = SHTDN_REASON_MAJOR_SOFTWARE | SHTDN_REASON_MINOR_INSTALLATION }
616 -enum : uint { REASON_HWINSTALL = SHTDN_REASON_MAJOR_HARDWARE | SHTDN_REASON_MINOR_INSTALLATION }
617 -enum : uint { REASON_SERVICEHANG = SHTDN_REASON_MAJOR_SOFTWARE | SHTDN_REASON_MINOR_HUNG }
618 -enum : uint { REASON_UNSTABLE = SHTDN_REASON_MAJOR_SYSTEM | SHTDN_REASON_MINOR_UNSTABLE }
619 -enum : uint { REASON_SWHWRECONF = SHTDN_REASON_MAJOR_SOFTWARE | SHTDN_REASON_MINOR_RECONFIG }
620 -enum : uint { REASON_OTHER = SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER }
621 -alias SHTDN_REASON_UNKNOWN REASON_UNKNOWN;
622 -alias SHTDN_REASON_FLAG_PLANNED REASON_PLANNED_FLAG;
623 -
624 -extern(Windows) export BOOL InitiateSystemShutdownExA(
625 - LPSTR lpMachineName,
626 - LPSTR lpMessage,
627 - DWORD dwTimeout,
628 - BOOL bForceAppsClosed,
629 - BOOL bRebootAfterShutdown,
630 - DWORD dwReason);
631 -extern(Windows) export BOOL InitiateSystemShutdownExW(
632 - LPWSTR lpMachineName,
633 - LPWSTR lpMessage,
634 - DWORD dwTimeout,
635 - BOOL bForceAppsClosed,
636 - BOOL bRebootAfterShutdown,
637 - DWORD dwReason);
638 -// #ifdef UNICODE
639 -alias InitiateSystemShutdownExW InitiateSystemShutdownEx;
640 -// #else
641 -// #...
642 -// #endif // !UNICODE
643 -
644 -extern(Windows) export LONG RegSaveKeyExA(
645 - HKEY hKey,
646 - LPCSTR lpFile,
647 - LPSECURITY_ATTRIBUTES lpSecurityAttributes,
648 - DWORD Flags);
649 -extern(Windows) export LONG RegSaveKeyExW(
650 - HKEY hKey,
651 - LPCWSTR lpFile,
652 - LPSECURITY_ATTRIBUTES lpSecurityAttributes,
653 - DWORD Flags);
654 -// #ifdef UNICODE
655 -alias RegSaveKeyExW RegSaveKeyEx;
656 -// #else
657 -// #...
658 -// #endif // !UNICODE
659 -
660 -extern(Windows) export LONG Wow64Win32ApiEntry(
661 - DWORD dwFuncNumber,
662 - DWORD dwFlag,
663 - DWORD dwRes);
664 -
665 -// #ifdef __cplusplus
666 -// }
667 -// #endif
668 -
669 -// #endif // _WINREG_
670 -
258 +alias VALENT* PVALENT;