xref: /reactos/sdk/include/xdk/cmtypes.h (revision 40462c92)
1 /******************************************************************************
2  *                            Configuration Manager Types                     *
3  ******************************************************************************/
4 
5 $if (_WDMDDK_)
6 /* Resource list definitions */
7 typedef int CM_RESOURCE_TYPE;
8 
9 #define CmResourceTypeNull              0
10 #define CmResourceTypePort              1
11 #define CmResourceTypeInterrupt         2
12 #define CmResourceTypeMemory            3
13 #define CmResourceTypeDma               4
14 #define CmResourceTypeDeviceSpecific    5
15 #define CmResourceTypeBusNumber         6
16 #define CmResourceTypeNonArbitrated     128
17 #define CmResourceTypeConfigData        128
18 #define CmResourceTypeDevicePrivate     129
19 #define CmResourceTypePcCardConfig      130
20 #define CmResourceTypeMfCardConfig      131
21 
22 /* KEY_VALUE_Xxx.Type */
23 #define REG_NONE                           0
24 #define REG_SZ                             1
25 #define REG_EXPAND_SZ                      2
26 #define REG_BINARY                         3
27 #define REG_DWORD                          4
28 #define REG_DWORD_LITTLE_ENDIAN            4
29 #define REG_DWORD_BIG_ENDIAN               5
30 #define REG_LINK                           6
31 #define REG_MULTI_SZ                       7
32 #define REG_RESOURCE_LIST                  8
33 #define REG_FULL_RESOURCE_DESCRIPTOR       9
34 #define REG_RESOURCE_REQUIREMENTS_LIST     10
35 #define REG_QWORD                          11
36 #define REG_QWORD_LITTLE_ENDIAN            11
37 
38 /* Registry Access Rights */
39 #define KEY_QUERY_VALUE         (0x0001)
40 #define KEY_SET_VALUE           (0x0002)
41 #define KEY_CREATE_SUB_KEY      (0x0004)
42 #define KEY_ENUMERATE_SUB_KEYS  (0x0008)
43 #define KEY_NOTIFY              (0x0010)
44 #define KEY_CREATE_LINK         (0x0020)
45 #define KEY_WOW64_32KEY         (0x0200)
46 #define KEY_WOW64_64KEY         (0x0100)
47 #define KEY_WOW64_RES           (0x0300)
48 
49 #define KEY_READ                ((STANDARD_RIGHTS_READ       |\
50                                   KEY_QUERY_VALUE            |\
51                                   KEY_ENUMERATE_SUB_KEYS     |\
52                                   KEY_NOTIFY)                 \
53                                   &                           \
54                                  (~SYNCHRONIZE))
55 
56 #define KEY_WRITE               ((STANDARD_RIGHTS_WRITE      |\
57                                   KEY_SET_VALUE              |\
58                                   KEY_CREATE_SUB_KEY)         \
59                                   &                           \
60                                  (~SYNCHRONIZE))
61 
62 #define KEY_EXECUTE             ((KEY_READ)                   \
63                                   &                           \
64                                  (~SYNCHRONIZE))
65 
66 #define KEY_ALL_ACCESS          ((STANDARD_RIGHTS_ALL        |\
67                                   KEY_QUERY_VALUE            |\
68                                   KEY_SET_VALUE              |\
69                                   KEY_CREATE_SUB_KEY         |\
70                                   KEY_ENUMERATE_SUB_KEYS     |\
71                                   KEY_NOTIFY                 |\
72                                   KEY_CREATE_LINK)            \
73                                   &                           \
74                                  (~SYNCHRONIZE))
75 
76 /* Registry Open/Create Options */
77 #define REG_OPTION_RESERVED         (0x00000000L)
78 #define REG_OPTION_NON_VOLATILE     (0x00000000L)
79 #define REG_OPTION_VOLATILE         (0x00000001L)
80 #define REG_OPTION_CREATE_LINK      (0x00000002L)
81 #define REG_OPTION_BACKUP_RESTORE   (0x00000004L)
82 #define REG_OPTION_OPEN_LINK        (0x00000008L)
83 
84 #define REG_LEGAL_OPTION            \
85                 (REG_OPTION_RESERVED            |\
86                  REG_OPTION_NON_VOLATILE        |\
87                  REG_OPTION_VOLATILE            |\
88                  REG_OPTION_CREATE_LINK         |\
89                  REG_OPTION_BACKUP_RESTORE      |\
90                  REG_OPTION_OPEN_LINK)
91 
92 #define REG_OPEN_LEGAL_OPTION       \
93                 (REG_OPTION_RESERVED            |\
94                  REG_OPTION_BACKUP_RESTORE      |\
95                  REG_OPTION_OPEN_LINK)
96 
97 #define REG_STANDARD_FORMAT            1
98 #define REG_LATEST_FORMAT              2
99 #define REG_NO_COMPRESSION             4
100 
101 /* Key creation/open disposition */
102 #define REG_CREATED_NEW_KEY         (0x00000001L)
103 #define REG_OPENED_EXISTING_KEY     (0x00000002L)
104 
105 /* Key restore & hive load flags */
106 #define REG_WHOLE_HIVE_VOLATILE         (0x00000001L)
107 #define REG_REFRESH_HIVE                (0x00000002L)
108 #define REG_NO_LAZY_FLUSH               (0x00000004L)
109 #define REG_FORCE_RESTORE               (0x00000008L)
110 #define REG_APP_HIVE                    (0x00000010L)
111 #define REG_PROCESS_PRIVATE             (0x00000020L)
112 #define REG_START_JOURNAL               (0x00000040L)
113 #define REG_HIVE_EXACT_FILE_GROWTH      (0x00000080L)
114 #define REG_HIVE_NO_RM                  (0x00000100L)
115 #define REG_HIVE_SINGLE_LOG             (0x00000200L)
116 #define REG_BOOT_HIVE                   (0x00000400L)
117 
118 /* Unload Flags */
119 #define REG_FORCE_UNLOAD            1
120 
121 /* Notify Filter Values */
122 #define REG_NOTIFY_CHANGE_NAME          (0x00000001L)
123 #define REG_NOTIFY_CHANGE_ATTRIBUTES    (0x00000002L)
124 #define REG_NOTIFY_CHANGE_LAST_SET      (0x00000004L)
125 #define REG_NOTIFY_CHANGE_SECURITY      (0x00000008L)
126 
127 #define REG_LEGAL_CHANGE_FILTER                 \
128                 (REG_NOTIFY_CHANGE_NAME          |\
129                  REG_NOTIFY_CHANGE_ATTRIBUTES    |\
130                  REG_NOTIFY_CHANGE_LAST_SET      |\
131                  REG_NOTIFY_CHANGE_SECURITY)
132 
133 #include <pshpack4.h>
134 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
135   UCHAR Type;
136   UCHAR ShareDisposition;
137   USHORT Flags;
138   union {
139     struct {
140       PHYSICAL_ADDRESS Start;
141       ULONG Length;
142     } Generic;
143     struct {
144       PHYSICAL_ADDRESS Start;
145       ULONG Length;
146     } Port;
147     struct {
148 #if defined(NT_PROCESSOR_GROUPS)
149       USHORT Level;
150       USHORT Group;
151 #else
152       ULONG Level;
153 #endif
154       ULONG Vector;
155       KAFFINITY Affinity;
156     } Interrupt;
157 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
158     struct {
159       _ANONYMOUS_UNION union {
160         struct {
161 #if defined(NT_PROCESSOR_GROUPS)
162           USHORT Group;
163 #else
164           USHORT Reserved;
165 #endif
166           USHORT MessageCount;
167           ULONG Vector;
168           KAFFINITY Affinity;
169         } Raw;
170         struct {
171 #if defined(NT_PROCESSOR_GROUPS)
172           USHORT Level;
173           USHORT Group;
174 #else
175           ULONG Level;
176 #endif
177           ULONG Vector;
178           KAFFINITY Affinity;
179         } Translated;
180       } DUMMYUNIONNAME;
181     } MessageInterrupt;
182 #endif
183     struct {
184       PHYSICAL_ADDRESS Start;
185       ULONG Length;
186     } Memory;
187     struct {
188       ULONG Channel;
189       ULONG Port;
190       ULONG Reserved1;
191     } Dma;
192     struct {
193       ULONG Data[3];
194     } DevicePrivate;
195     struct {
196       ULONG Start;
197       ULONG Length;
198       ULONG Reserved;
199     } BusNumber;
200     struct {
201       ULONG DataSize;
202       ULONG Reserved1;
203       ULONG Reserved2;
204     } DeviceSpecificData;
205 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
206     struct {
207       PHYSICAL_ADDRESS Start;
208       ULONG Length40;
209     } Memory40;
210     struct {
211       PHYSICAL_ADDRESS Start;
212       ULONG Length48;
213     } Memory48;
214     struct {
215       PHYSICAL_ADDRESS Start;
216       ULONG Length64;
217     } Memory64;
218 #endif
219   } u;
220 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
221 #include <poppack.h>
222 
223 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
224 #define CmResourceTypeNull                0
225 #define CmResourceTypePort                1
226 #define CmResourceTypeInterrupt           2
227 #define CmResourceTypeMemory              3
228 #define CmResourceTypeDma                 4
229 #define CmResourceTypeDeviceSpecific      5
230 #define CmResourceTypeBusNumber           6
231 #define CmResourceTypeMemoryLarge         7
232 #define CmResourceTypeNonArbitrated       128
233 #define CmResourceTypeConfigData          128
234 #define CmResourceTypeDevicePrivate       129
235 #define CmResourceTypePcCardConfig        130
236 #define CmResourceTypeMfCardConfig        131
237 
238 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
239 typedef enum _CM_SHARE_DISPOSITION {
240   CmResourceShareUndetermined = 0,
241   CmResourceShareDeviceExclusive,
242   CmResourceShareDriverExclusive,
243   CmResourceShareShared
244 } CM_SHARE_DISPOSITION;
245 
246 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
247 #define CM_RESOURCE_PORT_MEMORY           0x0000
248 #define CM_RESOURCE_PORT_IO               0x0001
249 #define CM_RESOURCE_PORT_10_BIT_DECODE    0x0004
250 #define CM_RESOURCE_PORT_12_BIT_DECODE    0x0008
251 #define CM_RESOURCE_PORT_16_BIT_DECODE    0x0010
252 #define CM_RESOURCE_PORT_POSITIVE_DECODE  0x0020
253 #define CM_RESOURCE_PORT_PASSIVE_DECODE   0x0040
254 #define CM_RESOURCE_PORT_WINDOW_DECODE    0x0080
255 #define CM_RESOURCE_PORT_BAR              0x0100
256 
257 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
258 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
259 #define CM_RESOURCE_INTERRUPT_LATCHED         0x0001
260 #define CM_RESOURCE_INTERRUPT_MESSAGE         0x0002
261 #define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 0x0004
262 #define CM_RESOURCE_INTERRUPT_SECONDARY_INTERRUPT   0x0010
263 #define CM_RESOURCE_INTERRUPT_WAKE_HINT             0x0020
264 
265 #define CM_RESOURCE_INTERRUPT_LEVEL_LATCHED_BITS 0x0001
266 
267 #define CM_RESOURCE_INTERRUPT_MESSAGE_TOKEN   ((ULONG)-2)
268 
269 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
270 #define CM_RESOURCE_MEMORY_READ_WRITE                    0x0000
271 #define CM_RESOURCE_MEMORY_READ_ONLY                     0x0001
272 #define CM_RESOURCE_MEMORY_WRITE_ONLY                    0x0002
273 #define CM_RESOURCE_MEMORY_WRITEABILITY_MASK             0x0003
274 #define CM_RESOURCE_MEMORY_PREFETCHABLE                  0x0004
275 #define CM_RESOURCE_MEMORY_COMBINEDWRITE                 0x0008
276 #define CM_RESOURCE_MEMORY_24                            0x0010
277 #define CM_RESOURCE_MEMORY_CACHEABLE                     0x0020
278 #define CM_RESOURCE_MEMORY_WINDOW_DECODE                 0x0040
279 #define CM_RESOURCE_MEMORY_BAR                           0x0080
280 #define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE 0x0100
281 
282 #define CM_RESOURCE_MEMORY_LARGE                         0x0E00
283 #define CM_RESOURCE_MEMORY_LARGE_40                      0x0200
284 #define CM_RESOURCE_MEMORY_LARGE_48                      0x0400
285 #define CM_RESOURCE_MEMORY_LARGE_64                      0x0800
286 
287 #define CM_RESOURCE_MEMORY_LARGE_40_MAXLEN               0x000000FFFFFFFF00
288 #define CM_RESOURCE_MEMORY_LARGE_48_MAXLEN               0x0000FFFFFFFF0000
289 #define CM_RESOURCE_MEMORY_LARGE_64_MAXLEN               0xFFFFFFFF00000000
290 
291 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
292 #define CM_RESOURCE_DMA_8                 0x0000
293 #define CM_RESOURCE_DMA_16                0x0001
294 #define CM_RESOURCE_DMA_32                0x0002
295 #define CM_RESOURCE_DMA_8_AND_16          0x0004
296 #define CM_RESOURCE_DMA_BUS_MASTER        0x0008
297 #define CM_RESOURCE_DMA_TYPE_A            0x0010
298 #define CM_RESOURCE_DMA_TYPE_B            0x0020
299 #define CM_RESOURCE_DMA_TYPE_F            0x0040
300 
301 typedef struct _DEVICE_FLAGS {
302   ULONG Failed:1;
303   ULONG ReadOnly:1;
304   ULONG Removable:1;
305   ULONG ConsoleIn:1;
306   ULONG ConsoleOut:1;
307   ULONG Input:1;
308   ULONG Output:1;
309 } DEVICE_FLAGS, *PDEVICE_FLAGS;
310 
311 typedef enum _INTERFACE_TYPE {
312   InterfaceTypeUndefined = -1,
313   Internal,
314   Isa,
315   Eisa,
316   MicroChannel,
317   TurboChannel,
318   PCIBus,
319   VMEBus,
320   NuBus,
321   PCMCIABus,
322   CBus,
323   MPIBus,
324   MPSABus,
325   ProcessorInternal,
326   InternalPowerBus,
327   PNPISABus,
328   PNPBus,
329   Vmcs,
330   MaximumInterfaceType
331 } INTERFACE_TYPE, *PINTERFACE_TYPE;
332 
333 typedef struct _CM_COMPONENT_INFORMATION {
334   DEVICE_FLAGS Flags;
335   ULONG Version;
336   ULONG Key;
337   KAFFINITY AffinityMask;
338 } CM_COMPONENT_INFORMATION, *PCM_COMPONENT_INFORMATION;
339 
340 typedef struct _CM_ROM_BLOCK {
341   ULONG Address;
342   ULONG Size;
343 } CM_ROM_BLOCK, *PCM_ROM_BLOCK;
344 
345 typedef struct _CM_PARTIAL_RESOURCE_LIST {
346   USHORT Version;
347   USHORT Revision;
348   ULONG Count;
349   CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
350 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
351 
352 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
353   INTERFACE_TYPE InterfaceType;
354   ULONG BusNumber;
355   CM_PARTIAL_RESOURCE_LIST PartialResourceList;
356 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
357 
358 typedef struct _CM_RESOURCE_LIST {
359   ULONG Count;
360   CM_FULL_RESOURCE_DESCRIPTOR List[1];
361 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
362 
363 typedef struct _PNP_BUS_INFORMATION {
364   GUID BusTypeGuid;
365   INTERFACE_TYPE LegacyBusType;
366   ULONG BusNumber;
367 } PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
368 
369 #include <pshpack1.h>
370 
371 typedef struct _CM_INT13_DRIVE_PARAMETER {
372   USHORT DriveSelect;
373   ULONG MaxCylinders;
374   USHORT SectorsPerTrack;
375   USHORT MaxHeads;
376   USHORT NumberDrives;
377 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
378 
379 typedef struct _CM_MCA_POS_DATA {
380   USHORT AdapterId;
381   UCHAR PosData1;
382   UCHAR PosData2;
383   UCHAR PosData3;
384   UCHAR PosData4;
385 } CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
386 
387 typedef struct _CM_PNP_BIOS_DEVICE_NODE {
388   USHORT Size;
389   UCHAR Node;
390   ULONG ProductId;
391   UCHAR DeviceType[3];
392   USHORT DeviceAttributes;
393 } CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE;
394 
395 typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK {
396   UCHAR Signature[4];
397   UCHAR Revision;
398   UCHAR Length;
399   USHORT ControlField;
400   UCHAR Checksum;
401   ULONG EventFlagAddress;
402   USHORT RealModeEntryOffset;
403   USHORT RealModeEntrySegment;
404   USHORT ProtectedModeEntryOffset;
405   ULONG ProtectedModeCodeBaseAddress;
406   ULONG OemDeviceId;
407   USHORT RealModeDataBaseAddress;
408   ULONG ProtectedModeDataBaseAddress;
409 } CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
410 
411 #include <poppack.h>
412 
413 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA {
414   ULONG BytesPerSector;
415   ULONG NumberOfCylinders;
416   ULONG SectorsPerTrack;
417   ULONG NumberOfHeads;
418 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
419 
420 typedef struct _CM_KEYBOARD_DEVICE_DATA {
421   USHORT Version;
422   USHORT Revision;
423   UCHAR Type;
424   UCHAR Subtype;
425   USHORT KeyboardFlags;
426 } CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
427 
428 typedef struct _CM_SCSI_DEVICE_DATA {
429   USHORT Version;
430   USHORT Revision;
431   UCHAR HostIdentifier;
432 } CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
433 
434 typedef struct _CM_VIDEO_DEVICE_DATA {
435   USHORT Version;
436   USHORT Revision;
437   ULONG VideoClock;
438 } CM_VIDEO_DEVICE_DATA, *PCM_VIDEO_DEVICE_DATA;
439 
440 typedef struct _CM_SONIC_DEVICE_DATA {
441   USHORT Version;
442   USHORT Revision;
443   USHORT DataConfigurationRegister;
444   UCHAR EthernetAddress[8];
445 } CM_SONIC_DEVICE_DATA, *PCM_SONIC_DEVICE_DATA;
446 
447 typedef struct _CM_SERIAL_DEVICE_DATA {
448   USHORT Version;
449   USHORT Revision;
450   ULONG BaudClock;
451 } CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
452 
453 typedef struct _CM_MONITOR_DEVICE_DATA {
454   USHORT Version;
455   USHORT Revision;
456   USHORT HorizontalScreenSize;
457   USHORT VerticalScreenSize;
458   USHORT HorizontalResolution;
459   USHORT VerticalResolution;
460   USHORT HorizontalDisplayTimeLow;
461   USHORT HorizontalDisplayTime;
462   USHORT HorizontalDisplayTimeHigh;
463   USHORT HorizontalBackPorchLow;
464   USHORT HorizontalBackPorch;
465   USHORT HorizontalBackPorchHigh;
466   USHORT HorizontalFrontPorchLow;
467   USHORT HorizontalFrontPorch;
468   USHORT HorizontalFrontPorchHigh;
469   USHORT HorizontalSyncLow;
470   USHORT HorizontalSync;
471   USHORT HorizontalSyncHigh;
472   USHORT VerticalBackPorchLow;
473   USHORT VerticalBackPorch;
474   USHORT VerticalBackPorchHigh;
475   USHORT VerticalFrontPorchLow;
476   USHORT VerticalFrontPorch;
477   USHORT VerticalFrontPorchHigh;
478   USHORT VerticalSyncLow;
479   USHORT VerticalSync;
480   USHORT VerticalSyncHigh;
481 } CM_MONITOR_DEVICE_DATA, *PCM_MONITOR_DEVICE_DATA;
482 
483 typedef struct _CM_FLOPPY_DEVICE_DATA {
484   USHORT Version;
485   USHORT Revision;
486   CHAR Size[8];
487   ULONG MaxDensity;
488   ULONG MountDensity;
489   UCHAR StepRateHeadUnloadTime;
490   UCHAR HeadLoadTime;
491   UCHAR MotorOffTime;
492   UCHAR SectorLengthCode;
493   UCHAR SectorPerTrack;
494   UCHAR ReadWriteGapLength;
495   UCHAR DataTransferLength;
496   UCHAR FormatGapLength;
497   UCHAR FormatFillCharacter;
498   UCHAR HeadSettleTime;
499   UCHAR MotorSettleTime;
500   UCHAR MaximumTrackValue;
501   UCHAR DataTransferRate;
502 } CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
503 
504 typedef enum _KEY_INFORMATION_CLASS {
505   KeyBasicInformation,
506   KeyNodeInformation,
507   KeyFullInformation,
508   KeyNameInformation,
509   KeyCachedInformation,
510   KeyFlagsInformation,
511   KeyVirtualizationInformation,
512   KeyHandleTagsInformation,
513   MaxKeyInfoClass
514 } KEY_INFORMATION_CLASS;
515 
516 typedef struct _KEY_BASIC_INFORMATION {
517   LARGE_INTEGER LastWriteTime;
518   ULONG TitleIndex;
519   ULONG NameLength;
520   WCHAR Name[1];
521 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
522 
523 typedef struct _KEY_CONTROL_FLAGS_INFORMATION {
524   ULONG ControlFlags;
525 } KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION;
526 
527 typedef struct _KEY_FULL_INFORMATION {
528   LARGE_INTEGER LastWriteTime;
529   ULONG TitleIndex;
530   ULONG ClassOffset;
531   ULONG ClassLength;
532   ULONG SubKeys;
533   ULONG MaxNameLen;
534   ULONG MaxClassLen;
535   ULONG Values;
536   ULONG MaxValueNameLen;
537   ULONG MaxValueDataLen;
538   WCHAR Class[1];
539 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
540 
541 typedef struct _KEY_HANDLE_TAGS_INFORMATION {
542   ULONG HandleTags;
543 } KEY_HANDLE_TAGS_INFORMATION, *PKEY_HANDLE_TAGS_INFORMATION;
544 
545 typedef struct _KEY_NODE_INFORMATION {
546   LARGE_INTEGER LastWriteTime;
547   ULONG TitleIndex;
548   ULONG ClassOffset;
549   ULONG ClassLength;
550   ULONG NameLength;
551   WCHAR Name[1];
552 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
553 
554 typedef enum _KEY_SET_INFORMATION_CLASS {
555   KeyWriteTimeInformation,
556   KeyWow64FlagsInformation,
557   KeyControlFlagsInformation,
558   KeySetVirtualizationInformation,
559   KeySetDebugInformation,
560   KeySetHandleTagsInformation,
561   MaxKeySetInfoClass
562 } KEY_SET_INFORMATION_CLASS;
563 
564 typedef struct _KEY_SET_VIRTUALIZATION_INFORMATION {
565   ULONG VirtualTarget:1;
566   ULONG VirtualStore:1;
567   ULONG VirtualSource:1;
568   ULONG Reserved:29;
569 } KEY_SET_VIRTUALIZATION_INFORMATION, *PKEY_SET_VIRTUALIZATION_INFORMATION;
570 
571 typedef struct _KEY_VALUE_BASIC_INFORMATION {
572   ULONG TitleIndex;
573   ULONG Type;
574   ULONG NameLength;
575   WCHAR Name[1];
576 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
577 
578 typedef struct _KEY_VALUE_FULL_INFORMATION {
579   ULONG TitleIndex;
580   ULONG Type;
581   ULONG DataOffset;
582   ULONG DataLength;
583   ULONG NameLength;
584   WCHAR Name[1];
585 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
586 
587 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
588   ULONG TitleIndex;
589   ULONG Type;
590   ULONG DataLength;
591   _Field_size_bytes_(DataLength) UCHAR Data[1];
592 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
593 
594 typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
595   ULONG Type;
596   ULONG DataLength;
597   _Field_size_bytes_(DataLength) UCHAR Data[1];
598 } KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
599 
600 typedef struct _KEY_VALUE_ENTRY {
601   PUNICODE_STRING ValueName;
602   ULONG DataLength;
603   ULONG DataOffset;
604   ULONG Type;
605 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
606 
607 typedef enum _KEY_VALUE_INFORMATION_CLASS {
608   KeyValueBasicInformation,
609   KeyValueFullInformation,
610   KeyValuePartialInformation,
611   KeyValueFullInformationAlign64,
612   KeyValuePartialInformationAlign64
613 } KEY_VALUE_INFORMATION_CLASS;
614 
615 typedef struct _KEY_WOW64_FLAGS_INFORMATION {
616   ULONG UserFlags;
617 } KEY_WOW64_FLAGS_INFORMATION, *PKEY_WOW64_FLAGS_INFORMATION;
618 
619 typedef struct _KEY_WRITE_TIME_INFORMATION {
620   LARGE_INTEGER LastWriteTime;
621 } KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
622 
623 #if (NTDDI_VERSION < NTDDI_VISTA)
624 typedef struct _KEY_USER_FLAGS_INFORMATION {
625     ULONG   UserFlags;
626 } KEY_USER_FLAGS_INFORMATION, *PKEY_USER_FLAGS_INFORMATION;
627 #endif
628 
629 typedef enum _REG_NOTIFY_CLASS {
630   RegNtDeleteKey,
631   RegNtPreDeleteKey = RegNtDeleteKey,
632   RegNtSetValueKey,
633   RegNtPreSetValueKey = RegNtSetValueKey,
634   RegNtDeleteValueKey,
635   RegNtPreDeleteValueKey = RegNtDeleteValueKey,
636   RegNtSetInformationKey,
637   RegNtPreSetInformationKey = RegNtSetInformationKey,
638   RegNtRenameKey,
639   RegNtPreRenameKey = RegNtRenameKey,
640   RegNtEnumerateKey,
641   RegNtPreEnumerateKey = RegNtEnumerateKey,
642   RegNtEnumerateValueKey,
643   RegNtPreEnumerateValueKey = RegNtEnumerateValueKey,
644   RegNtQueryKey,
645   RegNtPreQueryKey = RegNtQueryKey,
646   RegNtQueryValueKey,
647   RegNtPreQueryValueKey = RegNtQueryValueKey,
648   RegNtQueryMultipleValueKey,
649   RegNtPreQueryMultipleValueKey = RegNtQueryMultipleValueKey,
650   RegNtPreCreateKey,
651   RegNtPostCreateKey,
652   RegNtPreOpenKey,
653   RegNtPostOpenKey,
654   RegNtKeyHandleClose,
655   RegNtPreKeyHandleClose = RegNtKeyHandleClose,
656   RegNtPostDeleteKey,
657   RegNtPostSetValueKey,
658   RegNtPostDeleteValueKey,
659   RegNtPostSetInformationKey,
660   RegNtPostRenameKey,
661   RegNtPostEnumerateKey,
662   RegNtPostEnumerateValueKey,
663   RegNtPostQueryKey,
664   RegNtPostQueryValueKey,
665   RegNtPostQueryMultipleValueKey,
666   RegNtPostKeyHandleClose,
667   RegNtPreCreateKeyEx,
668   RegNtPostCreateKeyEx,
669   RegNtPreOpenKeyEx,
670   RegNtPostOpenKeyEx,
671   RegNtPreFlushKey,
672   RegNtPostFlushKey,
673   RegNtPreLoadKey,
674   RegNtPostLoadKey,
675   RegNtPreUnLoadKey,
676   RegNtPostUnLoadKey,
677   RegNtPreQueryKeySecurity,
678   RegNtPostQueryKeySecurity,
679   RegNtPreSetKeySecurity,
680   RegNtPostSetKeySecurity,
681   RegNtCallbackObjectContextCleanup,
682   RegNtPreRestoreKey,
683   RegNtPostRestoreKey,
684   RegNtPreSaveKey,
685   RegNtPostSaveKey,
686   RegNtPreReplaceKey,
687   RegNtPostReplaceKey,
688   MaxRegNtNotifyClass
689 } REG_NOTIFY_CLASS, *PREG_NOTIFY_CLASS;
690 
691 _IRQL_requires_same_
692 _Function_class_(EX_CALLBACK_FUNCTION)
693 typedef NTSTATUS
694 (NTAPI EX_CALLBACK_FUNCTION)(
695   _In_ PVOID CallbackContext,
696   _In_opt_ PVOID Argument1,
697   _In_opt_ PVOID Argument2);
698 typedef EX_CALLBACK_FUNCTION *PEX_CALLBACK_FUNCTION;
699 
700 typedef struct _REG_DELETE_KEY_INFORMATION {
701   PVOID Object;
702   PVOID CallContext;
703   PVOID ObjectContext;
704   PVOID Reserved;
705 } REG_DELETE_KEY_INFORMATION, *PREG_DELETE_KEY_INFORMATION
706 #if (NTDDI_VERSION >= NTDDI_VISTA)
707 , REG_FLUSH_KEY_INFORMATION, *PREG_FLUSH_KEY_INFORMATION
708 #endif
709 ;
710 
711 typedef struct _REG_SET_VALUE_KEY_INFORMATION {
712   PVOID Object;
713   PUNICODE_STRING ValueName;
714   ULONG TitleIndex;
715   ULONG Type;
716   PVOID Data;
717   ULONG DataSize;
718   PVOID CallContext;
719   PVOID ObjectContext;
720   PVOID Reserved;
721 } REG_SET_VALUE_KEY_INFORMATION, *PREG_SET_VALUE_KEY_INFORMATION;
722 
723 typedef struct _REG_DELETE_VALUE_KEY_INFORMATION {
724   PVOID Object;
725   PUNICODE_STRING ValueName;
726   PVOID CallContext;
727   PVOID ObjectContext;
728   PVOID Reserved;
729 } REG_DELETE_VALUE_KEY_INFORMATION, *PREG_DELETE_VALUE_KEY_INFORMATION;
730 
731 typedef struct _REG_SET_INFORMATION_KEY_INFORMATION {
732   PVOID Object;
733   KEY_SET_INFORMATION_CLASS KeySetInformationClass;
734   PVOID KeySetInformation;
735   ULONG KeySetInformationLength;
736   PVOID CallContext;
737   PVOID ObjectContext;
738   PVOID Reserved;
739 } REG_SET_INFORMATION_KEY_INFORMATION, *PREG_SET_INFORMATION_KEY_INFORMATION;
740 
741 typedef struct _REG_ENUMERATE_KEY_INFORMATION {
742   PVOID Object;
743   ULONG Index;
744   KEY_INFORMATION_CLASS KeyInformationClass;
745   PVOID KeyInformation;
746   ULONG Length;
747   PULONG ResultLength;
748   PVOID CallContext;
749   PVOID ObjectContext;
750   PVOID Reserved;
751 } REG_ENUMERATE_KEY_INFORMATION, *PREG_ENUMERATE_KEY_INFORMATION;
752 
753 typedef struct _REG_ENUMERATE_VALUE_KEY_INFORMATION {
754   PVOID Object;
755   ULONG Index;
756   KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass;
757   PVOID KeyValueInformation;
758   ULONG Length;
759   PULONG ResultLength;
760   PVOID CallContext;
761   PVOID ObjectContext;
762   PVOID Reserved;
763 } REG_ENUMERATE_VALUE_KEY_INFORMATION, *PREG_ENUMERATE_VALUE_KEY_INFORMATION;
764 
765 typedef struct _REG_QUERY_KEY_INFORMATION {
766   PVOID Object;
767   KEY_INFORMATION_CLASS KeyInformationClass;
768   PVOID KeyInformation;
769   ULONG Length;
770   PULONG ResultLength;
771   PVOID CallContext;
772   PVOID ObjectContext;
773   PVOID Reserved;
774 } REG_QUERY_KEY_INFORMATION, *PREG_QUERY_KEY_INFORMATION;
775 
776 typedef struct _REG_QUERY_VALUE_KEY_INFORMATION {
777   PVOID Object;
778   PUNICODE_STRING ValueName;
779   KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass;
780   PVOID KeyValueInformation;
781   ULONG Length;
782   PULONG ResultLength;
783   PVOID CallContext;
784   PVOID ObjectContext;
785   PVOID Reserved;
786 } REG_QUERY_VALUE_KEY_INFORMATION, *PREG_QUERY_VALUE_KEY_INFORMATION;
787 
788 typedef struct _REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION {
789   PVOID Object;
790   PKEY_VALUE_ENTRY ValueEntries;
791   ULONG EntryCount;
792   PVOID ValueBuffer;
793   PULONG BufferLength;
794   PULONG RequiredBufferLength;
795   PVOID CallContext;
796   PVOID ObjectContext;
797   PVOID Reserved;
798 } REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION, *PREG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION;
799 
800 typedef struct _REG_RENAME_KEY_INFORMATION {
801   PVOID Object;
802   PUNICODE_STRING NewName;
803   PVOID CallContext;
804   PVOID ObjectContext;
805   PVOID Reserved;
806 } REG_RENAME_KEY_INFORMATION, *PREG_RENAME_KEY_INFORMATION;
807 
808 typedef struct _REG_CREATE_KEY_INFORMATION {
809   PUNICODE_STRING CompleteName;
810   PVOID RootObject;
811   PVOID ObjectType;
812   ULONG CreateOptions;
813   PUNICODE_STRING Class;
814   PVOID SecurityDescriptor;
815   PVOID SecurityQualityOfService;
816   ACCESS_MASK DesiredAccess;
817   ACCESS_MASK GrantedAccess;
818   PULONG Disposition;
819   PVOID *ResultObject;
820   PVOID CallContext;
821   PVOID RootObjectContext;
822   PVOID Transaction;
823   PVOID Reserved;
824 } REG_CREATE_KEY_INFORMATION, REG_OPEN_KEY_INFORMATION,*PREG_CREATE_KEY_INFORMATION, *PREG_OPEN_KEY_INFORMATION;
825 
826 typedef struct _REG_CREATE_KEY_INFORMATION_V1 {
827   PUNICODE_STRING CompleteName;
828   PVOID RootObject;
829   PVOID ObjectType;
830   ULONG Options;
831   PUNICODE_STRING Class;
832   PVOID SecurityDescriptor;
833   PVOID SecurityQualityOfService;
834   ACCESS_MASK DesiredAccess;
835   ACCESS_MASK GrantedAccess;
836   PULONG Disposition;
837   PVOID *ResultObject;
838   PVOID CallContext;
839   PVOID RootObjectContext;
840   PVOID Transaction;
841   ULONG_PTR Version;
842   PUNICODE_STRING RemainingName;
843   ULONG Wow64Flags;
844   ULONG Attributes;
845   KPROCESSOR_MODE CheckAccessMode;
846 } REG_CREATE_KEY_INFORMATION_V1, REG_OPEN_KEY_INFORMATION_V1,*PREG_CREATE_KEY_INFORMATION_V1, *PREG_OPEN_KEY_INFORMATION_V1;
847 
848 typedef struct _REG_PRE_CREATE_KEY_INFORMATION {
849   PUNICODE_STRING CompleteName;
850 } REG_PRE_CREATE_KEY_INFORMATION, REG_PRE_OPEN_KEY_INFORMATION,*PREG_PRE_CREATE_KEY_INFORMATION, *PREG_PRE_OPEN_KEY_INFORMATION;
851 
852 typedef struct _REG_POST_CREATE_KEY_INFORMATION {
853   PUNICODE_STRING CompleteName;
854   PVOID Object;
855   NTSTATUS Status;
856 } REG_POST_CREATE_KEY_INFORMATION,REG_POST_OPEN_KEY_INFORMATION, *PREG_POST_CREATE_KEY_INFORMATION, *PREG_POST_OPEN_KEY_INFORMATION;
857 
858 typedef struct _REG_POST_OPERATION_INFORMATION {
859   PVOID Object;
860   NTSTATUS Status;
861   PVOID PreInformation;
862   NTSTATUS ReturnStatus;
863   PVOID CallContext;
864   PVOID ObjectContext;
865   PVOID Reserved;
866 } REG_POST_OPERATION_INFORMATION,*PREG_POST_OPERATION_INFORMATION;
867 
868 typedef struct _REG_KEY_HANDLE_CLOSE_INFORMATION {
869   PVOID Object;
870   PVOID CallContext;
871   PVOID ObjectContext;
872   PVOID Reserved;
873 } REG_KEY_HANDLE_CLOSE_INFORMATION, *PREG_KEY_HANDLE_CLOSE_INFORMATION;
874 
875 #if (NTDDI_VERSION >= NTDDI_VISTA)
876 
877 typedef struct _REG_LOAD_KEY_INFORMATION {
878   PVOID Object;
879   PUNICODE_STRING KeyName;
880   PUNICODE_STRING SourceFile;
881   ULONG Flags;
882   PVOID TrustClassObject;
883   PVOID UserEvent;
884   ACCESS_MASK DesiredAccess;
885   PHANDLE RootHandle;
886   PVOID CallContext;
887   PVOID ObjectContext;
888   PVOID Reserved;
889 } REG_LOAD_KEY_INFORMATION, *PREG_LOAD_KEY_INFORMATION;
890 
891 typedef struct _REG_UNLOAD_KEY_INFORMATION {
892   PVOID Object;
893   PVOID UserEvent;
894   PVOID CallContext;
895   PVOID ObjectContext;
896   PVOID Reserved;
897 } REG_UNLOAD_KEY_INFORMATION, *PREG_UNLOAD_KEY_INFORMATION;
898 
899 typedef struct _REG_CALLBACK_CONTEXT_CLEANUP_INFORMATION {
900   PVOID Object;
901   PVOID ObjectContext;
902   PVOID Reserved;
903 } REG_CALLBACK_CONTEXT_CLEANUP_INFORMATION, *PREG_CALLBACK_CONTEXT_CLEANUP_INFORMATION;
904 
905 typedef struct _REG_QUERY_KEY_SECURITY_INFORMATION {
906   PVOID Object;
907   PSECURITY_INFORMATION SecurityInformation;
908   PSECURITY_DESCRIPTOR SecurityDescriptor;
909   PULONG Length;
910   PVOID CallContext;
911   PVOID ObjectContext;
912   PVOID Reserved;
913 } REG_QUERY_KEY_SECURITY_INFORMATION, *PREG_QUERY_KEY_SECURITY_INFORMATION;
914 
915 typedef struct _REG_SET_KEY_SECURITY_INFORMATION {
916   PVOID Object;
917   PSECURITY_INFORMATION SecurityInformation;
918   PSECURITY_DESCRIPTOR SecurityDescriptor;
919   PVOID CallContext;
920   PVOID ObjectContext;
921   PVOID Reserved;
922 } REG_SET_KEY_SECURITY_INFORMATION, *PREG_SET_KEY_SECURITY_INFORMATION;
923 
924 typedef struct _REG_RESTORE_KEY_INFORMATION {
925   PVOID Object;
926   HANDLE FileHandle;
927   ULONG Flags;
928   PVOID CallContext;
929   PVOID ObjectContext;
930   PVOID Reserved;
931 } REG_RESTORE_KEY_INFORMATION, *PREG_RESTORE_KEY_INFORMATION;
932 
933 typedef struct _REG_SAVE_KEY_INFORMATION {
934   PVOID Object;
935   HANDLE FileHandle;
936   ULONG Format;
937   PVOID CallContext;
938   PVOID ObjectContext;
939   PVOID Reserved;
940 } REG_SAVE_KEY_INFORMATION, *PREG_SAVE_KEY_INFORMATION;
941 
942 typedef struct _REG_REPLACE_KEY_INFORMATION {
943   PVOID Object;
944   PUNICODE_STRING OldFileName;
945   PUNICODE_STRING NewFileName;
946   PVOID CallContext;
947   PVOID ObjectContext;
948   PVOID Reserved;
949 } REG_REPLACE_KEY_INFORMATION, *PREG_REPLACE_KEY_INFORMATION;
950 
951 #endif /* NTDDI_VERSION >= NTDDI_VISTA */
952 
953 #define SERVICE_KERNEL_DRIVER          0x00000001
954 #define SERVICE_FILE_SYSTEM_DRIVER     0x00000002
955 #define SERVICE_ADAPTER                0x00000004
956 #define SERVICE_RECOGNIZER_DRIVER      0x00000008
957 
958 #define SERVICE_DRIVER                 (SERVICE_KERNEL_DRIVER | \
959                                         SERVICE_FILE_SYSTEM_DRIVER | \
960                                         SERVICE_RECOGNIZER_DRIVER)
961 
962 #define SERVICE_WIN32_OWN_PROCESS      0x00000010
963 #define SERVICE_WIN32_SHARE_PROCESS    0x00000020
964 #define SERVICE_WIN32                  (SERVICE_WIN32_OWN_PROCESS | \
965                                         SERVICE_WIN32_SHARE_PROCESS)
966 
967 #define SERVICE_INTERACTIVE_PROCESS    0x00000100
968 
969 #define SERVICE_TYPE_ALL               (SERVICE_WIN32  | \
970                                         SERVICE_ADAPTER | \
971                                         SERVICE_DRIVER  | \
972                                         SERVICE_INTERACTIVE_PROCESS)
973 
974 /* Service Start Types */
975 #define SERVICE_BOOT_START             0x00000000
976 #define SERVICE_SYSTEM_START           0x00000001
977 #define SERVICE_AUTO_START             0x00000002
978 #define SERVICE_DEMAND_START           0x00000003
979 #define SERVICE_DISABLED               0x00000004
980 
981 #define SERVICE_ERROR_IGNORE           0x00000000
982 #define SERVICE_ERROR_NORMAL           0x00000001
983 #define SERVICE_ERROR_SEVERE           0x00000002
984 #define SERVICE_ERROR_CRITICAL         0x00000003
985 
986 typedef enum _CM_SERVICE_NODE_TYPE {
987   DriverType = SERVICE_KERNEL_DRIVER,
988   FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
989   Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
990   Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
991   AdapterType = SERVICE_ADAPTER,
992   RecognizerType = SERVICE_RECOGNIZER_DRIVER
993 } SERVICE_NODE_TYPE;
994 
995 typedef enum _CM_SERVICE_LOAD_TYPE {
996   BootLoad = SERVICE_BOOT_START,
997   SystemLoad = SERVICE_SYSTEM_START,
998   AutoLoad = SERVICE_AUTO_START,
999   DemandLoad = SERVICE_DEMAND_START,
1000   DisableLoad = SERVICE_DISABLED
1001 } SERVICE_LOAD_TYPE;
1002 
1003 typedef enum _CM_ERROR_CONTROL_TYPE {
1004   IgnoreError = SERVICE_ERROR_IGNORE,
1005   NormalError = SERVICE_ERROR_NORMAL,
1006   SevereError = SERVICE_ERROR_SEVERE,
1007   CriticalError = SERVICE_ERROR_CRITICAL
1008 } SERVICE_ERROR_TYPE;
1009 
1010 #define CM_SERVICE_NETWORK_BOOT_LOAD      0x00000001
1011 #define CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD 0x00000002
1012 #define CM_SERVICE_USB_DISK_BOOT_LOAD     0x00000004
1013 
1014 #define CM_SERVICE_VALID_PROMOTION_MASK (CM_SERVICE_NETWORK_BOOT_LOAD |       \
1015                                          CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD |  \
1016                                          CM_SERVICE_USB_DISK_BOOT_LOAD)
1017 
1018 $endif (_WDMDDK_)
1019 $if (_NTDDK_)
1020 typedef struct _KEY_NAME_INFORMATION {
1021   ULONG NameLength;
1022   WCHAR Name[1];
1023 } KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
1024 
1025 typedef struct _KEY_CACHED_INFORMATION {
1026   LARGE_INTEGER LastWriteTime;
1027   ULONG TitleIndex;
1028   ULONG SubKeys;
1029   ULONG MaxNameLen;
1030   ULONG Values;
1031   ULONG MaxValueNameLen;
1032   ULONG MaxValueDataLen;
1033   ULONG NameLength;
1034 } KEY_CACHED_INFORMATION, *PKEY_CACHED_INFORMATION;
1035 
1036 typedef struct _KEY_VIRTUALIZATION_INFORMATION {
1037   ULONG VirtualizationCandidate:1;
1038   ULONG VirtualizationEnabled:1;
1039   ULONG VirtualTarget:1;
1040   ULONG VirtualStore:1;
1041   ULONG VirtualSource:1;
1042   ULONG Reserved:27;
1043 } KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION;
1044 
1045 #define CmResourceTypeMaximum             8
1046 
1047 typedef struct _CM_PCCARD_DEVICE_DATA {
1048   UCHAR Flags;
1049   UCHAR ErrorCode;
1050   USHORT Reserved;
1051   ULONG BusData;
1052   ULONG DeviceId;
1053   ULONG LegacyBaseAddress;
1054   UCHAR IRQMap[16];
1055 } CM_PCCARD_DEVICE_DATA, *PCM_PCCARD_DEVICE_DATA;
1056 
1057 $endif (_NTDDK_)
1058