1 | /* $Id: reg.cpp,v 1.4 2000-08-20 15:16:58 phaller Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
5 | * Win32 NT Runtime / NTDLL for OS/2
|
---|
6 | *
|
---|
7 | * Copyright 1998 original WINE Author
|
---|
8 | * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
|
---|
9 | *
|
---|
10 | * registry functions
|
---|
11 | */
|
---|
12 |
|
---|
13 | #include <os2win.h>
|
---|
14 | #include <winnt.h>
|
---|
15 | #include <ntdef.h>
|
---|
16 | #include <winreg.h>
|
---|
17 |
|
---|
18 | #include <heapstring.h>
|
---|
19 | #include "debugtools.h"
|
---|
20 | #include "ntdll.h"
|
---|
21 |
|
---|
22 |
|
---|
23 | /* translates predefined paths to HKEY_ constants */
|
---|
24 | static BOOLEAN _NtKeyToWinKey(
|
---|
25 | IN POBJECT_ATTRIBUTES ObjectAttributes,
|
---|
26 | OUT UINT * Offset,/* offset within ObjectName */
|
---|
27 | OUT HKEY * KeyHandle)/* translated handle */
|
---|
28 | {
|
---|
29 | static const WCHAR KeyPath_HKLM[] = {
|
---|
30 | '\\','R','E','G','I','S','T','R','Y',
|
---|
31 | '\\','M','A','C','H','I','N','E',0};
|
---|
32 | static const WCHAR KeyPath_HKU [] = {
|
---|
33 | '\\','R','E','G','I','S','T','R','Y',
|
---|
34 | '\\','U','S','E','R',0};
|
---|
35 | static const WCHAR KeyPath_HCC [] = {
|
---|
36 | '\\','R','E','G','I','S','T','R','Y',
|
---|
37 | '\\','M','A','C','H','I','N','E',
|
---|
38 | '\\','S','Y','S','T','E','M',
|
---|
39 | '\\','C','U','R','R','E','N','T','C','O','N','T','R','O','L','S','E','T',
|
---|
40 | '\\','H','A','R','D','W','A','R','E','P','R','O','F','I','L','E','S',
|
---|
41 | '\\','C','U','R','R','E','N','T',0};
|
---|
42 | static const WCHAR KeyPath_HCR [] = {
|
---|
43 | '\\','R','E','G','I','S','T','R','Y',
|
---|
44 | '\\','M','A','C','H','I','N','E',
|
---|
45 | '\\','S','O','F','T','W','A','R','E',
|
---|
46 | '\\','C','L','A','S','S','E','S',0};
|
---|
47 | int len;
|
---|
48 | PUNICODE_STRING ObjectName = ObjectAttributes->ObjectName;
|
---|
49 |
|
---|
50 | if(ObjectAttributes->RootDirectory)
|
---|
51 | {
|
---|
52 | len = 0;
|
---|
53 | *KeyHandle = ObjectAttributes->RootDirectory;
|
---|
54 | }
|
---|
55 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM)))
|
---|
56 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HKLM,len)))
|
---|
57 | { *KeyHandle = HKEY_LOCAL_MACHINE;
|
---|
58 | }
|
---|
59 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU)))
|
---|
60 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HKU,len)))
|
---|
61 | { *KeyHandle = HKEY_USERS;
|
---|
62 | }
|
---|
63 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR)))
|
---|
64 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HCR,len)))
|
---|
65 | { *KeyHandle = HKEY_CLASSES_ROOT;
|
---|
66 | }
|
---|
67 | else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC)))
|
---|
68 | && (0==lstrncmpiW(ObjectName->Buffer,KeyPath_HCC,len)))
|
---|
69 | { *KeyHandle = HKEY_CURRENT_CONFIG;
|
---|
70 | }
|
---|
71 | else
|
---|
72 | {
|
---|
73 | *KeyHandle = 0;
|
---|
74 | *Offset = 0;
|
---|
75 | return FALSE;
|
---|
76 | }
|
---|
77 |
|
---|
78 | if (len > 0 && ObjectName->Buffer[len] == (WCHAR)'\\') len++;
|
---|
79 | *Offset = len;
|
---|
80 |
|
---|
81 | TRACE("off=%u hkey=0x%08x\n", *Offset, *KeyHandle);
|
---|
82 | return TRUE;
|
---|
83 | }
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|
87 | /******************************************************************************
|
---|
88 | * NtCreateKey [NTDLL]
|
---|
89 | * ZwCreateKey
|
---|
90 | */
|
---|
91 | NTSTATUS WINAPI NtCreateKey(PHANDLE KeyHandle,
|
---|
92 | ACCESS_MASK DesiredAccess,
|
---|
93 | POBJECT_ATTRIBUTES ObjectAttributes,
|
---|
94 | ULONG TitleIndex,
|
---|
95 | PUNICODE_STRING Class,
|
---|
96 | ULONG CreateOptions,
|
---|
97 | PULONG Disposition)
|
---|
98 | {
|
---|
99 | dprintf (("NTDLL: NtCreateKey(%08xh, %08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
100 | KeyHandle,
|
---|
101 | DesiredAccess,
|
---|
102 | ObjectAttributes,
|
---|
103 | TitleIndex,
|
---|
104 | Class,
|
---|
105 | CreateOptions,
|
---|
106 | Disposition));
|
---|
107 |
|
---|
108 | return (0);
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | /******************************************************************************
|
---|
113 | * NtDeleteKey [NTDLL]
|
---|
114 | * ZwDeleteKey
|
---|
115 | */
|
---|
116 | NTSTATUS WINAPI NtDeleteKey(HANDLE KeyHandle)
|
---|
117 | {
|
---|
118 | dprintf(("NTDLL: NtDeleteKey(%08xh) not implemented\n",
|
---|
119 | KeyHandle));
|
---|
120 |
|
---|
121 | return (0);
|
---|
122 | }
|
---|
123 |
|
---|
124 |
|
---|
125 | /******************************************************************************
|
---|
126 | * NtDeleteValueKey [NTDLL]
|
---|
127 | * ZwDeleteValueKey
|
---|
128 | */
|
---|
129 | NTSTATUS WINAPI NtDeleteValueKey(HANDLE KeyHandle,
|
---|
130 | PUNICODE_STRING ValueName)
|
---|
131 | {
|
---|
132 | dprintf(("NTDLL: NtDeleteValueKey(%08xh, %08xh) not implemented\n",
|
---|
133 | KeyHandle,
|
---|
134 | ValueName));
|
---|
135 |
|
---|
136 | return(0);
|
---|
137 | }
|
---|
138 |
|
---|
139 |
|
---|
140 | /******************************************************************************
|
---|
141 | * NtEnumerateKey [NTDLL]
|
---|
142 | * ZwEnumerateKey
|
---|
143 | */
|
---|
144 | NTSTATUS WINAPI NtEnumerateKey(HANDLE KeyHandle,
|
---|
145 | ULONG Index,
|
---|
146 | KEY_INFORMATION_CLASS KeyInformationClass,
|
---|
147 | PVOID KeyInformation,
|
---|
148 | ULONG Length,
|
---|
149 | PULONG ResultLength)
|
---|
150 | {
|
---|
151 | dprintf(("NTDLL: NtEnumerateKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
152 | KeyHandle,
|
---|
153 | Index,
|
---|
154 | KeyInformationClass,
|
---|
155 | KeyInformation,
|
---|
156 | Length,
|
---|
157 | ResultLength));
|
---|
158 |
|
---|
159 | return 0;
|
---|
160 | }
|
---|
161 |
|
---|
162 |
|
---|
163 | /******************************************************************************
|
---|
164 | * NtEnumerateValueKey [NTDLL]
|
---|
165 | * ZwEnumerateValueKey
|
---|
166 | */
|
---|
167 | NTSTATUS WINAPI NtEnumerateValueKey(HANDLE KeyHandle,
|
---|
168 | ULONG Index,
|
---|
169 | KEY_VALUE_INFORMATION_CLASS KeyInformationClass,
|
---|
170 | PVOID KeyInformation,
|
---|
171 | ULONG Length,
|
---|
172 | PULONG ResultLength)
|
---|
173 | {
|
---|
174 | dprintf(("NTDLL: NtEnumerateValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
175 | KeyHandle,
|
---|
176 | Index,
|
---|
177 | KeyInformationClass,
|
---|
178 | KeyInformation,
|
---|
179 | Length,
|
---|
180 | ResultLength));
|
---|
181 |
|
---|
182 | return 0;
|
---|
183 | }
|
---|
184 |
|
---|
185 |
|
---|
186 | /******************************************************************************
|
---|
187 | * NtFlushKey [NTDLL]
|
---|
188 | * ZwFlushKey
|
---|
189 | */
|
---|
190 | NTSTATUS WINAPI NtFlushKey(HANDLE KeyHandle)
|
---|
191 | {
|
---|
192 | dprintf(("NTDLL: NtFlushKey(%08xh)\n",
|
---|
193 | KeyHandle));
|
---|
194 |
|
---|
195 | return ERROR_SUCCESS;
|
---|
196 | }
|
---|
197 |
|
---|
198 |
|
---|
199 | /******************************************************************************
|
---|
200 | * NtLoadKey [NTDLL]
|
---|
201 | * ZwLoadKey
|
---|
202 | */
|
---|
203 | NTSTATUS WINAPI NtLoadKey(PHANDLE KeyHandle,
|
---|
204 | POBJECT_ATTRIBUTES ObjectAttributes)
|
---|
205 | {
|
---|
206 | dprintf(("NTDLL: NtLoadKey(%08xh,%08xh) not implemented.\n",
|
---|
207 | KeyHandle,
|
---|
208 | ObjectAttributes));
|
---|
209 |
|
---|
210 | return 0;
|
---|
211 | }
|
---|
212 |
|
---|
213 |
|
---|
214 | /******************************************************************************
|
---|
215 | * NtNotifyChangeKey [NTDLL]
|
---|
216 | * ZwNotifyChangeKey
|
---|
217 | */
|
---|
218 | NTSTATUS WINAPI NtNotifyChangeKey(HANDLE KeyHandle,
|
---|
219 | HANDLE Event,
|
---|
220 | PIO_APC_ROUTINE ApcRoutine,
|
---|
221 | PVOID ApcContext,
|
---|
222 | PIO_STATUS_BLOCK IoStatusBlock,
|
---|
223 | ULONG CompletionFilter,
|
---|
224 | BOOLEAN Asynchronous,
|
---|
225 | PVOID ChangeBuffer,
|
---|
226 | ULONG Length,
|
---|
227 | BOOLEAN WatchSubTree)
|
---|
228 | {
|
---|
229 | dprintf(("NTDLL: NtNotifyChangeKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
230 | KeyHandle,
|
---|
231 | Event,
|
---|
232 | ApcRoutine,
|
---|
233 | ApcContext,
|
---|
234 | IoStatusBlock,
|
---|
235 | CompletionFilter,
|
---|
236 | Asynchronous,
|
---|
237 | ChangeBuffer,
|
---|
238 | Length,
|
---|
239 | WatchSubTree));
|
---|
240 |
|
---|
241 | return 0;
|
---|
242 | }
|
---|
243 |
|
---|
244 |
|
---|
245 | /******************************************************************************
|
---|
246 | * NtOpenKey [NTDLL.129]
|
---|
247 | * ZwOpenKey
|
---|
248 | * OUT PHANDLE KeyHandle,
|
---|
249 | * IN ACCESS_MASK DesiredAccess,
|
---|
250 | * IN POBJECT_ATTRIBUTES ObjectAttributes
|
---|
251 | */
|
---|
252 | NTSTATUS WINAPI NtOpenKey(PHANDLE KeyHandle,
|
---|
253 | ACCESS_MASK DesiredAccess,
|
---|
254 | POBJECT_ATTRIBUTES ObjectAttributes)
|
---|
255 | {
|
---|
256 | dprintf(("NTDLL: NtOpenKey(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
257 | KeyHandle,
|
---|
258 | DesiredAccess,
|
---|
259 | ObjectAttributes));
|
---|
260 | return 0;
|
---|
261 | }
|
---|
262 |
|
---|
263 |
|
---|
264 | /******************************************************************************
|
---|
265 | * NtQueryKey [NTDLL]
|
---|
266 | * ZwQueryKey
|
---|
267 | */
|
---|
268 | NTSTATUS WINAPI NtQueryKey(HANDLE KeyHandle,
|
---|
269 | KEY_INFORMATION_CLASS KeyInformationClass,
|
---|
270 | PVOID KeyInformation,
|
---|
271 | ULONG Length,
|
---|
272 | PULONG ResultLength)
|
---|
273 | {
|
---|
274 | dprintf(("NTDLL: NtQueryKey(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
275 | KeyHandle,
|
---|
276 | KeyInformationClass,
|
---|
277 | KeyInformation,
|
---|
278 | Length,
|
---|
279 | ResultLength));
|
---|
280 |
|
---|
281 | return 0;
|
---|
282 | }
|
---|
283 |
|
---|
284 |
|
---|
285 | /******************************************************************************
|
---|
286 | * NtQueryMultipleValueKey [NTDLL]
|
---|
287 | * ZwQueryMultipleValueKey
|
---|
288 | */
|
---|
289 |
|
---|
290 | NTSTATUS WINAPI NtQueryMultipleValueKey(HANDLE KeyHandle,
|
---|
291 | PVALENTW ListOfValuesToQuery,
|
---|
292 | ULONG NumberOfItems,
|
---|
293 | PVOID MultipleValueInformation,
|
---|
294 | ULONG Length,
|
---|
295 | PULONG ReturnLength)
|
---|
296 | {
|
---|
297 | dprintf(("NTDLL: NtQueryMultipleValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
298 | KeyHandle,
|
---|
299 | ListOfValuesToQuery,
|
---|
300 | NumberOfItems,
|
---|
301 | MultipleValueInformation,
|
---|
302 | Length,
|
---|
303 | ReturnLength));
|
---|
304 |
|
---|
305 | return 0;
|
---|
306 | }
|
---|
307 |
|
---|
308 |
|
---|
309 | /******************************************************************************
|
---|
310 | * NtQueryValueKey [NTDLL]
|
---|
311 | * ZwQueryValueKey
|
---|
312 | */
|
---|
313 | NTSTATUS WINAPI NtQueryValueKey(HANDLE KeyHandle,
|
---|
314 | PUNICODE_STRING ValueName,
|
---|
315 | KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
---|
316 | PVOID KeyValueInformation,
|
---|
317 | ULONG Length,
|
---|
318 | PULONG ResultLength)
|
---|
319 | {
|
---|
320 | dprintf(("NTDLL: NtQueryValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
321 | KeyHandle,
|
---|
322 | ValueName,
|
---|
323 | KeyValueInformationClass,
|
---|
324 | KeyValueInformation,
|
---|
325 | Length,
|
---|
326 | ResultLength));
|
---|
327 |
|
---|
328 | return 0;
|
---|
329 | }
|
---|
330 |
|
---|
331 |
|
---|
332 | /******************************************************************************
|
---|
333 | * NtReplaceKey [NTDLL]
|
---|
334 | * ZwReplaceKey
|
---|
335 | */
|
---|
336 | NTSTATUS WINAPI NtReplaceKey(POBJECT_ATTRIBUTES ObjectAttributes,
|
---|
337 | HANDLE Key,
|
---|
338 | POBJECT_ATTRIBUTES ReplacedObjectAttributes)
|
---|
339 | {
|
---|
340 | dprintf(("NTDLL: NtReplaceKey(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
341 | ObjectAttributes,
|
---|
342 | Key,
|
---|
343 | ReplacedObjectAttributes));
|
---|
344 |
|
---|
345 | return 0;
|
---|
346 | }
|
---|
347 |
|
---|
348 |
|
---|
349 | /******************************************************************************
|
---|
350 | * NtRestoreKey [NTDLL]
|
---|
351 | * ZwRestoreKey
|
---|
352 | */
|
---|
353 | NTSTATUS WINAPI NtRestoreKey(HANDLE KeyHandle,
|
---|
354 | HANDLE FileHandle,
|
---|
355 | ULONG RestoreFlags)
|
---|
356 | {
|
---|
357 | dprintf(("NTDLL: NtRestoreKey(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
358 | KeyHandle,
|
---|
359 | FileHandle,
|
---|
360 | RestoreFlags));
|
---|
361 |
|
---|
362 | return 0;
|
---|
363 | }
|
---|
364 |
|
---|
365 |
|
---|
366 | /******************************************************************************
|
---|
367 | * NtSaveKey [NTDLL]
|
---|
368 | * ZwSaveKey
|
---|
369 | */
|
---|
370 | NTSTATUS WINAPI NtSaveKey(HANDLE KeyHandle,
|
---|
371 | HANDLE FileHandle)
|
---|
372 | {
|
---|
373 | dprintf(("NTDLL NtSaveKey(%08xh,%08xh) not implemented.\n",
|
---|
374 | KeyHandle,
|
---|
375 | FileHandle));
|
---|
376 |
|
---|
377 | return 0;
|
---|
378 | }
|
---|
379 |
|
---|
380 |
|
---|
381 | /******************************************************************************
|
---|
382 | * NtSetInformationKey [NTDLL]
|
---|
383 | * ZwSetInformationKey
|
---|
384 | */
|
---|
385 | NTSTATUS WINAPI NtSetInformationKey(HANDLE KeyHandle,
|
---|
386 | const int KeyInformationClass,
|
---|
387 | PVOID KeyInformation,
|
---|
388 | ULONG KeyInformationLength)
|
---|
389 | {
|
---|
390 | dprintf(("NTDLL: NtSetInformationKey(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
391 | KeyHandle,
|
---|
392 | KeyInformationClass,
|
---|
393 | KeyInformation,
|
---|
394 | KeyInformationLength));
|
---|
395 |
|
---|
396 | return 0;
|
---|
397 | }
|
---|
398 |
|
---|
399 |
|
---|
400 | /******************************************************************************
|
---|
401 | * NtSetValueKey [NTDLL]
|
---|
402 | * ZwSetValueKey
|
---|
403 | */
|
---|
404 | NTSTATUS WINAPI NtSetValueKey(HANDLE KeyHandle,
|
---|
405 | PUNICODE_STRING ValueName,
|
---|
406 | ULONG TitleIndex,
|
---|
407 | ULONG Type,
|
---|
408 | PVOID Data,
|
---|
409 | ULONG DataSize)
|
---|
410 | {
|
---|
411 | dprintf(("NTDLL: NtSetValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
412 | KeyHandle,
|
---|
413 | ValueName,
|
---|
414 | TitleIndex,
|
---|
415 | Type,
|
---|
416 | Data,
|
---|
417 | DataSize));
|
---|
418 |
|
---|
419 | return (0);
|
---|
420 | }
|
---|
421 |
|
---|
422 |
|
---|
423 | /******************************************************************************
|
---|
424 | * NtUnloadKey [NTDLL]
|
---|
425 | * ZwUnloadKey
|
---|
426 | */
|
---|
427 | NTSTATUS WINAPI NtUnloadKey(HANDLE KeyHandle)
|
---|
428 | {
|
---|
429 | dprintf(("NTDLL: NtUnloadKey(%08xh) not implemented.\n",
|
---|
430 | KeyHandle));
|
---|
431 |
|
---|
432 | return 0;
|
---|
433 | }
|
---|