2ae56a60e4735bdaa1274d21de9e3cef4bef5268
[reactos.git] / sdk / include / xdk / iotypes.h
1 $if (_WDMDDK_ || _NTDDK_)
2 /******************************************************************************
3 * I/O Manager Types *
4 ******************************************************************************/
5 $endif (_WDMDDK_ || _NTDDK_)
6
7 $if (_WDMDDK_)
8
9 #define STATUS_CONTINUE_COMPLETION STATUS_SUCCESS
10
11 #define CONNECT_FULLY_SPECIFIED 0x1
12 #define CONNECT_LINE_BASED 0x2
13 #define CONNECT_MESSAGE_BASED 0x3
14 #define CONNECT_FULLY_SPECIFIED_GROUP 0x4
15 #define CONNECT_CURRENT_VERSION 0x4
16
17 #define POOL_COLD_ALLOCATION 256
18 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 8
19 #define POOL_RAISE_IF_ALLOCATION_FAILURE 16
20
21 #define IO_TYPE_ADAPTER 1
22 #define IO_TYPE_CONTROLLER 2
23 #define IO_TYPE_DEVICE 3
24 #define IO_TYPE_DRIVER 4
25 #define IO_TYPE_FILE 5
26 #define IO_TYPE_IRP 6
27 #define IO_TYPE_MASTER_ADAPTER 7
28 #define IO_TYPE_OPEN_PACKET 8
29 #define IO_TYPE_TIMER 9
30 #define IO_TYPE_VPB 10
31 #define IO_TYPE_ERROR_LOG 11
32 #define IO_TYPE_ERROR_MESSAGE 12
33 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
34
35 #define IO_TYPE_CSQ_IRP_CONTEXT 1
36 #define IO_TYPE_CSQ 2
37 #define IO_TYPE_CSQ_EX 3
38
39 /* IO_RESOURCE_DESCRIPTOR.Option */
40 #define IO_RESOURCE_PREFERRED 0x01
41 #define IO_RESOURCE_DEFAULT 0x02
42 #define IO_RESOURCE_ALTERNATIVE 0x08
43
44 $endif (_WDMDDK_)
45 $if (_WDMDDK_ || _DEVIOCTL_)
46 #define FILE_DEVICE_BEEP 0x00000001
47 #define FILE_DEVICE_CD_ROM 0x00000002
48 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
49 #define FILE_DEVICE_CONTROLLER 0x00000004
50 #define FILE_DEVICE_DATALINK 0x00000005
51 #define FILE_DEVICE_DFS 0x00000006
52 #define FILE_DEVICE_DISK 0x00000007
53 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
54 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
55 #define FILE_DEVICE_INPORT_PORT 0x0000000a
56 #define FILE_DEVICE_KEYBOARD 0x0000000b
57 #define FILE_DEVICE_MAILSLOT 0x0000000c
58 #define FILE_DEVICE_MIDI_IN 0x0000000d
59 #define FILE_DEVICE_MIDI_OUT 0x0000000e
60 #define FILE_DEVICE_MOUSE 0x0000000f
61 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
62 #define FILE_DEVICE_NAMED_PIPE 0x00000011
63 #define FILE_DEVICE_NETWORK 0x00000012
64 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
65 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
66 #define FILE_DEVICE_NULL 0x00000015
67 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
68 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
69 #define FILE_DEVICE_PRINTER 0x00000018
70 #define FILE_DEVICE_SCANNER 0x00000019
71 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
72 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
73 #define FILE_DEVICE_SCREEN 0x0000001c
74 #define FILE_DEVICE_SOUND 0x0000001d
75 #define FILE_DEVICE_STREAMS 0x0000001e
76 #define FILE_DEVICE_TAPE 0x0000001f
77 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
78 #define FILE_DEVICE_TRANSPORT 0x00000021
79 #define FILE_DEVICE_UNKNOWN 0x00000022
80 #define FILE_DEVICE_VIDEO 0x00000023
81 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
82 #define FILE_DEVICE_WAVE_IN 0x00000025
83 #define FILE_DEVICE_WAVE_OUT 0x00000026
84 #define FILE_DEVICE_8042_PORT 0x00000027
85 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
86 #define FILE_DEVICE_BATTERY 0x00000029
87 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
88 #define FILE_DEVICE_MODEM 0x0000002b
89 #define FILE_DEVICE_VDM 0x0000002c
90 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
91 #define FILE_DEVICE_SMB 0x0000002e
92 #define FILE_DEVICE_KS 0x0000002f
93 #define FILE_DEVICE_CHANGER 0x00000030
94 #define FILE_DEVICE_SMARTCARD 0x00000031
95 #define FILE_DEVICE_ACPI 0x00000032
96 #define FILE_DEVICE_DVD 0x00000033
97 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
98 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
99 #define FILE_DEVICE_DFS_VOLUME 0x00000036
100 #define FILE_DEVICE_SERENUM 0x00000037
101 #define FILE_DEVICE_TERMSRV 0x00000038
102 #define FILE_DEVICE_KSEC 0x00000039
103 #define FILE_DEVICE_FIPS 0x0000003A
104 #define FILE_DEVICE_INFINIBAND 0x0000003B
105 #define FILE_DEVICE_VMBUS 0x0000003E
106 #define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F
107 #define FILE_DEVICE_WPD 0x00000040
108 #define FILE_DEVICE_BLUETOOTH 0x00000041
109 #define FILE_DEVICE_MT_COMPOSITE 0x00000042
110 #define FILE_DEVICE_MT_TRANSPORT 0x00000043
111 #define FILE_DEVICE_BIOMETRIC 0x00000044
112 #define FILE_DEVICE_PMI 0x00000045
113
114 $endif (_WDMDDK_ || _DEVIOCTL_)
115 $if (_WDMDDK_)
116 #if defined(NT_PROCESSOR_GROUPS)
117
118 typedef USHORT IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY;
119
120 typedef enum _IRQ_DEVICE_POLICY_USHORT {
121 IrqPolicyMachineDefault = 0,
122 IrqPolicyAllCloseProcessors = 1,
123 IrqPolicyOneCloseProcessor = 2,
124 IrqPolicyAllProcessorsInMachine = 3,
125 IrqPolicyAllProcessorsInGroup = 3,
126 IrqPolicySpecifiedProcessors = 4,
127 IrqPolicySpreadMessagesAcrossAllProcessors = 5};
128
129 #else /* defined(NT_PROCESSOR_GROUPS) */
130
131 typedef enum _IRQ_DEVICE_POLICY {
132 IrqPolicyMachineDefault = 0,
133 IrqPolicyAllCloseProcessors,
134 IrqPolicyOneCloseProcessor,
135 IrqPolicyAllProcessorsInMachine,
136 IrqPolicySpecifiedProcessors,
137 IrqPolicySpreadMessagesAcrossAllProcessors
138 } IRQ_DEVICE_POLICY, *PIRQ_DEVICE_POLICY;
139
140 #endif
141
142 typedef enum _IRQ_PRIORITY {
143 IrqPriorityUndefined = 0,
144 IrqPriorityLow,
145 IrqPriorityNormal,
146 IrqPriorityHigh
147 } IRQ_PRIORITY, *PIRQ_PRIORITY;
148
149 typedef enum _IRQ_GROUP_POLICY {
150 GroupAffinityAllGroupZero = 0,
151 GroupAffinityDontCare
152 } IRQ_GROUP_POLICY, *PIRQ_GROUP_POLICY;
153
154 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
155
156 typedef struct _OBJECT_HANDLE_INFORMATION {
157 ULONG HandleAttributes;
158 ACCESS_MASK GrantedAccess;
159 } OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
160
161 typedef struct _CLIENT_ID {
162 HANDLE UniqueProcess;
163 HANDLE UniqueThread;
164 } CLIENT_ID, *PCLIENT_ID;
165
166 typedef struct _VPB {
167 CSHORT Type;
168 CSHORT Size;
169 USHORT Flags;
170 USHORT VolumeLabelLength;
171 struct _DEVICE_OBJECT *DeviceObject;
172 struct _DEVICE_OBJECT *RealDevice;
173 ULONG SerialNumber;
174 ULONG ReferenceCount;
175 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
176 } VPB, *PVPB;
177
178 typedef enum _IO_ALLOCATION_ACTION {
179 KeepObject = 1,
180 DeallocateObject,
181 DeallocateObjectKeepRegisters
182 } IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
183
184 _Function_class_(DRIVER_CONTROL)
185 _IRQL_requires_same_
186 typedef IO_ALLOCATION_ACTION
187 (NTAPI DRIVER_CONTROL)(
188 _In_ struct _DEVICE_OBJECT *DeviceObject,
189 _Inout_ struct _IRP *Irp,
190 _In_ PVOID MapRegisterBase,
191 _In_ PVOID Context);
192 typedef DRIVER_CONTROL *PDRIVER_CONTROL;
193
194 typedef struct _WAIT_CONTEXT_BLOCK {
195 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
196 PDRIVER_CONTROL DeviceRoutine;
197 PVOID DeviceContext;
198 ULONG NumberOfMapRegisters;
199 PVOID DeviceObject;
200 PVOID CurrentIrp;
201 PKDPC BufferChainingDpc;
202 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
203
204 $endif (_WDMDDK_)
205 $if (_NTDDK_)
206 /* DEVICE_OBJECT.Flags */
207 #define DO_DEVICE_HAS_NAME 0x00000040
208 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
209 #define DO_LONG_TERM_REQUESTS 0x00000200
210 #define DO_NEVER_LAST_DEVICE 0x00000400
211 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
212 #define DO_SUPPORTS_TRANSACTIONS 0x00040000
213 #define DO_FORCE_NEITHER_IO 0x00080000
214 #define DO_VOLUME_DEVICE_OBJECT 0x00100000
215 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
216 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
217 #define DO_DISALLOW_EXECUTE 0x00800000
218
219 $endif (_NTDDK_)
220 $if (_WDMDDK_)
221 /* DEVICE_OBJECT.Flags */
222 #define DO_UNLOAD_PENDING 0x00000001
223 #define DO_VERIFY_VOLUME 0x00000002
224 #define DO_BUFFERED_IO 0x00000004
225 #define DO_EXCLUSIVE 0x00000008
226 #define DO_DIRECT_IO 0x00000010
227 #define DO_MAP_IO_BUFFER 0x00000020
228 #define DO_DEVICE_INITIALIZING 0x00000080
229 #define DO_SHUTDOWN_REGISTERED 0x00000800
230 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
231 #define DO_POWER_PAGABLE 0x00002000
232 #define DO_POWER_INRUSH 0x00004000
233
234 /* DEVICE_OBJECT.Characteristics */
235 #define FILE_REMOVABLE_MEDIA 0x00000001
236 #define FILE_READ_ONLY_DEVICE 0x00000002
237 #define FILE_FLOPPY_DISKETTE 0x00000004
238 #define FILE_WRITE_ONCE_MEDIA 0x00000008
239 #define FILE_REMOTE_DEVICE 0x00000010
240 #define FILE_DEVICE_IS_MOUNTED 0x00000020
241 #define FILE_VIRTUAL_VOLUME 0x00000040
242 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
243 #define FILE_DEVICE_SECURE_OPEN 0x00000100
244 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
245 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
246 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
247
248 /* DEVICE_OBJECT.AlignmentRequirement */
249 #define FILE_BYTE_ALIGNMENT 0x00000000
250 #define FILE_WORD_ALIGNMENT 0x00000001
251 #define FILE_LONG_ALIGNMENT 0x00000003
252 #define FILE_QUAD_ALIGNMENT 0x00000007
253 #define FILE_OCTA_ALIGNMENT 0x0000000f
254 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
255 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
256 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
257 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
258 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
259
260 $endif (_NTDDK_)
261 $if (_WDMDDK_ || _DEVIOCTL_)
262 /* DEVICE_OBJECT.DeviceType */
263 #define DEVICE_TYPE ULONG
264
265 $endif (_WDMDDK_ || _DEVIOCTL_)
266 $if (_WDMDDK_)
267 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {
268 CSHORT Type;
269 USHORT Size;
270 LONG ReferenceCount;
271 struct _DRIVER_OBJECT *DriverObject;
272 struct _DEVICE_OBJECT *NextDevice;
273 struct _DEVICE_OBJECT *AttachedDevice;
274 struct _IRP *CurrentIrp;
275 PIO_TIMER Timer;
276 ULONG Flags;
277 ULONG Characteristics;
278 volatile PVPB Vpb;
279 PVOID DeviceExtension;
280 DEVICE_TYPE DeviceType;
281 CCHAR StackSize;
282 union {
283 LIST_ENTRY ListEntry;
284 WAIT_CONTEXT_BLOCK Wcb;
285 } Queue;
286 ULONG AlignmentRequirement;
287 KDEVICE_QUEUE DeviceQueue;
288 KDPC Dpc;
289 ULONG ActiveThreadCount;
290 PSECURITY_DESCRIPTOR SecurityDescriptor;
291 KEVENT DeviceLock;
292 USHORT SectorSize;
293 USHORT Spare1;
294 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
295 PVOID Reserved;
296 } DEVICE_OBJECT, *PDEVICE_OBJECT;
297
298 typedef enum _IO_SESSION_STATE {
299 IoSessionStateCreated = 1,
300 IoSessionStateInitialized,
301 IoSessionStateConnected,
302 IoSessionStateDisconnected,
303 IoSessionStateDisconnectedLoggedOn,
304 IoSessionStateLoggedOn,
305 IoSessionStateLoggedOff,
306 IoSessionStateTerminated,
307 IoSessionStateMax
308 } IO_SESSION_STATE, *PIO_SESSION_STATE;
309
310 typedef enum _IO_COMPLETION_ROUTINE_RESULT {
311 ContinueCompletion = STATUS_CONTINUE_COMPLETION,
312 StopCompletion = STATUS_MORE_PROCESSING_REQUIRED
313 } IO_COMPLETION_ROUTINE_RESULT, *PIO_COMPLETION_ROUTINE_RESULT;
314
315 typedef struct _IO_INTERRUPT_MESSAGE_INFO_ENTRY {
316 PHYSICAL_ADDRESS MessageAddress;
317 KAFFINITY TargetProcessorSet;
318 PKINTERRUPT InterruptObject;
319 ULONG MessageData;
320 ULONG Vector;
321 KIRQL Irql;
322 KINTERRUPT_MODE Mode;
323 KINTERRUPT_POLARITY Polarity;
324 } IO_INTERRUPT_MESSAGE_INFO_ENTRY, *PIO_INTERRUPT_MESSAGE_INFO_ENTRY;
325
326 typedef struct _IO_INTERRUPT_MESSAGE_INFO {
327 KIRQL UnifiedIrql;
328 ULONG MessageCount;
329 IO_INTERRUPT_MESSAGE_INFO_ENTRY MessageInfo[1];
330 } IO_INTERRUPT_MESSAGE_INFO, *PIO_INTERRUPT_MESSAGE_INFO;
331
332 typedef struct _IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS {
333 _In_ PDEVICE_OBJECT PhysicalDeviceObject;
334 _Out_ PKINTERRUPT *InterruptObject;
335 _In_ PKSERVICE_ROUTINE ServiceRoutine;
336 _In_ PVOID ServiceContext;
337 _In_opt_ PKSPIN_LOCK SpinLock;
338 _In_ KIRQL SynchronizeIrql;
339 _In_ BOOLEAN FloatingSave;
340 _In_ BOOLEAN ShareVector;
341 _In_ ULONG Vector;
342 _In_ KIRQL Irql;
343 _In_ KINTERRUPT_MODE InterruptMode;
344 _In_ KAFFINITY ProcessorEnableMask;
345 _In_ USHORT Group;
346 } IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS, *PIO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS;
347
348 typedef struct _IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS {
349 _In_ PDEVICE_OBJECT PhysicalDeviceObject;
350 _Out_ PKINTERRUPT *InterruptObject;
351 _In_ PKSERVICE_ROUTINE ServiceRoutine;
352 _In_ PVOID ServiceContext;
353 _In_opt_ PKSPIN_LOCK SpinLock;
354 _In_opt_ KIRQL SynchronizeIrql;
355 _In_ BOOLEAN FloatingSave;
356 } IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS, *PIO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS;
357
358 typedef struct _IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS {
359 _In_ PDEVICE_OBJECT PhysicalDeviceObject;
360 union {
361 _Out_ PVOID *Generic;
362 _Out_ PIO_INTERRUPT_MESSAGE_INFO *InterruptMessageTable;
363 _Out_ PKINTERRUPT *InterruptObject;
364 } ConnectionContext;
365 _In_ PKMESSAGE_SERVICE_ROUTINE MessageServiceRoutine;
366 _In_ PVOID ServiceContext;
367 _In_opt_ PKSPIN_LOCK SpinLock;
368 _In_opt_ KIRQL SynchronizeIrql;
369 _In_ BOOLEAN FloatingSave;
370 _In_opt_ PKSERVICE_ROUTINE FallBackServiceRoutine;
371 } IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS, *PIO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS;
372
373 typedef struct _IO_CONNECT_INTERRUPT_PARAMETERS {
374 _Inout_ ULONG Version;
375 _ANONYMOUS_UNION union {
376 IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS FullySpecified;
377 IO_CONNECT_INTERRUPT_LINE_BASED_PARAMETERS LineBased;
378 IO_CONNECT_INTERRUPT_MESSAGE_BASED_PARAMETERS MessageBased;
379 } DUMMYUNIONNAME;
380 } IO_CONNECT_INTERRUPT_PARAMETERS, *PIO_CONNECT_INTERRUPT_PARAMETERS;
381
382 typedef struct _IO_DISCONNECT_INTERRUPT_PARAMETERS {
383 _In_ ULONG Version;
384 union {
385 _In_ PVOID Generic;
386 _In_ PKINTERRUPT InterruptObject;
387 _In_ PIO_INTERRUPT_MESSAGE_INFO InterruptMessageTable;
388 } ConnectionContext;
389 } IO_DISCONNECT_INTERRUPT_PARAMETERS, *PIO_DISCONNECT_INTERRUPT_PARAMETERS;
390
391 typedef enum _IO_ACCESS_TYPE {
392 ReadAccess,
393 WriteAccess,
394 ModifyAccess
395 } IO_ACCESS_TYPE;
396
397 typedef enum _IO_ACCESS_MODE {
398 SequentialAccess,
399 RandomAccess
400 } IO_ACCESS_MODE;
401
402 typedef enum _IO_CONTAINER_NOTIFICATION_CLASS {
403 IoSessionStateNotification,
404 IoMaxContainerNotificationClass
405 } IO_CONTAINER_NOTIFICATION_CLASS;
406
407 typedef struct _IO_SESSION_STATE_NOTIFICATION {
408 ULONG Size;
409 ULONG Flags;
410 PVOID IoObject;
411 ULONG EventMask;
412 PVOID Context;
413 } IO_SESSION_STATE_NOTIFICATION, *PIO_SESSION_STATE_NOTIFICATION;
414
415 typedef enum _IO_CONTAINER_INFORMATION_CLASS {
416 IoSessionStateInformation,
417 IoMaxContainerInformationClass
418 } IO_CONTAINER_INFORMATION_CLASS;
419
420 typedef struct _IO_SESSION_STATE_INFORMATION {
421 ULONG SessionId;
422 IO_SESSION_STATE SessionState;
423 BOOLEAN LocalSession;
424 } IO_SESSION_STATE_INFORMATION, *PIO_SESSION_STATE_INFORMATION;
425
426 #if (NTDDI_VERSION >= NTDDI_WIN7)
427
428 typedef NTSTATUS
429 (NTAPI *PIO_CONTAINER_NOTIFICATION_FUNCTION)(
430 VOID);
431
432 typedef NTSTATUS
433 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
434 _In_ PVOID SessionObject,
435 _In_ PVOID IoObject,
436 _In_ ULONG Event,
437 _In_ PVOID Context,
438 _In_reads_bytes_opt_(PayloadLength) PVOID NotificationPayload,
439 _In_ ULONG PayloadLength);
440
441 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
442
443 #endif
444
445 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
446
447 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
448 BOOLEAN Removed;
449 BOOLEAN Reserved[3];
450 volatile LONG IoCount;
451 KEVENT RemoveEvent;
452 } IO_REMOVE_LOCK_COMMON_BLOCK;
453
454 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
455 LONG Signature;
456 LONG HighWatermark;
457 LONGLONG MaxLockedTicks;
458 LONG AllocateTag;
459 LIST_ENTRY LockList;
460 KSPIN_LOCK Spin;
461 volatile LONG LowMemoryCount;
462 ULONG Reserved1[4];
463 PVOID Reserved2;
464 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
465 } IO_REMOVE_LOCK_DBG_BLOCK;
466
467 typedef struct _IO_REMOVE_LOCK {
468 IO_REMOVE_LOCK_COMMON_BLOCK Common;
469 #if DBG
470 IO_REMOVE_LOCK_DBG_BLOCK Dbg;
471 #endif
472 } IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
473
474 typedef struct _IO_WORKITEM *PIO_WORKITEM;
475
476 _Function_class_(IO_WORKITEM_ROUTINE)
477 _IRQL_requires_(PASSIVE_LEVEL)
478 _IRQL_requires_same_
479 typedef VOID
480 (NTAPI IO_WORKITEM_ROUTINE)(
481 _In_ PDEVICE_OBJECT DeviceObject,
482 _In_opt_ PVOID Context);
483 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
484
485 typedef VOID
486 (NTAPI IO_WORKITEM_ROUTINE_EX)(
487 _In_ PVOID IoObject,
488 _In_opt_ PVOID Context,
489 _In_ PIO_WORKITEM IoWorkItem);
490 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
491
492 typedef struct _SHARE_ACCESS {
493 ULONG OpenCount;
494 ULONG Readers;
495 ULONG Writers;
496 ULONG Deleters;
497 ULONG SharedRead;
498 ULONG SharedWrite;
499 ULONG SharedDelete;
500 } SHARE_ACCESS, *PSHARE_ACCESS;
501
502 typedef enum _CREATE_FILE_TYPE {
503 CreateFileTypeNone,
504 CreateFileTypeNamedPipe,
505 CreateFileTypeMailslot
506 } CREATE_FILE_TYPE;
507
508 #define IO_FORCE_ACCESS_CHECK 0x001
509 #define IO_NO_PARAMETER_CHECKING 0x100
510
511 #define IO_REPARSE 0x0
512 #define IO_REMOUNT 0x1
513
514 typedef struct _IO_STATUS_BLOCK {
515 _ANONYMOUS_UNION union {
516 NTSTATUS Status;
517 PVOID Pointer;
518 } DUMMYUNIONNAME;
519 ULONG_PTR Information;
520 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
521
522 #if defined(_WIN64)
523 typedef struct _IO_STATUS_BLOCK32 {
524 NTSTATUS Status;
525 ULONG Information;
526 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
527 #endif
528
529 typedef VOID
530 (NTAPI *PIO_APC_ROUTINE)(
531 _In_ PVOID ApcContext,
532 _In_ PIO_STATUS_BLOCK IoStatusBlock,
533 _In_ ULONG Reserved);
534
535 #define PIO_APC_ROUTINE_DEFINED
536
537 typedef enum _IO_SESSION_EVENT {
538 IoSessionEventIgnore = 0,
539 IoSessionEventCreated,
540 IoSessionEventTerminated,
541 IoSessionEventConnected,
542 IoSessionEventDisconnected,
543 IoSessionEventLogon,
544 IoSessionEventLogoff,
545 IoSessionEventMax
546 } IO_SESSION_EVENT, *PIO_SESSION_EVENT;
547
548 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff
549 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001
550 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002
551 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004
552 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008
553 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010
554 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020
555
556 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
557
558 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L
559
560 typedef struct _IO_SESSION_CONNECT_INFO {
561 ULONG SessionId;
562 BOOLEAN LocalSession;
563 } IO_SESSION_CONNECT_INFO, *PIO_SESSION_CONNECT_INFO;
564
565 #define EVENT_INCREMENT 1
566 #define IO_NO_INCREMENT 0
567 #define IO_CD_ROM_INCREMENT 1
568 #define IO_DISK_INCREMENT 1
569 #define IO_KEYBOARD_INCREMENT 6
570 #define IO_MAILSLOT_INCREMENT 2
571 #define IO_MOUSE_INCREMENT 6
572 #define IO_NAMED_PIPE_INCREMENT 2
573 #define IO_NETWORK_INCREMENT 2
574 #define IO_PARALLEL_INCREMENT 1
575 #define IO_SERIAL_INCREMENT 2
576 #define IO_SOUND_INCREMENT 8
577 #define IO_VIDEO_INCREMENT 1
578 #define SEMAPHORE_INCREMENT 1
579
580 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
581
582 typedef struct _BOOTDISK_INFORMATION {
583 LONGLONG BootPartitionOffset;
584 LONGLONG SystemPartitionOffset;
585 ULONG BootDeviceSignature;
586 ULONG SystemDeviceSignature;
587 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
588
589 typedef struct _BOOTDISK_INFORMATION_EX {
590 LONGLONG BootPartitionOffset;
591 LONGLONG SystemPartitionOffset;
592 ULONG BootDeviceSignature;
593 ULONG SystemDeviceSignature;
594 GUID BootDeviceGuid;
595 GUID SystemDeviceGuid;
596 BOOLEAN BootDeviceIsGpt;
597 BOOLEAN SystemDeviceIsGpt;
598 } BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
599
600 #if (NTDDI_VERSION >= NTDDI_WIN7)
601
602 typedef struct _LOADER_PARTITION_INFORMATION_EX {
603 ULONG PartitionStyle;
604 ULONG PartitionNumber;
605 _ANONYMOUS_UNION union {
606 ULONG Signature;
607 GUID DeviceId;
608 } DUMMYUNIONNAME;
609 ULONG Flags;
610 } LOADER_PARTITION_INFORMATION_EX, *PLOADER_PARTITION_INFORMATION_EX;
611
612 typedef struct _BOOTDISK_INFORMATION_LITE {
613 ULONG NumberEntries;
614 LOADER_PARTITION_INFORMATION_EX Entries[1];
615 } BOOTDISK_INFORMATION_LITE, *PBOOTDISK_INFORMATION_LITE;
616
617 #else
618
619 #if (NTDDI_VERSION >= NTDDI_VISTA)
620 typedef struct _BOOTDISK_INFORMATION_LITE {
621 ULONG BootDeviceSignature;
622 ULONG SystemDeviceSignature;
623 GUID BootDeviceGuid;
624 GUID SystemDeviceGuid;
625 BOOLEAN BootDeviceIsGpt;
626 BOOLEAN SystemDeviceIsGpt;
627 } BOOTDISK_INFORMATION_LITE, *PBOOTDISK_INFORMATION_LITE;
628 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
629
630 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
631
632 #include <pshpack1.h>
633
634 typedef struct _EISA_MEMORY_TYPE {
635 UCHAR ReadWrite:1;
636 UCHAR Cached:1;
637 UCHAR Reserved0:1;
638 UCHAR Type:2;
639 UCHAR Shared:1;
640 UCHAR Reserved1:1;
641 UCHAR MoreEntries:1;
642 } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
643
644 typedef struct _EISA_MEMORY_CONFIGURATION {
645 EISA_MEMORY_TYPE ConfigurationByte;
646 UCHAR DataSize;
647 USHORT AddressLowWord;
648 UCHAR AddressHighByte;
649 USHORT MemorySize;
650 } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
651
652 typedef struct _EISA_IRQ_DESCRIPTOR {
653 UCHAR Interrupt:4;
654 UCHAR Reserved:1;
655 UCHAR LevelTriggered:1;
656 UCHAR Shared:1;
657 UCHAR MoreEntries:1;
658 } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
659
660 typedef struct _EISA_IRQ_CONFIGURATION {
661 EISA_IRQ_DESCRIPTOR ConfigurationByte;
662 UCHAR Reserved;
663 } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
664
665 typedef struct _DMA_CONFIGURATION_BYTE0 {
666 UCHAR Channel:3;
667 UCHAR Reserved:3;
668 UCHAR Shared:1;
669 UCHAR MoreEntries:1;
670 } DMA_CONFIGURATION_BYTE0;
671
672 typedef struct _DMA_CONFIGURATION_BYTE1 {
673 UCHAR Reserved0:2;
674 UCHAR TransferSize:2;
675 UCHAR Timing:2;
676 UCHAR Reserved1:2;
677 } DMA_CONFIGURATION_BYTE1;
678
679 typedef struct _EISA_DMA_CONFIGURATION {
680 DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
681 DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
682 } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
683
684 typedef struct _EISA_PORT_DESCRIPTOR {
685 UCHAR NumberPorts:5;
686 UCHAR Reserved:1;
687 UCHAR Shared:1;
688 UCHAR MoreEntries:1;
689 } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
690
691 typedef struct _EISA_PORT_CONFIGURATION {
692 EISA_PORT_DESCRIPTOR Configuration;
693 USHORT PortAddress;
694 } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
695
696 typedef struct _CM_EISA_SLOT_INFORMATION {
697 UCHAR ReturnCode;
698 UCHAR ReturnFlags;
699 UCHAR MajorRevision;
700 UCHAR MinorRevision;
701 USHORT Checksum;
702 UCHAR NumberFunctions;
703 UCHAR FunctionInformation;
704 ULONG CompressedId;
705 } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
706
707 typedef struct _CM_EISA_FUNCTION_INFORMATION {
708 ULONG CompressedId;
709 UCHAR IdSlotFlags1;
710 UCHAR IdSlotFlags2;
711 UCHAR MinorRevision;
712 UCHAR MajorRevision;
713 UCHAR Selections[26];
714 UCHAR FunctionFlags;
715 UCHAR TypeString[80];
716 EISA_MEMORY_CONFIGURATION EisaMemory[9];
717 EISA_IRQ_CONFIGURATION EisaIrq[7];
718 EISA_DMA_CONFIGURATION EisaDma[4];
719 EISA_PORT_CONFIGURATION EisaPort[20];
720 UCHAR InitializationData[60];
721 } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
722
723 #include <poppack.h>
724
725 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
726
727 #define EISA_FUNCTION_ENABLED 0x80
728 #define EISA_FREE_FORM_DATA 0x40
729 #define EISA_HAS_PORT_INIT_ENTRY 0x20
730 #define EISA_HAS_PORT_RANGE 0x10
731 #define EISA_HAS_DMA_ENTRY 0x08
732 #define EISA_HAS_IRQ_ENTRY 0x04
733 #define EISA_HAS_MEMORY_ENTRY 0x02
734 #define EISA_HAS_TYPE_ENTRY 0x01
735 #define EISA_HAS_INFORMATION \
736 (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
737 + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
738
739 #define EISA_MORE_ENTRIES 0x80
740 #define EISA_SYSTEM_MEMORY 0x00
741 #define EISA_MEMORY_TYPE_RAM 0x01
742
743 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
744
745 #define EISA_INVALID_SLOT 0x80
746 #define EISA_INVALID_FUNCTION 0x81
747 #define EISA_INVALID_CONFIGURATION 0x82
748 #define EISA_EMPTY_SLOT 0x83
749 #define EISA_INVALID_BIOS_CALL 0x86
750
751 /*
752 ** Plug and Play structures
753 */
754
755 typedef VOID
756 (NTAPI *PINTERFACE_REFERENCE)(
757 PVOID Context);
758
759 typedef VOID
760 (NTAPI *PINTERFACE_DEREFERENCE)(
761 PVOID Context);
762
763 _Function_class_(TRANSLATE_BUS_ADDRESS)
764 _IRQL_requires_same_
765 typedef BOOLEAN
766 (NTAPI TRANSLATE_BUS_ADDRESS)(
767 _Inout_opt_ PVOID Context,
768 _In_ PHYSICAL_ADDRESS BusAddress,
769 _In_ ULONG Length,
770 _Out_ PULONG AddressSpace,
771 _Out_ PPHYSICAL_ADDRESS TranslatedAddress);
772 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
773
774 _Function_class_(GET_DMA_ADAPTER)
775 _IRQL_requires_same_
776 typedef struct _DMA_ADAPTER*
777 (NTAPI GET_DMA_ADAPTER)(
778 _Inout_opt_ PVOID Context,
779 _In_ struct _DEVICE_DESCRIPTION *DeviceDescriptor,
780 _Out_ PULONG NumberOfMapRegisters);
781 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
782
783 _Function_class_(GET_SET_DEVICE_DATA)
784 _IRQL_requires_same_
785 typedef ULONG
786 (NTAPI GET_SET_DEVICE_DATA)(
787 _Inout_opt_ PVOID Context,
788 _In_ ULONG DataType,
789 _Inout_updates_bytes_(Length) PVOID Buffer,
790 _In_ ULONG Offset,
791 _In_ ULONG Length);
792 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
793
794 typedef enum _DEVICE_INSTALL_STATE {
795 InstallStateInstalled,
796 InstallStateNeedsReinstall,
797 InstallStateFailedInstall,
798 InstallStateFinishInstall
799 } DEVICE_INSTALL_STATE, *PDEVICE_INSTALL_STATE;
800
801 typedef struct _LEGACY_BUS_INFORMATION {
802 GUID BusTypeGuid;
803 INTERFACE_TYPE LegacyBusType;
804 ULONG BusNumber;
805 } LEGACY_BUS_INFORMATION, *PLEGACY_BUS_INFORMATION;
806
807 typedef enum _DEVICE_REMOVAL_POLICY {
808 RemovalPolicyExpectNoRemoval = 1,
809 RemovalPolicyExpectOrderlyRemoval = 2,
810 RemovalPolicyExpectSurpriseRemoval = 3
811 } DEVICE_REMOVAL_POLICY, *PDEVICE_REMOVAL_POLICY;
812
813 typedef VOID
814 (NTAPI *PREENUMERATE_SELF)(
815 _In_ PVOID Context);
816
817 typedef struct _REENUMERATE_SELF_INTERFACE_STANDARD {
818 USHORT Size;
819 USHORT Version;
820 PVOID Context;
821 PINTERFACE_REFERENCE InterfaceReference;
822 PINTERFACE_DEREFERENCE InterfaceDereference;
823 PREENUMERATE_SELF SurpriseRemoveAndReenumerateSelf;
824 } REENUMERATE_SELF_INTERFACE_STANDARD, *PREENUMERATE_SELF_INTERFACE_STANDARD;
825
826 typedef VOID
827 (NTAPI *PIO_DEVICE_EJECT_CALLBACK)(
828 _In_ NTSTATUS Status,
829 _Inout_opt_ PVOID Context);
830
831 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
832
833 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
834 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
835 #define PCI_USE_REVISION 0x00000002
836 #define PCI_USE_VENDEV_IDS 0x00000004
837 #define PCI_USE_CLASS_SUBCLASS 0x00000008
838 #define PCI_USE_PROGIF 0x00000010
839 #define PCI_USE_LOCAL_BUS 0x00000020
840 #define PCI_USE_LOCAL_DEVICE 0x00000040
841
842 typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS {
843 ULONG Size;
844 ULONG Flags;
845 USHORT VendorID;
846 USHORT DeviceID;
847 UCHAR RevisionID;
848 USHORT SubVendorID;
849 USHORT SubSystemID;
850 UCHAR BaseClass;
851 UCHAR SubClass;
852 UCHAR ProgIf;
853 } PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS;
854
855 _IRQL_requires_max_(PASSIVE_LEVEL)
856 _Must_inspect_result_
857 typedef BOOLEAN
858 (NTAPI PCI_IS_DEVICE_PRESENT)(
859 _In_ USHORT VendorID,
860 _In_ USHORT DeviceID,
861 _In_ UCHAR RevisionID,
862 _In_ USHORT SubVendorID,
863 _In_ USHORT SubSystemID,
864 _In_ ULONG Flags);
865 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
866
867 _IRQL_requires_max_(PASSIVE_LEVEL)
868 _Must_inspect_result_
869 typedef BOOLEAN
870 (NTAPI PCI_IS_DEVICE_PRESENT_EX)(
871 _In_ PVOID Context,
872 _In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
873 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
874
875 typedef struct _BUS_INTERFACE_STANDARD {
876 USHORT Size;
877 USHORT Version;
878 PVOID Context;
879 PINTERFACE_REFERENCE InterfaceReference;
880 PINTERFACE_DEREFERENCE InterfaceDereference;
881 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
882 PGET_DMA_ADAPTER GetDmaAdapter;
883 PGET_SET_DEVICE_DATA SetBusData;
884 PGET_SET_DEVICE_DATA GetBusData;
885 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
886
887 typedef struct _PCI_DEVICE_PRESENT_INTERFACE {
888 USHORT Size;
889 USHORT Version;
890 PVOID Context;
891 PINTERFACE_REFERENCE InterfaceReference;
892 PINTERFACE_DEREFERENCE InterfaceDereference;
893 PPCI_IS_DEVICE_PRESENT IsDevicePresent;
894 PPCI_IS_DEVICE_PRESENT_EX IsDevicePresentEx;
895 } PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE;
896
897 _Struct_size_bytes_(Size)
898 typedef struct _DEVICE_CAPABILITIES {
899 _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
900 USHORT Version;
901 ULONG DeviceD1:1;
902 ULONG DeviceD2:1;
903 ULONG LockSupported:1;
904 ULONG EjectSupported:1;
905 ULONG Removable:1;
906 ULONG DockDevice:1;
907 ULONG UniqueID:1;
908 ULONG SilentInstall:1;
909 ULONG RawDeviceOK:1;
910 ULONG SurpriseRemovalOK:1;
911 ULONG WakeFromD0:1;
912 ULONG WakeFromD1:1;
913 ULONG WakeFromD2:1;
914 ULONG WakeFromD3:1;
915 ULONG HardwareDisabled:1;
916 ULONG NonDynamic:1;
917 ULONG WarmEjectSupported:1;
918 ULONG NoDisplayInUI:1;
919 ULONG Reserved:14;
920 ULONG Address;
921 ULONG UINumber;
922 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
923 SYSTEM_POWER_STATE SystemWake;
924 DEVICE_POWER_STATE DeviceWake;
925 ULONG D1Latency;
926 ULONG D2Latency;
927 ULONG D3Latency;
928 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
929
930 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
931 USHORT Version;
932 USHORT Size;
933 GUID Event;
934 GUID InterfaceClassGuid;
935 PUNICODE_STRING SymbolicLinkName;
936 } DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
937
938 typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
939 USHORT Version;
940 USHORT Size;
941 GUID Event;
942 } HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
943
944 #undef INTERFACE
945
946 typedef struct _INTERFACE {
947 USHORT Size;
948 USHORT Version;
949 PVOID Context;
950 PINTERFACE_REFERENCE InterfaceReference;
951 PINTERFACE_DEREFERENCE InterfaceDereference;
952 } INTERFACE, *PINTERFACE;
953
954 typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
955 USHORT Version;
956 USHORT Size;
957 GUID Event;
958 } PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
959
960 typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
961
962 /* PNP_DEVICE_STATE */
963
964 #define PNP_DEVICE_DISABLED 0x00000001
965 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
966 #define PNP_DEVICE_FAILED 0x00000004
967 #define PNP_DEVICE_REMOVED 0x00000008
968 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
969 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
970
971 typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
972 USHORT Version;
973 USHORT Size;
974 GUID Event;
975 struct _FILE_OBJECT *FileObject;
976 LONG NameBufferOffset;
977 UCHAR CustomDataBuffer[1];
978 } TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
979
980 typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
981 USHORT Version;
982 USHORT Size;
983 GUID Event;
984 struct _FILE_OBJECT *FileObject;
985 } TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
986
987 #if (NTDDI_VERSION >= NTDDI_VISTA)
988 #include <devpropdef.h>
989 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
990 #endif
991
992 #define PNP_REPLACE_NO_MAP MAXLONGLONG
993
994 _Must_inspect_result_
995 typedef NTSTATUS
996 (NTAPI *PREPLACE_MAP_MEMORY)(
997 _In_ PHYSICAL_ADDRESS TargetPhysicalAddress,
998 _In_ PHYSICAL_ADDRESS SparePhysicalAddress,
999 _Inout_ PLARGE_INTEGER NumberOfBytes,
1000 _Outptr_ PVOID *TargetAddress,
1001 _Outptr_ PVOID *SpareAddress);
1002
1003 typedef struct _PNP_REPLACE_MEMORY_LIST {
1004 ULONG AllocatedCount;
1005 ULONG Count;
1006 ULONGLONG TotalLength;
1007 struct {
1008 PHYSICAL_ADDRESS Address;
1009 ULONGLONG Length;
1010 } Ranges[ANYSIZE_ARRAY];
1011 } PNP_REPLACE_MEMORY_LIST, *PPNP_REPLACE_MEMORY_LIST;
1012
1013 typedef struct _PNP_REPLACE_PROCESSOR_LIST {
1014 PKAFFINITY Affinity;
1015 _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount;
1016 ULONG AllocatedCount;
1017 ULONG Count;
1018 ULONG ApicIds[ANYSIZE_ARRAY];
1019 } PNP_REPLACE_PROCESSOR_LIST, *PPNP_REPLACE_PROCESSOR_LIST;
1020
1021 typedef struct _PNP_REPLACE_PROCESSOR_LIST_V1 {
1022 KAFFINITY AffinityMask;
1023 ULONG AllocatedCount;
1024 ULONG Count;
1025 ULONG ApicIds[ANYSIZE_ARRAY];
1026 } PNP_REPLACE_PROCESSOR_LIST_V1, *PPNP_REPLACE_PROCESSOR_LIST_V1;
1027
1028 #define PNP_REPLACE_PARAMETERS_VERSION 2
1029
1030 typedef struct _PNP_REPLACE_PARAMETERS {
1031 ULONG Size;
1032 ULONG Version;
1033 ULONG64 Target;
1034 ULONG64 Spare;
1035 PPNP_REPLACE_PROCESSOR_LIST TargetProcessors;
1036 PPNP_REPLACE_PROCESSOR_LIST SpareProcessors;
1037 PPNP_REPLACE_MEMORY_LIST TargetMemory;
1038 PPNP_REPLACE_MEMORY_LIST SpareMemory;
1039 PREPLACE_MAP_MEMORY MapMemory;
1040 } PNP_REPLACE_PARAMETERS, *PPNP_REPLACE_PARAMETERS;
1041
1042 typedef VOID
1043 (NTAPI *PREPLACE_UNLOAD)(
1044 VOID);
1045
1046 _Must_inspect_result_
1047 typedef NTSTATUS
1048 (NTAPI *PREPLACE_BEGIN)(
1049 _In_ PPNP_REPLACE_PARAMETERS Parameters,
1050 _Outptr_ PVOID *Context);
1051
1052 _Must_inspect_result_
1053 typedef NTSTATUS
1054 (NTAPI *PREPLACE_END)(
1055 _In_ PVOID Context);
1056
1057 _Must_inspect_result_
1058 typedef NTSTATUS
1059 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1060 _In_ PVOID Context,
1061 _In_ PHYSICAL_ADDRESS PhysicalAddress,
1062 _In_ LARGE_INTEGER ByteCount);
1063
1064 _Must_inspect_result_
1065 typedef NTSTATUS
1066 (NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1067 _In_ PVOID Context,
1068 _In_ ULONG ApicId,
1069 _In_ BOOLEAN Target);
1070
1071 _Must_inspect_result_
1072 typedef NTSTATUS
1073 (NTAPI *PREPLACE_SWAP)(
1074 _In_ PVOID Context);
1075
1076 _Must_inspect_result_
1077 typedef NTSTATUS
1078 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1079 _In_ PVOID Context);
1080
1081 _Must_inspect_result_
1082 typedef NTSTATUS
1083 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1084 _In_ PVOID Context);
1085
1086 _Must_inspect_result_
1087 typedef NTSTATUS
1088 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1089 _In_ PVOID Context,
1090 _In_ PHYSICAL_ADDRESS SourceAddress,
1091 _Out_ PPHYSICAL_ADDRESS DestinationAddress);
1092
1093 _Must_inspect_result_
1094 typedef NTSTATUS
1095 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1096 _In_ PVOID Context,
1097 _In_ BOOLEAN Enable);
1098
1099 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1100 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1101 FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
1102
1103 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001
1104 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002
1105 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004
1106 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008
1107 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010
1108
1109 typedef struct _PNP_REPLACE_DRIVER_INTERFACE {
1110 ULONG Size;
1111 ULONG Version;
1112 ULONG Flags;
1113 PREPLACE_UNLOAD Unload;
1114 PREPLACE_BEGIN BeginReplace;
1115 PREPLACE_END EndReplace;
1116 PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory;
1117 PREPLACE_SET_PROCESSOR_ID SetProcessorId;
1118 PREPLACE_SWAP Swap;
1119 PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror;
1120 PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory;
1121 PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination;
1122 PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce;
1123 } PNP_REPLACE_DRIVER_INTERFACE, *PPNP_REPLACE_DRIVER_INTERFACE;
1124
1125 _Must_inspect_result_
1126 typedef NTSTATUS
1127 (NTAPI *PREPLACE_DRIVER_INIT)(
1128 _Inout_ PPNP_REPLACE_DRIVER_INTERFACE Interface,
1129 _In_ PVOID Unused);
1130
1131 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
1132 DeviceUsageTypeUndefined,
1133 DeviceUsageTypePaging,
1134 DeviceUsageTypeHibernation,
1135 DeviceUsageTypeDumpFile
1136 } DEVICE_USAGE_NOTIFICATION_TYPE;
1137
1138 typedef struct _POWER_SEQUENCE {
1139 ULONG SequenceD1;
1140 ULONG SequenceD2;
1141 ULONG SequenceD3;
1142 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
1143
1144 #ifdef _PREFAST_
1145 #define __string_type 0x1000
1146 #define __guid_type 0x2000
1147 #define __multiString_type 0x4000
1148 #else
1149 #define __string_type 0
1150 #define __guid_type 0
1151 #define __multiString_type 0
1152 #endif
1153
1154 typedef enum {
1155 DevicePropertyDeviceDescription = 0x0 | __string_type,
1156 DevicePropertyHardwareID = 0x1 | __multiString_type,
1157 DevicePropertyCompatibleIDs = 0x2 | __multiString_type,
1158 DevicePropertyBootConfiguration = 0x3,
1159 DevicePropertyBootConfigurationTranslated = 0x4,
1160 DevicePropertyClassName = 0x5 | __string_type,
1161 DevicePropertyClassGuid = 0x6 | __string_type,
1162 DevicePropertyDriverKeyName = 0x7 | __string_type,
1163 DevicePropertyManufacturer = 0x8 | __string_type,
1164 DevicePropertyFriendlyName = 0x9 | __string_type,
1165 DevicePropertyLocationInformation = 0xa | __string_type,
1166 DevicePropertyPhysicalDeviceObjectName = 0xb | __string_type,
1167 DevicePropertyBusTypeGuid = 0xc | __guid_type,
1168 DevicePropertyLegacyBusType = 0xd,
1169 DevicePropertyBusNumber = 0xe,
1170 DevicePropertyEnumeratorName = 0xf | __string_type,
1171 DevicePropertyAddress = 0x10,
1172 DevicePropertyUINumber = 0x11,
1173 DevicePropertyInstallState = 0x12,
1174 DevicePropertyRemovalPolicy = 0x13,
1175 DevicePropertyResourceRequirements = 0x14,
1176 DevicePropertyAllocatedResources = 0x15,
1177 DevicePropertyContainerID = 0x16 | __string_type
1178 } DEVICE_REGISTRY_PROPERTY;
1179
1180 typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
1181 EventCategoryReserved,
1182 EventCategoryHardwareProfileChange,
1183 EventCategoryDeviceInterfaceChange,
1184 EventCategoryTargetDeviceChange
1185 } IO_NOTIFICATION_EVENT_CATEGORY;
1186
1187 typedef enum _IO_PRIORITY_HINT {
1188 IoPriorityVeryLow = 0,
1189 IoPriorityLow,
1190 IoPriorityNormal,
1191 IoPriorityHigh,
1192 IoPriorityCritical,
1193 MaxIoPriorityTypes
1194 } IO_PRIORITY_HINT;
1195
1196 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1197
1198 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1199 _IRQL_requires_max_(PASSIVE_LEVEL)
1200 typedef NTSTATUS
1201 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1202 _In_ PVOID NotificationStructure,
1203 _Inout_opt_ PVOID Context);
1204 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1205
1206 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1207 _IRQL_requires_same_
1208 typedef VOID
1209 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1210 _Inout_opt_ PVOID Context);
1211 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1212
1213 typedef enum _FILE_INFORMATION_CLASS {
1214 FileDirectoryInformation = 1,
1215 FileFullDirectoryInformation,
1216 FileBothDirectoryInformation,
1217 FileBasicInformation,
1218 FileStandardInformation,
1219 FileInternalInformation,
1220 FileEaInformation,
1221 FileAccessInformation,
1222 FileNameInformation,
1223 FileRenameInformation,
1224 FileLinkInformation,
1225 FileNamesInformation,
1226 FileDispositionInformation,
1227 FilePositionInformation,
1228 FileFullEaInformation,
1229 FileModeInformation,
1230 FileAlignmentInformation,
1231 FileAllInformation,
1232 FileAllocationInformation,
1233 FileEndOfFileInformation,
1234 FileAlternateNameInformation,
1235 FileStreamInformation,
1236 FilePipeInformation,
1237 FilePipeLocalInformation,
1238 FilePipeRemoteInformation,
1239 FileMailslotQueryInformation,
1240 FileMailslotSetInformation,
1241 FileCompressionInformation,
1242 FileObjectIdInformation,
1243 FileCompletionInformation,
1244 FileMoveClusterInformation,
1245 FileQuotaInformation,
1246 FileReparsePointInformation,
1247 FileNetworkOpenInformation,
1248 FileAttributeTagInformation,
1249 FileTrackingInformation,
1250 FileIdBothDirectoryInformation,
1251 FileIdFullDirectoryInformation,
1252 FileValidDataLengthInformation,
1253 FileShortNameInformation,
1254 #if (NTDDI_VERSION >= NTDDI_VISTA)
1255 FileIoCompletionNotificationInformation,
1256 FileIoStatusBlockRangeInformation,
1257 FileIoPriorityHintInformation,
1258 FileSfioReserveInformation,
1259 FileSfioVolumeInformation,
1260 FileHardLinkInformation,
1261 FileProcessIdsUsingFileInformation,
1262 FileNormalizedNameInformation,
1263 FileNetworkPhysicalNameInformation,
1264 #endif
1265 #if (NTDDI_VERSION >= NTDDI_WIN7)
1266 FileIdGlobalTxDirectoryInformation,
1267 FileIsRemoteDeviceInformation,
1268 FileAttributeCacheInformation,
1269 FileNumaNodeInformation,
1270 FileStandardLinkInformation,
1271 FileRemoteProtocolInformation,
1272 #endif
1273 FileMaximumInformation
1274 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
1275
1276 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS {
1277 DirectoryNotifyInformation = 1,
1278 DirectoryNotifyExtendedInformation
1279 } DIRECTORY_NOTIFY_INFORMATION_CLASS, *PDIRECTORY_NOTIFY_INFORMATION_CLASS;
1280
1281 typedef struct _FILE_POSITION_INFORMATION {
1282 LARGE_INTEGER CurrentByteOffset;
1283 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
1284
1285 typedef struct _FILE_BASIC_INFORMATION {
1286 LARGE_INTEGER CreationTime;
1287 LARGE_INTEGER LastAccessTime;
1288 LARGE_INTEGER LastWriteTime;
1289 LARGE_INTEGER ChangeTime;
1290 ULONG FileAttributes;
1291 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
1292
1293 typedef struct _FILE_IO_PRIORITY_HINT_INFORMATION {
1294 IO_PRIORITY_HINT PriorityHint;
1295 } FILE_IO_PRIORITY_HINT_INFORMATION, *PFILE_IO_PRIORITY_HINT_INFORMATION;
1296
1297 typedef struct _FILE_IO_COMPLETION_NOTIFICATION_INFORMATION {
1298 ULONG Flags;
1299 } FILE_IO_COMPLETION_NOTIFICATION_INFORMATION, *PFILE_IO_COMPLETION_NOTIFICATION_INFORMATION;
1300
1301 typedef struct _FILE_IOSTATUSBLOCK_RANGE_INFORMATION {
1302 PUCHAR IoStatusBlockRange;
1303 ULONG Length;
1304 } FILE_IOSTATUSBLOCK_RANGE_INFORMATION, *PFILE_IOSTATUSBLOCK_RANGE_INFORMATION;
1305
1306 typedef struct _FILE_IS_REMOTE_DEVICE_INFORMATION {
1307 BOOLEAN IsRemote;
1308 } FILE_IS_REMOTE_DEVICE_INFORMATION, *PFILE_IS_REMOTE_DEVICE_INFORMATION;
1309
1310 typedef struct _FILE_NUMA_NODE_INFORMATION {
1311 USHORT NodeNumber;
1312 } FILE_NUMA_NODE_INFORMATION, *PFILE_NUMA_NODE_INFORMATION;
1313
1314 typedef struct _FILE_PROCESS_IDS_USING_FILE_INFORMATION {
1315 ULONG NumberOfProcessIdsInList;
1316 ULONG_PTR ProcessIdList[1];
1317 } FILE_PROCESS_IDS_USING_FILE_INFORMATION, *PFILE_PROCESS_IDS_USING_FILE_INFORMATION;
1318
1319 typedef struct _FILE_STANDARD_INFORMATION {
1320 LARGE_INTEGER AllocationSize;
1321 LARGE_INTEGER EndOfFile;
1322 ULONG NumberOfLinks;
1323 BOOLEAN DeletePending;
1324 BOOLEAN Directory;
1325 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
1326
1327 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1328 LARGE_INTEGER CreationTime;
1329 LARGE_INTEGER LastAccessTime;
1330 LARGE_INTEGER LastWriteTime;
1331 LARGE_INTEGER ChangeTime;
1332 LARGE_INTEGER AllocationSize;
1333 LARGE_INTEGER EndOfFile;
1334 ULONG FileAttributes;
1335 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
1336
1337 typedef enum _FSINFOCLASS {
1338 FileFsVolumeInformation = 1,
1339 FileFsLabelInformation,
1340 FileFsSizeInformation,
1341 FileFsDeviceInformation,
1342 FileFsAttributeInformation,
1343 FileFsControlInformation,
1344 FileFsFullSizeInformation,
1345 FileFsObjectIdInformation,
1346 FileFsDriverPathInformation,
1347 FileFsVolumeFlagsInformation,
1348 FileFsMaximumInformation
1349 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
1350
1351 typedef struct _FILE_FS_DEVICE_INFORMATION {
1352 DEVICE_TYPE DeviceType;
1353 ULONG Characteristics;
1354 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
1355
1356 typedef struct _FILE_FULL_EA_INFORMATION {
1357 ULONG NextEntryOffset;
1358 UCHAR Flags;
1359 UCHAR EaNameLength;
1360 USHORT EaValueLength;
1361 CHAR EaName[1];
1362 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
1363
1364 typedef struct _FILE_SFIO_RESERVE_INFORMATION {
1365 ULONG RequestsPerPeriod;
1366 ULONG Period;
1367 BOOLEAN RetryFailures;
1368 BOOLEAN Discardable;
1369 ULONG RequestSize;
1370 ULONG NumOutstandingRequests;
1371 } FILE_SFIO_RESERVE_INFORMATION, *PFILE_SFIO_RESERVE_INFORMATION;
1372
1373 typedef struct _FILE_SFIO_VOLUME_INFORMATION {
1374 ULONG MaximumRequestsPerPeriod;
1375 ULONG MinimumPeriod;
1376 ULONG MinimumTransferSize;
1377 } FILE_SFIO_VOLUME_INFORMATION, *PFILE_SFIO_VOLUME_INFORMATION;
1378
1379 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1380 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1381 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1382
1383 #define FM_LOCK_BIT (0x1)
1384 #define FM_LOCK_BIT_V (0x0)
1385 #define FM_LOCK_WAITER_WOKEN (0x2)
1386 #define FM_LOCK_WAITER_INC (0x4)
1387
1388 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1389 _IRQL_requires_same_
1390 typedef BOOLEAN
1391 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1392 _In_ struct _FILE_OBJECT *FileObject,
1393 _In_ PLARGE_INTEGER FileOffset,
1394 _In_ ULONG Length,
1395 _In_ BOOLEAN Wait,
1396 _In_ ULONG LockKey,
1397 _In_ BOOLEAN CheckForReadOperation,
1398 _Out_ PIO_STATUS_BLOCK IoStatus,
1399 _In_ struct _DEVICE_OBJECT *DeviceObject);
1400 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1401
1402 _Function_class_(FAST_IO_READ)
1403 _IRQL_requires_same_
1404 typedef BOOLEAN
1405 (NTAPI FAST_IO_READ)(
1406 _In_ struct _FILE_OBJECT *FileObject,
1407 _In_ PLARGE_INTEGER FileOffset,
1408 _In_ ULONG Length,
1409 _In_ BOOLEAN Wait,
1410 _In_ ULONG LockKey,
1411 _Out_ PVOID Buffer,
1412 _Out_ PIO_STATUS_BLOCK IoStatus,
1413 _In_ struct _DEVICE_OBJECT *DeviceObject);
1414 typedef FAST_IO_READ *PFAST_IO_READ;
1415
1416 _Function_class_(FAST_IO_WRITE)
1417 _IRQL_requires_same_
1418 typedef BOOLEAN
1419 (NTAPI FAST_IO_WRITE)(
1420 _In_ struct _FILE_OBJECT *FileObject,
1421 _In_ PLARGE_INTEGER FileOffset,
1422 _In_ ULONG Length,
1423 _In_ BOOLEAN Wait,
1424 _In_ ULONG LockKey,
1425 _In_ PVOID Buffer,
1426 _Out_ PIO_STATUS_BLOCK IoStatus,
1427 _In_ struct _DEVICE_OBJECT *DeviceObject);
1428 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1429
1430 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1431 _IRQL_requires_same_
1432 typedef BOOLEAN
1433 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1434 _In_ struct _FILE_OBJECT *FileObject,
1435 _In_ BOOLEAN Wait,
1436 _Out_ PFILE_BASIC_INFORMATION Buffer,
1437 _Out_ PIO_STATUS_BLOCK IoStatus,
1438 _In_ struct _DEVICE_OBJECT *DeviceObject);
1439 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1440
1441 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1442 _IRQL_requires_same_
1443 typedef BOOLEAN
1444 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1445 _In_ struct _FILE_OBJECT *FileObject,
1446 _In_ BOOLEAN Wait,
1447 _Out_ PFILE_STANDARD_INFORMATION Buffer,
1448 _Out_ PIO_STATUS_BLOCK IoStatus,
1449 _In_ struct _DEVICE_OBJECT *DeviceObject);
1450 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1451
1452 _Function_class_(FAST_IO_LOCK)
1453 _IRQL_requires_same_
1454 typedef BOOLEAN
1455 (NTAPI FAST_IO_LOCK)(
1456 _In_ struct _FILE_OBJECT *FileObject,
1457 _In_ PLARGE_INTEGER FileOffset,
1458 _In_ PLARGE_INTEGER Length,
1459 _In_ PEPROCESS ProcessId,
1460 _In_ ULONG Key,
1461 _In_ BOOLEAN FailImmediately,
1462 _In_ BOOLEAN ExclusiveLock,
1463 _Out_ PIO_STATUS_BLOCK IoStatus,
1464 _In_ struct _DEVICE_OBJECT *DeviceObject);
1465 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1466
1467 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1468 _IRQL_requires_same_
1469 typedef BOOLEAN
1470 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1471 _In_ struct _FILE_OBJECT *FileObject,
1472 _In_ PLARGE_INTEGER FileOffset,
1473 _In_ PLARGE_INTEGER Length,
1474 _In_ PEPROCESS ProcessId,
1475 _In_ ULONG Key,
1476 _Out_ PIO_STATUS_BLOCK IoStatus,
1477 _In_ struct _DEVICE_OBJECT *DeviceObject);
1478 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1479
1480 _Function_class_(FAST_IO_UNLOCK_ALL)
1481 _IRQL_requires_same_
1482 typedef BOOLEAN
1483 (NTAPI FAST_IO_UNLOCK_ALL)(
1484 _In_ struct _FILE_OBJECT *FileObject,
1485 _In_ PEPROCESS ProcessId,
1486 _Out_ PIO_STATUS_BLOCK IoStatus,
1487 _In_ struct _DEVICE_OBJECT *DeviceObject);
1488 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1489
1490 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1491 _IRQL_requires_same_
1492 typedef BOOLEAN
1493 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1494 _In_ struct _FILE_OBJECT *FileObject,
1495 _In_ PVOID ProcessId,
1496 _In_ ULONG Key,
1497 _Out_ PIO_STATUS_BLOCK IoStatus,
1498 _In_ struct _DEVICE_OBJECT *DeviceObject);
1499 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1500
1501 _Function_class_(FAST_IO_DEVICE_CONTROL)
1502 _IRQL_requires_same_
1503 typedef BOOLEAN
1504 (NTAPI FAST_IO_DEVICE_CONTROL)(
1505 _In_ struct _FILE_OBJECT *FileObject,
1506 _In_ BOOLEAN Wait,
1507 _In_opt_ PVOID InputBuffer,
1508 _In_ ULONG InputBufferLength,
1509 _Out_opt_ PVOID OutputBuffer,
1510 _In_ ULONG OutputBufferLength,
1511 _In_ ULONG IoControlCode,
1512 _Out_ PIO_STATUS_BLOCK IoStatus,
1513 _In_ struct _DEVICE_OBJECT *DeviceObject);
1514 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1515
1516 _Function_class_(FAST_IO_ACQUIRE_FILE)
1517 _IRQL_requires_same_
1518 typedef VOID
1519 (NTAPI FAST_IO_ACQUIRE_FILE)(
1520 _In_ struct _FILE_OBJECT *FileObject);
1521 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1522
1523 _Function_class_(FAST_IO_RELEASE_FILE)
1524 _IRQL_requires_same_
1525 typedef VOID
1526 (NTAPI FAST_IO_RELEASE_FILE)(
1527 _In_ struct _FILE_OBJECT *FileObject);
1528 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1529
1530 _Function_class_(FAST_IO_DETACH_DEVICE)
1531 _IRQL_requires_same_
1532 typedef VOID
1533 (NTAPI FAST_IO_DETACH_DEVICE)(
1534 _In_ struct _DEVICE_OBJECT *SourceDevice,
1535 _In_ struct _DEVICE_OBJECT *TargetDevice);
1536 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1537
1538 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1539 _IRQL_requires_same_
1540 typedef BOOLEAN
1541 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1542 _In_ struct _FILE_OBJECT *FileObject,
1543 _In_ BOOLEAN Wait,
1544 _Out_ struct _FILE_NETWORK_OPEN_INFORMATION *Buffer,
1545 _Out_ struct _IO_STATUS_BLOCK *IoStatus,
1546 _In_ struct _DEVICE_OBJECT *DeviceObject);
1547 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1548
1549 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1550 _IRQL_requires_same_
1551 typedef NTSTATUS
1552 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1553 _In_ struct _FILE_OBJECT *FileObject,
1554 _In_ PLARGE_INTEGER EndingOffset,
1555 _Out_ struct _ERESOURCE **ResourceToRelease,
1556 _In_ struct _DEVICE_OBJECT *DeviceObject);
1557 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1558
1559 _Function_class_(FAST_IO_MDL_READ)
1560 _IRQL_requires_same_
1561 typedef BOOLEAN
1562 (NTAPI FAST_IO_MDL_READ)(
1563 _In_ struct _FILE_OBJECT *FileObject,
1564 _In_ PLARGE_INTEGER FileOffset,
1565 _In_ ULONG Length,
1566 _In_ ULONG LockKey,
1567 _Out_ PMDL *MdlChain,
1568 _Out_ PIO_STATUS_BLOCK IoStatus,
1569 _In_ struct _DEVICE_OBJECT *DeviceObject);
1570 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1571
1572 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1573 _IRQL_requires_same_
1574 typedef BOOLEAN
1575 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1576 _In_ struct _FILE_OBJECT *FileObject,
1577 _In_ PMDL MdlChain,
1578 _In_ struct _DEVICE_OBJECT *DeviceObject);
1579 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1580
1581 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1582 _IRQL_requires_same_
1583 typedef BOOLEAN
1584 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1585 _In_ struct _FILE_OBJECT *FileObject,
1586 _In_ PLARGE_INTEGER FileOffset,
1587 _In_ ULONG Length,
1588 _In_ ULONG LockKey,
1589 _Out_ PMDL *MdlChain,
1590 _Out_ PIO_STATUS_BLOCK IoStatus,
1591 _In_ struct _DEVICE_OBJECT *DeviceObject);
1592 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1593
1594 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1595 _IRQL_requires_same_
1596 typedef BOOLEAN
1597 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1598 _In_ struct _FILE_OBJECT *FileObject,
1599 _In_ PLARGE_INTEGER FileOffset,
1600 _In_ PMDL MdlChain,
1601 _In_ struct _DEVICE_OBJECT *DeviceObject);
1602 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1603
1604 _Function_class_(FAST_IO_READ_COMPRESSED)
1605 _IRQL_requires_same_
1606 typedef BOOLEAN
1607 (NTAPI FAST_IO_READ_COMPRESSED)(
1608 _In_ struct _FILE_OBJECT *FileObject,
1609 _In_ PLARGE_INTEGER FileOffset,
1610 _In_ ULONG Length,
1611 _In_ ULONG LockKey,
1612 _Out_ PVOID Buffer,
1613 _Out_ PMDL *MdlChain,
1614 _Out_ PIO_STATUS_BLOCK IoStatus,
1615 _Out_ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
1616 _In_ ULONG CompressedDataInfoLength,
1617 _In_ struct _DEVICE_OBJECT *DeviceObject);
1618 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1619
1620 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1621 _IRQL_requires_same_
1622 typedef BOOLEAN
1623 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1624 _In_ struct _FILE_OBJECT *FileObject,
1625 _In_ PLARGE_INTEGER FileOffset,
1626 _In_ ULONG Length,
1627 _In_ ULONG LockKey,
1628 _In_ PVOID Buffer,
1629 _Out_ PMDL *MdlChain,
1630 _Out_ PIO_STATUS_BLOCK IoStatus,
1631 _In_ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
1632 _In_ ULONG CompressedDataInfoLength,
1633 _In_ struct _DEVICE_OBJECT *DeviceObject);
1634 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1635
1636 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1637 _IRQL_requires_same_
1638 typedef BOOLEAN
1639 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1640 _In_ struct _FILE_OBJECT *FileObject,
1641 _In_ PMDL MdlChain,
1642 _In_ struct _DEVICE_OBJECT *DeviceObject);
1643 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1644
1645 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1646 _IRQL_requires_same_
1647 typedef BOOLEAN
1648 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1649 _In_ struct _FILE_OBJECT *FileObject,
1650 _In_ PLARGE_INTEGER FileOffset,
1651 _In_ PMDL MdlChain,
1652 _In_ struct _DEVICE_OBJECT *DeviceObject);
1653 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1654
1655 _Function_class_(FAST_IO_QUERY_OPEN)
1656 _IRQL_requires_same_
1657 typedef BOOLEAN
1658 (NTAPI FAST_IO_QUERY_OPEN)(
1659 _Inout_ struct _IRP *Irp,
1660 _Out_ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
1661 _In_ struct _DEVICE_OBJECT *DeviceObject);
1662 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1663
1664 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1665 _IRQL_requires_same_
1666 typedef NTSTATUS
1667 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1668 _In_ struct _FILE_OBJECT *FileObject,
1669 _In_ struct _ERESOURCE *ResourceToRelease,
1670 _In_ struct _DEVICE_OBJECT *DeviceObject);
1671 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1672
1673 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1674 _IRQL_requires_same_
1675 typedef NTSTATUS
1676 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1677 _In_ struct _FILE_OBJECT *FileObject,
1678 _In_ struct _DEVICE_OBJECT *DeviceObject);
1679 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1680
1681 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1682 _IRQL_requires_same_
1683 typedef NTSTATUS
1684 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1685 _In_ struct _FILE_OBJECT *FileObject,
1686 _In_ struct _DEVICE_OBJECT *DeviceObject);
1687 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1688
1689 typedef struct _FAST_IO_DISPATCH {
1690 ULONG SizeOfFastIoDispatch;
1691 PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
1692 PFAST_IO_READ FastIoRead;
1693 PFAST_IO_WRITE FastIoWrite;
1694 PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
1695 PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
1696 PFAST_IO_LOCK FastIoLock;
1697 PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
1698 PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
1699 PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
1700 PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
1701 PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
1702 PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
1703 PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
1704 PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
1705 PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
1706 PFAST_IO_MDL_READ MdlRead;
1707 PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
1708 PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
1709 PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
1710 PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
1711 PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
1712 PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
1713 PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
1714 PFAST_IO_QUERY_OPEN FastIoQueryOpen;
1715 PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
1716 PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
1717 PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
1718 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
1719
1720 typedef struct _SECTION_OBJECT_POINTERS {
1721 PVOID DataSectionObject;
1722 PVOID SharedCacheMap;
1723 PVOID ImageSectionObject;
1724 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
1725
1726 typedef struct _IO_COMPLETION_CONTEXT {
1727 PVOID Port;
1728 PVOID Key;
1729 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
1730
1731 /* FILE_OBJECT.Flags */
1732 #define FO_FILE_OPEN 0x00000001
1733 #define FO_SYNCHRONOUS_IO 0x00000002
1734 #define FO_ALERTABLE_IO 0x00000004
1735 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1736 #define FO_WRITE_THROUGH 0x00000010
1737 #define FO_SEQUENTIAL_ONLY 0x00000020
1738 #define FO_CACHE_SUPPORTED 0x00000040
1739 #define FO_NAMED_PIPE 0x00000080
1740 #define FO_STREAM_FILE 0x00000100
1741 #define FO_MAILSLOT 0x00000200
1742 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1743 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1744 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1745 #define FO_FILE_MODIFIED 0x00001000
1746 #define FO_FILE_SIZE_CHANGED 0x00002000
1747 #define FO_CLEANUP_COMPLETE 0x00004000
1748 #define FO_TEMPORARY_FILE 0x00008000
1749 #define FO_DELETE_ON_CLOSE 0x00010000
1750 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1751 #define FO_HANDLE_CREATED 0x00040000
1752 #define FO_FILE_FAST_IO_READ 0x00080000
1753 #define FO_RANDOM_ACCESS 0x00100000
1754 #define FO_FILE_OPEN_CANCELLED 0x00200000
1755 #define FO_VOLUME_OPEN 0x00400000
1756 #define FO_REMOTE_ORIGIN 0x01000000
1757 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1758 #define FO_SKIP_COMPLETION_PORT 0x02000000
1759 #define FO_SKIP_SET_EVENT 0x04000000
1760 #define FO_SKIP_SET_FAST_IO 0x08000000
1761 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1762
1763 /* VPB.Flags */
1764 #define VPB_MOUNTED 0x0001
1765 #define VPB_LOCKED 0x0002
1766 #define VPB_PERSISTENT 0x0004
1767 #define VPB_REMOVE_PENDING 0x0008
1768 #define VPB_RAW_MOUNT 0x0010
1769 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1770
1771 /* IO_STACK_LOCATION.Flags */
1772
1773 #define SL_FORCE_ACCESS_CHECK 0x01
1774 #define SL_OPEN_PAGING_FILE 0x02
1775 #define SL_OPEN_TARGET_DIRECTORY 0x04
1776 #define SL_STOP_ON_SYMLINK 0x08
1777 #define SL_CASE_SENSITIVE 0x80
1778
1779 #define SL_KEY_SPECIFIED 0x01
1780 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1781 #define SL_WRITE_THROUGH 0x04
1782 #define SL_FT_SEQUENTIAL_WRITE 0x08
1783 #define SL_FORCE_DIRECT_WRITE 0x10
1784 #define SL_REALTIME_STREAM 0x20
1785
1786 #define SL_READ_ACCESS_GRANTED 0x01
1787 #define SL_WRITE_ACCESS_GRANTED 0x04
1788
1789 #define SL_FAIL_IMMEDIATELY 0x01
1790 #define SL_EXCLUSIVE_LOCK 0x02
1791
1792 #define SL_RESTART_SCAN 0x01
1793 #define SL_RETURN_SINGLE_ENTRY 0x02
1794 #define SL_INDEX_SPECIFIED 0x04
1795
1796 #define SL_WATCH_TREE 0x01
1797
1798 #define SL_ALLOW_RAW_MOUNT 0x01
1799
1800 $endif (_WDMDDK_)
1801 $if (_WDMDDK_ || _DEVIOCTL_)
1802 #define CTL_CODE(DeviceType, Function, Method, Access) \
1803 (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1804
1805 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1806
1807 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1808
1809 $endif (_WDMDDK_ || _DEVIOCTL_)
1810 $if (_WDMDDK_)
1811
1812 /* IRP.Flags */
1813 #define IRP_NOCACHE 0x00000001
1814 #define IRP_PAGING_IO 0x00000002
1815 #define IRP_MOUNT_COMPLETION 0x00000002
1816 #define IRP_SYNCHRONOUS_API 0x00000004
1817 #define IRP_ASSOCIATED_IRP 0x00000008
1818 #define IRP_BUFFERED_IO 0x00000010
1819 #define IRP_DEALLOCATE_BUFFER 0x00000020
1820 #define IRP_INPUT_OPERATION 0x00000040
1821 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1822 #define IRP_CREATE_OPERATION 0x00000080
1823 #define IRP_READ_OPERATION 0x00000100
1824 #define IRP_WRITE_OPERATION 0x00000200
1825 #define IRP_CLOSE_OPERATION 0x00000400
1826 #define IRP_DEFER_IO_COMPLETION 0x00000800
1827 #define IRP_OB_QUERY_NAME 0x00001000
1828 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1829 /* The following 2 are missing in latest WDK */
1830 #define IRP_RETRY_IO_COMPLETION 0x00004000
1831 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1832
1833 /* IRP.AllocationFlags */
1834 #define IRP_QUOTA_CHARGED 0x01
1835 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1836 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1837 #define IRP_LOOKASIDE_ALLOCATION 0x08
1838
1839 /*
1840 ** IRP function codes
1841 */
1842
1843 #define IRP_MJ_CREATE 0x00
1844 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1845 #define IRP_MJ_CLOSE 0x02
1846 #define IRP_MJ_READ 0x03
1847 #define IRP_MJ_WRITE 0x04
1848 #define IRP_MJ_QUERY_INFORMATION 0x05
1849 #define IRP_MJ_SET_INFORMATION 0x06
1850 #define IRP_MJ_QUERY_EA 0x07
1851 #define IRP_MJ_SET_EA 0x08
1852 #define IRP_MJ_FLUSH_BUFFERS 0x09
1853 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1854 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1855 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1856 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1857 #define IRP_MJ_DEVICE_CONTROL 0x0e
1858 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1859 #define IRP_MJ_SCSI 0x0f
1860 #define IRP_MJ_SHUTDOWN 0x10
1861 #define IRP_MJ_LOCK_CONTROL 0x11
1862 #define IRP_MJ_CLEANUP 0x12
1863 #define IRP_MJ_CREATE_MAILSLOT 0x13
1864 #define IRP_MJ_QUERY_SECURITY 0x14
1865 #define IRP_MJ_SET_SECURITY 0x15
1866 #define IRP_MJ_POWER 0x16
1867 #define IRP_MJ_SYSTEM_CONTROL 0x17
1868 #define IRP_MJ_DEVICE_CHANGE 0x18
1869 #define IRP_MJ_QUERY_QUOTA 0x19
1870 #define IRP_MJ_SET_QUOTA 0x1a
1871 #define IRP_MJ_PNP 0x1b
1872 #define IRP_MJ_PNP_POWER 0x1b
1873 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1874
1875 #define IRP_MN_SCSI_CLASS 0x01
1876
1877 #define IRP_MN_START_DEVICE 0x00
1878 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1879 #define IRP_MN_REMOVE_DEVICE 0x02
1880 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1881 #define IRP_MN_STOP_DEVICE 0x04
1882 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1883 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1884
1885 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1886 #define IRP_MN_QUERY_INTERFACE 0x08
1887 #define IRP_MN_QUERY_CAPABILITIES 0x09
1888 #define IRP_MN_QUERY_RESOURCES 0x0A
1889 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1890 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1891 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1892
1893 #define IRP_MN_READ_CONFIG 0x0F
1894 #define IRP_MN_WRITE_CONFIG 0x10
1895 #define IRP_MN_EJECT 0x11
1896 #define IRP_MN_SET_LOCK 0x12
1897 #define IRP_MN_QUERY_ID 0x13
1898 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1899 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1900 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1901 #define IRP_MN_SURPRISE_REMOVAL 0x17
1902 #if (NTDDI_VERSION >= NTDDI_WIN7)
1903 #define IRP_MN_DEVICE_ENUMERATED 0x19
1904 #endif
1905
1906 #define IRP_MN_WAIT_WAKE 0x00
1907 #define IRP_MN_POWER_SEQUENCE 0x01
1908 #define IRP_MN_SET_POWER 0x02
1909 #define IRP_MN_QUERY_POWER 0x03
1910
1911 #define IRP_MN_QUERY_ALL_DATA 0x00
1912 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1913 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1914 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1915 #define IRP_MN_ENABLE_EVENTS 0x04
1916 #define IRP_MN_DISABLE_EVENTS 0x05
1917 #define IRP_MN_ENABLE_COLLECTION 0x06
1918 #define IRP_MN_DISABLE_COLLECTION 0x07
1919 #define IRP_MN_REGINFO 0x08
1920 #define IRP_MN_EXECUTE_METHOD 0x09
1921
1922 #define IRP_MN_REGINFO_EX 0x0b
1923
1924 typedef struct _FILE_OBJECT {
1925 CSHORT Type;
1926 CSHORT Size;
1927 PDEVICE_OBJECT DeviceObject;
1928 PVPB Vpb;
1929 PVOID FsContext;
1930 PVOID FsContext2;
1931 PSECTION_OBJECT_POINTERS SectionObjectPointer;
1932 PVOID PrivateCacheMap;
1933 NTSTATUS FinalStatus;
1934 struct _FILE_OBJECT *RelatedFileObject;
1935 BOOLEAN LockOperation;
1936 BOOLEAN DeletePending;
1937 BOOLEAN ReadAccess;
1938 BOOLEAN WriteAccess;
1939 BOOLEAN DeleteAccess;
1940 BOOLEAN SharedRead;
1941 BOOLEAN SharedWrite;
1942 BOOLEAN SharedDelete;
1943 ULONG Flags;
1944 UNICODE_STRING FileName;
1945 LARGE_INTEGER CurrentByteOffset;
1946 volatile ULONG Waiters;
1947 volatile ULONG Busy;
1948 PVOID LastLock;
1949 KEVENT Lock;
1950 KEVENT Event;
1951 volatile PIO_COMPLETION_CONTEXT CompletionContext;
1952 KSPIN_LOCK IrpListLock;
1953 LIST_ENTRY IrpList;
1954 volatile PVOID FileObjectExtension;
1955 } FILE_OBJECT, *PFILE_OBJECT;
1956
1957 typedef struct _IO_ERROR_LOG_PACKET {
1958 UCHAR MajorFunctionCode;
1959 UCHAR RetryCount;
1960 USHORT DumpDataSize;
1961 USHORT NumberOfStrings;
1962 USHORT StringOffset;
1963 USHORT EventCategory;
1964 NTSTATUS ErrorCode;
1965 ULONG UniqueErrorValue;
1966 NTSTATUS FinalStatus;
1967 ULONG SequenceNumber;
1968 ULONG IoControlCode;
1969 LARGE_INTEGER DeviceOffset;
1970 ULONG DumpData[1];
1971 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
1972
1973 typedef struct _IO_ERROR_LOG_MESSAGE {
1974 USHORT Type;
1975 USHORT Size;
1976 USHORT DriverNameLength;
1977 LARGE_INTEGER TimeStamp;
1978 ULONG DriverNameOffset;
1979 IO_ERROR_LOG_PACKET EntryData;
1980 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
1981
1982 /* See ndk/lpctypes.h */
1983 #ifdef _WIN64
1984 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
1985 #else
1986 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
1987 #endif
1988
1989 #define ERROR_LOG_LIMIT_SIZE 240
1990 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1991 sizeof(IO_ERROR_LOG_PACKET) + \
1992 (sizeof(WCHAR) * 40))
1993 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
1994 (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1995 #define IO_ERROR_LOG_MESSAGE_LENGTH \
1996 ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
1997 ERROR_LOG_MESSAGE_LIMIT_SIZE : \
1998 PORT_MAXIMUM_MESSAGE_LENGTH)
1999 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
2000 IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2001
2002 typedef enum _DMA_WIDTH {
2003 Width8Bits,
2004 Width16Bits,
2005 Width32Bits,
2006 MaximumDmaWidth
2007 } DMA_WIDTH, *PDMA_WIDTH;
2008
2009 typedef enum _DMA_SPEED {
2010 Compatible,
2011 TypeA,
2012 TypeB,
2013 TypeC,
2014 TypeF,
2015 MaximumDmaSpeed
2016 } DMA_SPEED, *PDMA_SPEED;
2017
2018 /* DEVICE_DESCRIPTION.Version */
2019
2020 #define DEVICE_DESCRIPTION_VERSION 0x0000
2021 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2022 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2023
2024 typedef struct _DEVICE_DESCRIPTION {
2025 ULONG Version;
2026 BOOLEAN Master;
2027 BOOLEAN ScatterGather;
2028 BOOLEAN DemandMode;
2029 BOOLEAN AutoInitialize;
2030 BOOLEAN Dma32BitAddresses;
2031 BOOLEAN IgnoreCount;
2032 BOOLEAN Reserved1;
2033 BOOLEAN Dma64BitAddresses;
2034 ULONG BusNumber;
2035 ULONG DmaChannel;
2036 INTERFACE_TYPE InterfaceType;
2037 DMA_WIDTH DmaWidth;
2038 DMA_SPEED DmaSpeed;
2039 ULONG MaximumLength;
2040 ULONG DmaPort;
2041 } DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
2042
2043 typedef enum _DEVICE_RELATION_TYPE {
2044 BusRelations,
2045 EjectionRelations,
2046 PowerRelations,
2047 RemovalRelations,
2048 TargetDeviceRelation,
2049 SingleBusRelations,
2050 TransportRelations
2051 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
2052
2053 typedef struct _DEVICE_RELATIONS {
2054 ULONG Count;
2055 PDEVICE_OBJECT Objects[1];
2056 } DEVICE_RELATIONS, *PDEVICE_RELATIONS;
2057
2058 typedef struct _DEVOBJ_EXTENSION {
2059 CSHORT Type;
2060 USHORT Size;
2061 PDEVICE_OBJECT DeviceObject;
2062 } DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
2063
2064 typedef struct _SCATTER_GATHER_ELEMENT {
2065 PHYSICAL_ADDRESS Address;
2066 ULONG Length;
2067 ULONG_PTR Reserved;
2068 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
2069
2070 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2071
2072 #if defined(_MSC_VER)
2073 #if _MSC_VER >= 1200
2074 #pragma warning(push)
2075 #endif
2076 #pragma warning(disable:4200)
2077 #endif /* _MSC_VER */
2078
2079 typedef struct _SCATTER_GATHER_LIST {
2080 ULONG NumberOfElements;
2081 ULONG_PTR Reserved;
2082 SCATTER_GATHER_ELEMENT Elements[1];
2083 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2084
2085 #if defined(_MSC_VER)
2086 #if _MSC_VER >= 1200
2087 #pragma warning(pop)
2088 #else
2089 #pragma warning(default:4200)
2090 #endif
2091 #endif /* _MSC_VER */
2092
2093 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2094
2095 struct _SCATTER_GATHER_LIST;
2096 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2097
2098 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2099
2100 _Function_class_(DRIVER_ADD_DEVICE)
2101 _IRQL_requires_(PASSIVE_LEVEL)
2102 _IRQL_requires_same_
2103 _When_(return>=0, _Kernel_clear_do_init_(__yes))
2104 typedef NTSTATUS
2105 (NTAPI DRIVER_ADD_DEVICE)(
2106 _In_ struct _DRIVER_OBJECT *DriverObject,
2107 _In_ struct _DEVICE_OBJECT *PhysicalDeviceObject);
2108 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2109
2110 typedef struct _DRIVER_EXTENSION {
2111 struct _DRIVER_OBJECT *DriverObject;
2112 PDRIVER_ADD_DEVICE AddDevice;
2113 ULONG Count;
2114 UNICODE_STRING ServiceKeyName;
2115 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
2116
2117 #define DRVO_UNLOAD_INVOKED 0x00000001
2118 #define DRVO_LEGACY_DRIVER 0x00000002
2119 #define DRVO_BUILTIN_DRIVER 0x00000004
2120
2121 _Function_class_(DRIVER_INITIALIZE)
2122 _IRQL_requires_same_
2123 typedef NTSTATUS
2124 (NTAPI DRIVER_INITIALIZE)(
2125 _In_ struct _DRIVER_OBJECT *DriverObject,
2126 _In_ PUNICODE_STRING RegistryPath);
2127 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2128
2129 _Function_class_(DRIVER_STARTIO)
2130 _IRQL_always_function_min_(DISPATCH_LEVEL)
2131 _IRQL_requires_(DISPATCH_LEVEL)
2132 _IRQL_requires_same_
2133 typedef VOID
2134 (NTAPI DRIVER_STARTIO)(
2135 _Inout_ struct _DEVICE_OBJECT *DeviceObject,
2136 _Inout_ struct _IRP *Irp);
2137 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2138
2139 _Function_class_(DRIVER_UNLOAD)
2140 _IRQL_requires_(PASSIVE_LEVEL)
2141 _IRQL_requires_same_
2142 typedef VOID
2143 (NTAPI DRIVER_UNLOAD)(
2144 _In_ struct _DRIVER_OBJECT *DriverObject);
2145 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2146
2147 _Function_class_(DRIVER_DISPATCH)
2148 _IRQL_requires_max_(DISPATCH_LEVEL)
2149 _IRQL_requires_same_
2150 typedef NTSTATUS
2151 (NTAPI DRIVER_DISPATCH)(
2152 _In_ struct _DEVICE_OBJECT *DeviceObject,
2153 _Inout_ struct _IRP *Irp);
2154 typedef DRIVER_DISPATCH *PDRIVER_DISPATCH;
2155 typedef DRIVER_DISPATCH DRIVER_DISPATCH_RAISED;
2156
2157 _Function_class_(DRIVER_DISPATCH)
2158 _IRQL_requires_(PASSIVE_LEVEL)
2159 _IRQL_requires_same_
2160 typedef NTSTATUS
2161 (NTAPI DRIVER_DISPATCH_PAGED)(
2162 _In_ struct _DEVICE_OBJECT *DeviceObject,
2163 _Inout_ struct _IRP *Irp);
2164 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2165
2166 typedef struct _DRIVER_OBJECT {
2167 CSHORT Type;
2168 CSHORT Size;
2169 PDEVICE_OBJECT DeviceObject;
2170 ULONG Flags;
2171 PVOID DriverStart;
2172 ULONG DriverSize;
2173 PVOID DriverSection;
2174 PDRIVER_EXTENSION DriverExtension;
2175 UNICODE_STRING DriverName;
2176 PUNICODE_STRING HardwareDatabase;
2177 struct _FAST_IO_DISPATCH *FastIoDispatch;
2178 PDRIVER_INITIALIZE DriverInit;
2179 PDRIVER_STARTIO DriverStartIo;
2180 PDRIVER_UNLOAD DriverUnload;
2181 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
2182 } DRIVER_OBJECT, *PDRIVER_OBJECT;
2183
2184 typedef struct _DMA_ADAPTER {
2185 USHORT Version;
2186 USHORT Size;
2187 struct _DMA_OPERATIONS* DmaOperations;
2188 } DMA_ADAPTER, *PDMA_ADAPTER;
2189
2190 typedef VOID
2191 (NTAPI *PPUT_DMA_ADAPTER)(
2192 PDMA_ADAPTER DmaAdapter);
2193
2194 typedef PVOID
2195 (NTAPI *PALLOCATE_COMMON_BUFFER)(
2196 _In_ PDMA_ADAPTER DmaAdapter,
2197 _In_ ULONG Length,
2198 _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2199 _In_ BOOLEAN CacheEnabled);
2200
2201 typedef VOID
2202 (NTAPI *PFREE_COMMON_BUFFER)(
2203 _In_ PDMA_ADAPTER DmaAdapter,
2204 _In_ ULONG Length,
2205 _In_ PHYSICAL_ADDRESS LogicalAddress,
2206 _In_ PVOID VirtualAddress,
2207 _In_ BOOLEAN CacheEnabled);
2208
2209 typedef NTSTATUS
2210 (NTAPI *PALLOCATE_ADAPTER_CHANNEL)(
2211 _In_ PDMA_ADAPTER DmaAdapter,
2212 _In_ PDEVICE_OBJECT DeviceObject,
2213 _In_ ULONG NumberOfMapRegisters,
2214 _In_ PDRIVER_CONTROL ExecutionRoutine,
2215 _In_ PVOID Context);
2216
2217 typedef BOOLEAN
2218 (NTAPI *PFLUSH_ADAPTER_BUFFERS)(
2219 _In_ PDMA_ADAPTER DmaAdapter,
2220 _In_ PMDL Mdl,
2221 _In_ PVOID MapRegisterBase,
2222 _In_ PVOID CurrentVa,
2223 _In_ ULONG Length,
2224 _In_ BOOLEAN WriteToDevice);
2225
2226 typedef VOID
2227 (NTAPI *PFREE_ADAPTER_CHANNEL)(
2228 _In_ PDMA_ADAPTER DmaAdapter);
2229
2230 typedef VOID
2231 (NTAPI *PFREE_MAP_REGISTERS)(
2232 _In_ PDMA_ADAPTER DmaAdapter,
2233 PVOID MapRegisterBase,
2234 ULONG NumberOfMapRegisters);
2235
2236 typedef PHYSICAL_ADDRESS
2237 (NTAPI *PMAP_TRANSFER)(
2238 _In_ PDMA_ADAPTER DmaAdapter,
2239 _In_ PMDL Mdl,
2240 _In_ PVOID MapRegisterBase,
2241 _In_ PVOID CurrentVa,
2242 _Inout_ PULONG Length,
2243 _In_ BOOLEAN WriteToDevice);
2244
2245 typedef ULONG
2246 (NTAPI *PGET_DMA_ALIGNMENT)(
2247 _In_ PDMA_ADAPTER DmaAdapter);
2248
2249 typedef ULONG
2250 (NTAPI *PREAD_DMA_COUNTER)(
2251 _In_ PDMA_ADAPTER DmaAdapter);
2252
2253 _Function_class_(DRIVER_LIST_CONTROL)
2254 _IRQL_requires_same_
2255 typedef VOID
2256 (NTAPI DRIVER_LIST_CONTROL)(
2257 _In_ struct _DEVICE_OBJECT *DeviceObject,
2258 _In_ struct _IRP *Irp,
2259 _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2260 _In_ PVOID Context);
2261 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2262
2263 typedef NTSTATUS
2264 (NTAPI *PGET_SCATTER_GATHER_LIST)(
2265 _In_ PDMA_ADAPTER DmaAdapter,
2266 _In_ PDEVICE_OBJECT DeviceObject,
2267 _In_ PMDL Mdl,
2268 _In_ PVOID CurrentVa,
2269 _In_ ULONG Length,
2270 _In_ PDRIVER_LIST_CONTROL ExecutionRoutine,
2271 _In_ PVOID Context,
2272 _In_ BOOLEAN WriteToDevice);
2273
2274 typedef VOID
2275 (NTAPI *PPUT_SCATTER_GATHER_LIST)(
2276 _In_ PDMA_ADAPTER DmaAdapter,
2277 _In_ PSCATTER_GATHER_LIST ScatterGather,
2278 _In_ BOOLEAN WriteToDevice);
2279
2280 typedef NTSTATUS
2281 (NTAPI *PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
2282 _In_ PDMA_ADAPTER DmaAdapter,
2283 _In_ PMDL Mdl OPTIONAL,
2284 _In_ PVOID CurrentVa,
2285 _In_ ULONG Length,
2286 _Out_ PULONG ScatterGatherListSize,
2287 _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2288
2289 typedef NTSTATUS
2290 (NTAPI *PBUILD_SCATTER_GATHER_LIST)(
2291 _In_ PDMA_ADAPTER DmaAdapter,
2292 _In_ PDEVICE_OBJECT DeviceObject,
2293 _In_ PMDL Mdl,
2294 _In_ PVOID CurrentVa,
2295 _In_ ULONG Length,
2296 _In_ PDRIVER_LIST_CONTROL ExecutionRoutine,
2297 _In_ PVOID Context,
2298 _In_ BOOLEAN WriteToDevice,
2299 _In_ PVOID ScatterGatherBuffer,
2300 _In_ ULONG ScatterGatherLength);
2301
2302 typedef NTSTATUS
2303 (NTAPI *PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
2304 _In_ PDMA_ADAPTER DmaAdapter,
2305 _In_ PSCATTER_GATHER_LIST ScatterGather,
2306 _In_ PMDL OriginalMdl,
2307 _Out_ PMDL *TargetMdl);
2308
2309 typedef struct _DMA_OPERATIONS {
2310 ULONG Size;
2311 PPUT_DMA_ADAPTER PutDmaAdapter;
2312 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
2313 PFREE_COMMON_BUFFER FreeCommonBuffer;
2314 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
2315 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
2316 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
2317 PFREE_MAP_REGISTERS FreeMapRegisters;
2318 PMAP_TRANSFER MapTransfer;
2319 PGET_DMA_ALIGNMENT GetDmaAlignment;
2320 PREAD_DMA_COUNTER ReadDmaCounter;
2321 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
2322 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
2323 PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList;
2324 PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList;
2325 PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList;
2326 } DMA_OPERATIONS, *PDMA_OPERATIONS;
2327
2328 typedef struct _IO_RESOURCE_DESCRIPTOR {
2329 UCHAR Option;
2330 UCHAR Type;
2331 UCHAR ShareDisposition;
2332 UCHAR Spare1;
2333 USHORT Flags;
2334 USHORT Spare2;
2335 union {
2336 struct {
2337 ULONG Length;
2338 ULONG Alignment;
2339 PHYSICAL_ADDRESS MinimumAddress;
2340 PHYSICAL_ADDRESS MaximumAddress;
2341 } Port;
2342 struct {
2343 ULONG Length;
2344 ULONG Alignment;
2345 PHYSICAL_ADDRESS MinimumAddress;
2346 PHYSICAL_ADDRESS MaximumAddress;
2347 } Memory;
2348 struct {
2349 ULONG MinimumVector;
2350 ULONG MaximumVector;
2351 } Interrupt;
2352 struct {
2353 ULONG MinimumChannel;
2354 ULONG MaximumChannel;
2355 } Dma;
2356 struct {
2357 ULONG Length;
2358 ULONG Alignment;
2359 PHYSICAL_ADDRESS MinimumAddress;
2360 PHYSICAL_ADDRESS MaximumAddress;
2361 } Generic;
2362 struct {
2363 ULONG Data[3];
2364 } DevicePrivate;
2365 struct {
2366 ULONG Length;
2367 ULONG MinBusNumber;
2368 ULONG MaxBusNumber;
2369 ULONG Reserved;
2370 } BusNumber;
2371 struct {
2372 ULONG Priority;
2373 ULONG Reserved1;
2374 ULONG Reserved2;
2375 } ConfigData;
2376 } u;
2377 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
2378
2379 typedef struct _IO_RESOURCE_LIST {
2380 USHORT Version;
2381 USHORT Revision;
2382 ULONG Count;
2383 IO_RESOURCE_DESCRIPTOR Descriptors[1];
2384 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
2385
2386 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
2387 ULONG ListSize;
2388 INTERFACE_TYPE InterfaceType;
2389 ULONG BusNumber;
2390 ULONG SlotNumber;
2391 ULONG Reserved[3];
2392 ULONG AlternativeLists;
2393 IO_RESOURCE_LIST List[1];
2394 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
2395
2396 _Function_class_(DRIVER_CANCEL)
2397 _Requires_lock_held_(_Global_cancel_spin_lock_)
2398 _Releases_lock_(_Global_cancel_spin_lock_)
2399 _IRQL_requires_min_(DISPATCH_LEVEL)
2400 _IRQL_requires_(DISPATCH_LEVEL)
2401 typedef VOID
2402 (NTAPI DRIVER_CANCEL)(
2403 _Inout_ struct _DEVICE_OBJECT *DeviceObject,
2404 _Inout_ _IRQL_uses_cancel_ struct _IRP *Irp);
2405 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2406
2407 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
2408 CSHORT Type;
2409 USHORT Size;
2410 struct _MDL *MdlAddress;
2411 ULONG Flags;
2412 union {
2413 struct _IRP *MasterIrp;
2414 volatile LONG IrpCount;
2415 PVOID SystemBuffer;
2416 } AssociatedIrp;
2417 LIST_ENTRY ThreadListEntry;
2418 IO_STATUS_BLOCK IoStatus;
2419 KPROCESSOR_MODE RequestorMode;
2420 BOOLEAN PendingReturned;
2421 CHAR StackCount;
2422 CHAR CurrentLocation;
2423 BOOLEAN Cancel;
2424 KIRQL CancelIrql;
2425 CCHAR ApcEnvironment;
2426 UCHAR AllocationFlags;
2427 PIO_STATUS_BLOCK UserIosb;
2428 PKEVENT UserEvent;
2429 union {
2430 struct {
2431 _ANONYMOUS_UNION union {
2432 PIO_APC_ROUTINE UserApcRoutine;
2433 PVOID IssuingProcess;
2434 } DUMMYUNIONNAME;
2435 PVOID UserApcContext;
2436 } AsynchronousParameters;
2437 LARGE_INTEGER AllocationSize;
2438 } Overlay;
2439 volatile PDRIVER_CANCEL CancelRoutine;
2440 PVOID UserBuffer;
2441 union {
2442 struct {
2443 _ANONYMOUS_UNION union {
2444 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
2445 _ANONYMOUS_STRUCT struct {
2446 PVOID DriverContext[4];
2447 } DUMMYSTRUCTNAME;
2448 } DUMMYUNIONNAME;
2449 PETHREAD Thread;
2450 PCHAR AuxiliaryBuffer;
2451 _ANONYMOUS_STRUCT struct {
2452 LIST_ENTRY ListEntry;
2453 _ANONYMOUS_UNION union {
2454 struct _IO_STACK_LOCATION *CurrentStackLocation;
2455 ULONG PacketType;
2456 } DUMMYUNIONNAME;
2457 } DUMMYSTRUCTNAME;
2458 struct _FILE_OBJECT *OriginalFileObject;
2459 } Overlay;
2460 KAPC Apc;
2461 PVOID CompletionKey;
2462 } Tail;
2463 } IRP, *PIRP;
2464
2465 typedef enum _IO_PAGING_PRIORITY {
2466 IoPagingPriorityInvalid,
2467 IoPagingPriorityNormal,
2468 IoPagingPriorityHigh,
2469 IoPagingPriorityReserved1,
2470 IoPagingPriorityReserved2
2471 } IO_PAGING_PRIORITY;
2472
2473 _Function_class_(IO_COMPLETION_ROUTINE)
2474 _IRQL_requires_same_
2475 typedef NTSTATUS
2476 (NTAPI IO_COMPLETION_ROUTINE)(
2477 _In_ struct _DEVICE_OBJECT *DeviceObject,
2478 _In_ struct _IRP *Irp,
2479 _In_opt_ PVOID Context);
2480 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2481
2482 _Function_class_(IO_DPC_ROUTINE)
2483 _IRQL_always_function_min_(DISPATCH_LEVEL)
2484 _IRQL_requires_(DISPATCH_LEVEL)
2485 _IRQL_requires_same_
2486 typedef VOID
2487 (NTAPI IO_DPC_ROUTINE)(
2488 _In_ struct _KDPC *Dpc,
2489 _In_ struct _DEVICE_OBJECT *DeviceObject,
2490 _Inout_ struct _IRP *Irp,
2491 _In_opt_ PVOID Context);
2492 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2493
2494 typedef NTSTATUS
2495 (NTAPI *PMM_DLL_INITIALIZE)(
2496 _In_ PUNICODE_STRING RegistryPath);
2497
2498 typedef NTSTATUS
2499 (NTAPI *PMM_DLL_UNLOAD)(
2500 VOID);
2501
2502 _Function_class_(IO_TIMER_ROUTINE)
2503 _IRQL_requires_same_
2504 typedef VOID
2505 (NTAPI IO_TIMER_ROUTINE)(
2506 _In_ struct _DEVICE_OBJECT *DeviceObject,
2507 _In_opt_ PVOID Context);
2508 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2509
2510 typedef struct _IO_SECURITY_CONTEXT {
2511 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
2512 PACCESS_STATE AccessState;
2513 ACCESS_MASK DesiredAccess;
2514 ULONG FullCreateOptions;
2515 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
2516
2517 struct _IO_CSQ;
2518
2519 typedef struct _IO_CSQ_IRP_CONTEXT {
2520 ULONG Type;
2521 struct _IRP *Irp;
2522 struct _IO_CSQ *Csq;
2523 } IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
2524
2525 typedef VOID
2526 (NTAPI IO_CSQ_INSERT_IRP)(
2527 _In_ struct _IO_CSQ *Csq,
2528 _In_ PIRP Irp);
2529 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2530
2531 typedef NTSTATUS
2532 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2533 _In_ struct _IO_CSQ *Csq,
2534 _In_ PIRP Irp,
2535 _In_ PVOID InsertContext);
2536 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2537
2538 typedef VOID
2539 (NTAPI IO_CSQ_REMOVE_IRP)(
2540 _In_ struct _IO_CSQ *Csq,
2541 _In_ PIRP Irp);
2542 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2543
2544 typedef PIRP
2545 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2546 _In_ struct _IO_CSQ *Csq,
2547 _In_ PIRP Irp,
2548 _In_ PVOID PeekContext);
2549 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2550
2551 typedef VOID
2552 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2553 _In_ struct _IO_CSQ *Csq,
2554 _Out_ PKIRQL Irql);
2555 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2556
2557 typedef VOID
2558 (NTAPI IO_CSQ_RELEASE_LOCK)(
2559 _In_ struct _IO_CSQ *Csq,
2560 _In_ KIRQL Irql);
2561 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2562
2563 typedef VOID
2564 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2565 _In_ struct _IO_CSQ *Csq,
2566 _In_ PIRP Irp);
2567 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2568
2569 typedef struct _IO_CSQ {
2570 ULONG Type;
2571 PIO_CSQ_INSERT_IRP CsqInsertIrp;
2572 PIO_CSQ_REMOVE_IRP CsqRemoveIrp;
2573 PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;
2574 PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock;
2575 PIO_CSQ_RELEASE_LOCK CsqReleaseLock;
2576 PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp;
2577 PVOID ReservePointer;
2578 } IO_CSQ, *PIO_CSQ;
2579
2580 typedef enum _BUS_QUERY_ID_TYPE {
2581 BusQueryDeviceID,
2582 BusQueryHardwareIDs,
2583 BusQueryCompatibleIDs,
2584 BusQueryInstanceID,
2585 BusQueryDeviceSerialNumber
2586 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
2587
2588 typedef enum _DEVICE_TEXT_TYPE {
2589 DeviceTextDescription,
2590 DeviceTextLocationInformation
2591 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
2592
2593 typedef BOOLEAN
2594 (NTAPI *PGPE_SERVICE_ROUTINE)(
2595 PVOID,
2596 PVOID);
2597
2598 _IRQL_requires_max_(DISPATCH_LEVEL)
2599 _Must_inspect_result_
2600 typedef NTSTATUS
2601 (NTAPI *PGPE_CONNECT_VECTOR)(
2602 PDEVICE_OBJECT,
2603 ULONG,
2604 KINTERRUPT_MODE,
2605 BOOLEAN,
2606 PGPE_SERVICE_ROUTINE,
2607 PVOID,
2608 PVOID);
2609
2610 _IRQL_requires_max_(DISPATCH_LEVEL)
2611 _Must_inspect_result_
2612 typedef NTSTATUS
2613 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2614 PVOID);
2615
2616 _IRQL_requires_max_(DISPATCH_LEVEL)
2617 _Must_inspect_result_
2618 typedef NTSTATUS
2619 (NTAPI *PGPE_ENABLE_EVENT)(
2620 PDEVICE_OBJECT,
2621 PVOID);
2622
2623 _IRQL_requires_max_(DISPATCH_LEVEL)
2624 _Must_inspect_result_
2625 typedef NTSTATUS
2626 (NTAPI *PGPE_DISABLE_EVENT)(
2627 PDEVICE_OBJECT,
2628 PVOID);
2629
2630 _IRQL_requires_max_(DISPATCH_LEVEL)
2631 _Must_inspect_result_
2632 typedef NTSTATUS
2633 (NTAPI *PGPE_CLEAR_STATUS)(
2634 PDEVICE_OBJECT,
2635 PVOID);
2636
2637 typedef VOID
2638 (NTAPI *PDEVICE_NOTIFY_CALLBACK)(
2639 PVOID,
2640 ULONG);
2641
2642 _IRQL_requires_max_(DISPATCH_LEVEL)
2643 _Must_inspect_result_
2644 typedef NTSTATUS
2645 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2646 PDEVICE_OBJECT,
2647 PDEVICE_NOTIFY_CALLBACK,
2648 PVOID);
2649
2650 _IRQL_requires_max_(DISPATCH_LEVEL)
2651 typedef VOID
2652 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2653 PDEVICE_OBJECT,
2654 PDEVICE_NOTIFY_CALLBACK);
2655
2656 typedef struct _ACPI_INTERFACE_STANDARD {
2657 USHORT Size;
2658 USHORT Version;
2659 PVOID Context;
2660 PINTERFACE_REFERENCE InterfaceReference;
2661 PINTERFACE_DEREFERENCE InterfaceDereference;
2662 PGPE_CONNECT_VECTOR GpeConnectVector;
2663 PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
2664 PGPE_ENABLE_EVENT GpeEnableEvent;
2665 PGPE_DISABLE_EVENT GpeDisableEvent;
2666 PGPE_CLEAR_STATUS GpeClearStatus;
2667 PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
2668 PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
2669 } ACPI_INTERFACE_STANDARD, *PACPI_INTERFACE_STANDARD;
2670
2671 typedef BOOLEAN
2672 (NTAPI *PGPE_SERVICE_ROUTINE2)(
2673 PVOID ObjectContext,
2674 PVOID ServiceContext);
2675
2676 _IRQL_requires_max_(DISPATCH_LEVEL)
2677 _Must_inspect_result_
2678 typedef NTSTATUS
2679 (NTAPI *PGPE_CONNECT_VECTOR2)(
2680 PVOID Context,
2681 ULONG GpeNumber,
2682 KINTERRUPT_MODE Mode,
2683 BOOLEAN Shareable,
2684 PGPE_SERVICE_ROUTINE ServiceRoutine,
2685 PVOID ServiceContext,
2686 PVOID *ObjectContext);
2687
2688 _IRQL_requires_max_(DISPATCH_LEVEL)
2689 _Must_inspect_result_
2690 typedef NTSTATUS
2691 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
2692 PVOID Context,
2693 PVOID ObjectContext);
2694
2695 _IRQL_requires_max_(DISPATCH_LEVEL)
2696 _Must_inspect_result_
2697 typedef NTSTATUS
2698 (NTAPI *PGPE_ENABLE_EVENT2)(
2699 PVOID Context,
2700 PVOID ObjectContext);
2701
2702 _IRQL_requires_max_(DISPATCH_LEVEL)
2703 _Must_inspect_result_
2704 typedef NTSTATUS
2705 (NTAPI *PGPE_DISABLE_EVENT2)(
2706 PVOID Context,
2707 PVOID ObjectContext);
2708
2709 _IRQL_requires_max_(DISPATCH_LEVEL)
2710 _Must_inspect_result_
2711 typedef NTSTATUS
2712 (NTAPI *PGPE_CLEAR_STATUS2)(
2713 PVOID Context,
2714 PVOID ObjectContext);
2715
2716 _IRQL_requires_max_(DISPATCH_LEVEL)
2717 typedef VOID
2718 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
2719 PVOID NotificationContext,
2720 ULONG NotifyCode);
2721
2722 _IRQL_requires_max_(DISPATCH_LEVEL)
2723 _Must_inspect_result_
2724 typedef NTSTATUS
2725 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2726 PVOID Context,
2727 PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
2728 PVOID NotificationContext);
2729
2730 _IRQL_requires_max_(DISPATCH_LEVEL)
2731 typedef VOID
2732 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2733 PVOID Context);
2734
2735 typedef struct _ACPI_INTERFACE_STANDARD2 {
2736 USHORT Size;
2737 USHORT Version;
2738 PVOID Context;
2739 PINTERFACE_REFERENCE InterfaceReference;
2740 PINTERFACE_DEREFERENCE InterfaceDereference;
2741 PGPE_CONNECT_VECTOR2 GpeConnectVector;
2742 PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
2743 PGPE_ENABLE_EVENT2 GpeEnableEvent;
2744 PGPE_DISABLE_EVENT2 GpeDisableEvent;
2745 PGPE_CLEAR_STATUS2 GpeClearStatus;
2746 PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
2747 PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
2748 } ACPI_INTERFACE_STANDARD2, *PACPI_INTERFACE_STANDARD2;
2749
2750 #if !defined(_AMD64_) && !defined(_ARM_)
2751 #include <pshpack4.h>
2752 #endif
2753
2754 typedef struct _IO_STACK_LOCATION {
2755 UCHAR MajorFunction;
2756 UCHAR MinorFunction;
2757 UCHAR Flags;
2758 UCHAR Control;
2759 union {
2760 struct {
2761 PIO_SECURITY_CONTEXT SecurityContext;
2762 ULONG Options;
2763 USHORT POINTER_ALIGNMENT FileAttributes;
2764 USHORT ShareAccess;
2765 ULONG POINTER_ALIGNMENT EaLength;
2766 } Create;
2767 struct {
2768 struct _IO_SECURITY_CONTEXT *SecurityContext;
2769 ULONG Options;
2770 USHORT POINTER_ALIGNMENT Reserved;
2771 USHORT ShareAccess;
2772 struct _NAMED_PIPE_CREATE_PARAMETERS *Parameters;
2773 } CreatePipe;
2774 struct {
2775 PIO_SECURITY_CONTEXT SecurityContext;
2776 ULONG Options;
2777 USHORT POINTER_ALIGNMENT Reserved;
2778 USHORT ShareAccess;
2779 struct _MAILSLOT_CREATE_PARAMETERS *Parameters;
2780 } CreateMailslot;
2781 struct {
2782 ULONG Length;
2783 ULONG POINTER_ALIGNMENT Key;
2784 LARGE_INTEGER ByteOffset;
2785 } Read;
2786 struct {
2787 ULONG Length;
2788 ULONG POINTER_ALIGNMENT Key;
2789 LARGE_INTEGER ByteOffset;
2790 } Write;
2791 struct {
2792 ULONG Length;
2793 PUNICODE_STRING FileName;
2794 FILE_INFORMATION_CLASS FileInformationClass;
2795 ULONG POINTER_ALIGNMENT FileIndex;
2796 } QueryDirectory;
2797 struct {
2798 ULONG Length;
2799 ULONG POINTER_ALIGNMENT CompletionFilter;
2800 } NotifyDirectory;
2801 struct {
2802 ULONG Length;
2803 ULONG POINTER_ALIGNMENT CompletionFilter;
2804 DIRECTORY_NOTIFY_INFORMATION_CLASS POINTER_ALIGNMENT DirectoryNotifyInformationClass;
2805 } NotifyDirectoryEx;
2806 struct {
2807 ULONG Length;
2808 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
2809 } QueryFile;
2810 struct {
2811 ULONG Length;
2812 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
2813 PFILE_OBJECT FileObject;
2814 _ANONYMOUS_UNION union {
2815 _ANONYMOUS_STRUCT struct {
2816 BOOLEAN ReplaceIfExists;
2817 BOOLEAN AdvanceOnly;
2818 } DUMMYSTRUCTNAME;
2819 ULONG ClusterCount;
2820 HANDLE DeleteHandle;
2821 } DUMMYUNIONNAME;
2822 } SetFile;
2823 struct {
2824 ULONG Length;
2825 PVOID EaList;
2826 ULONG EaListLength;
2827 ULONG POINTER_ALIGNMENT EaIndex;
2828 } QueryEa;
2829 struct {
2830 ULONG Length;
2831 } SetEa;
2832 struct {
2833 ULONG Length;
2834 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
2835 } QueryVolume;
2836 struct {
2837 ULONG Length;
2838 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
2839 } SetVolume;
2840 struct {
2841 ULONG OutputBufferLength;
2842 ULONG POINTER_ALIGNMENT InputBufferLength;
2843 ULONG POINTER_ALIGNMENT FsControlCode;
2844 PVOID Type3InputBuffer;
2845 } FileSystemControl;
2846 struct {
2847 PLARGE_INTEGER Length;
2848 ULONG POINTER_ALIGNMENT Key;
2849 LARGE_INTEGER ByteOffset;
2850 } LockControl;
2851 struct {
2852 ULONG OutputBufferLength;
2853 ULONG POINTER_ALIGNMENT InputBufferLength;
2854 ULONG POINTER_ALIGNMENT IoControlCode;
2855 PVOID Type3InputBuffer;
2856 } DeviceIoControl;
2857 struct {
2858 SECURITY_INFORMATION SecurityInformation;
2859 ULONG POINTER_ALIGNMENT Length;
2860 } QuerySecurity;
2861 struct {
2862 SECURITY_INFORMATION SecurityInformation;
2863 PSECURITY_DESCRIPTOR SecurityDescriptor;
2864 } SetSecurity;
2865 struct {
2866 PVPB Vpb;
2867 PDEVICE_OBJECT DeviceObject;
2868 } MountVolume;
2869 struct {
2870 PVPB Vpb;
2871 PDEVICE_OBJECT DeviceObject;
2872 } VerifyVolume;
2873 struct {
2874 struct _SCSI_REQUEST_BLOCK *Srb;
2875 } Scsi;
2876 struct {
2877 ULONG Length;
2878 PSID StartSid;
2879 struct _FILE_GET_QUOTA_INFORMATION *SidList;
2880 ULONG SidListLength;
2881 } QueryQuota;
2882 struct {
2883 ULONG Length;
2884 } SetQuota;
2885 struct {
2886 DEVICE_RELATION_TYPE Type;
2887 } QueryDeviceRelations;
2888 struct {
2889 CONST GUID *InterfaceType;
2890 USHORT Size;
2891 USHORT Version;
2892 PINTERFACE Interface;
2893 PVOID InterfaceSpecificData;
2894 } QueryInterface;
2895 struct {
2896 PDEVICE_CAPABILITIES Capabilities;
2897 } DeviceCapabilities;
2898 struct {
2899 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
2900 } FilterResourceRequirements;
2901 struct {
2902 ULONG WhichSpace;
2903 PVOID Buffer;
2904 ULONG Offset;
2905 ULONG POINTER_ALIGNMENT Length;
2906 } ReadWriteConfig;
2907 struct {
2908 BOOLEAN Lock;
2909 } SetLock;
2910 struct {
2911 BUS_QUERY_ID_TYPE IdType;
2912 } QueryId;
2913 struct {
2914 DEVICE_TEXT_TYPE DeviceTextType;
2915 LCID POINTER_ALIGNMENT LocaleId;
2916 } QueryDeviceText;
2917 struct {
2918 BOOLEAN InPath;
2919 BOOLEAN Reserved[3];
2920 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
2921 } UsageNotification;
2922 struct {
2923 SYSTEM_POWER_STATE PowerState;
2924 } WaitWake;
2925 struct {
2926 PPOWER_SEQUENCE PowerSequence;
2927 } PowerSequence;
2928 struct {
2929 union {
2930 ULONG SystemContext;
2931 #if (NTDDI_VERSION >= NTDDI_VISTA)
2932 SYSTEM_POWER_STATE_CONTEXT SystemPowerStateContext;
2933 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
2934 };
2935 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
2936 POWER_STATE POINTER_ALIGNMENT State;
2937 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
2938 } Power;
2939 struct {
2940 PCM_RESOURCE_LIST AllocatedResources;
2941 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
2942 } StartDevice;
2943 struct {
2944 ULONG_PTR ProviderId;
2945 PVOID DataPath;
2946 ULONG BufferSize;
2947 PVOID Buffer;
2948 } WMI;
2949 struct {
2950 PVOID Argument1;
2951 PVOID Argument2;
2952 PVOID Argument3;
2953 PVOID Argument4;
2954 } Others;
2955 } Parameters;
2956 PDEVICE_OBJECT DeviceObject;
2957 PFILE_OBJECT FileObject;
2958 PIO_COMPLETION_ROUTINE CompletionRoutine;
2959 PVOID Context;
2960 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
2961
2962 #if !defined(_AMD64_) && !defined(_ARM_)
2963 #include "poppack.h"
2964 #endif
2965
2966
2967 /* IO_STACK_LOCATION.Control */
2968
2969 #define SL_PENDING_RETURNED 0x01
2970 #define SL_ERROR_RETURNED 0x02
2971 #define SL_INVOKE_ON_CANCEL 0x20
2972 #define SL_INVOKE_ON_SUCCESS 0x40
2973 #define SL_INVOKE_ON_ERROR 0x80
2974
2975 $endif (_WDMDDK_)
2976 $if (_WDMDDK_ || _DEVIOCTL_)
2977 #define METHOD_BUFFERED 0
2978 #define METHOD_IN_DIRECT 1
2979 #define METHOD_OUT_DIRECT 2
2980 #define METHOD_NEITHER 3
2981
2982 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2983 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2984
2985 $endif (_WDMDDK_ || _DEVIOCTL_)
2986 $if (_WDMDDK_)
2987 #define FILE_SUPERSEDED 0x00000000
2988 #define FILE_OPENED 0x00000001
2989 #define FILE_CREATED 0x00000002
2990 #define FILE_OVERWRITTEN 0x00000003
2991 #define FILE_EXISTS 0x00000004
2992 #define FILE_DOES_NOT_EXIST 0x00000005
2993
2994 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
2995 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
2996
2997 /* also in winnt.h */
2998 #define FILE_LIST_DIRECTORY 0x00000001
2999 #define FILE_READ_DATA 0x00000001
3000 #define FILE_ADD_FILE 0x00000002
3001 #define FILE_WRITE_DATA 0x00000002
3002 #define FILE_ADD_SUBDIRECTORY 0x00000004
3003 #define FILE_APPEND_DATA 0x00000004
3004 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3005 #define FILE_READ_EA 0x00000008
3006 #define FILE_WRITE_EA 0x00000010
3007 #define FILE_EXECUTE 0x00000020
3008 #define FILE_TRAVERSE 0x00000020
3009 #define FILE_DELETE_CHILD 0x00000040
3010 #define FILE_READ_ATTRIBUTES 0x00000080
3011 #define FILE_WRITE_ATTRIBUTES 0x00000100
3012
3013 #define FILE_SHARE_READ 0x00000001
3014 #define FILE_SHARE_WRITE 0x00000002
3015 #define FILE_SHARE_DELETE 0x00000004
3016 #define FILE_SHARE_VALID_FLAGS 0x00000007
3017
3018 #define FILE_ATTRIBUTE_READONLY 0x00000001
3019 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3020 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3021 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3022 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3023 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3024 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3025 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3026 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3027 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3028 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3029 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3030 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3031 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3032 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3033 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3034
3035 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3036 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3037
3038 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3039 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3040 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3041 #define FILE_VALID_SET_FLAGS 0x00000036
3042
3043 #define FILE_SUPERSEDE 0x00000000
3044 #define FILE_OPEN 0x00000001
3045 #define FILE_CREATE 0x00000002
3046 #define FILE_OPEN_IF 0x00000003
3047 #define FILE_OVERWRITE 0x00000004
3048 #define FILE_OVERWRITE_IF 0x00000005
3049 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3050
3051 #define FILE_DIRECTORY_FILE 0x00000001
3052 #define FILE_WRITE_THROUGH 0x00000002
3053 #define FILE_SEQUENTIAL_ONLY 0x00000004
3054 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3055 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3056 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3057 #define FILE_NON_DIRECTORY_FILE 0x00000040
3058 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3059 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3060 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3061 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3062 #define FILE_RANDOM_ACCESS 0x00000800
3063 #define FILE_DELETE_ON_CLOSE 0x00001000
3064 #define FILE_OPEN_BY_FILE_ID 0x00002000
3065 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3066 #define FILE_NO_COMPRESSION 0x00008000
3067 #if (NTDDI_VERSION >= NTDDI_WIN7)
3068 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3069 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3070 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3071 #define FILE_RESERVE_OPFILTER 0x00100000
3072 #define FILE_OPEN_REPARSE_POINT 0x00200000
3073 #define FILE_OPEN_NO_RECALL 0x00400000
3074 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3075
3076 $endif (_WDMDDK_)
3077 $if (_WDMDDK_ || _DEVIOCTL_)
3078 #define FILE_ANY_ACCESS 0x00000000
3079 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3080 #define FILE_READ_ACCESS 0x00000001
3081 #define FILE_WRITE_ACCESS 0x00000002
3082
3083 $endif (_WDMDDK_ || _DEVIOCTL_)
3084 $if (_WDMDDK_)
3085 #define FILE_ALL_ACCESS \
3086 (STANDARD_RIGHTS_REQUIRED | \
3087 SYNCHRONIZE | \
3088 0x1FF)
3089
3090 #define FILE_GENERIC_EXECUTE \
3091 (STANDARD_RIGHTS_EXECUTE | \
3092 FILE_READ_ATTRIBUTES | \
3093 FILE_EXECUTE | \
3094 SYNCHRONIZE)
3095
3096 #define FILE_GENERIC_READ \
3097 (STANDARD_RIGHTS_READ | \
3098 FILE_READ_DATA | \
3099 FILE_READ_ATTRIBUTES | \
3100 FILE_READ_EA | \
3101 SYNCHRONIZE)
3102
3103 #define FILE_GENERIC_WRITE \
3104 (STANDARD_RIGHTS_WRITE | \
3105 FILE_WRITE_DATA | \
3106 FILE_WRITE_ATTRIBUTES | \
3107 FILE_WRITE_EA | \
3108 FILE_APPEND_DATA | \
3109 SYNCHRONIZE)
3110
3111 /* end winnt.h */
3112
3113 #define WMIREG_ACTION_REGISTER 1
3114 #define WMIREG_ACTION_DEREGISTER 2
3115 #define WMIREG_ACTION_REREGISTER 3
3116 #define WMIREG_ACTION_UPDATE_GUIDS 4
3117 #define WMIREG_ACTION_BLOCK_IRPS 5
3118
3119 #define WMIREGISTER 0
3120 #define WMIUPDATE 1
3121
3122 _Function_class_(WMI_NOTIFICATION_CALLBACK)
3123 _IRQL_requires_same_
3124 typedef VOID
3125 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3126 PVOID Wnode,
3127 PVOID Context);
3128 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3129
3130 #ifndef _PCI_X_
3131 #define _PCI_X_
3132
3133 typedef struct _PCI_SLOT_NUMBER {
3134 union {
3135 struct {
3136 ULONG DeviceNumber:5;
3137 ULONG FunctionNumber:3;
3138 ULONG Reserved:24;
3139 } bits;
3140 ULONG AsULONG;
3141 } u;
3142 } PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
3143
3144 #define PCI_TYPE0_ADDRESSES 6
3145 #define PCI_TYPE1_ADDRESSES 2
3146 #define PCI_TYPE2_ADDRESSES 5
3147
3148 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3149 inheritance, even from a struct renders the type non-POD. So we use
3150 this hack */
3151 #define PCI_COMMON_HEADER_LAYOUT \
3152 USHORT VendorID; \
3153 USHORT DeviceID; \
3154 USHORT Command; \
3155 USHORT Status; \
3156 UCHAR RevisionID; \
3157 UCHAR ProgIf; \
3158 UCHAR SubClass; \
3159 UCHAR BaseClass; \
3160 UCHAR CacheLineSize; \
3161 UCHAR LatencyTimer; \
3162 UCHAR HeaderType; \
3163 UCHAR BIST; \
3164 union { \
3165 struct _PCI_HEADER_TYPE_0 { \
3166 ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3167 ULONG CIS; \
3168 USHORT SubVendorID; \
3169 USHORT SubSystemID; \
3170 ULONG ROMBaseAddress; \
3171 UCHAR CapabilitiesPtr; \
3172 UCHAR Reserved1[3]; \
3173 ULONG Reserved2; \
3174 UCHAR InterruptLine; \
3175 UCHAR InterruptPin; \
3176 UCHAR MinimumGrant; \
3177 UCHAR MaximumLatency; \
3178 } type0; \
3179 struct _PCI_HEADER_TYPE_1 { \
3180 ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3181 UCHAR PrimaryBus; \
3182 UCHAR SecondaryBus; \
3183 UCHAR SubordinateBus; \
3184 UCHAR SecondaryLatency; \
3185 UCHAR IOBase; \
3186 UCHAR IOLimit; \
3187 USHORT SecondaryStatus; \
3188 USHORT MemoryBase; \
3189 USHORT MemoryLimit; \
3190 USHORT PrefetchBase; \
3191 USHORT PrefetchLimit; \
3192 ULONG PrefetchBaseUpper32; \
3193 ULONG PrefetchLimitUpper32; \
3194 USHORT IOBaseUpper16; \
3195 USHORT IOLimitUpper16; \
3196 UCHAR CapabilitiesPtr; \
3197 UCHAR Reserved1[3]; \
3198 ULONG ROMBaseAddress; \
3199 UCHAR InterruptLine; \
3200 UCHAR InterruptPin; \
3201 USHORT BridgeControl; \
3202 } type1; \
3203 struct _PCI_HEADER_TYPE_2 { \
3204 ULONG SocketRegistersBaseAddress; \
3205 UCHAR CapabilitiesPtr; \
3206 UCHAR Reserved; \
3207 USHORT SecondaryStatus; \
3208 UCHAR PrimaryBus; \
3209 UCHAR SecondaryBus; \
3210 UCHAR SubordinateBus; \
3211 UCHAR SecondaryLatency; \
3212 struct { \
3213 ULONG Base; \
3214 ULONG Limit; \
3215 } Range[PCI_TYPE2_ADDRESSES-1]; \
3216 UCHAR InterruptLine; \
3217 UCHAR InterruptPin; \
3218 USHORT BridgeControl; \
3219 } type2; \
3220 } u;
3221
3222 typedef struct _PCI_COMMON_HEADER {
3223 PCI_COMMON_HEADER_LAYOUT
3224 } PCI_COMMON_HEADER, *PPCI_COMMON_HEADER;
3225
3226 #ifdef __cplusplus
3227 typedef struct _PCI_COMMON_CONFIG {
3228 PCI_COMMON_HEADER_LAYOUT
3229 UCHAR DeviceSpecific[192];
3230 } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
3231 #else
3232 typedef struct _PCI_COMMON_CONFIG {
3233 PCI_COMMON_HEADER DUMMYSTRUCTNAME;
3234 UCHAR DeviceSpecific[192];
3235 } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
3236 #endif
3237
3238 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3239
3240 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3241
3242 #define PCI_MAX_DEVICES 32
3243 #define PCI_MAX_FUNCTION 8
3244 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3245 #define PCI_INVALID_VENDORID 0xFFFF
3246
3247 /* PCI_COMMON_CONFIG.HeaderType */
3248 #define PCI_MULTIFUNCTION 0x80
3249 #define PCI_DEVICE_TYPE 0x00
3250 #define PCI_BRIDGE_TYPE 0x01
3251 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3252
3253 #define PCI_CONFIGURATION_TYPE(PciData) \
3254 (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3255
3256 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3257 ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3258
3259 /* PCI_COMMON_CONFIG.Command */
3260 #define PCI_ENABLE_IO_SPACE 0x0001
3261 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3262 #define PCI_ENABLE_BUS_MASTER 0x0004
3263 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3264 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3265 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3266 #define PCI_ENABLE_PARITY 0x0040
3267 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3268 #define PCI_ENABLE_SERR 0x0100
3269 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3270 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3271
3272 /* PCI_COMMON_CONFIG.Status */
3273 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3274 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3275 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3276 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3277 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3278 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3279 #define PCI_STATUS_DEVSEL 0x0600
3280 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3281 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3282 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3283 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3284 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3285
3286 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3287
3288 #define PCI_WHICHSPACE_CONFIG 0x0
3289 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3290
3291 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3292 #define PCI_CAPABILITY_ID_AGP 0x02
3293 #define PCI_CAPABILITY_ID_VPD 0x03
3294 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3295 #define PCI_CAPABILITY_ID_MSI 0x05
3296 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3297 #define PCI_CAPABILITY_ID_PCIX 0x07
3298 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3299 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3300 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3301 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3302 #define PCI_CAPABILITY_ID_SHPC 0x0C
3303 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3304 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3305 #define PCI_CAPABILITY_ID_SECURE 0x0F
3306 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3307 #define PCI_CAPABILITY_ID_MSIX 0x11
3308
3309 typedef struct _PCI_CAPABILITIES_HEADER {
3310 UCHAR CapabilityID;
3311 UCHAR Next;
3312 } PCI_CAPABILITIES_HEADER, *PPCI_CAPABILITIES_HEADER;
3313
3314 typedef struct _PCI_PMC {
3315 UCHAR Version:3;
3316 UCHAR PMEClock:1;
3317 UCHAR Rsvd1:1;
3318 UCHAR DeviceSpecificInitialization:1;
3319 UCHAR Rsvd2:2;
3320 struct _PM_SUPPORT {
3321 UCHAR Rsvd2:1;
3322 UCHAR D1:1;
3323 UCHAR D2:1;
3324 UCHAR PMED0:1;
3325 UCHAR PMED1:1;
3326 UCHAR PMED2:1;
3327 UCHAR PMED3Hot:1;
3328 UCHAR PMED3Cold:1;
3329 } Support;
3330 } PCI_PMC, *PPCI_PMC;
3331
3332 typedef struct _PCI_PMCSR {
3333 USHORT PowerState:2;
3334 USHORT Rsvd1:6;
3335 USHORT PMEEnable:1;
3336 USHORT DataSelect:4;
3337 USHORT DataScale:2;
3338 USHORT PMEStatus:1;
3339 } PCI_PMCSR, *PPCI_PMCSR;
3340
3341 typedef struct _PCI_PMCSR_BSE {
3342 UCHAR Rsvd1:6;
3343 UCHAR D3HotSupportsStopClock:1;
3344 UCHAR BusPowerClockControlEnabled:1;
3345 } PCI_PMCSR_BSE, *PPCI_PMCSR_BSE;
3346
3347 typedef struct _PCI_PM_CAPABILITY {
3348 PCI_CAPABILITIES_HEADER Header;
3349 union {
3350 PCI_PMC Capabilities;
3351 USHORT AsUSHORT;
3352 } PMC;
3353 union {
3354 PCI_PMCSR ControlStatus;
3355 USHORT AsUSHORT;
3356 } PMCSR;
3357 union {
3358 PCI_PMCSR_BSE BridgeSupport;
3359 UCHAR AsUCHAR;
3360 } PMCSR_BSE;
3361 UCHAR Data;
3362 } PCI_PM_CAPABILITY, *PPCI_PM_CAPABILITY;
3363
3364 typedef struct {
3365 PCI_CAPABILITIES_HEADER Header;
3366 union {
3367 struct {
3368 USHORT DataParityErrorRecoveryEnable:1;
3369 USHORT EnableRelaxedOrdering:1;
3370 USHORT MaxMemoryReadByteCount:2;
3371 USHORT MaxOutstandingSplitTransactions:3;
3372 USHORT Reserved:9;
3373 } bits;
3374 USHORT AsUSHORT;
3375 } Command;
3376 union {
3377 struct {
3378 ULONG FunctionNumber:3;
3379 ULONG DeviceNumber:5;
3380 ULONG BusNumber:8;
3381 ULONG Device64Bit:1;
3382 ULONG Capable133MHz:1;
3383 ULONG SplitCompletionDiscarded:1;
3384 ULONG UnexpectedSplitCompletion:1;
3385 ULONG DeviceComplexity:1;
3386 ULONG DesignedMaxMemoryReadByteCount:2;
3387 ULONG DesignedMaxOutstandingSplitTransactions:3;
3388 ULONG DesignedMaxCumulativeReadSize:3;
3389 ULONG ReceivedSplitCompletionErrorMessage:1;
3390 ULONG CapablePCIX266:1;
3391 ULONG CapablePCIX533:1;
3392 } bits;
3393 ULONG AsULONG;
3394 } Status;
3395 } PCI_X_CAPABILITY, *PPCI_X_CAPABILITY;
3396
3397 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3398 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3399 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3400 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3401 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3402 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3403 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3404 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3405 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3406 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3407 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3408
3409 typedef struct _PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER {
3410 USHORT CapabilityID;
3411 USHORT Version:4;
3412 USHORT Next:12;
3413 } PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER, *PPCI_EXPRESS_ENHANCED_CAPABILITY_HEADER;
3414
3415 typedef struct _PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY {
3416 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header;
3417 ULONG LowSerialNumber;
3418 ULONG HighSerialNumber;
3419 } PCI_EXPRESS_SERIAL_NUMBER_CAPABILITY, *PPCI_EXPRESS_SERIAL_NUMBER_CAPABILITY;
3420
3421 typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS {
3422 _ANONYMOUS_STRUCT struct {
3423 ULONG Undefined:1;
3424 ULONG Reserved1:3;
3425 ULONG DataLinkProtocolError:1;
3426 ULONG SurpriseDownError:1;
3427 ULONG Reserved2:6;
3428 ULONG PoisonedTLP:1;
3429 ULONG FlowControlProtocolError:1;
3430 ULONG CompletionTimeout:1;
3431 ULONG CompleterAbort:1;
3432 ULONG UnexpectedCompletion:1;
3433 ULONG ReceiverOverflow:1;
3434 ULONG MalformedTLP:1;
3435 ULONG ECRCError:1;
3436 ULONG UnsupportedRequestError:1;
3437 ULONG Reserved3:11;
3438 } DUMMYSTRUCTNAME;
3439 ULONG AsULONG;
3440 } PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS;
3441
3442 typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK {
3443 _ANONYMOUS_STRUCT struct {
3444 ULONG Undefined:1;
3445 ULONG Reserved1:3;
3446 ULONG DataLinkProtocolError:1;
3447 ULONG SurpriseDownError:1;
3448 ULONG Reserved2:6;
3449 ULONG PoisonedTLP:1;
3450 ULONG FlowControlProtocolError:1;
3451 ULONG CompletionTimeout:1;
3452 ULONG CompleterAbort:1;
3453 ULONG UnexpectedCompletion:1;
3454 ULONG ReceiverOverflow:1;
3455 ULONG MalformedTLP:1;
3456 ULONG ECRCError:1;
3457 ULONG UnsupportedRequestError:1;
3458 ULONG Reserved3:11;
3459 } DUMMYSTRUCTNAME;
3460 ULONG AsULONG;
3461 } PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_MASK;
3462
3463 typedef union _PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY {
3464 _ANONYMOUS_STRUCT struct {
3465 ULONG Undefined:1;
3466 ULONG Reserved1:3;
3467 ULONG DataLinkProtocolError:1;
3468 ULONG SurpriseDownError:1;
3469 ULONG Reserved2:6;
3470 ULONG PoisonedTLP:1;
3471 ULONG FlowControlProtocolError:1;
3472 ULONG CompletionTimeout:1;
3473 ULONG CompleterAbort:1;
3474 ULONG UnexpectedCompletion:1;
3475 ULONG ReceiverOverflow:1;
3476 ULONG MalformedTLP:1;
3477 ULONG ECRCError:1;
3478 ULONG UnsupportedRequestError:1;
3479 ULONG Reserved3:11;
3480 } DUMMYSTRUCTNAME;
3481 ULONG AsULONG;
3482 } PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY, *PPCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY;
3483
3484 typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_STATUS {
3485 _ANONYMOUS_STRUCT struct {
3486 ULONG ReceiverError:1;
3487 ULONG Reserved1:5;
3488 ULONG BadTLP:1;
3489 ULONG BadDLLP:1;
3490 ULONG ReplayNumRollover:1;
3491 ULONG Reserved2:3;
3492 ULONG ReplayTimerTimeout:1;
3493 ULONG AdvisoryNonFatalError:1;
3494 ULONG Reserved3:18;
3495 } DUMMYSTRUCTNAME;
3496 ULONG AsULONG;
3497 } PCI_EXPRESS_CORRECTABLE_ERROR_STATUS, *PPCI_CORRECTABLE_ERROR_STATUS;
3498
3499 typedef union _PCI_EXPRESS_CORRECTABLE_ERROR_MASK {
3500 _ANONYMOUS_STRUCT struct {
3501 ULONG ReceiverError:1;
3502 ULONG Reserved1:5;
3503 ULONG BadTLP:1;
3504 ULONG BadDLLP:1;
3505 ULONG ReplayNumRollover:1;
3506 ULONG Reserved2:3;
3507 ULONG ReplayTimerTimeout:1;
3508 ULONG AdvisoryNonFatalError:1;
3509 ULONG Reserved3:18;
3510 } DUMMYSTRUCTNAME;
3511 ULONG AsULONG;
3512 } PCI_EXPRESS_CORRECTABLE_ERROR_MASK, *PPCI_CORRECTABLE_ERROR_MASK;
3513
3514 typedef union _PCI_EXPRESS_AER_CAPABILITIES {
3515 _ANONYMOUS_STRUCT struct {
3516 ULONG FirstErrorPointer:5;
3517 ULONG ECRCGenerationCapable:1;
3518 ULONG ECRCGenerationEnable:1;
3519 ULONG ECRCCheckCapable:1;
3520 ULONG ECRCCheckEnable:1;
3521 ULONG Reserved:23;
3522 } DUMMYSTRUCTNAME;
3523 ULONG AsULONG;
3524 } PCI_EXPRESS_AER_CAPABILITIES, *PPCI_EXPRESS_AER_CAPABILITIES;
3525
3526 typedef union _PCI_EXPRESS_ROOT_ERROR_COMMAND {
3527 _ANONYMOUS_STRUCT struct {
3528 ULONG CorrectableErrorReportingEnable:1;
3529 ULONG NonFatalErrorReportingEnable:1;
3530 ULONG FatalErrorReportingEnable:1;
3531 ULONG Reserved:29;
3532 } DUMMYSTRUCTNAME;
3533 ULONG AsULONG;
3534 } PCI_EXPRESS_ROOT_ERROR_COMMAND, *PPCI_EXPRESS_ROOT_ERROR_COMMAND;
3535
3536 typedef union _PCI_EXPRESS_ROOT_ERROR_STATUS {
3537 _ANONYMOUS_STRUCT struct {
3538 ULONG CorrectableErrorReceived:1;
3539 ULONG MultipleCorrectableErrorsReceived:1;
3540 ULONG UncorrectableErrorReceived:1;
3541 ULONG MultipleUncorrectableErrorsReceived:1;
3542 ULONG FirstUncorrectableFatal:1;
3543 ULONG NonFatalErrorMessagesReceived:1;
3544 ULONG FatalErrorMessagesReceived:1;
3545 ULONG Reserved:20;
3546 ULONG AdvancedErrorInterruptMessageNumber:5;
3547 } DUMMYSTRUCTNAME;
3548 ULONG AsULONG;
3549 } PCI_EXPRESS_ROOT_ERROR_STATUS, *PPCI_EXPRESS_ROOT_ERROR_STATUS;
3550
3551 typedef union _PCI_EXPRESS_ERROR_SOURCE_ID {
3552 _ANONYMOUS_STRUCT struct {
3553 USHORT CorrectableSourceIdFun:3;
3554 USHORT CorrectableSourceIdDev:5;
3555 USHORT CorrectableSourceIdBus:8;
3556 USHORT UncorrectableSourceIdFun:3;
3557 USHORT UncorrectableSourceIdDev:5;
3558 USHORT UncorrectableSourceIdBus:8;
3559 } DUMMYSTRUCTNAME;
3560 ULONG AsULONG;
3561 } PCI_EXPRESS_ERROR_SOURCE_ID, *PPCI_EXPRESS_ERROR_SOURCE_ID;
3562
3563 typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS {
3564 _ANONYMOUS_STRUCT struct {
3565 ULONG TargetAbortOnSplitCompletion:1;
3566 ULONG MasterAbortOnSplitCompletion:1;
3567 ULONG ReceivedTargetAbort:1;
3568 ULONG ReceivedMasterAbort:1;
3569 ULONG RsvdZ:1;
3570 ULONG UnexpectedSplitCompletionError:1;
3571 ULONG UncorrectableSplitCompletion:1;
3572 ULONG UncorrectableDataError:1;
3573 ULONG UncorrectableAttributeError:1;
3574 ULONG UncorrectableAddressError:1;
3575 ULONG DelayedTransactionDiscardTimerExpired:1;
3576 ULONG PERRAsserted:1;
3577 ULONG SERRAsserted:1;
3578 ULONG InternalBridgeError:1;
3579 ULONG Reserved:18;
3580 } DUMMYSTRUCTNAME;
3581 ULONG AsULONG;
3582 } PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS, *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS;
3583
3584 typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK {
3585 _ANONYMOUS_STRUCT struct {
3586 ULONG TargetAbortOnSplitCompletion:1;
3587 ULONG MasterAbortOnSplitCompletion:1;
3588 ULONG ReceivedTargetAbort:1;
3589 ULONG ReceivedMasterAbort:1;
3590 ULONG RsvdZ:1;
3591 ULONG UnexpectedSplitCompletionError:1;
3592 ULONG UncorrectableSplitCompletion:1;
3593 ULONG UncorrectableDataError:1;
3594 ULONG UncorrectableAttributeError:1;
3595 ULONG UncorrectableAddressError:1;
3596 ULONG DelayedTransactionDiscardTimerExpired:1;
3597 ULONG PERRAsserted:1;
3598 ULONG SERRAsserted:1;
3599 ULONG InternalBridgeError:1;
3600 ULONG Reserved:18;
3601 } DUMMYSTRUCTNAME;
3602 ULONG AsULONG;
3603 } PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK, *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK;
3604
3605 typedef union _PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY {
3606 _ANONYMOUS_STRUCT struct {
3607 ULONG TargetAbortOnSplitCompletion:1;
3608 ULONG MasterAbortOnSplitCompletion:1;
3609 ULONG ReceivedTargetAbort:1;
3610 ULONG ReceivedMasterAbort:1;
3611 ULONG RsvdZ:1;
3612 ULONG UnexpectedSplitCompletionError:1;
3613 ULONG UncorrectableSplitCompletion:1;
3614 ULONG UncorrectableDataError:1;
3615 ULONG UncorrectableAttributeError:1;
3616 ULONG UncorrectableAddressError:1;
3617 ULONG DelayedTransactionDiscardTimerExpired:1;
3618 ULONG PERRAsserted:1;
3619 ULONG SERRAsserted:1;
3620 ULONG InternalBridgeError:1;
3621 ULONG Reserved:18;
3622 } DUMMYSTRUCTNAME;
3623 ULONG AsULONG;
3624 } PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY, *PPCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY;
3625
3626 typedef union _PCI_EXPRESS_SEC_AER_CAPABILITIES {
3627 _ANONYMOUS_STRUCT struct {
3628 ULONG SecondaryUncorrectableFirstErrorPtr:5;
3629 ULONG Reserved:27;
3630 } DUMMYSTRUCTNAME;
3631 ULONG AsULONG;
3632 } PCI_EXPRESS_SEC_AER_CAPABILITIES, *PPCI_EXPRESS_SEC_AER_CAPABILITIES;
3633
3634 #define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001
3635 #define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002
3636 #define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004
3637
3638 #define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \
3639 (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \
3640 ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \
3641 ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING)
3642
3643 typedef struct _PCI_EXPRESS_AER_CAPABILITY {
3644 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header;
3645 PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus;
3646 PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask;
3647 PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity;
3648 PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus;
3649 PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask;
3650 PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl;
3651 ULONG HeaderLog[4];
3652 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus;
3653 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask;
3654 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity;
3655 PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl;
3656 ULONG SecHeaderLog[4];
3657 } PCI_EXPRESS_AER_CAPABILITY, *PPCI_EXPRESS_AER_CAPABILITY;
3658
3659 typedef struct _PCI_EXPRESS_ROOTPORT_AER_CAPABILITY {
3660 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header;
3661 PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus;
3662 PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask;
3663 PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity;
3664 PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus;
3665 PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask;
3666 PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl;
3667 ULONG HeaderLog[4];
3668 PCI_EXPRESS_ROOT_ERROR_COMMAND RootErrorCommand;
3669 PCI_EXPRESS_ROOT_ERROR_STATUS RootErrorStatus;
3670 PCI_EXPRESS_ERROR_SOURCE_ID ErrorSourceId;
3671 } PCI_EXPRESS_ROOTPORT_AER_CAPABILITY, *PPCI_EXPRESS_ROOTPORT_AER_CAPABILITY;
3672
3673 typedef struct _PCI_EXPRESS_BRIDGE_AER_CAPABILITY {
3674 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header;
3675 PCI_EXPRESS_UNCORRECTABLE_ERROR_STATUS UncorrectableErrorStatus;
3676 PCI_EXPRESS_UNCORRECTABLE_ERROR_MASK UncorrectableErrorMask;
3677 PCI_EXPRESS_UNCORRECTABLE_ERROR_SEVERITY UncorrectableErrorSeverity;
3678 PCI_EXPRESS_CORRECTABLE_ERROR_STATUS CorrectableErrorStatus;
3679 PCI_EXPRESS_CORRECTABLE_ERROR_MASK CorrectableErrorMask;
3680 PCI_EXPRESS_AER_CAPABILITIES CapabilitiesAndControl;
3681 ULONG HeaderLog[4];
3682 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_STATUS SecUncorrectableErrorStatus;
3683 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_MASK SecUncorrectableErrorMask;
3684 PCI_EXPRESS_SEC_UNCORRECTABLE_ERROR_SEVERITY SecUncorrectableErrorSeverity;
3685 PCI_EXPRESS_SEC_AER_CAPABILITIES SecCapabilitiesAndControl;
3686 ULONG SecHeaderLog[4];
3687 } PCI_EXPRESS_BRIDGE_AER_CAPABILITY, *PPCI_EXPRESS_BRIDGE_AER_CAPABILITY;
3688
3689 typedef union _PCI_EXPRESS_SRIOV_CAPS {
3690 _ANONYMOUS_STRUCT struct {
3691 ULONG VFMigrationCapable:1;
3692 ULONG Reserved1:20;
3693 ULONG VFMigrationInterruptNumber:11;
3694 } DUMMYSTRUCTNAME;
3695 ULONG AsULONG;
3696 } PCI_EXPRESS_SRIOV_CAPS, *PPCI_EXPRESS_SRIOV_CAPS;
3697
3698 typedef union _PCI_EXPRESS_SRIOV_CONTROL {
3699 _ANONYMOUS_STRUCT struct {
3700 USHORT VFEnable:1;
3701 USHORT VFMigrationEnable:1;
3702 USHORT VFMigrationInterruptEnable:1;
3703 USHORT VFMemorySpaceEnable:1;
3704 USHORT ARICapableHierarchy:1;
3705 USHORT Reserved1:11;
3706 } DUMMYSTRUCTNAME;
3707 USHORT AsUSHORT;
3708 } PCI_EXPRESS_SRIOV_CONTROL, *PPCI_EXPRESS_SRIOV_CONTROL;
3709
3710 typedef union _PCI_EXPRESS_SRIOV_STATUS {
3711 _ANONYMOUS_STRUCT struct {
3712 USHORT VFMigrationStatus:1;
3713 USHORT Reserved1:15;
3714 } DUMMYSTRUCTNAME;
3715 USHORT AsUSHORT;
3716 } PCI_EXPRESS_SRIOV_STATUS, *PPCI_EXPRESS_SRIOV_STATUS;
3717
3718 typedef union _PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY {
3719 _ANONYMOUS_STRUCT struct {
3720 ULONG VFMigrationStateBIR:3;
3721 ULONG VFMigrationStateOffset:29;
3722 } DUMMYSTRUCTNAME;
3723 ULONG AsULONG;
3724 } PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY, *PPCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY;
3725
3726 typedef struct _PCI_EXPRESS_SRIOV_CAPABILITY {
3727 PCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Header;
3728 PCI_EXPRESS_SRIOV_CAPS SRIOVCapabilities;
3729 PCI_EXPRESS_SRIOV_CONTROL SRIOVControl;
3730 PCI_EXPRESS_SRIOV_STATUS SRIOVStatus;
3731 USHORT InitialVFs;
3732 USHORT TotalVFs;
3733 USHORT NumVFs;
3734 UCHAR FunctionDependencyLink;
3735 UCHAR RsvdP1;
3736 USHORT FirstVFOffset;
3737 USHORT VFStride;
3738 USHORT RsvdP2;
3739 USHORT VFDeviceId;
3740 ULONG SupportedPageSizes;
3741 ULONG SystemPageSize;
3742 ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
3743 PCI_EXPRESS_SRIOV_MIGRATION_STATE_ARRAY VFMigrationStateArrayOffset;
3744 } PCI_EXPRESS_SRIOV_CAPABILITY, *PPCI_EXPRESS_SRIOV_CAPABILITY;
3745
3746 /* PCI device classes */
3747 #define PCI_CLASS_PRE_20 0x00
3748 #define PCI_CLASS_MASS_STORAGE_CTLR 0x01
3749 #define PCI_CLASS_NETWORK_CTLR 0x02
3750 #define PCI_CLASS_DISPLAY_CTLR 0x03
3751 #define PCI_CLASS_MULTIMEDIA_DEV 0x04
3752 #define PCI_CLASS_MEMORY_CTLR 0x05
3753 #define PCI_CLASS_BRIDGE_DEV 0x06
3754 #define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07
3755 #define PCI_CLASS_BASE_SYSTEM_DEV 0x08
3756 #define PCI_CLASS_INPUT_DEV 0x09
3757 #define PCI_CLASS_DOCKING_STATION 0x0a
3758 #define PCI_CLASS_PROCESSOR 0x0b
3759 #define PCI_CLASS_SERIAL_BUS_CTLR 0x0c
3760 #define PCI_CLASS_WIRELESS_CTLR 0x0d
3761 #define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e
3762 #define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f
3763 #define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10
3764 #define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11
3765 #define PCI_CLASS_NOT_DEFINED 0xff
3766
3767 /* PCI device subclasses for class 0 */
3768 #define PCI_SUBCLASS_PRE_20_NON_VGA 0x00
3769 #define PCI_SUBCLASS_PRE_20_VGA 0x01
3770
3771 /* PCI device subclasses for class 1 (mass storage controllers)*/
3772 #define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00
3773 #define PCI_SUBCLASS_MSC_IDE_CTLR 0x01
3774 #define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02
3775 #define PCI_SUBCLASS_MSC_IPI_CTLR 0x03
3776 #define PCI_SUBCLASS_MSC_RAID_CTLR 0x04
3777 #define PCI_SUBCLASS_MSC_OTHER 0x80
3778
3779 /* PCI device subclasses for class 2 (network controllers)*/
3780 #define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00
3781 #define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01
3782 #define PCI_SUBCLASS_NET_FDDI_CTLR 0x02
3783 #define PCI_SUBCLASS_NET_ATM_CTLR 0x03
3784 #define PCI_SUBCLASS_NET_ISDN_CTLR 0x04
3785 #define PCI_SUBCLASS_NET_OTHER 0x80
3786
3787 /* PCI device subclasses for class 3 (display controllers)*/
3788 #define PCI_SUBCLASS_VID_VGA_CTLR 0x00
3789 #define PCI_SUBCLASS_VID_XGA_CTLR 0x01
3790 #define PCI_SUBCLASS_VID_3D_CTLR 0x02
3791 #define PCI_SUBCLASS_VID_OTHER 0x80
3792
3793 /* PCI device subclasses for class 4 (multimedia device)*/
3794 #define PCI_SUBCLASS_MM_VIDEO_DEV 0x00
3795 #define PCI_SUBCLASS_MM_AUDIO_DEV 0x01
3796 #define PCI_SUBCLASS_MM_TELEPHONY_DEV 0x02
3797 #define PCI_SUBCLASS_MM_OTHER 0x80
3798
3799 /* PCI device subclasses for class 5 (memory controller)*/
3800 #define PCI_SUBCLASS_MEM_RAM 0x00
3801 #define PCI_SUBCLASS_MEM_FLASH 0x01
3802 #define PCI_SUBCLASS_MEM_OTHER 0x80
3803
3804 /* PCI device subclasses for class 6 (bridge device)*/
3805 #define PCI_SUBCLASS_BR_HOST 0x00
3806 #define PCI_SUBCLASS_BR_ISA 0x01
3807 #define PCI_SUBCLASS_BR_EISA 0x02
3808 #define PCI_SUBCLASS_BR_MCA 0x03
3809 #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
3810 #define PCI_SUBCLASS_BR_PCMCIA 0x05
3811 #define PCI_SUBCLASS_BR_NUBUS 0x06
3812 #define PCI_SUBCLASS_BR_CARDBUS 0x07
3813 #define PCI_SUBCLASS_BR_RACEWAY 0x08
3814 #define PCI_SUBCLASS_BR_OTHER 0x80
3815
3816 #define PCI_SUBCLASS_COM_SERIAL 0x00
3817 #define PCI_SUBCLASS_COM_PARALLEL 0x01
3818 #define PCI_SUBCLASS_COM_MULTIPORT 0x02
3819 #define PCI_SUBCLASS_COM_MODEM 0x03
3820 #define PCI_SUBCLASS_COM_OTHER 0x80
3821
3822 #define PCI_SUBCLASS_SYS_INTERRUPT_CTLR 0x00
3823 #define PCI_SUBCLASS_SYS_DMA_CTLR 0x01
3824 #define PCI_SUBCLASS_SYS_SYSTEM_TIMER 0x02
3825 #define PCI_SUBCLASS_SYS_REAL_TIME_CLOCK 0x03
3826 #define PCI_SUBCLASS_SYS_GEN_HOTPLUG_CTLR 0x04
3827 #define PCI_SUBCLASS_SYS_SDIO_CTRL 0x05
3828 #define PCI_SUBCLASS_SYS_OTHER 0x80
3829
3830 #define PCI_SUBCLASS_INP_KEYBOARD 0x00
3831 #define PCI_SUBCLASS_INP_DIGITIZER 0x01
3832 #define PCI_SUBCLASS_INP_MOUSE 0x02
3833 #define PCI_SUBCLASS_INP_SCANNER 0x03
3834 #define PCI_SUBCLASS_INP_GAMEPORT 0x04
3835 #define PCI_SUBCLASS_INP_OTHER 0x80
3836
3837 #define PCI_SUBCLASS_DOC_GENERIC 0x00
3838 #define PCI_SUBCLASS_DOC_OTHER 0x80
3839
3840 #define PCI_SUBCLASS_PROC_386 0x00
3841 #define PCI_SUBCLASS_PROC_486 0x01
3842 #define PCI_SUBCLASS_PROC_PENTIUM 0x02
3843 #define PCI_SUBCLASS_PROC_ALPHA 0x10
3844 #define PCI_SUBCLASS_PROC_POWERPC 0x20
3845 #define PCI_SUBCLASS_PROC_COPROCESSOR 0x40
3846
3847 /* PCI device subclasses for class C (serial bus controller)*/
3848 #define PCI_SUBCLASS_SB_IEEE1394 0x00
3849 #define PCI_SUBCLASS_SB_ACCESS 0x01
3850 #define PCI_SUBCLASS_SB_SSA 0x02
3851 #define PCI_SUBCLASS_SB_USB 0x03
3852 #define PCI_SUBCLASS_SB_FIBRE_CHANNEL 0x04
3853 #define PCI_SUBCLASS_SB_SMBUS 0x05
3854
3855 #define PCI_SUBCLASS_WIRELESS_IRDA 0x00
3856 #define PCI_SUBCLASS_WIRELESS_CON_IR 0x01
3857 #define PCI_SUBCLASS_WIRELESS_RF 0x10
3858 #define PCI_SUBCLASS_WIRELESS_OTHER 0x80
3859
3860 #define PCI_SUBCLASS_INTIO_I2O 0x00
3861
3862 #define PCI_SUBCLASS_SAT_TV 0x01
3863 #define PCI_SUBCLASS_SAT_AUDIO 0x02
3864 #define PCI_SUBCLASS_SAT_VOICE 0x03
3865 #define PCI_SUBCLASS_SAT_DATA 0x04
3866
3867 #define PCI_SUBCLASS_CRYPTO_NET_COMP 0x00
3868 #define PCI_SUBCLASS_CRYPTO_ENTERTAINMENT 0x10
3869 #define PCI_SUBCLASS_CRYPTO_OTHER 0x80
3870
3871 #define PCI_SUBCLASS_DASP_DPIO 0x00
3872 #define PCI_SUBCLASS_DASP_OTHER 0x80
3873
3874 #define PCI_ADDRESS_IO_SPACE 0x00000001
3875 #define PCI_ADDRESS_MEMORY_TYPE_MASK 0x00000006
3876 #define PCI_ADDRESS_MEMORY_PREFETCHABLE 0x00000008
3877 #define PCI_ADDRESS_IO_ADDRESS_MASK 0xfffffffc
3878 #define PCI_ADDRESS_MEMORY_ADDRESS_MASK 0xfffffff0
3879 #define PCI_ADDRESS_ROM_ADDRESS_MASK 0xfffff800
3880
3881 #define PCI_TYPE_32BIT 0
3882 #define PCI_TYPE_20BIT 2
3883 #define PCI_TYPE_64BIT 4
3884
3885 #define PCI_ROMADDRESS_ENABLED 0x00000001
3886
3887 #endif /* _PCI_X_ */
3888
3889 #define PCI_EXPRESS_LINK_QUIESCENT_INTERFACE_VERSION 1
3890
3891 _IRQL_requires_max_(PASSIVE_LEVEL)
3892 _Must_inspect_result_
3893 typedef NTSTATUS
3894 (NTAPI PCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE)(
3895 _Inout_ PVOID Context);
3896 typedef PCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE *PPCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE;
3897
3898 _IRQL_requires_max_(PASSIVE_LEVEL)
3899 _Must_inspect_result_
3900 typedef NTSTATUS
3901 (NTAPI PCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE)(
3902 _Inout_ PVOID Context);
3903 typedef PCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE *PPCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE;
3904
3905 typedef struct _PCI_EXPRESS_LINK_QUIESCENT_INTERFACE {
3906 USHORT Size;
3907 USHORT Version;
3908 PVOID Context;
3909 PINTERFACE_REFERENCE InterfaceReference;
3910 PINTERFACE_DEREFERENCE InterfaceDereference;
3911 PPCI_EXPRESS_ENTER_LINK_QUIESCENT_MODE PciExpressEnterLinkQuiescentMode;
3912 PPCI_EXPRESS_EXIT_LINK_QUIESCENT_MODE PciExpressExitLinkQuiescentMode;
3913 } PCI_EXPRESS_LINK_QUIESCENT_INTERFACE, *PPCI_EXPRESS_LINK_QUIESCENT_INTERFACE;
3914
3915 #define PCI_EXPRESS_ROOT_PORT_INTERFACE_VERSION 1
3916
3917 typedef ULONG
3918 (NTAPI *PPCI_EXPRESS_ROOT_PORT_READ_CONFIG_SPACE)(
3919 _In_ PVOID Context,
3920 _Out_writes_bytes_(Length) PVOID Buffer,
3921 _In_ ULONG Offset,
3922 _In_ ULONG Length);
3923
3924 typedef ULONG
3925 (NTAPI *PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE)(
3926 _In_ PVOID Context,
3927 _In_reads_bytes_(Length) PVOID Buffer,
3928 _In_ ULONG Offset,
3929 _In_ ULONG Length);
3930
3931 typedef struct _PCI_EXPRESS_ROOT_PORT_INTERFACE {
3932 USHORT Size;
3933 USHORT Version;
3934 PVOID Context;
3935 PINTERFACE_REFERENCE InterfaceReference;
3936 PINTERFACE_DEREFERENCE InterfaceDereference;
3937 PPCI_EXPRESS_ROOT_PORT_READ_CONFIG_SPACE ReadConfigSpace;
3938 PPCI_EXPRESS_ROOT_PORT_WRITE_CONFIG_SPACE WriteConfigSpace;
3939 } PCI_EXPRESS_ROOT_PORT_INTERFACE, *PPCI_EXPRESS_ROOT_PORT_INTERFACE;
3940
3941 #define PCI_MSIX_TABLE_CONFIG_INTERFACE_VERSION 1
3942
3943 _Must_inspect_result_
3944 typedef NTSTATUS
3945 (NTAPI PCI_MSIX_SET_ENTRY)(
3946 _In_ PVOID Context,
3947 _In_ ULONG TableEntry,
3948 _In_ ULONG MessageNumber);
3949 typedef PCI_MSIX_SET_ENTRY *PPCI_MSIX_SET_ENTRY;
3950
3951 _Must_inspect_result_
3952 typedef NTSTATUS
3953 (NTAPI PCI_MSIX_MASKUNMASK_ENTRY)(
3954 _In_ PVOID Context,
3955 _In_ ULONG TableEntry);
3956 typedef PCI_MSIX_MASKUNMASK_ENTRY *PPCI_MSIX_MASKUNMASK_ENTRY;
3957
3958 _Must_inspect_result_
3959 typedef NTSTATUS
3960 (NTAPI PCI_MSIX_GET_ENTRY)(
3961 _In_ PVOID Context,
3962 _In_ ULONG TableEntry,
3963 _Out_ PULONG MessageNumber,
3964 _Out_ PBOOLEAN Masked);
3965 typedef PCI_MSIX_GET_ENTRY *PPCI_MSIX_GET_ENTRY;
3966
3967 _Must_inspect_result_
3968 typedef NTSTATUS
3969 (NTAPI PCI_MSIX_GET_TABLE_SIZE)(
3970 _In_ PVOID Context,
3971 _Out_ PULONG TableSize);
3972 typedef PCI_MSIX_GET_TABLE_SIZE *PPCI_MSIX_GET_TABLE_SIZE;
3973
3974 typedef struct _PCI_MSIX_TABLE_CONFIG_INTERFACE {
3975 USHORT Size;
3976 USHORT Version;
3977 PVOID Context;
3978 PINTERFACE_REFERENCE InterfaceReference;
3979 PINTERFACE_DEREFERENCE InterfaceDereference;
3980 PPCI_MSIX_SET_ENTRY SetTableEntry;
3981 PPCI_MSIX_MASKUNMASK_ENTRY MaskTableEntry;
3982 PPCI_MSIX_MASKUNMASK_ENTRY UnmaskTableEntry;
3983 PPCI_MSIX_GET_ENTRY GetTableEntry;
3984 PPCI_MSIX_GET_TABLE_SIZE GetTableSize;
3985 } PCI_MSIX_TABLE_CONFIG_INTERFACE, *PPCI_MSIX_TABLE_CONFIG_INTERFACE;
3986
3987 #define PCI_MSIX_TABLE_CONFIG_MINIMUM_SIZE \
3988 RTL_SIZEOF_THROUGH_FIELD(PCI_MSIX_TABLE_CONFIG_INTERFACE, UnmaskTableEntry)
3989
3990 $endif (_WDMDDK_)
3991 $if (_NTDDK_)
3992 #ifndef _ARC_DDK_
3993 #define _ARC_DDK_
3994 typedef enum _CONFIGURATION_TYPE {
3995 ArcSystem,
3996 CentralProcessor,
3997 FloatingPointProcessor,
3998 PrimaryIcache,
3999 PrimaryDcache,
4000 SecondaryIcache,
4001 SecondaryDcache,
4002 SecondaryCache,
4003 EisaAdapter,
4004 TcAdapter,
4005 ScsiAdapter,
4006 DtiAdapter,
4007 MultiFunctionAdapter,
4008 DiskController,
4009 TapeController,
4010 CdromController,
4011 WormController,
4012 SerialController,
4013 NetworkController,
4014 DisplayController,
4015 ParallelController,
4016 PointerController,
4017 KeyboardController,
4018 AudioController,
4019 OtherController,
4020 DiskPeripheral,
4021 FloppyDiskPeripheral,
4022 TapePeripheral,
4023 ModemPeripheral,
4024 MonitorPeripheral,
4025 PrinterPeripheral,
4026 PointerPeripheral,
4027 KeyboardPeripheral,
4028 TerminalPeripheral,
4029 OtherPeripheral,
4030 LinePeripheral,
4031 NetworkPeripheral,
4032 SystemMemory,
4033 DockingInformation,
4034 RealModeIrqRoutingTable,
4035 RealModePCIEnumeration,
4036 MaximumType
4037 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
4038 #endif /* !_ARC_DDK_ */
4039
4040 /*
4041 ** IRP function codes
4042 */
4043
4044 #define IRP_MN_QUERY_DIRECTORY 0x01
4045 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
4046
4047 #define IRP_MN_USER_FS_REQUEST 0x00
4048 #define IRP_MN_MOUNT_VOLUME 0x01
4049 #define IRP_MN_VERIFY_VOLUME 0x02
4050 #define IRP_MN_LOAD_FILE_SYSTEM 0x03
4051 #define IRP_MN_TRACK_LINK 0x04
4052 #define IRP_MN_KERNEL_CALL 0x04
4053
4054 #define IRP_MN_LOCK 0x01
4055 #define IRP_MN_UNLOCK_SINGLE 0x02
4056 #define IRP_MN_UNLOCK_ALL 0x03
4057 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
4058
4059 #define IRP_MN_FLUSH_AND_PURGE 0x01
4060
4061 #define IRP_MN_NORMAL 0x00
4062 #define IRP_MN_DPC 0x01
4063 #define IRP_MN_MDL 0x02
4064 #define IRP_MN_COMPLETE 0x04
4065 #define IRP_MN_COMPRESSED 0x08
4066
4067 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
4068 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
4069 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
4070
4071 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
4072
4073 #define IO_CHECK_CREATE_PARAMETERS 0x0200
4074 #define IO_ATTACH_DEVICE 0x0400
4075 #define IO_IGNORE_SHARE_ACCESS_CHECK 0x0800
4076
4077 typedef NTSTATUS
4078 (NTAPI *PIO_QUERY_DEVICE_ROUTINE)(
4079 _In_ PVOID Context,
4080 _In_ PUNICODE_STRING PathName,
4081 _In_ INTERFACE_TYPE BusType,
4082 _In_ ULONG BusNumber,
4083 _In_ PKEY_VALUE_FULL_INFORMATION *BusInformation,
4084 _In_ CONFIGURATION_TYPE ControllerType,
4085 _In_ ULONG ControllerNumber,
4086 _In_ PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
4087 _In_ CONFIGURATION_TYPE PeripheralType,
4088 _In_ ULONG PeripheralNumber,
4089 _In_ PKEY_VALUE_FULL_INFORMATION *PeripheralInformation);
4090
4091 typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
4092 IoQueryDeviceIdentifier = 0,
4093 IoQueryDeviceConfigurationData,
4094 IoQueryDeviceComponentInformation,
4095 IoQueryDeviceMaxData
4096 } IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
4097
4098 typedef VOID
4099 (NTAPI *PDRIVER_REINITIALIZE)(
4100 _In_ struct _DRIVER_OBJECT *DriverObject,
4101 _In_opt_ PVOID Context,
4102 _In_ ULONG Count);
4103
4104 typedef struct _CONTROLLER_OBJECT {
4105 CSHORT Type;
4106 CSHORT Size;
4107 PVOID ControllerExtension;
4108 KDEVICE_QUEUE DeviceWaitQueue;
4109 ULONG Spare1;
4110 LARGE_INTEGER Spare2;
4111 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
4112
4113 #define DRVO_REINIT_REGISTERED 0x00000008
4114 #define DRVO_INITIALIZED 0x00000010
4115 #define DRVO_BOOTREINIT_REGISTERED 0x00000020
4116 #define DRVO_LEGACY_RESOURCES 0x00000040
4117
4118 typedef struct _CONFIGURATION_INFORMATION {
4119 ULONG DiskCount;
4120 ULONG FloppyCount;
4121 ULONG CdRomCount;
4122 ULONG TapeCount;
4123 ULONG ScsiPortCount;
4124 ULONG SerialCount;
4125 ULONG ParallelCount;
4126 BOOLEAN AtDiskPrimaryAddressClaimed;
4127 BOOLEAN AtDiskSecondaryAddressClaimed;
4128 ULONG Version;
4129 ULONG MediumChangerCount;
4130 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
4131
4132 typedef struct _DISK_SIGNATURE {
4133 ULONG PartitionStyle;
4134 _ANONYMOUS_UNION union {
4135 struct {
4136 ULONG Signature;
4137 ULONG CheckSum;
4138 } Mbr;
4139 struct {
4140 GUID DiskId;
4141 } Gpt;
4142 } DUMMYUNIONNAME;
4143 } DISK_SIGNATURE, *PDISK_SIGNATURE;
4144
4145 typedef struct _TXN_PARAMETER_BLOCK {
4146 USHORT Length;
4147 USHORT TxFsContext;
4148 PVOID TransactionObject;
4149 } TXN_PARAMETER_BLOCK, *PTXN_PARAMETER_BLOCK;
4150
4151 #define TXF_MINIVERSION_DEFAULT_VIEW (0xFFFE)
4152
4153 typedef struct _IO_DRIVER_CREATE_CONTEXT {
4154 CSHORT Size;
4155 struct _ECP_LIST *ExtraCreateParameter;
4156 PVOID DeviceObjectHint;
4157 PTXN_PARAMETER_BLOCK TxnParameters;
4158 } IO_DRIVER_CREATE_CONTEXT, *PIO_DRIVER_CREATE_CONTEXT;
4159
4160 typedef struct _AGP_TARGET_BUS_INTERFACE_STANDARD {
4161 USHORT Size;
4162 USHORT Version;
4163 PVOID Context;
4164 PINTERFACE_REFERENCE InterfaceReference;
4165 PINTERFACE_DEREFERENCE InterfaceDereference;
4166 PGET_SET_DEVICE_DATA SetBusData;
4167 PGET_SET_DEVICE_DATA GetBusData;
4168 UCHAR CapabilityID;
4169 } AGP_TARGET_BUS_INTERFACE_STANDARD, *PAGP_TARGET_BUS_INTERFACE_STANDARD;
4170
4171 _IRQL_requires_max_(PASSIVE_LEVEL)
4172 _Must_inspect_result_
4173 typedef NTSTATUS
4174 (NTAPI *PGET_LOCATION_STRING)(
4175 _Inout_opt_ PVOID Context,
4176 _Outptr_
4177 _At_(*LocationStrings,
4178 _When_(return == 0, __drv_allocatesMem(Mem)))
4179 PZZWSTR *LocationStrings);
4180
4181 typedef struct _PNP_LOCATION_INTERFACE {
4182 USHORT Size;
4183 USHORT Version;
4184 PVOID Context;
4185 PINTERFACE_REFERENCE InterfaceReference;
4186 PINTERFACE_DEREFERENCE InterfaceDereference;
4187 PGET_LOCATION_STRING GetLocationString;
4188 } PNP_LOCATION_INTERFACE, *PPNP_LOCATION_INTERFACE;
4189
4190 typedef enum _ARBITER_ACTION {
4191 ArbiterActionTestAllocation,
4192 ArbiterActionRetestAllocation,
4193 ArbiterActionCommitAllocation,
4194 ArbiterActionRollbackAllocation,
4195 ArbiterActionQueryAllocatedResources,
4196 ArbiterActionWriteReservedResources,
4197 ArbiterActionQueryConflict,
4198 ArbiterActionQueryArbitrate,
4199 ArbiterActionAddReserved,
4200 ArbiterActionBootAllocation
4201 } ARBITER_ACTION, *PARBITER_ACTION;
4202
4203 typedef struct _ARBITER_CONFLICT_INFO {
4204 PDEVICE_OBJECT OwningObject;
4205 ULONGLONG Start;
4206 ULONGLONG End;
4207 } ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO;
4208
4209 typedef struct _ARBITER_TEST_ALLOCATION_PARAMETERS {
4210 _Inout_ PLIST_ENTRY ArbitrationList;
4211 _In_ ULONG AllocateFromCount;
4212 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
4213 } ARBITER_TEST_ALLOCATION_PARAMETERS, *PARBITER_TEST_ALLOCATION_PARAMETERS;
4214
4215 typedef struct _ARBITER_RETEST_ALLOCATION_PARAMETERS {
4216 _Inout_ PLIST_ENTRY ArbitrationList;
4217 _In_ ULONG AllocateFromCount;
4218 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
4219 } ARBITER_RETEST_ALLOCATION_PARAMETERS, *PARBITER_RETEST_ALLOCATION_PARAMETERS;
4220
4221 typedef struct _ARBITER_BOOT_ALLOCATION_PARAMETERS {
4222 _Inout_ PLIST_ENTRY ArbitrationList;
4223 } ARBITER_BOOT_ALLOCATION_PARAMETERS, *PARBITER_BOOT_ALLOCATION_PARAMETERS;
4224
4225 typedef struct _ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS {
4226 _Out_ PCM_PARTIAL_RESOURCE_LIST *AllocatedResources;
4227 } ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS, *PARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS;
4228
4229 typedef struct _ARBITER_QUERY_CONFLICT_PARAMETERS {
4230 _In_ PDEVICE_OBJECT PhysicalDeviceObject;
4231 _In_ PIO_RESOURCE_DESCRIPTOR ConflictingResource;
4232 _Out_ PULONG ConflictCount;
4233 _Out_ PARBITER_CONFLICT_INFO *Conflicts;
4234 } ARBITER_QUERY_CONFLICT_PARAMETERS, *PARBITER_QUERY_CONFLICT_PARAMETERS;
4235
4236 typedef struct _ARBITER_QUERY_ARBITRATE_PARAMETERS {
4237 _In_ PLIST_ENTRY ArbitrationList;
4238 } ARBITER_QUERY_ARBITRATE_PARAMETERS, *PARBITER_QUERY_ARBITRATE_PARAMETERS;
4239
4240 typedef struct _ARBITER_ADD_RESERVED_PARAMETERS {
4241 _In_ PDEVICE_OBJECT ReserveDevice;
4242 } ARBITER_ADD_RESERVED_PARAMETERS, *PARBITER_ADD_RESERVED_PARAMETERS;
4243
4244 typedef struct _ARBITER_PARAMETERS {
4245 union {
4246 ARBITER_TEST_ALLOCATION_PARAMETERS TestAllocation;
4247 ARBITER_RETEST_ALLOCATION_PARAMETERS RetestAllocation;
4248 ARBITER_BOOT_ALLOCATION_PARAMETERS BootAllocation;
4249 ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS QueryAllocatedResources;
4250 ARBITER_QUERY_CONFLICT_PARAMETERS QueryConflict;
4251 ARBITER_QUERY_ARBITRATE_PARAMETERS QueryArbitrate;
4252 ARBITER_ADD_RESERVED_PARAMETERS AddReserved;
4253 } Parameters;
4254 } ARBITER_PARAMETERS, *PARBITER_PARAMETERS;
4255
4256 typedef enum _ARBITER_REQUEST_SOURCE {
4257 ArbiterRequestUndefined = -1,
4258 ArbiterRequestLegacyReported,
4259 ArbiterRequestHalReported,
4260 ArbiterRequestLegacyAssigned,
4261 ArbiterRequestPnpDetected,
4262 ArbiterRequestPnpEnumerated
4263 } ARBITER_REQUEST_SOURCE;
4264
4265 typedef enum _ARBITER_RESULT {
4266 ArbiterResultUndefined = -1,
4267 ArbiterResultSuccess,
4268 ArbiterResultExternalConflict,
4269 ArbiterResultNullRequest
4270 } ARBITER_RESULT;
4271
4272 #define ARBITER_FLAG_BOOT_CONFIG 0x00000001
4273
4274 typedef struct _ARBITER_LIST_ENTRY {
4275 LIST_ENTRY ListEntry;
4276 ULONG AlternativeCount;
4277 PIO_RESOURCE_DESCRIPTOR Alternatives;
4278 PDEVICE_OBJECT PhysicalDeviceObject;
4279 ARBITER_REQUEST_SOURCE RequestSource;
4280 ULONG Flags;
4281 LONG_PTR WorkSpace;
4282 INTERFACE_TYPE InterfaceType;
4283 ULONG SlotNumber;
4284 ULONG BusNumber;
4285 PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment;
4286 PIO_RESOURCE_DESCRIPTOR SelectedAlternative;
4287 ARBITER_RESULT Result;
4288 } ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY;
4289
4290 typedef NTSTATUS
4291 (NTAPI *PARBITER_HANDLER)(
4292 _Inout_opt_ PVOID Context,
4293 _In_ ARBITER_ACTION Action,
4294 _Inout_ PARBITER_PARAMETERS Parameters);
4295
4296 #define ARBITER_PARTIAL 0x00000001
4297
4298 typedef struct _ARBITER_INTERFACE {
4299 USHORT Size;
4300 USHORT Version;
4301 PVOID Context;
4302 PINTERFACE_REFERENCE InterfaceReference;
4303 PINTERFACE_DEREFERENCE InterfaceDereference;
4304 PARBITER_HANDLER ArbiterHandler;
4305 ULONG Flags;
4306 } ARBITER_INTERFACE, *PARBITER_INTERFACE;
4307
4308 typedef enum _RESOURCE_TRANSLATION_DIRECTION {
4309 TranslateChildToParent,
4310 TranslateParentToChild
4311 } RESOURCE_TRANSLATION_DIRECTION;
4312
4313 typedef NTSTATUS
4314 (NTAPI *PTRANSLATE_RESOURCE_HANDLER)(
4315 _Inout_opt_ PVOID Context,
4316 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Source,
4317 _In_ RESOURCE_TRANSLATION_DIRECTION Direction,
4318 _In_opt_ ULONG AlternativesCount,
4319 _In_reads_opt_(AlternativesCount) IO_RESOURCE_DESCRIPTOR Alternatives[],
4320 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
4321 _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Target);
4322
4323 typedef NTSTATUS
4324 (NTAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)(
4325 _Inout_opt_ PVOID Context,
4326 _In_ PIO_RESOURCE_DESCRIPTOR Source,
4327 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
4328 _Out_ PULONG TargetCount,
4329 _Out_writes_(*TargetCount) PIO_RESOURCE_DESCRIPTOR *Target);
4330
4331 typedef struct _TRANSLATOR_INTERFACE {
4332 USHORT Size;
4333 USHORT Version;
4334 PVOID Context;
4335 PINTERFACE_REFERENCE InterfaceReference;
4336 PINTERFACE_DEREFERENCE InterfaceDereference;
4337 PTRANSLATE_RESOURCE_HANDLER TranslateResources;
4338 PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements;
4339 } TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE;
4340
4341 typedef struct _PCI_AGP_CAPABILITY {
4342 PCI_CAPABILITIES_HEADER Header;
4343 USHORT Minor:4;
4344 USHORT Major:4;
4345 USHORT Rsvd1:8;
4346 struct _PCI_AGP_STATUS {
4347 ULONG Rate:3;
4348 ULONG Agp3Mode:1;
4349 ULONG FastWrite:1;
4350 ULONG FourGB:1;
4351 ULONG HostTransDisable:1;
4352 ULONG Gart64:1;
4353 ULONG ITA_Coherent:1;
4354 ULONG SideBandAddressing:1;
4355 ULONG CalibrationCycle:3;
4356 ULONG AsyncRequestSize:3;
4357 ULONG Rsvd1:1;
4358 ULONG Isoch:1;
4359 ULONG Rsvd2:6;
4360 ULONG RequestQueueDepthMaximum:8;
4361 } AGPStatus;
4362 struct _PCI_AGP_COMMAND {
4363 ULONG Rate:3;
4364 ULONG Rsvd1:1;
4365 ULONG FastWriteEnable:1;
4366 ULONG FourGBEnable:1;