[USB]
[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 PlugPlayControlUserResponse = 0x07,
175 PlugPlayControlProperty = 0x0A,
176 PlugPlayControlGetRelatedDevice = 0x0C,
177 PlugPlayControlDeviceStatus = 0x0E,
178 PlugPlayControlGetDeviceDepth,
179 PlugPlayControlResetDevice = 0x14
180 } PLUGPLAY_CONTROL_CLASS;
181
182 typedef enum _PLUGPLAY_BUS_CLASS
183 {
184 SystemBus,
185 PlugPlayVirtualBus,
186 MaxPlugPlayBusClass
187 } PLUGPLAY_BUS_CLASS, *PPLUGPLAY_BUS_CLASS;
188
189 //
190 // Plag and Play Bus Types
191 //
192 typedef enum _PLUGPLAY_VIRTUAL_BUS_TYPE
193 {
194 Root,
195 MaxPlugPlayVirtualBusType
196 } PLUGPLAY_VIRTUAL_BUS_TYPE, *PPLUGPLAY_VIRTUAL_BUS_TYPE;
197
198 //
199 // Plag and Play Event Categories
200 //
201 typedef enum _PLUGPLAY_EVENT_CATEGORY
202 {
203 HardwareProfileChangeEvent,
204 TargetDeviceChangeEvent,
205 DeviceClassChangeEvent,
206 CustomDeviceEvent,
207 DeviceInstallEvent,
208 DeviceArrivalEvent,
209 PowerEvent,
210 VetoEvent,
211 BlockedDriverEvent,
212 MaxPlugEventCategory
213 } PLUGPLAY_EVENT_CATEGORY;
214
215 #ifdef NTOS_MODE_USER
216
217 //
218 // Information Structures for NtQueryKeyInformation
219 //
220 typedef struct _KEY_WRITE_TIME_INFORMATION
221 {
222 LARGE_INTEGER LastWriteTime;
223 } KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
224
225 typedef struct _KEY_WOW64_FLAGS_INFORMATION
226 {
227 ULONG UserFlags;
228 } KEY_WOW64_FLAGS_INFORMATION, *PKEY_WOW64_FLAGS_INFORMATION;
229
230 typedef struct _KEY_USER_FLAGS_INFORMATION
231 {
232 ULONG UserFlags;
233 } KEY_USER_FLAGS_INFORMATION, *PKEY_USER_FLAGS_INFORMATION;
234
235 typedef struct _KEY_HANDLE_TAGS_INFORMATION
236 {
237 ULONG HandleTags;
238 } KEY_HANDLE_TAGS_INFORMATION, *PKEY_HANDLE_TAGS_INFORMATION;
239
240 typedef struct _KEY_CONTROL_FLAGS_INFORMATION
241 {
242 ULONG ControlFlags;
243 } KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION;
244
245 typedef struct _KEY_VIRTUALIZATION_INFORMATION
246 {
247 ULONG VirtualizationCandidate:1;
248 ULONG VirtualizationEnabled:1;
249 ULONG VirtualTarget:1;
250 ULONG VirtualStore:1;
251 ULONG VirtualSource:1;
252 ULONG Reserved:27;
253 } KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION;
254
255 typedef struct _KEY_SET_VIRTUALIZATION_INFORMATION
256 {
257 ULONG VirtualTarget:1;
258 ULONG VirtualStore:1;
259 ULONG VirtualSource:1;
260 ULONG Reserved:29;
261 } KEY_SET_VIRTUALIZATION_INFORMATION, *PKEY_SET_VIRTUALIZATION_INFORMATION;
262
263
264 typedef struct _KEY_FULL_INFORMATION
265 {
266 LARGE_INTEGER LastWriteTime;
267 ULONG TitleIndex;
268 ULONG ClassOffset;
269 ULONG ClassLength;
270 ULONG SubKeys;
271 ULONG MaxNameLen;
272 ULONG MaxClassLen;
273 ULONG Values;
274 ULONG MaxValueNameLen;
275 ULONG MaxValueDataLen;
276 WCHAR Class[1];
277 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
278
279 typedef struct _KEY_NAME_INFORMATION
280 {
281 WCHAR Name[1];
282 } KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
283
284
285 typedef struct _KEY_NODE_INFORMATION
286 {
287 LARGE_INTEGER LastWriteTime;
288 ULONG TitleIndex;
289 ULONG ClassOffset;
290 ULONG ClassLength;
291 ULONG NameLength;
292 WCHAR Name[1];
293 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
294
295 typedef struct _KEY_VALUE_ENTRY
296 {
297 PUNICODE_STRING ValueName;
298 ULONG DataLength;
299 ULONG DataOffset;
300 ULONG Type;
301 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
302
303 typedef struct _KEY_VALUE_PARTIAL_INFORMATION
304 {
305 ULONG TitleIndex;
306 ULONG Type;
307 ULONG DataLength;
308 UCHAR Data[1];
309 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
310
311 typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
312 {
313 ULONG Type;
314 ULONG DataLength;
315 UCHAR Data[1];
316 } KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
317
318 typedef struct _KEY_VALUE_BASIC_INFORMATION
319 {
320 ULONG TitleIndex;
321 ULONG Type;
322 ULONG NameLength;
323 WCHAR Name[1];
324 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
325
326 typedef struct _KEY_VALUE_FULL_INFORMATION
327 {
328 ULONG TitleIndex;
329 ULONG Type;
330 ULONG DataOffset;
331 ULONG DataLength;
332 ULONG NameLength;
333 WCHAR Name[1];
334 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
335
336 typedef struct _KEY_BASIC_INFORMATION
337 {
338 LARGE_INTEGER LastWriteTime;
339 ULONG TitleIndex;
340 ULONG NameLength;
341 WCHAR Name[1];
342 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
343
344 #endif
345
346 //
347 // Plug and Play Event Block
348 //
349 typedef struct _PLUGPLAY_EVENT_BLOCK
350 {
351 GUID EventGuid;
352 PLUGPLAY_EVENT_CATEGORY EventCategory;
353 PULONG Result;
354 ULONG Flags;
355 ULONG TotalSize;
356 PVOID DeviceObject;
357 union
358 {
359 struct
360 {
361 GUID ClassGuid;
362 WCHAR SymbolicLinkName[ANYSIZE_ARRAY];
363 } DeviceClass;
364 struct
365 {
366 WCHAR DeviceIds[ANYSIZE_ARRAY];
367 } TargetDevice;
368 struct
369 {
370 WCHAR DeviceId[ANYSIZE_ARRAY];
371 } InstallDevice;
372 struct
373 {
374 PVOID NotificationStructure;
375 WCHAR DeviceIds[ANYSIZE_ARRAY];
376 } CustomNotification;
377 struct
378 {
379 PVOID Notification;
380 } ProfileNotification;
381 struct
382 {
383 ULONG NotificationCode;
384 ULONG NotificationData;
385 } PowerNotification;
386 struct
387 {
388 PNP_VETO_TYPE VetoType;
389 WCHAR DeviceIdVetoNameBuffer[ANYSIZE_ARRAY];
390 } VetoNotification;
391 struct
392 {
393 GUID BlockedDriverGuid;
394 } BlockedDriverNotification;
395 };
396 } PLUGPLAY_EVENT_BLOCK, *PPLUGPLAY_EVENT_BLOCK;
397
398 //
399 // Plug and Play Control Classes
400 //
401
402 //Class 0x0A
403 typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA
404 {
405 UNICODE_STRING DeviceInstance;
406 ULONG Property;
407 PVOID Buffer;
408 ULONG BufferSize;
409 } PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA;
410
411 // Class 0x0C
412 typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA
413 {
414 UNICODE_STRING TargetDeviceInstance;
415 ULONG Relation;
416 PWCHAR RelatedDeviceInstance;
417 ULONG RelatedDeviceInstanceLength;
418 } PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA;
419
420 // Class 0x0E
421 typedef struct _PLUGPLAY_CONTOL_STATUS_DATA
422 {
423 UNICODE_STRING DeviceInstance;
424 ULONG Operation;
425 ULONG DeviceStatus;
426 ULONG DeviceProblem;
427 } PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA;
428
429 // Class 0x0F
430 typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA
431 {
432 UNICODE_STRING DeviceInstance;
433 ULONG Depth;
434 } PLUGPLAY_CONTROL_DEPTH_DATA, *PPLUGPLAY_CONTROL_DEPTH_DATA;
435
436 // Class 0x14
437 typedef struct _PLUGPLAY_CONTROL_RESET_DEVICE_DATA
438 {
439 UNICODE_STRING DeviceInstance;
440 } PLUGPLAY_CONTROL_RESET_DEVICE_DATA, *PPLUGPLAY_CONTROL_RESET_DEVICE_DATA;
441
442 //
443 // Plug and Play Bus Type Definition
444 //
445 typedef struct _PLUGPLAY_BUS_TYPE
446 {
447 PLUGPLAY_BUS_CLASS BusClass;
448 union
449 {
450 INTERFACE_TYPE SystemBusType;
451 PLUGPLAY_VIRTUAL_BUS_TYPE PlugPlayVirtualBusType;
452 };
453 } PLUGPLAY_BUS_TYPE, *PPLUGPLAY_BUS_TYPE;
454
455 //
456 // Plug and Play Bus Instance Definition
457 //
458 typedef struct _PLUGPLAY_BUS_INSTANCE
459 {
460 PLUGPLAY_BUS_TYPE BusType;
461 ULONG BusNumber;
462 WCHAR BusName[MAX_BUS_NAME];
463 } PLUGPLAY_BUS_INSTANCE, *PPLUGPLAY_BUS_INSTANCE;
464
465 #ifdef NTOS_MODE_USER
466
467 //
468 // Partial Resource Descriptor and List for Hardware
469 //
470 #include <pshpack1.h>
471 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
472 {
473 UCHAR Type;
474 UCHAR ShareDisposition;
475 USHORT Flags;
476 union
477 {
478 struct
479 {
480 PHYSICAL_ADDRESS Start;
481 ULONG Length;
482 } Generic;
483 struct
484 {
485 PHYSICAL_ADDRESS Start;
486 ULONG Length;
487 } Port;
488 struct
489 {
490 ULONG Level;
491 ULONG Vector;
492 KAFFINITY Affinity;
493 } Interrupt;
494 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
495 struct
496 {
497 union
498 {
499 struct
500 {
501 USHORT Reserved;
502 USHORT MessageCount;
503 ULONG Vector;
504 KAFFINITY Affinity;
505 } Raw;
506 struct
507 {
508 ULONG Level;
509 ULONG Vector;
510 KAFFINITY Affinity;
511 } Translated;
512 };
513 } MessageInterrupt;
514 #endif
515 struct
516 {
517 PHYSICAL_ADDRESS Start;
518 ULONG Length;
519 } Memory;
520 struct
521 {
522 ULONG Channel;
523 ULONG Port;
524 ULONG Reserved1;
525 } Dma;
526 struct
527 {
528 ULONG Data[3];
529 } DevicePrivate;
530 struct
531 {
532 ULONG Start;
533 ULONG Length;
534 ULONG Reserved;
535 } BusNumber;
536 struct
537 {
538 ULONG DataSize;
539 ULONG Reserved1;
540 ULONG Reserved2;
541 } DeviceSpecificData;
542 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
543 struct
544 {
545 PHYSICAL_ADDRESS Start;
546 ULONG Length40;
547 } Memory40;
548 struct
549 {
550 PHYSICAL_ADDRESS Start;
551 ULONG Length48;
552 } Memory48;
553 struct
554 {
555 PHYSICAL_ADDRESS Start;
556 ULONG Length64;
557 } Memory64;
558 #endif
559 } u;
560 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
561
562 typedef struct _CM_PARTIAL_RESOURCE_LIST
563 {
564 USHORT Version;
565 USHORT Revision;
566 ULONG Count;
567 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
568 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
569
570 //
571 // Full Resource Descriptor and List for Hardware
572 //
573 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
574 {
575 INTERFACE_TYPE InterfaceType;
576 ULONG BusNumber;
577 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
578 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
579
580 typedef struct _CM_RESOURCE_LIST
581 {
582 ULONG Count;
583 CM_FULL_RESOURCE_DESCRIPTOR List[1];
584 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
585
586 //
587 // ROM Block Structure
588 //
589 typedef struct _CM_ROM_BLOCK
590 {
591 ULONG Address;
592 ULONG Size;
593 } CM_ROM_BLOCK, *PCM_ROM_BLOCK;
594
595 //
596 // Disk/INT13 Structures
597 //
598 typedef struct _CM_INT13_DRIVE_PARAMETER
599 {
600 USHORT DriveSelect;
601 ULONG MaxCylinders;
602 USHORT SectorsPerTrack;
603 USHORT MaxHeads;
604 USHORT NumberDrives;
605 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
606
607 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
608 {
609 ULONG BytesPerSector;
610 ULONG NumberOfCylinders;
611 ULONG SectorsPerTrack;
612 ULONG NumberOfHeads;
613 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
614
615 #include <poppack.h>
616
617 #endif // _!NTOS_MODE_USER
618
619 #endif // _CMTYPES_H
620
621
622