[NDK]
[reactos.git] / reactos / sdk / include / ndk / cmtypes.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 cmtypes.h
8
9 Abstract:
10
11 Type definitions for the Configuration Manager.
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _CMTYPES_H
20 #define _CMTYPES_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <cfg.h>
27 #include <iotypes.h>
28
29 #define MAX_BUS_NAME 24
30
31 //
32 // PLUGPLAY_CONTROL_RELATED_DEVICE_DATA.Relations
33 //
34 #define PNP_GET_PARENT_DEVICE 1
35 #define PNP_GET_CHILD_DEVICE 2
36 #define PNP_GET_SIBLING_DEVICE 3
37
38 //
39 // PLUGPLAY_CONTROL_STATUS_DATA Operations
40 //
41 #define PNP_GET_DEVICE_STATUS 0
42 #define PNP_SET_DEVICE_STATUS 1
43 #define PNP_CLEAR_DEVICE_STATUS 2
44
45 #ifdef NTOS_MODE_USER
46
47 //
48 // Resource Type
49 //
50 #define CmResourceTypeNull 0
51 #define CmResourceTypePort 1
52 #define CmResourceTypeInterrupt 2
53 #define CmResourceTypeMemory 3
54 #define CmResourceTypeDma 4
55 #define CmResourceTypeDeviceSpecific 5
56 #define CmResourceTypeBusNumber 6
57 #define CmResourceTypeMemoryLarge 7
58 #define CmResourceTypeNonArbitrated 128
59 #define CmResourceTypeConfigData 128
60 #define CmResourceTypeDevicePrivate 129
61 #define CmResourceTypePcCardConfig 130
62 #define CmResourceTypeMfCardConfig 131
63
64
65 //
66 // Resource Descriptor Share Dispositions
67 //
68 typedef enum _CM_SHARE_DISPOSITION
69 {
70 CmResourceShareUndetermined,
71 CmResourceShareDeviceExclusive,
72 CmResourceShareDriverExclusive,
73 CmResourceShareShared
74 } CM_SHARE_DISPOSITION;
75
76 #endif
77
78 //
79 // Port Resource Descriptor Flags
80 //
81 #define CM_RESOURCE_PORT_MEMORY 0x0000
82 #define CM_RESOURCE_PORT_IO 0x0001
83 #define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
84 #define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
85 #define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
86 #define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
87 #define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
88 #define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
89
90 //
91 // Memory Resource Descriptor Flags
92 //
93 #define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
94 #define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
95 #define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
96 #define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
97 #define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
98 #define CM_RESOURCE_MEMORY_24 0x0010
99 #define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
100
101 //
102 // DMA Resource Descriptor Flags
103 //
104 #define CM_RESOURCE_DMA_8 0x0000
105 #define CM_RESOURCE_DMA_16 0x0001
106 #define CM_RESOURCE_DMA_32 0x0002
107 #define CM_RESOURCE_DMA_8_AND_16 0x0004
108 #define CM_RESOURCE_DMA_BUS_MASTER 0x0008
109 #define CM_RESOURCE_DMA_TYPE_A 0x0010
110 #define CM_RESOURCE_DMA_TYPE_B 0x0020
111 #define CM_RESOURCE_DMA_TYPE_F 0x0040
112
113 //
114 // Interrupt Resource Descriptor Flags
115 //
116 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
117 #define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
118 #define CM_RESOURCE_INTERRUPT_MESSAGE 0x0002
119 #define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 0x0004
120
121 //
122 // NtInitializeRegistry Flags
123 //
124 #define CM_BOOT_FLAG_SMSS 0x0000
125 #define CM_BOOT_FLAG_SETUP 0x0001
126 #define CM_BOOT_FLAG_ACCEPTED 0x0002
127 #define CM_BOOT_FLAG_MAX 0x03E9
128
129 #ifdef NTOS_MODE_USER
130
131 //
132 // Information Classes for NtQueryKey
133 //
134 typedef enum _KEY_INFORMATION_CLASS
135 {
136 KeyBasicInformation,
137 KeyNodeInformation,
138 KeyFullInformation,
139 KeyNameInformation,
140 KeyCachedInformation,
141 KeyFlagsInformation,
142 KeyVirtualizationInformation,
143 KeyHandleTagsInformation,
144 MaxKeyInfoClass
145 } KEY_INFORMATION_CLASS;
146
147 typedef enum _KEY_VALUE_INFORMATION_CLASS
148 {
149 KeyValueBasicInformation,
150 KeyValueFullInformation,
151 KeyValuePartialInformation,
152 KeyValueFullInformationAlign64,
153 KeyValuePartialInformationAlign64,
154 MaxKeyValueInfoClass
155 } KEY_VALUE_INFORMATION_CLASS;
156
157 typedef enum _KEY_SET_INFORMATION_CLASS {
158 KeyWriteTimeInformation,
159 KeyWow64FlagsInformation,
160 KeyControlFlagsInformation,
161 KeySetVirtualizationInformation,
162 KeySetDebugInformation,
163 KeySetHandleTagsInformation,
164 MaxKeySetInfoClass
165 } KEY_SET_INFORMATION_CLASS;
166
167 #endif
168
169 //
170 // Plag and Play Classes
171 //
172 typedef enum _PLUGPLAY_CONTROL_CLASS
173 {
174 PlugPlayControlEnumerateDevice,
175 PlugPlayControlRegisterNewDevice,
176 PlugPlayControlDeregisterDevice,
177 PlugPlayControlInitializeDevice,
178 PlugPlayControlStartDevice,
179 PlugPlayControlUnlockDevice,
180 PlugPlayControlQueryAndRemoveDevice,
181 PlugPlayControlUserResponse,
182 PlugPlayControlGenerateLegacyDevice,
183 PlugPlayControlGetInterfaceDeviceList,
184 PlugPlayControlProperty,
185 PlugPlayControlDeviceClassAssociation,
186 PlugPlayControlGetRelatedDevice,
187 PlugPlayControlGetInterfaceDeviceAlias,
188 PlugPlayControlDeviceStatus,
189 PlugPlayControlGetDeviceDepth,
190 PlugPlayControlQueryDeviceRelations,
191 PlugPlayControlTargetDeviceRelation,
192 PlugPlayControlQueryConflictList,
193 PlugPlayControlRetrieveDock,
194 PlugPlayControlResetDevice,
195 PlugPlayControlHaltDevice,
196 PlugPlayControlGetBlockedDriverList,
197 MaxPlugPlayControl
198 } PLUGPLAY_CONTROL_CLASS;
199
200 typedef enum _PLUGPLAY_BUS_CLASS
201 {
202 SystemBus,
203 PlugPlayVirtualBus,
204 MaxPlugPlayBusClass
205 } PLUGPLAY_BUS_CLASS, *PPLUGPLAY_BUS_CLASS;
206
207 //
208 // Plag and Play Bus Types
209 //
210 typedef enum _PLUGPLAY_VIRTUAL_BUS_TYPE
211 {
212 Root,
213 MaxPlugPlayVirtualBusType
214 } PLUGPLAY_VIRTUAL_BUS_TYPE, *PPLUGPLAY_VIRTUAL_BUS_TYPE;
215
216 //
217 // Plag and Play Event Categories
218 //
219 typedef enum _PLUGPLAY_EVENT_CATEGORY
220 {
221 HardwareProfileChangeEvent,
222 TargetDeviceChangeEvent,
223 DeviceClassChangeEvent,
224 CustomDeviceEvent,
225 DeviceInstallEvent,
226 DeviceArrivalEvent,
227 PowerEvent,
228 VetoEvent,
229 BlockedDriverEvent,
230 MaxPlugEventCategory
231 } PLUGPLAY_EVENT_CATEGORY;
232
233 #ifdef NTOS_MODE_USER
234
235 //
236 // Information Structures for NtQueryKeyInformation
237 //
238 typedef struct _KEY_WRITE_TIME_INFORMATION
239 {
240 LARGE_INTEGER LastWriteTime;
241 } KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
242
243 typedef struct _KEY_WOW64_FLAGS_INFORMATION
244 {
245 ULONG UserFlags;
246 } KEY_WOW64_FLAGS_INFORMATION, *PKEY_WOW64_FLAGS_INFORMATION;
247
248 typedef struct _KEY_USER_FLAGS_INFORMATION
249 {
250 ULONG UserFlags;
251 } KEY_USER_FLAGS_INFORMATION, *PKEY_USER_FLAGS_INFORMATION;
252
253 typedef struct _KEY_HANDLE_TAGS_INFORMATION
254 {
255 ULONG HandleTags;
256 } KEY_HANDLE_TAGS_INFORMATION, *PKEY_HANDLE_TAGS_INFORMATION;
257
258 typedef struct _KEY_CONTROL_FLAGS_INFORMATION
259 {
260 ULONG ControlFlags;
261 } KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION;
262
263 typedef struct _KEY_VIRTUALIZATION_INFORMATION
264 {
265 ULONG VirtualizationCandidate:1;
266 ULONG VirtualizationEnabled:1;
267 ULONG VirtualTarget:1;
268 ULONG VirtualStore:1;
269 ULONG VirtualSource:1;
270 ULONG Reserved:27;
271 } KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION;
272
273 typedef struct _KEY_SET_VIRTUALIZATION_INFORMATION
274 {
275 ULONG VirtualTarget:1;
276 ULONG VirtualStore:1;
277 ULONG VirtualSource:1;
278 ULONG Reserved:29;
279 } KEY_SET_VIRTUALIZATION_INFORMATION, *PKEY_SET_VIRTUALIZATION_INFORMATION;
280
281
282 typedef struct _KEY_FULL_INFORMATION
283 {
284 LARGE_INTEGER LastWriteTime;
285 ULONG TitleIndex;
286 ULONG ClassOffset;
287 ULONG ClassLength;
288 ULONG SubKeys;
289 ULONG MaxNameLen;
290 ULONG MaxClassLen;
291 ULONG Values;
292 ULONG MaxValueNameLen;
293 ULONG MaxValueDataLen;
294 WCHAR Class[1];
295 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
296
297 typedef struct _KEY_NAME_INFORMATION
298 {
299 ULONG NameLength;
300 WCHAR Name[1];
301 } KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
302
303
304 typedef struct _KEY_NODE_INFORMATION
305 {
306 LARGE_INTEGER LastWriteTime;
307 ULONG TitleIndex;
308 ULONG ClassOffset;
309 ULONG ClassLength;
310 ULONG NameLength;
311 WCHAR Name[1];
312 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
313
314 typedef struct _KEY_VALUE_ENTRY
315 {
316 PUNICODE_STRING ValueName;
317 ULONG DataLength;
318 ULONG DataOffset;
319 ULONG Type;
320 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
321
322 typedef struct _KEY_VALUE_PARTIAL_INFORMATION
323 {
324 ULONG TitleIndex;
325 ULONG Type;
326 ULONG DataLength;
327 UCHAR Data[1];
328 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
329
330 typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
331 {
332 ULONG Type;
333 ULONG DataLength;
334 UCHAR Data[1];
335 } KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
336
337 typedef struct _KEY_VALUE_BASIC_INFORMATION
338 {
339 ULONG TitleIndex;
340 ULONG Type;
341 ULONG NameLength;
342 WCHAR Name[1];
343 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
344
345 typedef struct _KEY_VALUE_FULL_INFORMATION
346 {
347 ULONG TitleIndex;
348 ULONG Type;
349 ULONG DataOffset;
350 ULONG DataLength;
351 ULONG NameLength;
352 WCHAR Name[1];
353 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
354
355 typedef struct _KEY_BASIC_INFORMATION
356 {
357 LARGE_INTEGER LastWriteTime;
358 ULONG TitleIndex;
359 ULONG NameLength;
360 WCHAR Name[1];
361 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
362
363 #endif
364
365 //
366 // Plug and Play Event Block
367 //
368 typedef struct _PLUGPLAY_EVENT_BLOCK
369 {
370 GUID EventGuid;
371 PLUGPLAY_EVENT_CATEGORY EventCategory;
372 PULONG Result;
373 ULONG Flags;
374 ULONG TotalSize;
375 PVOID DeviceObject;
376 union
377 {
378 struct
379 {
380 GUID ClassGuid;
381 WCHAR SymbolicLinkName[ANYSIZE_ARRAY];
382 } DeviceClass;
383 struct
384 {
385 WCHAR DeviceIds[ANYSIZE_ARRAY];
386 } TargetDevice;
387 struct
388 {
389 WCHAR DeviceId[ANYSIZE_ARRAY];
390 } InstallDevice;
391 struct
392 {
393 PVOID NotificationStructure;
394 WCHAR DeviceIds[ANYSIZE_ARRAY];
395 } CustomNotification;
396 struct
397 {
398 PVOID Notification;
399 } ProfileNotification;
400 struct
401 {
402 ULONG NotificationCode;
403 ULONG NotificationData;
404 } PowerNotification;
405 struct
406 {
407 PNP_VETO_TYPE VetoType;
408 WCHAR DeviceIdVetoNameBuffer[ANYSIZE_ARRAY];
409 } VetoNotification;
410 struct
411 {
412 GUID BlockedDriverGuid;
413 } BlockedDriverNotification;
414 };
415 } PLUGPLAY_EVENT_BLOCK, *PPLUGPLAY_EVENT_BLOCK;
416
417 //
418 // Plug and Play Control Classes
419 //
420
421 //Class 0x09
422 typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA
423 {
424 UNICODE_STRING DeviceInstance;
425 LPGUID FilterGuid;
426 ULONG Flags;
427 PVOID Buffer;
428 ULONG BufferSize;
429 } PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA, *PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA;
430
431 //Class 0x0A
432 typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA
433 {
434 UNICODE_STRING DeviceInstance;
435 ULONG Property;
436 PVOID Buffer;
437 ULONG BufferSize;
438 } PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA;
439
440 // Class 0x0C
441 typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA
442 {
443 UNICODE_STRING TargetDeviceInstance;
444 ULONG Relation;
445 PWCHAR RelatedDeviceInstance;
446 ULONG RelatedDeviceInstanceLength;
447 } PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA;
448
449 // Class 0x0E
450 typedef struct _PLUGPLAY_CONTOL_STATUS_DATA
451 {
452 UNICODE_STRING DeviceInstance;
453 ULONG Operation;
454 ULONG DeviceStatus;
455 ULONG DeviceProblem;
456 } PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
457
458 // Class 0x0F
459 typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA
460 {
461 UNICODE_STRING DeviceInstance;
462 ULONG Depth;
463 } PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA;
464
465 // Class 0x10
466 typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA
467 {
468 UNICODE_STRING DeviceInstance;
469 ULONG Relations; // 0:EjectRelations, 1:RemovalRelations, 3:BusRelations
470 ULONG BufferSize;
471 PWCHAR Buffer;
472 } PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA, *PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA;
473
474 // Class 0x13
475 typedef struct _PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA
476 {
477 ULONG DeviceInstanceLength;
478 PWSTR DeviceInstance;
479 } PLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA, *PPLUGPLAY_CONTROL_RETRIEVE_DOCK_DATA;
480
481 // Class 0x14
482 typedef struct _PLUGPLAY_CONTROL_RESET_DEVICE_DATA
483 {
484 UNICODE_STRING DeviceInstance;
485 } PLUGPLAY_CONTROL_RESET_DEVICE_DATA, *PPLUGPLAY_CONTROL_RESET_DEVICE_DATA;
486
487 //
488 // Plug and Play Bus Type Definition
489 //
490 typedef struct _PLUGPLAY_BUS_TYPE
491 {
492 PLUGPLAY_BUS_CLASS BusClass;
493 union
494 {
495 INTERFACE_TYPE SystemBusType;
496 PLUGPLAY_VIRTUAL_BUS_TYPE PlugPlayVirtualBusType;
497 };
498 } PLUGPLAY_BUS_TYPE, *PPLUGPLAY_BUS_TYPE;
499
500 //
501 // Plug and Play Bus Instance Definition
502 //
503 typedef struct _PLUGPLAY_BUS_INSTANCE
504 {
505 PLUGPLAY_BUS_TYPE BusType;
506 ULONG BusNumber;
507 WCHAR BusName[MAX_BUS_NAME];
508 } PLUGPLAY_BUS_INSTANCE, *PPLUGPLAY_BUS_INSTANCE;
509
510 #ifdef NTOS_MODE_USER
511
512 //
513 // Partial Resource Descriptor and List for Hardware
514 //
515 #include <pshpack1.h>
516 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
517 {
518 UCHAR Type;
519 UCHAR ShareDisposition;
520 USHORT Flags;
521 union
522 {
523 struct
524 {
525 PHYSICAL_ADDRESS Start;
526 ULONG Length;
527 } Generic;
528 struct
529 {
530 PHYSICAL_ADDRESS Start;
531 ULONG Length;
532 } Port;
533 struct
534 {
535 ULONG Level;
536 ULONG Vector;
537 KAFFINITY Affinity;
538 } Interrupt;
539 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
540 struct
541 {
542 union
543 {
544 struct
545 {
546 USHORT Reserved;
547 USHORT MessageCount;
548 ULONG Vector;
549 KAFFINITY Affinity;
550 } Raw;
551 struct
552 {
553 ULONG Level;
554 ULONG Vector;
555 KAFFINITY Affinity;
556 } Translated;
557 };
558 } MessageInterrupt;
559 #endif
560 struct
561 {
562 PHYSICAL_ADDRESS Start;
563 ULONG Length;
564 } Memory;
565 struct
566 {
567 ULONG Channel;
568 ULONG Port;
569 ULONG Reserved1;
570 } Dma;
571 struct
572 {
573 ULONG Data[3];
574 } DevicePrivate;
575 struct
576 {
577 ULONG Start;
578 ULONG Length;
579 ULONG Reserved;
580 } BusNumber;
581 struct
582 {
583 ULONG DataSize;
584 ULONG Reserved1;
585 ULONG Reserved2;
586 } DeviceSpecificData;
587 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
588 struct
589 {
590 PHYSICAL_ADDRESS Start;
591 ULONG Length40;
592 } Memory40;
593 struct
594 {
595 PHYSICAL_ADDRESS Start;
596 ULONG Length48;
597 } Memory48;
598 struct
599 {
600 PHYSICAL_ADDRESS Start;
601 ULONG Length64;
602 } Memory64;
603 #endif
604 } u;
605 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
606
607 typedef struct _CM_PARTIAL_RESOURCE_LIST
608 {
609 USHORT Version;
610 USHORT Revision;
611 ULONG Count;
612 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
613 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
614
615 //
616 // Full Resource Descriptor and List for Hardware
617 //
618 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
619 {
620 INTERFACE_TYPE InterfaceType;
621 ULONG BusNumber;
622 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
623 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
624
625 typedef struct _CM_RESOURCE_LIST
626 {
627 ULONG Count;
628 CM_FULL_RESOURCE_DESCRIPTOR List[1];
629 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
630
631 //
632 // ROM Block Structure
633 //
634 typedef struct _CM_ROM_BLOCK
635 {
636 ULONG Address;
637 ULONG Size;
638 } CM_ROM_BLOCK, *PCM_ROM_BLOCK;
639
640 //
641 // Disk/INT13 Structures
642 //
643 typedef struct _CM_INT13_DRIVE_PARAMETER
644 {
645 USHORT DriveSelect;
646 ULONG MaxCylinders;
647 USHORT SectorsPerTrack;
648 USHORT MaxHeads;
649 USHORT NumberDrives;
650 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
651
652 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
653 {
654 ULONG BytesPerSector;
655 ULONG NumberOfCylinders;
656 ULONG SectorsPerTrack;
657 ULONG NumberOfHeads;
658 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
659
660 #include <poppack.h>
661
662 #endif // _!NTOS_MODE_USER
663
664 #endif // _CMTYPES_H
665
666
667