xref: /reactos/sdk/include/ndk/cmfuncs.h (revision c2c66aff)
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu.  All rights reserved.
4 
5 Header Name:
6 
7     cmfuncs.h
8 
9 Abstract:
10 
11     Function definitions for the Configuration Manager.
12 
13 Author:
14 
15     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 
19 #ifndef _CMFUNCS_H
20 #define _CMFUNCS_H
21 
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <cmtypes.h>
27 
28 //
29 // Native calls
30 //
31 NTSTATUS
32 NTAPI
33 NtCompactKeys(
34     _In_ ULONG Count,
35     _In_reads_(Count) PHANDLE KeyArray
36 );
37 
38 NTSTATUS
39 NTAPI
40 NtCompressKey(
41     _In_ HANDLE Key
42 );
43 
44 _IRQL_requires_max_(PASSIVE_LEVEL)
45 NTSYSAPI
46 NTSTATUS
47 NTAPI
48 NtCreateKey(
49     _Out_ PHANDLE KeyHandle,
50     _In_ ACCESS_MASK DesiredAccess,
51     _In_ POBJECT_ATTRIBUTES ObjectAttributes,
52     _Reserved_ ULONG TitleIndex,
53     _In_opt_ PUNICODE_STRING Class,
54     _In_ ULONG CreateOptions,
55     _Out_opt_ PULONG Disposition
56 );
57 
58 NTSYSCALLAPI
59 NTSTATUS
60 NTAPI
61 NtDeleteKey(
62     _In_ HANDLE KeyHandle
63 );
64 
65 NTSYSCALLAPI
66 NTSTATUS
67 NTAPI
68 NtDeleteValueKey(
69     _In_ HANDLE KeyHandle,
70     _In_ PUNICODE_STRING ValueName
71 );
72 
73 NTSYSCALLAPI
74 NTSTATUS
75 NTAPI
76 NtEnumerateKey(
77     _In_ HANDLE KeyHandle,
78     _In_ ULONG Index,
79     _In_ KEY_INFORMATION_CLASS KeyInformationClass,
80     _Out_bytecap_(Length) PVOID KeyInformation,
81     _In_ ULONG Length,
82     _Out_ PULONG ResultLength
83 );
84 
85 _IRQL_requires_max_(PASSIVE_LEVEL)
86 _When_(Length == 0, _Post_satisfies_(return < 0))
87 _When_(Length > 0, _Post_satisfies_(return <= 0))
88 NTSYSAPI
89 NTSTATUS
90 NTAPI
91 NtEnumerateValueKey(
92     _In_ HANDLE KeyHandle,
93     _In_ ULONG Index,
94     _In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
95     _Out_writes_bytes_opt_(Length) PVOID KeyValueInformation,
96     _In_ ULONG Length,
97     _Out_ PULONG ResultLength
98 );
99 
100 NTSYSCALLAPI
101 NTSTATUS
102 NTAPI
103 NtFlushKey(
104     _In_ HANDLE KeyHandle
105 );
106 
107 NTSYSCALLAPI
108 NTSTATUS
109 NTAPI
110 NtGetPlugPlayEvent(
111     _In_ ULONG Reserved1,
112     _In_ ULONG Reserved2,
113     _Out_ PPLUGPLAY_EVENT_BLOCK Buffer,
114     _In_ ULONG BufferSize
115 );
116 
117 NTSYSCALLAPI
118 NTSTATUS
119 NTAPI
120 NtInitializeRegistry(
121     _In_ USHORT Flag
122 );
123 
124 NTSYSCALLAPI
125 NTSTATUS
126 NTAPI
127 NtLoadKey(
128     _In_ POBJECT_ATTRIBUTES KeyObjectAttributes,
129     _In_ POBJECT_ATTRIBUTES FileObjectAttributes
130 );
131 
132 NTSYSCALLAPI
133 NTSTATUS
134 NTAPI
135 NtLoadKey2(
136     _In_ POBJECT_ATTRIBUTES KeyObjectAttributes,
137     _In_ POBJECT_ATTRIBUTES FileObjectAttributes,
138     _In_ ULONG Flags
139 );
140 
141 NTSTATUS
142 NTAPI
143 NtLoadKeyEx(
144     _In_ POBJECT_ATTRIBUTES TargetKey,
145     _In_ POBJECT_ATTRIBUTES SourceFile,
146     _In_ ULONG Flags,
147     _In_ HANDLE TrustClassKey
148 );
149 
150 NTSTATUS
151 NTAPI
152 NtLockProductActivationKeys(
153     _In_ PULONG pPrivateVer,
154     _In_ PULONG pSafeMode
155 );
156 
157 NTSTATUS
158 NTAPI
159 NtLockRegistryKey(
160     _In_ HANDLE KeyHandle
161 );
162 
163 NTSYSCALLAPI
164 NTSTATUS
165 NTAPI
166 NtNotifyChangeKey(
167     _In_ HANDLE KeyHandle,
168     _In_ HANDLE Event,
169     _In_opt_ PIO_APC_ROUTINE ApcRoutine,
170     _In_opt_ PVOID ApcContext,
171     _Out_ PIO_STATUS_BLOCK IoStatusBlock,
172     _In_ ULONG CompletionFilter,
173     _In_ BOOLEAN Asynchroneous,
174     _Out_bytecap_(Length) PVOID ChangeBuffer,
175     _In_ ULONG Length,
176     _In_ BOOLEAN WatchSubtree
177 );
178 
179 __kernel_entry
180 NTSYSCALLAPI
181 NTSTATUS
182 NTAPI
183 NtNotifyChangeMultipleKeys(
184     _In_ HANDLE MasterKeyHandle,
185     _In_opt_ ULONG Count,
186     _In_reads_opt_(Count) OBJECT_ATTRIBUTES SubordinateObjects[],
187     _In_opt_ HANDLE Event,
188     _In_opt_ PIO_APC_ROUTINE ApcRoutine,
189     _In_opt_ PVOID ApcContext,
190     _Out_ PIO_STATUS_BLOCK IoStatusBlock,
191     _In_ ULONG CompletionFilter,
192     _In_ BOOLEAN WatchTree,
193     _Out_writes_bytes_opt_(BufferSize) PVOID Buffer,
194     _In_ ULONG BufferSize,
195     _In_ BOOLEAN Asynchronous
196 );
197 
198 NTSYSCALLAPI
199 NTSTATUS
200 NTAPI
201 NtOpenKey(
202     _Out_ PHANDLE KeyHandle,
203     _In_ ACCESS_MASK DesiredAccess,
204     _In_ POBJECT_ATTRIBUTES ObjectAttributes
205 );
206 
207 NTSYSCALLAPI
208 NTSTATUS
209 NTAPI
210 NtPlugPlayControl(
211     _In_ PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
212     _Inout_ PVOID Buffer,
213     _In_ ULONG BufferSize
214 );
215 
216 NTSYSCALLAPI
217 NTSTATUS
218 NTAPI
219 NtQueryKey(
220     _In_ HANDLE KeyHandle,
221     _In_ KEY_INFORMATION_CLASS KeyInformationClass,
222     _Out_bytecap_(Length) PVOID KeyInformation,
223     _In_ ULONG Length,
224     _Out_ PULONG ResultLength
225 );
226 
227 __kernel_entry
228 NTSYSCALLAPI
229 NTSTATUS
230 NTAPI
231 NtQueryMultipleValueKey(
232     _In_ HANDLE KeyHandle,
233     _Inout_updates_(EntryCount) PKEY_VALUE_ENTRY ValueEntries,
234     _In_ ULONG EntryCount,
235     _Out_writes_bytes_(*BufferLength) PVOID ValueBuffer,
236     _Inout_ PULONG BufferLength,
237     _Out_opt_ PULONG RequiredBufferLength
238 );
239 
240 NTSTATUS
241 NTAPI
242 NtQueryOpenSubKeys(
243     _In_ POBJECT_ATTRIBUTES TargetKey,
244     _Out_ PULONG HandleCount
245 );
246 
247 NTSTATUS
248 NTAPI
249 NtQueryOpenSubKeysEx(
250     _In_ POBJECT_ATTRIBUTES TargetKey,
251     _In_ ULONG BufferLength,
252     _In_ PVOID Buffer,
253     _In_ PULONG RequiredSize
254 );
255 
256 _IRQL_requires_max_(PASSIVE_LEVEL)
257 _When_(Length == 0, _Post_satisfies_(return < 0))
258 _When_(Length > 0, _Post_satisfies_(return <= 0))
259 NTSYSAPI
260 NTSTATUS
261 NTAPI
262 NtQueryValueKey(
263     _In_ HANDLE KeyHandle,
264     _In_ PUNICODE_STRING ValueName,
265     _In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
266     _Out_writes_bytes_opt_(Length) PVOID KeyValueInformation,
267     _In_ ULONG Length,
268     _Out_ PULONG ResultLength
269 );
270 
271 NTSYSCALLAPI
272 NTSTATUS
273 NTAPI
274 NtRenameKey(
275     _In_ HANDLE KeyHandle,
276     _In_ PUNICODE_STRING NewName
277 );
278 
279 NTSYSCALLAPI
280 NTSTATUS
281 NTAPI
282 NtReplaceKey(
283     _In_ POBJECT_ATTRIBUTES ObjectAttributes,
284     _In_ HANDLE Key,
285     _In_ POBJECT_ATTRIBUTES ReplacedObjectAttributes
286 );
287 
288 NTSYSCALLAPI
289 NTSTATUS
290 NTAPI
291 NtRestoreKey(
292     _In_ HANDLE KeyHandle,
293     _In_ HANDLE FileHandle,
294     _In_ ULONG RestoreFlags
295 );
296 
297 NTSYSCALLAPI
298 NTSTATUS
299 NTAPI
300 NtSaveKey(
301     _In_ HANDLE KeyHandle,
302     _In_ HANDLE FileHandle
303 );
304 
305 NTSYSCALLAPI
306 NTSTATUS
307 NTAPI
308 NtSaveKeyEx(
309     _In_ HANDLE KeyHandle,
310     _In_ HANDLE FileHandle,
311     _In_ ULONG Flags
312 );
313 
314 
315 NTSTATUS
316 NTAPI
317 NtSaveMergedKeys(
318     _In_ HANDLE HighPrecedenceKeyHandle,
319     _In_ HANDLE LowPrecedenceKeyHandle,
320     _In_ HANDLE FileHandle
321 );
322 
323 __kernel_entry
324 NTSYSCALLAPI
325 NTSTATUS
326 NTAPI
327 NtSetInformationKey(
328     _In_ HANDLE KeyHandle,
329     _In_ _Strict_type_match_
330         KEY_SET_INFORMATION_CLASS KeySetInformationClass,
331     _In_reads_bytes_(KeySetInformationLength) PVOID KeySetInformation,
332     _In_ ULONG KeySetInformationLength
333 );
334 
335 NTSYSCALLAPI
336 NTSTATUS
337 NTAPI
338 NtSetValueKey(
339     _In_ HANDLE KeyHandle,
340     _In_ PUNICODE_STRING ValueName,
341     _In_opt_ ULONG TitleIndex,
342     _In_ ULONG Type,
343     _In_ PVOID Data,
344     _In_ ULONG DataSize
345 );
346 
347 NTSYSCALLAPI
348 NTSTATUS
349 NTAPI
350 NtUnloadKey(
351     _In_ POBJECT_ATTRIBUTES KeyObjectAttributes
352 );
353 
354 NTSTATUS
355 NTAPI
356 NtUnloadKey2(
357     _In_ POBJECT_ATTRIBUTES TargetKey,
358     _In_ ULONG Flags
359 );
360 
361 NTSTATUS
362 NTAPI
363 NtUnloadKeyEx(
364     _In_ POBJECT_ATTRIBUTES TargetKey,
365     _In_ HANDLE Event
366 );
367 
368 #ifdef NTOS_MODE_USER
369 _IRQL_requires_max_(PASSIVE_LEVEL)
370 NTSYSAPI
371 NTSTATUS
372 NTAPI
373 ZwCreateKey(
374     _Out_ PHANDLE KeyHandle,
375     _In_ ACCESS_MASK DesiredAccess,
376     _In_ POBJECT_ATTRIBUTES ObjectAttributes,
377     _Reserved_ ULONG TitleIndex,
378     _In_opt_ PUNICODE_STRING Class,
379     _In_ ULONG CreateOptions,
380     _Out_opt_ PULONG Disposition
381 );
382 
383 NTSYSAPI
384 NTSTATUS
385 NTAPI
386 ZwDeleteKey(
387     _In_ HANDLE KeyHandle
388 );
389 
390 NTSYSAPI
391 NTSTATUS
392 NTAPI
393 ZwDeleteValueKey(
394     _In_ HANDLE KeyHandle,
395     _In_ PUNICODE_STRING ValueName
396 );
397 
398 NTSYSAPI
399 NTSTATUS
400 NTAPI
401 ZwEnumerateKey(
402     _In_ HANDLE KeyHandle,
403     _In_ ULONG Index,
404     _In_ KEY_INFORMATION_CLASS KeyInformationClass,
405     _Out_bytecap_(Length) PVOID KeyInformation,
406     _In_ ULONG Length,
407     _Out_ PULONG ResultLength
408 );
409 
410 _IRQL_requires_max_(PASSIVE_LEVEL)
411 _When_(Length == 0, _Post_satisfies_(return < 0))
412 _When_(Length > 0, _Post_satisfies_(return <= 0))
413 NTSYSAPI
414 NTSTATUS
415 NTAPI
416 ZwEnumerateValueKey(
417     _In_ HANDLE KeyHandle,
418     _In_ ULONG Index,
419     _In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
420     _Out_writes_bytes_opt_(Length) PVOID KeyValueInformation,
421     _In_ ULONG Length,
422     _Out_ PULONG ResultLength
423 );
424 
425 NTSYSAPI
426 NTSTATUS
427 NTAPI
428 ZwFlushKey(
429     _In_ HANDLE KeyHandle
430 );
431 
432 NTSYSAPI
433 NTSTATUS
434 NTAPI
435 ZwGetPlugPlayEvent(
436     _In_ ULONG Reserved1,
437     _In_ ULONG Reserved2,
438     _Out_bytecap_(BufferSize) PPLUGPLAY_EVENT_BLOCK Buffer,
439     _In_ ULONG BufferSize
440 );
441 
442 NTSYSAPI
443 NTSTATUS
444 NTAPI
445 ZwLoadKey(
446     _In_ POBJECT_ATTRIBUTES KeyObjectAttributes,
447     _In_ POBJECT_ATTRIBUTES FileObjectAttributes
448 );
449 
450 NTSYSAPI
451 NTSTATUS
452 NTAPI
453 ZwLoadKey2(
454     _In_ POBJECT_ATTRIBUTES KeyObjectAttributes,
455     _In_ POBJECT_ATTRIBUTES FileObjectAttributes,
456     _In_ ULONG Flags
457 );
458 
459 NTSYSAPI
460 NTSTATUS
461 NTAPI
462 ZwNotifyChangeKey(
463     _In_ HANDLE KeyHandle,
464     _In_ HANDLE Event,
465     _In_opt_ PIO_APC_ROUTINE ApcRoutine,
466     _In_opt_ PVOID ApcContext,
467     _Out_ PIO_STATUS_BLOCK IoStatusBlock,
468     _In_ ULONG CompletionFilter,
469     _In_ BOOLEAN Asynchroneous,
470     _Out_bytecap_(Length) PVOID ChangeBuffer,
471     _In_ ULONG Length,
472     _In_ BOOLEAN WatchSubtree
473 );
474 
475 NTSYSAPI
476 NTSTATUS
477 NTAPI
478 ZwOpenKey(
479     _Out_ PHANDLE KeyHandle,
480     _In_ ACCESS_MASK DesiredAccess,
481     _In_ POBJECT_ATTRIBUTES ObjectAttributes
482 );
483 
484 NTSYSAPI
485 NTSTATUS
486 NTAPI
487 ZwPlugPlayControl(
488     _In_ PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
489     _Inout_bytecap_(BufferSize) PVOID Buffer,
490     _In_ ULONG BufferSize
491 );
492 
493 NTSYSAPI
494 NTSTATUS
495 NTAPI
496 ZwQueryKey(
497     _In_ HANDLE KeyHandle,
498     _In_ KEY_INFORMATION_CLASS KeyInformationClass,
499     _Out_bytecap_(Length) PVOID KeyInformation,
500     _In_ ULONG Length,
501     _Out_ PULONG ResultLength
502 );
503 
504 NTSYSAPI
505 NTSTATUS
506 NTAPI
507 ZwQueryMultipleValueKey(
508     _In_ HANDLE KeyHandle,
509     _Inout_ PKEY_VALUE_ENTRY ValueList,
510     _In_ ULONG NumberOfValues,
511     _Out_bytecap_(*Length) PVOID Buffer,
512     _Inout_ PULONG Length,
513     _Out_ PULONG ReturnLength
514 );
515 
516 _IRQL_requires_max_(PASSIVE_LEVEL)
517 _When_(Length == 0, _Post_satisfies_(return < 0))
518 _When_(Length > 0, _Post_satisfies_(return <= 0))
519 NTSYSAPI
520 NTSTATUS
521 NTAPI
522 ZwQueryValueKey(
523     _In_ HANDLE KeyHandle,
524     _In_ PUNICODE_STRING ValueName,
525     _In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
526     _Out_writes_bytes_opt_(Length) PVOID KeyValueInformation,
527     _In_ ULONG Length,
528     _Out_ PULONG ResultLength
529 );
530 
531 NTSYSAPI
532 NTSTATUS
533 NTAPI
534 ZwReplaceKey(
535     _In_ POBJECT_ATTRIBUTES ObjectAttributes,
536     _In_ HANDLE Key,
537     _In_ POBJECT_ATTRIBUTES ReplacedObjectAttributes
538 );
539 
540 NTSYSAPI
541 NTSTATUS
542 NTAPI
543 ZwRestoreKey(
544     _In_ HANDLE KeyHandle,
545     _In_ HANDLE FileHandle,
546     _In_ ULONG RestoreFlags
547 );
548 
549 NTSYSAPI
550 NTSTATUS
551 NTAPI
552 ZwSaveKey(
553     _In_ HANDLE KeyHandle,
554     _In_ HANDLE FileHandle
555 );
556 
557 NTSYSAPI
558 NTSTATUS
559 NTAPI
560 ZwSaveKeyEx(
561     _In_ HANDLE KeyHandle,
562     _In_ HANDLE FileHandle,
563     _In_ ULONG Flags
564 );
565 
566 NTSYSAPI
567 NTSTATUS
568 NTAPI
569 ZwSetInformationKey(
570     _In_ HANDLE KeyHandle,
571     _In_ KEY_SET_INFORMATION_CLASS KeyInformationClass,
572     _In_bytecount_(KeyInformationLength) PVOID KeyInformation,
573     _In_ ULONG KeyInformationLength
574 );
575 
576 NTSYSAPI
577 NTSTATUS
578 NTAPI
579 ZwSetValueKey(
580     _In_ HANDLE KeyHandle,
581     _In_ PUNICODE_STRING ValueName,
582     _In_opt_ ULONG TitleIndex,
583     _In_ ULONG Type,
584     _In_bytecount_(DataSize) PVOID Data,
585     _In_ ULONG DataSize
586 );
587 #endif
588 
589 NTSYSAPI
590 NTSTATUS
591 NTAPI
592 ZwInitializeRegistry(
593     _In_ USHORT Flag
594 );
595 
596 NTSYSAPI
597 NTSTATUS
598 NTAPI
599 ZwUnloadKey(
600     _In_ POBJECT_ATTRIBUTES KeyObjectAttributes
601 );
602 
603 #endif
604