[NDK]
[reactos.git] / reactos / 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 LPWSTR FilterGuid;
426 PVOID Buffer;
427 ULONG BufferSize;
428 } PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA, *PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA;
429
430 //Class 0x0A
431 typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA
432 {
433 UNICODE_STRING DeviceInstance;
434 ULONG Property;
435 PVOID Buffer;
436 ULONG BufferSize;
437 } PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA;
438
439 // Class 0x0C
440 typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA
441 {
442 UNICODE_STRING TargetDeviceInstance;
443 ULONG Relation;
444 PWCHAR RelatedDeviceInstance;
445 ULONG RelatedDeviceInstanceLength;
446 } PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA;
447
448 // Class 0x0E
449 typedef struct _PLUGPLAY_CONTOL_STATUS_DATA
450 {
451 UNICODE_STRING DeviceInstance;
452 ULONG Operation;
453 ULONG DeviceStatus;
454 ULONG DeviceProblem;
455 } PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
456
457 // Class 0x0F
458 typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA
459 {
460 UNICODE_STRING DeviceInstance;
461 ULONG Depth;
462 } PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA;
463
464 // Class 0x14
465 typedef struct _PLUGPLAY_CONTROL_RESET_DEVICE_DATA
466 {
467 UNICODE_STRING DeviceInstance;
468 } PLUGPLAY_CONTROL_RESET_DEVICE_DATA, *PPLUGPLAY_CONTROL_RESET_DEVICE_DATA;
469
470 //
471 // Plug and Play Bus Type Definition
472 //
473 typedef struct _PLUGPLAY_BUS_TYPE
474 {
475 PLUGPLAY_BUS_CLASS BusClass;
476 union
477 {
478 INTERFACE_TYPE SystemBusType;
479 PLUGPLAY_VIRTUAL_BUS_TYPE PlugPlayVirtualBusType;
480 };
481 } PLUGPLAY_BUS_TYPE, *PPLUGPLAY_BUS_TYPE;
482
483 //
484 // Plug and Play Bus Instance Definition
485 //
486 typedef struct _PLUGPLAY_BUS_INSTANCE
487 {
488 PLUGPLAY_BUS_TYPE BusType;
489 ULONG BusNumber;
490 WCHAR BusName[MAX_BUS_NAME];
491 } PLUGPLAY_BUS_INSTANCE, *PPLUGPLAY_BUS_INSTANCE;
492
493 #ifdef NTOS_MODE_USER
494
495 //
496 // Partial Resource Descriptor and List for Hardware
497 //
498 #include <pshpack1.h>
499 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
500 {
501 UCHAR Type;
502 UCHAR ShareDisposition;
503 USHORT Flags;
504 union
505 {
506 struct
507 {
508 PHYSICAL_ADDRESS Start;
509 ULONG Length;
510 } Generic;
511 struct
512 {
513 PHYSICAL_ADDRESS Start;
514 ULONG Length;
515 } Port;
516 struct
517 {
518 ULONG Level;
519 ULONG Vector;
520 KAFFINITY Affinity;
521 } Interrupt;
522 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
523 struct
524 {
525 union
526 {
527 struct
528 {
529 USHORT Reserved;
530 USHORT MessageCount;
531 ULONG Vector;
532 KAFFINITY Affinity;
533 } Raw;
534 struct
535 {
536 ULONG Level;
537 ULONG Vector;
538 KAFFINITY Affinity;
539 } Translated;
540 };
541 } MessageInterrupt;
542 #endif
543 struct
544 {
545 PHYSICAL_ADDRESS Start;
546 ULONG Length;
547 } Memory;
548 struct
549 {
550 ULONG Channel;
551 ULONG Port;
552 ULONG Reserved1;
553 } Dma;
554 struct
555 {
556 ULONG Data[3];
557 } DevicePrivate;
558 struct
559 {
560 ULONG Start;
561 ULONG Length;
562 ULONG Reserved;
563 } BusNumber;
564 struct
565 {
566 ULONG DataSize;
567 ULONG Reserved1;
568 ULONG Reserved2;
569 } DeviceSpecificData;
570 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
571 struct
572 {
573 PHYSICAL_ADDRESS Start;
574 ULONG Length40;
575 } Memory40;
576 struct
577 {
578 PHYSICAL_ADDRESS Start;
579 ULONG Length48;
580 } Memory48;
581 struct
582 {
583 PHYSICAL_ADDRESS Start;
584 ULONG Length64;
585 } Memory64;
586 #endif
587 } u;
588 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
589
590 typedef struct _CM_PARTIAL_RESOURCE_LIST
591 {
592 USHORT Version;
593 USHORT Revision;
594 ULONG Count;
595 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
596 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
597
598 //
599 // Full Resource Descriptor and List for Hardware
600 //
601 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
602 {
603 INTERFACE_TYPE InterfaceType;
604 ULONG BusNumber;
605 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
606 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
607
608 typedef struct _CM_RESOURCE_LIST
609 {
610 ULONG Count;
611 CM_FULL_RESOURCE_DESCRIPTOR List[1];
612 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
613
614 //
615 // ROM Block Structure
616 //
617 typedef struct _CM_ROM_BLOCK
618 {
619 ULONG Address;
620 ULONG Size;
621 } CM_ROM_BLOCK, *PCM_ROM_BLOCK;
622
623 //
624 // Disk/INT13 Structures
625 //
626 typedef struct _CM_INT13_DRIVE_PARAMETER
627 {
628 USHORT DriveSelect;
629 ULONG MaxCylinders;
630 USHORT SectorsPerTrack;
631 USHORT MaxHeads;
632 USHORT NumberDrives;
633 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
634
635 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
636 {
637 ULONG BytesPerSector;
638 ULONG NumberOfCylinders;
639 ULONG SectorsPerTrack;
640 ULONG NumberOfHeads;
641 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
642
643 #include <poppack.h>
644
645 #endif // _!NTOS_MODE_USER
646
647 #endif // _CMTYPES_H
648
649
650