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