xref: /reactos/sdk/include/wdf/kmdf/1.17/wdfregistry.h (revision 6d8aafb6)
1 /*++
2 
3 Copyright (c) Microsoft Corporation.  All rights reserved.
4 
5 _WdfVersionBuild_
6 
7 Module Name:
8 
9     WdfRegistry.h
10 
11 Abstract:
12 
13     This is the interface to registry access.
14 
15 Environment:
16 
17     kernel mode only
18 
19 Revision History:
20 
21 --*/
22 
23 //
24 // NOTE: This header is generated by stubwork.  Please make any
25 //       modifications to the corresponding template files
26 //       (.x or .y) and use stubwork to regenerate the header
27 //
28 
29 #ifndef _WDFREGISTRY_H_
30 #define _WDFREGISTRY_H_
31 
32 #ifndef WDF_EXTERN_C
33   #ifdef __cplusplus
34     #define WDF_EXTERN_C       extern "C"
35     #define WDF_EXTERN_C_START extern "C" {
36     #define WDF_EXTERN_C_END   }
37   #else
38     #define WDF_EXTERN_C
39     #define WDF_EXTERN_C_START
40     #define WDF_EXTERN_C_END
41   #endif
42 #endif
43 
44 WDF_EXTERN_C_START
45 
46 
47 
48 #if (NTDDI_VERSION >= NTDDI_WIN2K)
49 
50 #define WDF_REGKEY_DEVICE_SUBKEY 0
51 #define WDF_REGKEY_DRIVER_SUBKEY 0
52 
53 
54 
55 
56 
57 //
58 // WDF Function: WdfRegistryOpenKey
59 //
60 typedef
61 _Must_inspect_result_
62 _IRQL_requires_max_(PASSIVE_LEVEL)
63 WDFAPI
64 NTSTATUS
65 (STDCALL *PFN_WDFREGISTRYOPENKEY)(
66     _In_
67     PWDF_DRIVER_GLOBALS DriverGlobals,
68     _In_opt_
69     WDFKEY ParentKey,
70     _In_
71     PCUNICODE_STRING KeyName,
72     _In_
73     ACCESS_MASK DesiredAccess,
74     _In_opt_
75     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
76     _Out_
77     WDFKEY* Key
78     );
79 
80 _Must_inspect_result_
81 _IRQL_requires_max_(PASSIVE_LEVEL)
82 FORCEINLINE
83 NTSTATUS
84 WdfRegistryOpenKey(
85     _In_opt_
86     WDFKEY ParentKey,
87     _In_
88     PCUNICODE_STRING KeyName,
89     _In_
90     ACCESS_MASK DesiredAccess,
91     _In_opt_
92     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
93     _Out_
94     WDFKEY* Key
95     )
96 {
97     return ((PFN_WDFREGISTRYOPENKEY) WdfFunctions[WdfRegistryOpenKeyTableIndex])(WdfDriverGlobals, ParentKey, KeyName, DesiredAccess, KeyAttributes, Key);
98 }
99 
100 //
101 // WDF Function: WdfRegistryCreateKey
102 //
103 typedef
104 _Must_inspect_result_
105 _IRQL_requires_max_(PASSIVE_LEVEL)
106 WDFAPI
107 NTSTATUS
108 (STDCALL *PFN_WDFREGISTRYCREATEKEY)(
109     _In_
110     PWDF_DRIVER_GLOBALS DriverGlobals,
111     _In_opt_
112     WDFKEY ParentKey,
113     _In_
114     PCUNICODE_STRING KeyName,
115     _In_
116     ACCESS_MASK DesiredAccess,
117     _In_
118     ULONG CreateOptions,
119     _Out_opt_
120     PULONG CreateDisposition,
121     _In_opt_
122     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
123     _Out_
124     WDFKEY* Key
125     );
126 
127 _Must_inspect_result_
128 _IRQL_requires_max_(PASSIVE_LEVEL)
129 FORCEINLINE
130 NTSTATUS
131 WdfRegistryCreateKey(
132     _In_opt_
133     WDFKEY ParentKey,
134     _In_
135     PCUNICODE_STRING KeyName,
136     _In_
137     ACCESS_MASK DesiredAccess,
138     _In_
139     ULONG CreateOptions,
140     _Out_opt_
141     PULONG CreateDisposition,
142     _In_opt_
143     PWDF_OBJECT_ATTRIBUTES KeyAttributes,
144     _Out_
145     WDFKEY* Key
146     )
147 {
148     return ((PFN_WDFREGISTRYCREATEKEY) WdfFunctions[WdfRegistryCreateKeyTableIndex])(WdfDriverGlobals, ParentKey, KeyName, DesiredAccess, CreateOptions, CreateDisposition, KeyAttributes, Key);
149 }
150 
151 //
152 // WDF Function: WdfRegistryClose
153 //
154 typedef
155 _IRQL_requires_max_(PASSIVE_LEVEL)
156 WDFAPI
157 VOID
158 (STDCALL *PFN_WDFREGISTRYCLOSE)(
159     _In_
160     PWDF_DRIVER_GLOBALS DriverGlobals,
161     _In_
162     WDFKEY Key
163     );
164 
165 _IRQL_requires_max_(PASSIVE_LEVEL)
166 FORCEINLINE
167 VOID
168 WdfRegistryClose(
169     _In_
170     WDFKEY Key
171     )
172 {
173     ((PFN_WDFREGISTRYCLOSE) WdfFunctions[WdfRegistryCloseTableIndex])(WdfDriverGlobals, Key);
174 }
175 
176 //
177 // WDF Function: WdfRegistryWdmGetHandle
178 //
179 typedef
180 _IRQL_requires_max_(PASSIVE_LEVEL)
181 WDFAPI
182 HANDLE
183 (STDCALL *PFN_WDFREGISTRYWDMGETHANDLE)(
184     _In_
185     PWDF_DRIVER_GLOBALS DriverGlobals,
186     _In_
187     WDFKEY Key
188     );
189 
190 _IRQL_requires_max_(PASSIVE_LEVEL)
191 FORCEINLINE
192 HANDLE
193 WdfRegistryWdmGetHandle(
194     _In_
195     WDFKEY Key
196     )
197 {
198     return ((PFN_WDFREGISTRYWDMGETHANDLE) WdfFunctions[WdfRegistryWdmGetHandleTableIndex])(WdfDriverGlobals, Key);
199 }
200 
201 //
202 // WDF Function: WdfRegistryRemoveKey
203 //
204 typedef
205 _Must_inspect_result_
206 _IRQL_requires_max_(PASSIVE_LEVEL)
207 WDFAPI
208 NTSTATUS
209 (STDCALL *PFN_WDFREGISTRYREMOVEKEY)(
210     _In_
211     PWDF_DRIVER_GLOBALS DriverGlobals,
212     _In_
213     WDFKEY Key
214     );
215 
216 _Must_inspect_result_
217 _IRQL_requires_max_(PASSIVE_LEVEL)
218 FORCEINLINE
219 NTSTATUS
220 WdfRegistryRemoveKey(
221     _In_
222     WDFKEY Key
223     )
224 {
225     return ((PFN_WDFREGISTRYREMOVEKEY) WdfFunctions[WdfRegistryRemoveKeyTableIndex])(WdfDriverGlobals, Key);
226 }
227 
228 //
229 // WDF Function: WdfRegistryRemoveValue
230 //
231 typedef
232 _Must_inspect_result_
233 _IRQL_requires_max_(PASSIVE_LEVEL)
234 WDFAPI
235 NTSTATUS
236 (STDCALL *PFN_WDFREGISTRYREMOVEVALUE)(
237     _In_
238     PWDF_DRIVER_GLOBALS DriverGlobals,
239     _In_
240     WDFKEY Key,
241     _In_
242     PCUNICODE_STRING ValueName
243     );
244 
245 _Must_inspect_result_
246 _IRQL_requires_max_(PASSIVE_LEVEL)
247 FORCEINLINE
248 NTSTATUS
249 WdfRegistryRemoveValue(
250     _In_
251     WDFKEY Key,
252     _In_
253     PCUNICODE_STRING ValueName
254     )
255 {
256     return ((PFN_WDFREGISTRYREMOVEVALUE) WdfFunctions[WdfRegistryRemoveValueTableIndex])(WdfDriverGlobals, Key, ValueName);
257 }
258 
259 //
260 // WDF Function: WdfRegistryQueryValue
261 //
262 typedef
263 _Must_inspect_result_
264 _IRQL_requires_max_(PASSIVE_LEVEL)
265 WDFAPI
266 NTSTATUS
267 (STDCALL *PFN_WDFREGISTRYQUERYVALUE)(
268     _In_
269     PWDF_DRIVER_GLOBALS DriverGlobals,
270     _In_
271     WDFKEY Key,
272     _In_
273     PCUNICODE_STRING ValueName,
274     _In_
275     ULONG ValueLength,
276     _Out_writes_bytes_opt_( ValueLength)
277     PVOID Value,
278     _Out_opt_
279     PULONG ValueLengthQueried,
280     _Out_opt_
281     PULONG ValueType
282     );
283 
284 _Must_inspect_result_
285 _IRQL_requires_max_(PASSIVE_LEVEL)
286 FORCEINLINE
287 NTSTATUS
288 WdfRegistryQueryValue(
289     _In_
290     WDFKEY Key,
291     _In_
292     PCUNICODE_STRING ValueName,
293     _In_
294     ULONG ValueLength,
295     _Out_writes_bytes_opt_( ValueLength)
296     PVOID Value,
297     _Out_opt_
298     PULONG ValueLengthQueried,
299     _Out_opt_
300     PULONG ValueType
301     )
302 {
303     return ((PFN_WDFREGISTRYQUERYVALUE) WdfFunctions[WdfRegistryQueryValueTableIndex])(WdfDriverGlobals, Key, ValueName, ValueLength, Value, ValueLengthQueried, ValueType);
304 }
305 
306 //
307 // WDF Function: WdfRegistryQueryMemory
308 //
309 typedef
310 _Must_inspect_result_
311 _IRQL_requires_max_(PASSIVE_LEVEL)
312 WDFAPI
313 NTSTATUS
314 (STDCALL *PFN_WDFREGISTRYQUERYMEMORY)(
315     _In_
316     PWDF_DRIVER_GLOBALS DriverGlobals,
317     _In_
318     WDFKEY Key,
319     _In_
320     PCUNICODE_STRING ValueName,
321     _In_
322     _Strict_type_match_
323     POOL_TYPE PoolType,
324     _In_opt_
325     PWDF_OBJECT_ATTRIBUTES MemoryAttributes,
326     _Out_
327     WDFMEMORY* Memory,
328     _Out_opt_
329     PULONG ValueType
330     );
331 
332 _Must_inspect_result_
333 _IRQL_requires_max_(PASSIVE_LEVEL)
334 FORCEINLINE
335 NTSTATUS
336 WdfRegistryQueryMemory(
337     _In_
338     WDFKEY Key,
339     _In_
340     PCUNICODE_STRING ValueName,
341     _In_
342     _Strict_type_match_
343     POOL_TYPE PoolType,
344     _In_opt_
345     PWDF_OBJECT_ATTRIBUTES MemoryAttributes,
346     _Out_
347     WDFMEMORY* Memory,
348     _Out_opt_
349     PULONG ValueType
350     )
351 {
352     return ((PFN_WDFREGISTRYQUERYMEMORY) WdfFunctions[WdfRegistryQueryMemoryTableIndex])(WdfDriverGlobals, Key, ValueName, PoolType, MemoryAttributes, Memory, ValueType);
353 }
354 
355 //
356 // WDF Function: WdfRegistryQueryMultiString
357 //
358 typedef
359 _Must_inspect_result_
360 _IRQL_requires_max_(PASSIVE_LEVEL)
361 WDFAPI
362 NTSTATUS
363 (STDCALL *PFN_WDFREGISTRYQUERYMULTISTRING)(
364     _In_
365     PWDF_DRIVER_GLOBALS DriverGlobals,
366     _In_
367     WDFKEY Key,
368     _In_
369     PCUNICODE_STRING ValueName,
370     _In_opt_
371     PWDF_OBJECT_ATTRIBUTES StringsAttributes,
372     _In_
373     WDFCOLLECTION Collection
374     );
375 
376 _Must_inspect_result_
377 _IRQL_requires_max_(PASSIVE_LEVEL)
378 FORCEINLINE
379 NTSTATUS
380 WdfRegistryQueryMultiString(
381     _In_
382     WDFKEY Key,
383     _In_
384     PCUNICODE_STRING ValueName,
385     _In_opt_
386     PWDF_OBJECT_ATTRIBUTES StringsAttributes,
387     _In_
388     WDFCOLLECTION Collection
389     )
390 {
391     return ((PFN_WDFREGISTRYQUERYMULTISTRING) WdfFunctions[WdfRegistryQueryMultiStringTableIndex])(WdfDriverGlobals, Key, ValueName, StringsAttributes, Collection);
392 }
393 
394 //
395 // WDF Function: WdfRegistryQueryUnicodeString
396 //
397 typedef
398 _Must_inspect_result_
399 _IRQL_requires_max_(PASSIVE_LEVEL)
400 WDFAPI
401 NTSTATUS
402 (STDCALL *PFN_WDFREGISTRYQUERYUNICODESTRING)(
403     _In_
404     PWDF_DRIVER_GLOBALS DriverGlobals,
405     _In_
406     WDFKEY Key,
407     _In_
408     PCUNICODE_STRING ValueName,
409     _Out_opt_
410     PUSHORT ValueByteLength,
411     _Inout_opt_
412     PUNICODE_STRING Value
413     );
414 
415 _Must_inspect_result_
416 _IRQL_requires_max_(PASSIVE_LEVEL)
417 FORCEINLINE
418 NTSTATUS
419 WdfRegistryQueryUnicodeString(
420     _In_
421     WDFKEY Key,
422     _In_
423     PCUNICODE_STRING ValueName,
424     _Out_opt_
425     PUSHORT ValueByteLength,
426     _Inout_opt_
427     PUNICODE_STRING Value
428     )
429 {
430     return ((PFN_WDFREGISTRYQUERYUNICODESTRING) WdfFunctions[WdfRegistryQueryUnicodeStringTableIndex])(WdfDriverGlobals, Key, ValueName, ValueByteLength, Value);
431 }
432 
433 //
434 // WDF Function: WdfRegistryQueryString
435 //
436 typedef
437 _Must_inspect_result_
438 _IRQL_requires_max_(PASSIVE_LEVEL)
439 WDFAPI
440 NTSTATUS
441 (STDCALL *PFN_WDFREGISTRYQUERYSTRING)(
442     _In_
443     PWDF_DRIVER_GLOBALS DriverGlobals,
444     _In_
445     WDFKEY Key,
446     _In_
447     PCUNICODE_STRING ValueName,
448     _In_
449     WDFSTRING String
450     );
451 
452 _Must_inspect_result_
453 _IRQL_requires_max_(PASSIVE_LEVEL)
454 FORCEINLINE
455 NTSTATUS
456 WdfRegistryQueryString(
457     _In_
458     WDFKEY Key,
459     _In_
460     PCUNICODE_STRING ValueName,
461     _In_
462     WDFSTRING String
463     )
464 {
465     return ((PFN_WDFREGISTRYQUERYSTRING) WdfFunctions[WdfRegistryQueryStringTableIndex])(WdfDriverGlobals, Key, ValueName, String);
466 }
467 
468 //
469 // WDF Function: WdfRegistryQueryULong
470 //
471 typedef
472 _Must_inspect_result_
473 _IRQL_requires_max_(PASSIVE_LEVEL)
474 WDFAPI
475 NTSTATUS
476 (STDCALL *PFN_WDFREGISTRYQUERYULONG)(
477     _In_
478     PWDF_DRIVER_GLOBALS DriverGlobals,
479     _In_
480     WDFKEY Key,
481     _In_
482     PCUNICODE_STRING ValueName,
483     _Out_
484     PULONG Value
485     );
486 
487 _Must_inspect_result_
488 _IRQL_requires_max_(PASSIVE_LEVEL)
489 FORCEINLINE
490 NTSTATUS
491 WdfRegistryQueryULong(
492     _In_
493     WDFKEY Key,
494     _In_
495     PCUNICODE_STRING ValueName,
496     _Out_
497     PULONG Value
498     )
499 {
500     return ((PFN_WDFREGISTRYQUERYULONG) WdfFunctions[WdfRegistryQueryULongTableIndex])(WdfDriverGlobals, Key, ValueName, Value);
501 }
502 
503 //
504 // WDF Function: WdfRegistryAssignValue
505 //
506 typedef
507 _Must_inspect_result_
508 _IRQL_requires_max_(PASSIVE_LEVEL)
509 WDFAPI
510 NTSTATUS
511 (STDCALL *PFN_WDFREGISTRYASSIGNVALUE)(
512     _In_
513     PWDF_DRIVER_GLOBALS DriverGlobals,
514     _In_
515     WDFKEY Key,
516     _In_
517     PCUNICODE_STRING ValueName,
518     _In_
519     ULONG ValueType,
520     _In_
521     ULONG ValueLength,
522     _In_reads_( ValueLength)
523     PVOID Value
524     );
525 
526 _Must_inspect_result_
527 _IRQL_requires_max_(PASSIVE_LEVEL)
528 FORCEINLINE
529 NTSTATUS
530 WdfRegistryAssignValue(
531     _In_
532     WDFKEY Key,
533     _In_
534     PCUNICODE_STRING ValueName,
535     _In_
536     ULONG ValueType,
537     _In_
538     ULONG ValueLength,
539     _In_reads_( ValueLength)
540     PVOID Value
541     )
542 {
543     return ((PFN_WDFREGISTRYASSIGNVALUE) WdfFunctions[WdfRegistryAssignValueTableIndex])(WdfDriverGlobals, Key, ValueName, ValueType, ValueLength, Value);
544 }
545 
546 //
547 // WDF Function: WdfRegistryAssignMemory
548 //
549 typedef
550 _Must_inspect_result_
551 _IRQL_requires_max_(PASSIVE_LEVEL)
552 WDFAPI
553 NTSTATUS
554 (STDCALL *PFN_WDFREGISTRYASSIGNMEMORY)(
555     _In_
556     PWDF_DRIVER_GLOBALS DriverGlobals,
557     _In_
558     WDFKEY Key,
559     _In_
560     PCUNICODE_STRING ValueName,
561     _In_
562     ULONG ValueType,
563     _In_
564     WDFMEMORY Memory,
565     _In_opt_
566     PWDFMEMORY_OFFSET MemoryOffsets
567     );
568 
569 _Must_inspect_result_
570 _IRQL_requires_max_(PASSIVE_LEVEL)
571 FORCEINLINE
572 NTSTATUS
573 WdfRegistryAssignMemory(
574     _In_
575     WDFKEY Key,
576     _In_
577     PCUNICODE_STRING ValueName,
578     _In_
579     ULONG ValueType,
580     _In_
581     WDFMEMORY Memory,
582     _In_opt_
583     PWDFMEMORY_OFFSET MemoryOffsets
584     )
585 {
586     return ((PFN_WDFREGISTRYASSIGNMEMORY) WdfFunctions[WdfRegistryAssignMemoryTableIndex])(WdfDriverGlobals, Key, ValueName, ValueType, Memory, MemoryOffsets);
587 }
588 
589 //
590 // WDF Function: WdfRegistryAssignMultiString
591 //
592 typedef
593 _Must_inspect_result_
594 _IRQL_requires_max_(PASSIVE_LEVEL)
595 WDFAPI
596 NTSTATUS
597 (STDCALL *PFN_WDFREGISTRYASSIGNMULTISTRING)(
598     _In_
599     PWDF_DRIVER_GLOBALS DriverGlobals,
600     _In_
601     WDFKEY Key,
602     _In_
603     PCUNICODE_STRING ValueName,
604     _In_
605     WDFCOLLECTION StringsCollection
606     );
607 
608 _Must_inspect_result_
609 _IRQL_requires_max_(PASSIVE_LEVEL)
610 FORCEINLINE
611 NTSTATUS
612 WdfRegistryAssignMultiString(
613     _In_
614     WDFKEY Key,
615     _In_
616     PCUNICODE_STRING ValueName,
617     _In_
618     WDFCOLLECTION StringsCollection
619     )
620 {
621     return ((PFN_WDFREGISTRYASSIGNMULTISTRING) WdfFunctions[WdfRegistryAssignMultiStringTableIndex])(WdfDriverGlobals, Key, ValueName, StringsCollection);
622 }
623 
624 //
625 // WDF Function: WdfRegistryAssignUnicodeString
626 //
627 typedef
628 _Must_inspect_result_
629 _IRQL_requires_max_(PASSIVE_LEVEL)
630 WDFAPI
631 NTSTATUS
632 (STDCALL *PFN_WDFREGISTRYASSIGNUNICODESTRING)(
633     _In_
634     PWDF_DRIVER_GLOBALS DriverGlobals,
635     _In_
636     WDFKEY Key,
637     _In_
638     PCUNICODE_STRING ValueName,
639     _In_
640     PCUNICODE_STRING Value
641     );
642 
643 _Must_inspect_result_
644 _IRQL_requires_max_(PASSIVE_LEVEL)
645 FORCEINLINE
646 NTSTATUS
647 WdfRegistryAssignUnicodeString(
648     _In_
649     WDFKEY Key,
650     _In_
651     PCUNICODE_STRING ValueName,
652     _In_
653     PCUNICODE_STRING Value
654     )
655 {
656     return ((PFN_WDFREGISTRYASSIGNUNICODESTRING) WdfFunctions[WdfRegistryAssignUnicodeStringTableIndex])(WdfDriverGlobals, Key, ValueName, Value);
657 }
658 
659 //
660 // WDF Function: WdfRegistryAssignString
661 //
662 typedef
663 _Must_inspect_result_
664 _IRQL_requires_max_(PASSIVE_LEVEL)
665 WDFAPI
666 NTSTATUS
667 (STDCALL *PFN_WDFREGISTRYASSIGNSTRING)(
668     _In_
669     PWDF_DRIVER_GLOBALS DriverGlobals,
670     _In_
671     WDFKEY Key,
672     _In_
673     PCUNICODE_STRING ValueName,
674     _In_
675     WDFSTRING String
676     );
677 
678 _Must_inspect_result_
679 _IRQL_requires_max_(PASSIVE_LEVEL)
680 FORCEINLINE
681 NTSTATUS
682 WdfRegistryAssignString(
683     _In_
684     WDFKEY Key,
685     _In_
686     PCUNICODE_STRING ValueName,
687     _In_
688     WDFSTRING String
689     )
690 {
691     return ((PFN_WDFREGISTRYASSIGNSTRING) WdfFunctions[WdfRegistryAssignStringTableIndex])(WdfDriverGlobals, Key, ValueName, String);
692 }
693 
694 //
695 // WDF Function: WdfRegistryAssignULong
696 //
697 typedef
698 _Must_inspect_result_
699 _IRQL_requires_max_(PASSIVE_LEVEL)
700 WDFAPI
701 NTSTATUS
702 (STDCALL *PFN_WDFREGISTRYASSIGNULONG)(
703     _In_
704     PWDF_DRIVER_GLOBALS DriverGlobals,
705     _In_
706     WDFKEY Key,
707     _In_
708     PCUNICODE_STRING ValueName,
709     _In_
710     ULONG Value
711     );
712 
713 _Must_inspect_result_
714 _IRQL_requires_max_(PASSIVE_LEVEL)
715 FORCEINLINE
716 NTSTATUS
717 WdfRegistryAssignULong(
718     _In_
719     WDFKEY Key,
720     _In_
721     PCUNICODE_STRING ValueName,
722     _In_
723     ULONG Value
724     )
725 {
726     return ((PFN_WDFREGISTRYASSIGNULONG) WdfFunctions[WdfRegistryAssignULongTableIndex])(WdfDriverGlobals, Key, ValueName, Value);
727 }
728 
729 
730 
731 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
732 
733 
734 WDF_EXTERN_C_END
735 
736 #endif // _WDFREGISTRY_H_
737 
738