ReactOS  r75400
iotypes.h
Go to the documentation of this file.
2 /******************************************************************************
3  * I/O Manager Types *
4  ******************************************************************************/
6 
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 
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 
115 $if (_WDMDDK_)
116 #if defined(NT_PROCESSOR_GROUPS)
117 
119 
120 typedef enum _IRQ_DEVICE_POLICY_USHORT {
125  IrqPolicyAllProcessorsInGroup = 3,
128 
129 #else /* defined(NT_PROCESSOR_GROUPS) */
130 
131 typedef enum _IRQ_DEVICE_POLICY {
139 
140 #endif
141 
142 typedef enum _IRQ_PRIORITY {
148 
149 typedef enum _IRQ_GROUP_POLICY {
153 
154 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
155 
160 
161 typedef struct _CLIENT_ID {
165 
166 typedef struct _VPB {
176 } VPB, *PVPB;
177 
178 typedef enum _IO_ALLOCATION_ACTION {
183 
184 _Function_class_(DRIVER_CONTROL)
186 typedef IO_ALLOCATION_ACTION
187 (NTAPI DRIVER_CONTROL)(
191  _In_ PVOID Context);
192 typedef DRIVER_CONTROL *PDRIVER_CONTROL;
193 
196  PDRIVER_CONTROL DeviceRoutine;
203 
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_VERIFY_VOLUME 0x00000002
223 #define DO_BUFFERED_IO 0x00000004
224 #define DO_EXCLUSIVE 0x00000008
225 #define DO_DIRECT_IO 0x00000010
226 #define DO_MAP_IO_BUFFER 0x00000020
227 #define DO_DEVICE_INITIALIZING 0x00000080
228 #define DO_SHUTDOWN_REGISTERED 0x00000800
229 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
230 #define DO_POWER_PAGABLE 0x00002000
231 #define DO_POWER_INRUSH 0x00004000
232 
233 /* DEVICE_OBJECT.Characteristics */
234 #define FILE_REMOVABLE_MEDIA 0x00000001
235 #define FILE_READ_ONLY_DEVICE 0x00000002
236 #define FILE_FLOPPY_DISKETTE 0x00000004
237 #define FILE_WRITE_ONCE_MEDIA 0x00000008
238 #define FILE_REMOTE_DEVICE 0x00000010
239 #define FILE_DEVICE_IS_MOUNTED 0x00000020
240 #define FILE_VIRTUAL_VOLUME 0x00000040
241 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
242 #define FILE_DEVICE_SECURE_OPEN 0x00000100
243 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
244 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
245 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
246 
247 /* DEVICE_OBJECT.AlignmentRequirement */
248 #define FILE_BYTE_ALIGNMENT 0x00000000
249 #define FILE_WORD_ALIGNMENT 0x00000001
250 #define FILE_LONG_ALIGNMENT 0x00000003
251 #define FILE_QUAD_ALIGNMENT 0x00000007
252 #define FILE_OCTA_ALIGNMENT 0x0000000f
253 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
254 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
255 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
256 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
257 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
258 
259 $endif (_NTDDK_)
261 /* DEVICE_OBJECT.DeviceType */
262 #define DEVICE_TYPE ULONG
263 
265 $if (_WDMDDK_)
267  CSHORT Type;
268  USHORT Size;
269  LONG ReferenceCount;
271  struct _DEVICE_OBJECT *NextDevice;
272  struct _DEVICE_OBJECT *AttachedDevice;
273  struct _IRP *CurrentIrp;
275  ULONG Flags;
276  ULONG Characteristics;
277  volatile PVPB Vpb;
278  PVOID DeviceExtension;
281  union {
282  LIST_ENTRY ListEntry;
283  WAIT_CONTEXT_BLOCK Wcb;
284  } Queue;
285  ULONG AlignmentRequirement;
286  KDEVICE_QUEUE DeviceQueue;
287  KDPC Dpc;
288  ULONG ActiveThreadCount;
290  KEVENT DeviceLock;
292  USHORT Spare1;
293  struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
294  PVOID Reserved;
296 
297 typedef enum _IO_SESSION_STATE {
308 
313 
324 
330 
332  _In_ PDEVICE_OBJECT PhysicalDeviceObject;
346 
348  _In_ PDEVICE_OBJECT PhysicalDeviceObject;
356 
358  _In_ PDEVICE_OBJECT PhysicalDeviceObject;
359  union {
361  _Out_ PIO_INTERRUPT_MESSAGE_INFO *InterruptMessageTable;
371 
374  _ANONYMOUS_UNION union {
378  } DUMMYUNIONNAME;
380 
383  union {
386  _In_ PIO_INTERRUPT_MESSAGE_INFO InterruptMessageTable;
389 
390 typedef enum _IO_ACCESS_TYPE {
395 
396 typedef enum _IO_ACCESS_MODE {
400 
405 
413 
418 
424 
425 #if (NTDDI_VERSION >= NTDDI_WIN7)
426 
427 typedef NTSTATUS
429  VOID);
430 
431 typedef NTSTATUS
432 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
435  _In_ ULONG Event,
439 
440 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
441 
442 #endif
443 
445 
449  volatile LONG IoCount;
452 
463  PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
465 
466 typedef struct _IO_REMOVE_LOCK {
468 #if DBG
470 #endif
472 
473 typedef struct _IO_WORKITEM *PIO_WORKITEM;
474 
475 _Function_class_(IO_WORKITEM_ROUTINE)
478 typedef VOID
479 (NTAPI IO_WORKITEM_ROUTINE)(
480  _In_ PDEVICE_OBJECT DeviceObject,
481  _In_opt_ PVOID Context);
482 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
483 
484 typedef VOID
485 (NTAPI IO_WORKITEM_ROUTINE_EX)(
486  _In_ PVOID IoObject,
487  _In_opt_ PVOID Context,
488  _In_ PIO_WORKITEM IoWorkItem);
489 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
490 
500 
501 typedef enum _CREATE_FILE_TYPE {
506 
507 #define IO_FORCE_ACCESS_CHECK 0x001
508 #define IO_NO_PARAMETER_CHECKING 0x100
509 
510 #define IO_REPARSE 0x0
511 #define IO_REMOUNT 0x1
512 
513 typedef struct _IO_STATUS_BLOCK {
514  _ANONYMOUS_UNION union {
516  PVOID Pointer;
517  } DUMMYUNIONNAME;
520 
521 #if defined(_WIN64)
522 typedef struct _IO_STATUS_BLOCK32 {
525 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
526 #endif
527 
528 typedef VOID
531  _In_ PIO_STATUS_BLOCK IoStatusBlock,
533 
534 #define PIO_APC_ROUTINE_DEFINED
535 
536 typedef enum _IO_SESSION_EVENT {
546 
547 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff
548 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001
549 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002
550 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004
551 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008
552 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010
553 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020
554 
555 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
556 
557 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L
558 
559 typedef struct _IO_SESSION_CONNECT_INFO {
563 
564 #define EVENT_INCREMENT 1
565 #define IO_NO_INCREMENT 0
566 #define IO_CD_ROM_INCREMENT 1
567 #define IO_DISK_INCREMENT 1
568 #define IO_KEYBOARD_INCREMENT 6
569 #define IO_MAILSLOT_INCREMENT 2
570 #define IO_MOUSE_INCREMENT 6
571 #define IO_NAMED_PIPE_INCREMENT 2
572 #define IO_NETWORK_INCREMENT 2
573 #define IO_PARALLEL_INCREMENT 1
574 #define IO_SERIAL_INCREMENT 2
575 #define IO_SOUND_INCREMENT 8
576 #define IO_VIDEO_INCREMENT 1
577 #define SEMAPHORE_INCREMENT 1
578 
579 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
580 
581 typedef struct _BOOTDISK_INFORMATION {
587 
588 typedef struct _BOOTDISK_INFORMATION_EX {
598 
599 #if (NTDDI_VERSION >= NTDDI_WIN7)
600 
604  _ANONYMOUS_UNION union {
607  } DUMMYUNIONNAME;
610 
615 
616 #else
617 
618 #if (NTDDI_VERSION >= NTDDI_VISTA)
619 typedef struct _BOOTDISK_INFORMATION_LITE {
620  ULONG BootDeviceSignature;
621  ULONG SystemDeviceSignature;
622  GUID BootDeviceGuid;
623  GUID SystemDeviceGuid;
624  BOOLEAN BootDeviceIsGpt;
625  BOOLEAN SystemDeviceIsGpt;
627 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
628 
629 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
630 
631 #include <pshpack1.h>
632 
633 typedef struct _EISA_MEMORY_TYPE {
642 
650 
651 typedef struct _EISA_IRQ_DESCRIPTOR {
658 
659 typedef struct _EISA_IRQ_CONFIGURATION {
663 
664 typedef struct _DMA_CONFIGURATION_BYTE0 {
670 
671 typedef struct _DMA_CONFIGURATION_BYTE1 {
677 
678 typedef struct _EISA_DMA_CONFIGURATION {
682 
683 typedef struct _EISA_PORT_DESCRIPTOR {
689 
690 typedef struct _EISA_PORT_CONFIGURATION {
694 
705 
721 
722 #include <poppack.h>
723 
724 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
725 
726 #define EISA_FUNCTION_ENABLED 0x80
727 #define EISA_FREE_FORM_DATA 0x40
728 #define EISA_HAS_PORT_INIT_ENTRY 0x20
729 #define EISA_HAS_PORT_RANGE 0x10
730 #define EISA_HAS_DMA_ENTRY 0x08
731 #define EISA_HAS_IRQ_ENTRY 0x04
732 #define EISA_HAS_MEMORY_ENTRY 0x02
733 #define EISA_HAS_TYPE_ENTRY 0x01
734 #define EISA_HAS_INFORMATION \
735  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
736  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
737 
738 #define EISA_MORE_ENTRIES 0x80
739 #define EISA_SYSTEM_MEMORY 0x00
740 #define EISA_MEMORY_TYPE_RAM 0x01
741 
742 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
743 
744 #define EISA_INVALID_SLOT 0x80
745 #define EISA_INVALID_FUNCTION 0x81
746 #define EISA_INVALID_CONFIGURATION 0x82
747 #define EISA_EMPTY_SLOT 0x83
748 #define EISA_INVALID_BIOS_CALL 0x86
749 
750 /*
751 ** Plug and Play structures
752 */
753 
754 typedef VOID
756  PVOID Context);
757 
758 typedef VOID
760  PVOID Context);
761 
762 _Function_class_(TRANSLATE_BUS_ADDRESS)
764 typedef BOOLEAN
765 (NTAPI TRANSLATE_BUS_ADDRESS)(
766  _Inout_opt_ PVOID Context,
768  _In_ ULONG Length,
771 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
772 
773 _Function_class_(GET_DMA_ADAPTER)
775 typedef struct _DMA_ADAPTER*
776 (NTAPI GET_DMA_ADAPTER)(
777  _Inout_opt_ PVOID Context,
780 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
781 
782 _Function_class_(GET_SET_DEVICE_DATA)
784 typedef ULONG
785 (NTAPI GET_SET_DEVICE_DATA)(
786  _Inout_opt_ PVOID Context,
790  _In_ ULONG Length);
791 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
792 
799 
800 typedef struct _LEGACY_BUS_INFORMATION {
805 
811 
812 typedef VOID
814  _In_ PVOID Context);
815 
820  PINTERFACE_REFERENCE InterfaceReference;
821  PINTERFACE_DEREFERENCE InterfaceDereference;
824 
825 typedef VOID
829 
830 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
831 
832 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
833 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
834 #define PCI_USE_REVISION 0x00000002
835 #define PCI_USE_VENDEV_IDS 0x00000004
836 #define PCI_USE_CLASS_SUBCLASS 0x00000008
837 #define PCI_USE_PROGIF 0x00000010
838 #define PCI_USE_LOCAL_BUS 0x00000020
839 #define PCI_USE_LOCAL_DEVICE 0x00000040
840 
853 
856 typedef BOOLEAN
857 (NTAPI PCI_IS_DEVICE_PRESENT)(
858  _In_ USHORT VendorID,
863  _In_ ULONG Flags);
864 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
865 
868 typedef BOOLEAN
869 (NTAPI PCI_IS_DEVICE_PRESENT_EX)(
870  _In_ PVOID Context,
871  _In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
872 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
873 
878  PINTERFACE_REFERENCE InterfaceReference;
879  PINTERFACE_DEREFERENCE InterfaceDereference;
885 
890  PINTERFACE_REFERENCE InterfaceReference;
891  PINTERFACE_DEREFERENCE InterfaceDereference;
895 
897 typedef struct _DEVICE_CAPABILITIES {
898  _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
899  USHORT Version;
900  ULONG DeviceD1:1;
901  ULONG DeviceD2:1;
902  ULONG LockSupported:1;
903  ULONG EjectSupported:1;
904  ULONG Removable:1;
905  ULONG DockDevice:1;
906  ULONG UniqueID:1;
907  ULONG SilentInstall:1;
908  ULONG RawDeviceOK:1;
909  ULONG SurpriseRemovalOK:1;
910  ULONG WakeFromD0:1;
911  ULONG WakeFromD1:1;
912  ULONG WakeFromD2:1;
913  ULONG WakeFromD3:1;
914  ULONG HardwareDisabled:1;
915  ULONG NonDynamic:1;
916  ULONG WarmEjectSupported:1;
917  ULONG NoDisplayInUI:1;
918  ULONG Reserved:14;
919  ULONG Address;
920  ULONG UINumber;
922  SYSTEM_POWER_STATE SystemWake;
923  DEVICE_POWER_STATE DeviceWake;
924  ULONG D1Latency;
925  ULONG D2Latency;
926  ULONG D3Latency;
928 
936 
942 
943 #undef INTERFACE
944 
945 typedef struct _INTERFACE {
946  USHORT Size;
947  USHORT Version;
948  PVOID Context;
949  PINTERFACE_REFERENCE InterfaceReference;
950  PINTERFACE_DEREFERENCE InterfaceDereference;
952 
958 
960 
961 /* PNP_DEVICE_STATE */
962 
963 #define PNP_DEVICE_DISABLED 0x00000001
964 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
965 #define PNP_DEVICE_FAILED 0x00000004
966 #define PNP_DEVICE_REMOVED 0x00000008
967 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
968 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
969 
974  struct _FILE_OBJECT *FileObject;
978 
983  struct _FILE_OBJECT *FileObject;
985 
986 #if (NTDDI_VERSION >= NTDDI_VISTA)
987 #include <devpropdef.h>
988 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
989 #endif
990 
991 #define PNP_REPLACE_NO_MAP MAXLONGLONG
992 
994 typedef NTSTATUS
995 (NTAPI *PREPLACE_MAP_MEMORY)(
996  _In_ PHYSICAL_ADDRESS TargetPhysicalAddress,
1001 
1006  struct {
1009  } Ranges[ANYSIZE_ARRAY];
1011 
1014  _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount;
1019 
1026 
1027 #define PNP_REPLACE_PARAMETERS_VERSION 2
1028 
1029 typedef struct _PNP_REPLACE_PARAMETERS {
1036  PPNP_REPLACE_MEMORY_LIST TargetMemory;
1037  PPNP_REPLACE_MEMORY_LIST SpareMemory;
1038  PREPLACE_MAP_MEMORY MapMemory;
1040 
1041 typedef VOID
1043  VOID);
1044 
1046 typedef NTSTATUS
1047 (NTAPI *PREPLACE_BEGIN)(
1050 
1052 typedef NTSTATUS
1053 (NTAPI *PREPLACE_END)(
1054  _In_ PVOID Context);
1055 
1057 typedef NTSTATUS
1058 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1059  _In_ PVOID Context,
1062 
1064 typedef NTSTATUS
1065 (NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1066  _In_ PVOID Context,
1068  _In_ BOOLEAN Target);
1069 
1071 typedef NTSTATUS
1072 (NTAPI *PREPLACE_SWAP)(
1073  _In_ PVOID Context);
1074 
1076 typedef NTSTATUS
1077 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1078  _In_ PVOID Context);
1079 
1081 typedef NTSTATUS
1082 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1083  _In_ PVOID Context);
1084 
1086 typedef NTSTATUS
1087 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1088  _In_ PVOID Context,
1091 
1093 typedef NTSTATUS
1094 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1095  _In_ PVOID Context,
1097 
1098 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1099 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1100  FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
1101 
1102 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001
1103 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002
1104 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004
1105 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008
1106 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010
1107 
1112  PREPLACE_UNLOAD Unload;
1113  PREPLACE_BEGIN BeginReplace;
1114  PREPLACE_END EndReplace;
1115  PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory;
1116  PREPLACE_SET_PROCESSOR_ID SetProcessorId;
1117  PREPLACE_SWAP Swap;
1118  PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror;
1119  PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory;
1120  PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination;
1121  PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce;
1123 
1125 typedef NTSTATUS
1126 (NTAPI *PREPLACE_DRIVER_INIT)(
1129 
1136 
1137 typedef struct _POWER_SEQUENCE {
1142 
1143 #ifdef _PREFAST_
1144 #define __string_type 0x1000
1145 #define __guid_type 0x2000
1146 #define __multiString_type 0x4000
1147 #else
1148 #define __string_type 0
1149 #define __guid_type 0
1150 #define __multiString_type 0
1151 #endif
1152 
1153 typedef enum {
1178 
1185 
1186 typedef enum _IO_PRIORITY_HINT {
1194 
1195 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1196 
1197 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1199 typedef NTSTATUS
1200 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1202  _Inout_opt_ PVOID Context);
1203 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1204 
1205 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1207 typedef VOID
1208 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1209  _Inout_opt_ PVOID Context);
1210 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1211 
1253 #if (NTDDI_VERSION >= NTDDI_VISTA)
1263 #endif
1264 #if (NTDDI_VERSION >= NTDDI_WIN7)
1271 #endif
1274 
1275 typedef struct _FILE_POSITION_INFORMATION {
1276  LARGE_INTEGER CurrentByteOffset;
1278 
1279 typedef struct _FILE_BASIC_INFORMATION {
1280  LARGE_INTEGER CreationTime;
1281  LARGE_INTEGER LastAccessTime;
1282  LARGE_INTEGER LastWriteTime;
1283  LARGE_INTEGER ChangeTime;
1286 
1290 
1292  ULONG Flags;
1294 
1299 
1303 
1307 
1310  ULONG_PTR ProcessIdList[1];
1312 
1313 typedef struct _FILE_STANDARD_INFORMATION {
1315  LARGE_INTEGER EndOfFile;
1316  ULONG NumberOfLinks;
1317  BOOLEAN DeletePending;
1320 
1321 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1322  LARGE_INTEGER CreationTime;
1323  LARGE_INTEGER LastAccessTime;
1324  LARGE_INTEGER LastWriteTime;
1325  LARGE_INTEGER ChangeTime;
1327  LARGE_INTEGER EndOfFile;
1330 
1331 typedef enum _FSINFOCLASS {
1344 
1345 typedef struct _FILE_FS_DEVICE_INFORMATION {
1347  ULONG Characteristics;
1349 
1350 typedef struct _FILE_FULL_EA_INFORMATION {
1351  ULONG NextEntryOffset;
1352  UCHAR Flags;
1353  UCHAR EaNameLength;
1354  USHORT EaValueLength;
1355  CHAR EaName[1];
1357 
1366 
1372 
1373 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1374 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1375 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1376 
1377 #define FM_LOCK_BIT (0x1)
1378 #define FM_LOCK_BIT_V (0x0)
1379 #define FM_LOCK_WAITER_WOKEN (0x2)
1380 #define FM_LOCK_WAITER_INC (0x4)
1381 
1382 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1384 typedef BOOLEAN
1385 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1386  _In_ struct _FILE_OBJECT *FileObject,
1388  _In_ ULONG Length,
1389  _In_ BOOLEAN Wait,
1390  _In_ ULONG LockKey,
1392  _Out_ PIO_STATUS_BLOCK IoStatus,
1394 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1395 
1396 _Function_class_(FAST_IO_READ)
1398 typedef BOOLEAN
1399 (NTAPI FAST_IO_READ)(
1400  _In_ struct _FILE_OBJECT *FileObject,
1401  _In_ PLARGE_INTEGER FileOffset,
1402  _In_ ULONG Length,
1403  _In_ BOOLEAN Wait,
1404  _In_ ULONG LockKey,
1405  _Out_ PVOID Buffer,
1406  _Out_ PIO_STATUS_BLOCK IoStatus,
1407  _In_ struct _DEVICE_OBJECT *DeviceObject);
1408 typedef FAST_IO_READ *PFAST_IO_READ;
1409 
1410 _Function_class_(FAST_IO_WRITE)
1412 typedef BOOLEAN
1413 (NTAPI FAST_IO_WRITE)(
1414  _In_ struct _FILE_OBJECT *FileObject,
1415  _In_ PLARGE_INTEGER FileOffset,
1416  _In_ ULONG Length,
1417  _In_ BOOLEAN Wait,
1418  _In_ ULONG LockKey,
1419  _In_ PVOID Buffer,
1420  _Out_ PIO_STATUS_BLOCK IoStatus,
1421  _In_ struct _DEVICE_OBJECT *DeviceObject);
1422 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1423 
1424 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1426 typedef BOOLEAN
1427 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1428  _In_ struct _FILE_OBJECT *FileObject,
1429  _In_ BOOLEAN Wait,
1431  _Out_ PIO_STATUS_BLOCK IoStatus,
1432  _In_ struct _DEVICE_OBJECT *DeviceObject);
1433 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1434 
1435 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1437 typedef BOOLEAN
1438 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1439  _In_ struct _FILE_OBJECT *FileObject,
1440  _In_ BOOLEAN Wait,
1442  _Out_ PIO_STATUS_BLOCK IoStatus,
1443  _In_ struct _DEVICE_OBJECT *DeviceObject);
1444 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1445 
1446 _Function_class_(FAST_IO_LOCK)
1448 typedef BOOLEAN
1449 (NTAPI FAST_IO_LOCK)(
1450  _In_ struct _FILE_OBJECT *FileObject,
1451  _In_ PLARGE_INTEGER FileOffset,
1452  _In_ PLARGE_INTEGER Length,
1454  _In_ ULONG Key,
1457  _Out_ PIO_STATUS_BLOCK IoStatus,
1458  _In_ struct _DEVICE_OBJECT *DeviceObject);
1459 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1460 
1461 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1463 typedef BOOLEAN
1464 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1465  _In_ struct _FILE_OBJECT *FileObject,
1466  _In_ PLARGE_INTEGER FileOffset,
1467  _In_ PLARGE_INTEGER Length,
1468  _In_ PEPROCESS ProcessId,
1469  _In_ ULONG Key,
1470  _Out_ PIO_STATUS_BLOCK IoStatus,
1471  _In_ struct _DEVICE_OBJECT *DeviceObject);
1472 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1473 
1474 _Function_class_(FAST_IO_UNLOCK_ALL)
1476 typedef BOOLEAN
1477 (NTAPI FAST_IO_UNLOCK_ALL)(
1478  _In_ struct _FILE_OBJECT *FileObject,
1479  _In_ PEPROCESS ProcessId,
1480  _Out_ PIO_STATUS_BLOCK IoStatus,
1481  _In_ struct _DEVICE_OBJECT *DeviceObject);
1482 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1483 
1484 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1486 typedef BOOLEAN
1487 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1488  _In_ struct _FILE_OBJECT *FileObject,
1489  _In_ PVOID ProcessId,
1490  _In_ ULONG Key,
1491  _Out_ PIO_STATUS_BLOCK IoStatus,
1492  _In_ struct _DEVICE_OBJECT *DeviceObject);
1493 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1494 
1495 _Function_class_(FAST_IO_DEVICE_CONTROL)
1497 typedef BOOLEAN
1498 (NTAPI FAST_IO_DEVICE_CONTROL)(
1499  _In_ struct _FILE_OBJECT *FileObject,
1506  _Out_ PIO_STATUS_BLOCK IoStatus,
1507  _In_ struct _DEVICE_OBJECT *DeviceObject);
1508 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1509 
1510 _Function_class_(FAST_IO_ACQUIRE_FILE)
1512 typedef VOID
1513 (NTAPI FAST_IO_ACQUIRE_FILE)(
1514  _In_ struct _FILE_OBJECT *FileObject);
1515 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1516 
1517 _Function_class_(FAST_IO_RELEASE_FILE)
1519 typedef VOID
1520 (NTAPI FAST_IO_RELEASE_FILE)(
1521  _In_ struct _FILE_OBJECT *FileObject);
1522 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1523 
1524 _Function_class_(FAST_IO_DETACH_DEVICE)
1526 typedef VOID
1527 (NTAPI FAST_IO_DETACH_DEVICE)(
1530 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1531 
1532 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1534 typedef BOOLEAN
1535 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1536  _In_ struct _FILE_OBJECT *FileObject,
1537  _In_ BOOLEAN Wait,
1539  _Out_ struct _IO_STATUS_BLOCK *IoStatus,
1540  _In_ struct _DEVICE_OBJECT *DeviceObject);
1541 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1542 
1543 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1545 typedef NTSTATUS
1546 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1547  _In_ struct _FILE_OBJECT *FileObject,
1550  _In_ struct _DEVICE_OBJECT *DeviceObject);
1551 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1552 
1553 _Function_class_(FAST_IO_MDL_READ)
1555 typedef BOOLEAN
1556 (NTAPI FAST_IO_MDL_READ)(
1557  _In_ struct _FILE_OBJECT *FileObject,
1558  _In_ PLARGE_INTEGER FileOffset,
1559  _In_ ULONG Length,
1560  _In_ ULONG LockKey,
1561  _Out_ PMDL *MdlChain,
1562  _Out_ PIO_STATUS_BLOCK IoStatus,
1563  _In_ struct _DEVICE_OBJECT *DeviceObject);
1564 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1565 
1566 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1568 typedef BOOLEAN
1569 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1570  _In_ struct _FILE_OBJECT *FileObject,
1571  _In_ PMDL MdlChain,
1572  _In_ struct _DEVICE_OBJECT *DeviceObject);
1573 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1574 
1575 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1577 typedef BOOLEAN
1578 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1579  _In_ struct _FILE_OBJECT *FileObject,
1580  _In_ PLARGE_INTEGER FileOffset,
1581  _In_ ULONG Length,
1582  _In_ ULONG LockKey,
1583  _Out_ PMDL *MdlChain,
1584  _Out_ PIO_STATUS_BLOCK IoStatus,
1585  _In_ struct _DEVICE_OBJECT *DeviceObject);
1586 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1587 
1588 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1590 typedef BOOLEAN
1591 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1592  _In_ struct _FILE_OBJECT *FileObject,
1593  _In_ PLARGE_INTEGER FileOffset,
1594  _In_ PMDL MdlChain,
1595  _In_ struct _DEVICE_OBJECT *DeviceObject);
1596 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1597 
1598 _Function_class_(FAST_IO_READ_COMPRESSED)
1600 typedef BOOLEAN
1601 (NTAPI FAST_IO_READ_COMPRESSED)(
1602  _In_ struct _FILE_OBJECT *FileObject,
1603  _In_ PLARGE_INTEGER FileOffset,
1604  _In_ ULONG Length,
1605  _In_ ULONG LockKey,
1606  _Out_ PVOID Buffer,
1607  _Out_ PMDL *MdlChain,
1608  _Out_ PIO_STATUS_BLOCK IoStatus,
1611  _In_ struct _DEVICE_OBJECT *DeviceObject);
1612 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1613 
1614 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1616 typedef BOOLEAN
1617 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1618  _In_ struct _FILE_OBJECT *FileObject,
1619  _In_ PLARGE_INTEGER FileOffset,
1620  _In_ ULONG Length,
1621  _In_ ULONG LockKey,
1622  _In_ PVOID Buffer,
1623  _Out_ PMDL *MdlChain,
1624  _Out_ PIO_STATUS_BLOCK IoStatus,
1625  _In_ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
1626  _In_ ULONG CompressedDataInfoLength,
1627  _In_ struct _DEVICE_OBJECT *DeviceObject);
1628 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1629 
1630 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1632 typedef BOOLEAN
1633 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1634  _In_ struct _FILE_OBJECT *FileObject,
1635  _In_ PMDL MdlChain,
1636  _In_ struct _DEVICE_OBJECT *DeviceObject);
1637 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1638 
1639 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1641 typedef BOOLEAN
1642 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1643  _In_ struct _FILE_OBJECT *FileObject,
1644  _In_ PLARGE_INTEGER FileOffset,
1645  _In_ PMDL MdlChain,
1646  _In_ struct _DEVICE_OBJECT *DeviceObject);
1647 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1648 
1649 _Function_class_(FAST_IO_QUERY_OPEN)
1651 typedef BOOLEAN
1652 (NTAPI FAST_IO_QUERY_OPEN)(
1653  _Inout_ struct _IRP *Irp,
1655  _In_ struct _DEVICE_OBJECT *DeviceObject);
1656 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1657 
1658 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1660 typedef NTSTATUS
1661 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1662  _In_ struct _FILE_OBJECT *FileObject,
1663  _In_ struct _ERESOURCE *ResourceToRelease,
1664  _In_ struct _DEVICE_OBJECT *DeviceObject);
1665 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1666 
1667 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1669 typedef NTSTATUS
1670 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1671  _In_ struct _FILE_OBJECT *FileObject,
1672  _In_ struct _DEVICE_OBJECT *DeviceObject);
1673 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1674 
1675 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1677 typedef NTSTATUS
1678 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1679  _In_ struct _FILE_OBJECT *FileObject,
1680  _In_ struct _DEVICE_OBJECT *DeviceObject);
1681 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1682 
1685  PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
1686  PFAST_IO_READ FastIoRead;
1687  PFAST_IO_WRITE FastIoWrite;
1688  PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
1689  PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
1690  PFAST_IO_LOCK FastIoLock;
1691  PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
1692  PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
1693  PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
1694  PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
1695  PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
1696  PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
1697  PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
1698  PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
1699  PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
1700  PFAST_IO_MDL_READ MdlRead;
1701  PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
1702  PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
1703  PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
1704  PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
1705  PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
1706  PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
1707  PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
1708  PFAST_IO_QUERY_OPEN FastIoQueryOpen;
1709  PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
1710  PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
1711  PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
1713 
1714 typedef struct _SECTION_OBJECT_POINTERS {
1715  PVOID DataSectionObject;
1716  PVOID SharedCacheMap;
1719 
1720 typedef struct _IO_COMPLETION_CONTEXT {
1724 
1725 /* FILE_OBJECT.Flags */
1726 #define FO_FILE_OPEN 0x00000001
1727 #define FO_SYNCHRONOUS_IO 0x00000002
1728 #define FO_ALERTABLE_IO 0x00000004
1729 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1730 #define FO_WRITE_THROUGH 0x00000010
1731 #define FO_SEQUENTIAL_ONLY 0x00000020
1732 #define FO_CACHE_SUPPORTED 0x00000040
1733 #define FO_NAMED_PIPE 0x00000080
1734 #define FO_STREAM_FILE 0x00000100
1735 #define FO_MAILSLOT 0x00000200
1736 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1737 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1738 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1739 #define FO_FILE_MODIFIED 0x00001000
1740 #define FO_FILE_SIZE_CHANGED 0x00002000
1741 #define FO_CLEANUP_COMPLETE 0x00004000
1742 #define FO_TEMPORARY_FILE 0x00008000
1743 #define FO_DELETE_ON_CLOSE 0x00010000
1744 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1745 #define FO_HANDLE_CREATED 0x00040000
1746 #define FO_FILE_FAST_IO_READ 0x00080000
1747 #define FO_RANDOM_ACCESS 0x00100000
1748 #define FO_FILE_OPEN_CANCELLED 0x00200000
1749 #define FO_VOLUME_OPEN 0x00400000
1750 #define FO_REMOTE_ORIGIN 0x01000000
1751 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1752 #define FO_SKIP_COMPLETION_PORT 0x02000000
1753 #define FO_SKIP_SET_EVENT 0x04000000
1754 #define FO_SKIP_SET_FAST_IO 0x08000000
1755 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1756 
1757 /* VPB.Flags */
1758 #define VPB_MOUNTED 0x0001
1759 #define VPB_LOCKED 0x0002
1760 #define VPB_PERSISTENT 0x0004
1761 #define VPB_REMOVE_PENDING 0x0008
1762 #define VPB_RAW_MOUNT 0x0010
1763 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1764 
1765 /* IO_STACK_LOCATION.Flags */
1766 
1767 #define SL_FORCE_ACCESS_CHECK 0x01
1768 #define SL_OPEN_PAGING_FILE 0x02
1769 #define SL_OPEN_TARGET_DIRECTORY 0x04
1770 #define SL_STOP_ON_SYMLINK 0x08
1771 #define SL_CASE_SENSITIVE 0x80
1772 
1773 #define SL_KEY_SPECIFIED 0x01
1774 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1775 #define SL_WRITE_THROUGH 0x04
1776 #define SL_FT_SEQUENTIAL_WRITE 0x08
1777 #define SL_FORCE_DIRECT_WRITE 0x10
1778 #define SL_REALTIME_STREAM 0x20
1779 
1780 #define SL_READ_ACCESS_GRANTED 0x01
1781 #define SL_WRITE_ACCESS_GRANTED 0x04
1782 
1783 #define SL_FAIL_IMMEDIATELY 0x01
1784 #define SL_EXCLUSIVE_LOCK 0x02
1785 
1786 #define SL_RESTART_SCAN 0x01
1787 #define SL_RETURN_SINGLE_ENTRY 0x02
1788 #define SL_INDEX_SPECIFIED 0x04
1789 
1790 #define SL_WATCH_TREE 0x01
1791 
1792 #define SL_ALLOW_RAW_MOUNT 0x01
1793 
1794 $endif (_WDMDDK_)
1795 $if (_WDMDDK_ || _DEVIOCTL_)
1796 #define CTL_CODE(DeviceType, Function, Method, Access) \
1797  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1798 
1799 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1800 
1801 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1802 
1804 $if (_WDMDDK_)
1805 
1806 /* IRP.Flags */
1807 #define IRP_NOCACHE 0x00000001
1808 #define IRP_PAGING_IO 0x00000002
1809 #define IRP_MOUNT_COMPLETION 0x00000002
1810 #define IRP_SYNCHRONOUS_API 0x00000004
1811 #define IRP_ASSOCIATED_IRP 0x00000008
1812 #define IRP_BUFFERED_IO 0x00000010
1813 #define IRP_DEALLOCATE_BUFFER 0x00000020
1814 #define IRP_INPUT_OPERATION 0x00000040
1815 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1816 #define IRP_CREATE_OPERATION 0x00000080
1817 #define IRP_READ_OPERATION 0x00000100
1818 #define IRP_WRITE_OPERATION 0x00000200
1819 #define IRP_CLOSE_OPERATION 0x00000400
1820 #define IRP_DEFER_IO_COMPLETION 0x00000800
1821 #define IRP_OB_QUERY_NAME 0x00001000
1822 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1823 /* The following 2 are missing in latest WDK */
1824 #define IRP_RETRY_IO_COMPLETION 0x00004000
1825 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1826 
1827 /* IRP.AllocationFlags */
1828 #define IRP_QUOTA_CHARGED 0x01
1829 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1830 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1831 #define IRP_LOOKASIDE_ALLOCATION 0x08
1832 
1833 /*
1834 ** IRP function codes
1835 */
1836 
1837 #define IRP_MJ_CREATE 0x00
1838 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1839 #define IRP_MJ_CLOSE 0x02
1840 #define IRP_MJ_READ 0x03
1841 #define IRP_MJ_WRITE 0x04
1842 #define IRP_MJ_QUERY_INFORMATION 0x05
1843 #define IRP_MJ_SET_INFORMATION 0x06
1844 #define IRP_MJ_QUERY_EA 0x07
1845 #define IRP_MJ_SET_EA 0x08
1846 #define IRP_MJ_FLUSH_BUFFERS 0x09
1847 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1848 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1849 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1850 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1851 #define IRP_MJ_DEVICE_CONTROL 0x0e
1852 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1853 #define IRP_MJ_SCSI 0x0f
1854 #define IRP_MJ_SHUTDOWN 0x10
1855 #define IRP_MJ_LOCK_CONTROL 0x11
1856 #define IRP_MJ_CLEANUP 0x12
1857 #define IRP_MJ_CREATE_MAILSLOT 0x13
1858 #define IRP_MJ_QUERY_SECURITY 0x14
1859 #define IRP_MJ_SET_SECURITY 0x15
1860 #define IRP_MJ_POWER 0x16
1861 #define IRP_MJ_SYSTEM_CONTROL 0x17
1862 #define IRP_MJ_DEVICE_CHANGE 0x18
1863 #define IRP_MJ_QUERY_QUOTA 0x19
1864 #define IRP_MJ_SET_QUOTA 0x1a
1865 #define IRP_MJ_PNP 0x1b
1866 #define IRP_MJ_PNP_POWER 0x1b
1867 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1868 
1869 #define IRP_MN_SCSI_CLASS 0x01
1870 
1871 #define IRP_MN_START_DEVICE 0x00
1872 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1873 #define IRP_MN_REMOVE_DEVICE 0x02
1874 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1875 #define IRP_MN_STOP_DEVICE 0x04
1876 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1877 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1878 
1879 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1880 #define IRP_MN_QUERY_INTERFACE 0x08
1881 #define IRP_MN_QUERY_CAPABILITIES 0x09
1882 #define IRP_MN_QUERY_RESOURCES 0x0A
1883 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1884 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1885 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1886 
1887 #define IRP_MN_READ_CONFIG 0x0F
1888 #define IRP_MN_WRITE_CONFIG 0x10
1889 #define IRP_MN_EJECT 0x11
1890 #define IRP_MN_SET_LOCK 0x12
1891 #define IRP_MN_QUERY_ID 0x13
1892 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1893 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1894 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1895 #define IRP_MN_SURPRISE_REMOVAL 0x17
1896 #if (NTDDI_VERSION >= NTDDI_WIN7)
1897 #define IRP_MN_DEVICE_ENUMERATED 0x19
1898 #endif
1899 
1900 #define IRP_MN_WAIT_WAKE 0x00
1901 #define IRP_MN_POWER_SEQUENCE 0x01
1902 #define IRP_MN_SET_POWER 0x02
1903 #define IRP_MN_QUERY_POWER 0x03
1904 
1905 #define IRP_MN_QUERY_ALL_DATA 0x00
1906 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1907 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1908 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1909 #define IRP_MN_ENABLE_EVENTS 0x04
1910 #define IRP_MN_DISABLE_EVENTS 0x05
1911 #define IRP_MN_ENABLE_COLLECTION 0x06
1912 #define IRP_MN_DISABLE_COLLECTION 0x07
1913 #define IRP_MN_REGINFO 0x08
1914 #define IRP_MN_EXECUTE_METHOD 0x09
1915 
1916 #define IRP_MN_REGINFO_EX 0x0b
1917 
1918 typedef struct _FILE_OBJECT {
1919  CSHORT Type;
1920  CSHORT Size;
1921  PDEVICE_OBJECT DeviceObject;
1922  PVPB Vpb;
1923  PVOID FsContext;
1924  PVOID FsContext2;
1926  PVOID PrivateCacheMap;
1927  NTSTATUS FinalStatus;
1928  struct _FILE_OBJECT *RelatedFileObject;
1929  BOOLEAN LockOperation;
1930  BOOLEAN DeletePending;
1933  BOOLEAN DeleteAccess;
1934  BOOLEAN SharedRead;
1935  BOOLEAN SharedWrite;
1936  BOOLEAN SharedDelete;
1937  ULONG Flags;
1939  LARGE_INTEGER CurrentByteOffset;
1940  volatile ULONG Waiters;
1941  volatile ULONG Busy;
1942  PVOID LastLock;
1943  KEVENT Lock;
1944  KEVENT Event;
1946  KSPIN_LOCK IrpListLock;
1947  LIST_ENTRY IrpList;
1948  volatile PVOID FileObjectExtension;
1950 
1951 typedef struct _IO_ERROR_LOG_PACKET {
1964  ULONG DumpData[1];
1966 
1967 typedef struct _IO_ERROR_LOG_MESSAGE {
1975 
1976 /* See ndk/lpctypes.h */
1977 #ifdef _WIN64
1978 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
1979 #else
1980 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
1981 #endif
1982 
1983 #define ERROR_LOG_LIMIT_SIZE 240
1984 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1985  sizeof(IO_ERROR_LOG_PACKET) + \
1986  (sizeof(WCHAR) * 40))
1987 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
1988  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1989 #define IO_ERROR_LOG_MESSAGE_LENGTH \
1990  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
1991  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
1992  PORT_MAXIMUM_MESSAGE_LENGTH)
1993 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
1994  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1995 
1996 typedef enum _DMA_WIDTH {
2001 } DMA_WIDTH, *PDMA_WIDTH;
2002 
2003 typedef enum _DMA_SPEED {
2010 } DMA_SPEED, *PDMA_SPEED;
2011 
2012 /* DEVICE_DESCRIPTION.Version */
2013 
2014 #define DEVICE_DESCRIPTION_VERSION 0x0000
2015 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2016 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2017 
2018 typedef struct _DEVICE_DESCRIPTION {
2036 
2046 
2047 typedef struct _DEVICE_RELATIONS {
2049  PDEVICE_OBJECT Objects[1];
2051 
2052 typedef struct _DEVOBJ_EXTENSION {
2055  PDEVICE_OBJECT DeviceObject;
2057 
2058 typedef struct _SCATTER_GATHER_ELEMENT {
2063 
2064 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2065 
2066 #if defined(_MSC_VER)
2067 #if _MSC_VER >= 1200
2068 #pragma warning(push)
2069 #endif
2070 #pragma warning(disable:4200)
2071 #endif /* _MSC_VER */
2072 
2073 typedef struct _SCATTER_GATHER_LIST {
2074  ULONG NumberOfElements;
2078 
2079 #if defined(_MSC_VER)
2080 #if _MSC_VER >= 1200
2081 #pragma warning(pop)
2082 #else
2083 #pragma warning(default:4200)
2084 #endif
2085 #endif /* _MSC_VER */
2086 
2087 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2088 
2089 struct _SCATTER_GATHER_LIST;
2090 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2091 
2092 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2093 
2094 _Function_class_(DRIVER_ADD_DEVICE)
2098 typedef NTSTATUS
2099 (NTAPI DRIVER_ADD_DEVICE)(
2102 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2103 
2106  PDRIVER_ADD_DEVICE AddDevice;
2110 
2111 #define DRVO_UNLOAD_INVOKED 0x00000001
2112 #define DRVO_LEGACY_DRIVER 0x00000002
2113 #define DRVO_BUILTIN_DRIVER 0x00000004
2114 
2115 _Function_class_(DRIVER_INITIALIZE)
2117 typedef NTSTATUS
2118 (NTAPI DRIVER_INITIALIZE)(
2121 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2122 
2123 _Function_class_(DRIVER_STARTIO)
2127 typedef VOID
2128 (NTAPI DRIVER_STARTIO)(
2130  _Inout_ struct _IRP *Irp);
2131 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2132 
2133 _Function_class_(DRIVER_UNLOAD)
2136 typedef VOID
2137 (NTAPI DRIVER_UNLOAD)(
2138  _In_ struct _DRIVER_OBJECT *DriverObject);
2139 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2140 
2144 typedef NTSTATUS
2146  _In_ struct _DEVICE_OBJECT *DeviceObject,
2147  _Inout_ struct _IRP *Irp);
2150 
2154 typedef NTSTATUS
2155 (NTAPI DRIVER_DISPATCH_PAGED)(
2156  _In_ struct _DEVICE_OBJECT *DeviceObject,
2157  _Inout_ struct _IRP *Irp);
2158 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2159 
2163  PDEVICE_OBJECT DeviceObject;
2172  PDRIVER_INITIALIZE DriverInit;
2173  PDRIVER_STARTIO DriverStartIo;
2174  PDRIVER_UNLOAD DriverUnload;
2175  PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
2177 
2178 typedef struct _DMA_ADAPTER {
2183 
2184 typedef VOID
2186  PDMA_ADAPTER DmaAdapter);
2187 
2188 typedef PVOID
2190  _In_ PDMA_ADAPTER DmaAdapter,
2191  _In_ ULONG Length,
2192  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2193  _In_ BOOLEAN CacheEnabled);
2194 
2195 typedef VOID
2197  _In_ PDMA_ADAPTER DmaAdapter,
2198  _In_ ULONG Length,
2199  _In_ PHYSICAL_ADDRESS LogicalAddress,
2201  _In_ BOOLEAN CacheEnabled);
2202 
2203 typedef NTSTATUS
2205  _In_ PDMA_ADAPTER DmaAdapter,
2206  _In_ PDEVICE_OBJECT DeviceObject,
2209  _In_ PVOID Context);
2210 
2211 typedef BOOLEAN
2213  _In_ PDMA_ADAPTER DmaAdapter,
2214  _In_ PMDL Mdl,
2216  _In_ PVOID CurrentVa,
2217  _In_ ULONG Length,
2218  _In_ BOOLEAN WriteToDevice);
2219 
2220 typedef VOID
2222  _In_ PDMA_ADAPTER DmaAdapter);
2223 
2224 typedef VOID
2226  _In_ PDMA_ADAPTER DmaAdapter,
2229 
2230 typedef PHYSICAL_ADDRESS
2232  _In_ PDMA_ADAPTER DmaAdapter,
2233  _In_ PMDL Mdl,
2235  _In_ PVOID CurrentVa,
2237  _In_ BOOLEAN WriteToDevice);
2238 
2239 typedef ULONG
2241  _In_ PDMA_ADAPTER DmaAdapter);
2242 
2243 typedef ULONG
2245  _In_ PDMA_ADAPTER DmaAdapter);
2246 
2247 _Function_class_(DRIVER_LIST_CONTROL)
2249 typedef VOID
2250 (NTAPI DRIVER_LIST_CONTROL)(
2252  _In_ struct _IRP *Irp,
2253  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2254  _In_ PVOID Context);
2255 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2256 
2257 typedef NTSTATUS
2259  _In_ PDMA_ADAPTER DmaAdapter,
2260  _In_ PDEVICE_OBJECT DeviceObject,
2261  _In_ PMDL Mdl,
2262  _In_ PVOID CurrentVa,
2263  _In_ ULONG Length,
2264  _In_ PDRIVER_LIST_CONTROL ExecutionRoutine,
2265  _In_ PVOID Context,
2266  _In_ BOOLEAN WriteToDevice);
2267 
2268 typedef VOID
2270  _In_ PDMA_ADAPTER DmaAdapter,
2271  _In_ PSCATTER_GATHER_LIST ScatterGather,
2272  _In_ BOOLEAN WriteToDevice);
2273 
2274 typedef NTSTATUS
2276  _In_ PDMA_ADAPTER DmaAdapter,
2277  _In_ PMDL Mdl OPTIONAL,
2278  _In_ PVOID CurrentVa,
2279  _In_ ULONG Length,
2280  _Out_ PULONG ScatterGatherListSize,
2281  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2282 
2283 typedef NTSTATUS
2285  _In_ PDMA_ADAPTER DmaAdapter,
2286  _In_ PDEVICE_OBJECT DeviceObject,
2287  _In_ PMDL Mdl,
2288  _In_ PVOID CurrentVa,
2289  _In_ ULONG Length,
2290  _In_ PDRIVER_LIST_CONTROL ExecutionRoutine,
2291  _In_ PVOID Context,
2292  _In_ BOOLEAN WriteToDevice,
2293  _In_ PVOID ScatterGatherBuffer,
2294  _In_ ULONG ScatterGatherLength);
2295 
2296 typedef NTSTATUS
2298  _In_ PDMA_ADAPTER DmaAdapter,
2299  _In_ PSCATTER_GATHER_LIST ScatterGather,
2300  _In_ PMDL OriginalMdl,
2301  _Out_ PMDL *TargetMdl);
2302 
2305  PPUT_DMA_ADAPTER PutDmaAdapter;
2306  PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
2307  PFREE_COMMON_BUFFER FreeCommonBuffer;
2308  PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
2309  PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
2310  PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
2311  PFREE_MAP_REGISTERS FreeMapRegisters;
2312  PMAP_TRANSFER MapTransfer;
2313  PGET_DMA_ALIGNMENT GetDmaAlignment;
2314  PREAD_DMA_COUNTER ReadDmaCounter;
2321 
2322 typedef struct _IO_RESOURCE_DESCRIPTOR {
2323  UCHAR Option;
2324  UCHAR Type;
2325  UCHAR ShareDisposition;
2326  UCHAR Spare1;
2327  USHORT Flags;
2328  USHORT Spare2;
2329  union {
2330  struct {
2331  ULONG Length;
2332  ULONG Alignment;
2333  PHYSICAL_ADDRESS MinimumAddress;
2334  PHYSICAL_ADDRESS MaximumAddress;
2335  } Port;
2336  struct {
2337  ULONG Length;
2338  ULONG Alignment;
2339  PHYSICAL_ADDRESS MinimumAddress;
2340  PHYSICAL_ADDRESS MaximumAddress;
2341  } Memory;
2342  struct {
2343  ULONG MinimumVector;
2344  ULONG MaximumVector;
2345  } Interrupt;
2346  struct {
2347  ULONG MinimumChannel;
2348  ULONG MaximumChannel;
2349  } Dma;
2350  struct {
2351  ULONG Length;
2352  ULONG Alignment;
2353  PHYSICAL_ADDRESS MinimumAddress;
2354  PHYSICAL_ADDRESS MaximumAddress;
2355  } Generic;
2356  struct {
2357  ULONG Data[3];
2358  } DevicePrivate;
2359  struct {
2360  ULONG Length;
2361  ULONG MinBusNumber;
2362  ULONG MaxBusNumber;
2363  ULONG Reserved;
2364  } BusNumber;
2365  struct {
2366  ULONG Priority;
2367  ULONG Reserved1;
2368  ULONG Reserved2;
2369  } ConfigData;
2370  } u;
2372 
2373 typedef struct _IO_RESOURCE_LIST {
2377  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2379 
2389 
2390 _Function_class_(DRIVER_CANCEL)
2391 _Requires_lock_held_(_Global_cancel_spin_lock_)
2392 _Releases_lock_(_Global_cancel_spin_lock_)
2395 typedef VOID
2396 (NTAPI DRIVER_CANCEL)(
2399 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2400 
2402  CSHORT Type;
2403  USHORT Size;
2404  struct _MDL *MdlAddress;
2405  ULONG Flags;
2406  union {
2407  struct _IRP *MasterIrp;
2408  volatile LONG IrpCount;
2409  PVOID SystemBuffer;
2410  } AssociatedIrp;
2411  LIST_ENTRY ThreadListEntry;
2413  KPROCESSOR_MODE RequestorMode;
2414  BOOLEAN PendingReturned;
2415  CHAR StackCount;
2416  CHAR CurrentLocation;
2417  BOOLEAN Cancel;
2418  KIRQL CancelIrql;
2419  CCHAR ApcEnvironment;
2420  UCHAR AllocationFlags;
2421  PIO_STATUS_BLOCK UserIosb;
2422  PKEVENT UserEvent;
2423  union {
2424  struct {
2425  _ANONYMOUS_UNION union {
2426  PIO_APC_ROUTINE UserApcRoutine;
2427  PVOID IssuingProcess;
2428  } DUMMYUNIONNAME;
2429  PVOID UserApcContext;
2430  } AsynchronousParameters;
2432  } Overlay;
2433  volatile PDRIVER_CANCEL CancelRoutine;
2434  PVOID UserBuffer;
2435  union {
2436  struct {
2437  _ANONYMOUS_UNION union {
2439  _ANONYMOUS_STRUCT struct {
2440  PVOID DriverContext[4];
2441  } DUMMYSTRUCTNAME;
2442  } DUMMYUNIONNAME;
2443  PETHREAD Thread;
2444  PCHAR AuxiliaryBuffer;
2445  _ANONYMOUS_STRUCT struct {
2446  LIST_ENTRY ListEntry;
2447  _ANONYMOUS_UNION union {
2448  struct _IO_STACK_LOCATION *CurrentStackLocation;
2449  ULONG PacketType;
2450  } DUMMYUNIONNAME;
2451  } DUMMYSTRUCTNAME;
2452  struct _FILE_OBJECT *OriginalFileObject;
2453  } Overlay;
2454  KAPC Apc;
2455  PVOID CompletionKey;
2456  } Tail;
2457 } IRP, *PIRP;
2458 
2459 typedef enum _IO_PAGING_PRIORITY {
2466 
2467 _Function_class_(IO_COMPLETION_ROUTINE)
2469 typedef NTSTATUS
2470 (NTAPI IO_COMPLETION_ROUTINE)(
2472  _In_ struct _IRP *Irp,
2473  _In_opt_ PVOID Context);
2474 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2475 
2476 _Function_class_(IO_DPC_ROUTINE)
2480 typedef VOID
2481 (NTAPI IO_DPC_ROUTINE)(
2482  _In_ struct _KDPC *Dpc,
2483  _In_ struct _DEVICE_OBJECT *DeviceObject,
2484  _Inout_ struct _IRP *Irp,
2485  _In_opt_ PVOID Context);
2486 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2487 
2488 typedef NTSTATUS
2491 
2492 typedef NTSTATUS
2494  VOID);
2495 
2496 _Function_class_(IO_TIMER_ROUTINE)
2498 typedef VOID
2499 (NTAPI IO_TIMER_ROUTINE)(
2500  _In_ struct _DEVICE_OBJECT *DeviceObject,
2501  _In_opt_ PVOID Context);
2502 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2503 
2510 
2511 struct _IO_CSQ;
2512 
2513 typedef struct _IO_CSQ_IRP_CONTEXT {
2514  ULONG Type;
2515  struct _IRP *Irp;
2516  struct _IO_CSQ *Csq;
2518 
2519 typedef VOID
2520 (NTAPI IO_CSQ_INSERT_IRP)(
2521  _In_ struct _IO_CSQ *Csq,
2523 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2524 
2525 typedef NTSTATUS
2526 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2527  _In_ struct _IO_CSQ *Csq,
2530 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2531 
2532 typedef VOID
2533 (NTAPI IO_CSQ_REMOVE_IRP)(
2534  _In_ struct _IO_CSQ *Csq,
2535  _In_ PIRP Irp);
2536 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2537 
2538 typedef PIRP
2539 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2540  _In_ struct _IO_CSQ *Csq,
2543 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2544 
2545 typedef VOID
2546 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2547  _In_ struct _IO_CSQ *Csq,
2549 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2550 
2551 typedef VOID
2552 (NTAPI IO_CSQ_RELEASE_LOCK)(
2553  _In_ struct _IO_CSQ *Csq,
2554  _In_ KIRQL Irql);
2555 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2556 
2557 typedef VOID
2558 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2559  _In_ struct _IO_CSQ *Csq,
2560  _In_ PIRP Irp);
2561 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2562 
2563 typedef struct _IO_CSQ {
2564  ULONG Type;
2571  PVOID ReservePointer;
2572 } IO_CSQ, *PIO_CSQ;
2573 
2574 typedef enum _BUS_QUERY_ID_TYPE {
2581 
2582 typedef enum _DEVICE_TEXT_TYPE {
2586 
2587 typedef BOOLEAN
2589  PVOID,
2590  PVOID);
2591 
2594 typedef NTSTATUS
2595 (NTAPI *PGPE_CONNECT_VECTOR)(
2596  PDEVICE_OBJECT,
2599  BOOLEAN,
2600  PGPE_SERVICE_ROUTINE,
2601  PVOID,
2602  PVOID);
2603 
2606 typedef NTSTATUS
2607 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2608  PVOID);
2609 
2612 typedef NTSTATUS
2613 (NTAPI *PGPE_ENABLE_EVENT)(
2614  PDEVICE_OBJECT,
2615  PVOID);
2616 
2619 typedef NTSTATUS
2620 (NTAPI *PGPE_DISABLE_EVENT)(
2621  PDEVICE_OBJECT,
2622  PVOID);
2623 
2626 typedef NTSTATUS
2627 (NTAPI *PGPE_CLEAR_STATUS)(
2628  PDEVICE_OBJECT,
2629  PVOID);
2630 
2631 typedef VOID
2633  PVOID,
2634  ULONG);
2635 
2638 typedef NTSTATUS
2639 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2640  PDEVICE_OBJECT,
2642  PVOID);
2643 
2645 typedef VOID
2646 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2647  PDEVICE_OBJECT,
2648  PDEVICE_NOTIFY_CALLBACK);
2649 
2653  PVOID Context;
2654  PINTERFACE_REFERENCE InterfaceReference;
2655  PINTERFACE_DEREFERENCE InterfaceDereference;
2656  PGPE_CONNECT_VECTOR GpeConnectVector;
2657  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
2658  PGPE_ENABLE_EVENT GpeEnableEvent;
2659  PGPE_DISABLE_EVENT GpeDisableEvent;
2660  PGPE_CLEAR_STATUS GpeClearStatus;
2661  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
2662  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
2664 
2665 typedef BOOLEAN
2669 
2672 typedef NTSTATUS
2673 (NTAPI *PGPE_CONNECT_VECTOR2)(
2674  PVOID Context,
2678  PGPE_SERVICE_ROUTINE ServiceRoutine,
2680  PVOID *ObjectContext);
2681 
2684 typedef NTSTATUS
2685 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
2686  PVOID Context,
2687  PVOID ObjectContext);
2688 
2691 typedef NTSTATUS
2692 (NTAPI *PGPE_ENABLE_EVENT2)(
2693  PVOID Context,
2694  PVOID ObjectContext);
2695 
2698 typedef NTSTATUS
2699 (NTAPI *PGPE_DISABLE_EVENT2)(
2700  PVOID Context,
2701  PVOID ObjectContext);
2702 
2705 typedef NTSTATUS
2706 (NTAPI *PGPE_CLEAR_STATUS2)(
2707  PVOID Context,
2708  PVOID ObjectContext);
2709 
2711 typedef VOID
2712 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
2715 
2718 typedef NTSTATUS
2719 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2720  PVOID Context,
2721  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
2722  PVOID NotificationContext);
2723 
2725 typedef VOID
2726 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2727  PVOID Context);
2728 
2733  PINTERFACE_REFERENCE InterfaceReference;
2734  PINTERFACE_DEREFERENCE InterfaceDereference;
2735  PGPE_CONNECT_VECTOR2 GpeConnectVector;
2736  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
2737  PGPE_ENABLE_EVENT2 GpeEnableEvent;
2738  PGPE_DISABLE_EVENT2 GpeDisableEvent;
2739  PGPE_CLEAR_STATUS2 GpeClearStatus;
2740  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
2741  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
2743 
2744 #if !defined(_AMD64_) && !defined(_IA64_)
2745 #include <pshpack4.h>
2746 #endif
2747 typedef struct _IO_STACK_LOCATION {
2752  union {
2753  struct {
2759  } Create;
2760  struct {
2764  } Read;
2765  struct {
2766  ULONG Length;
2769  } Write;
2770  struct {
2771  ULONG Length;
2775  } QueryDirectory;
2776  struct {
2777  ULONG Length;
2779  } NotifyDirectory;
2780  struct {
2781  ULONG Length;
2783  } QueryFile;
2784  struct {
2785  ULONG Length;
2788  _ANONYMOUS_UNION union {
2789  _ANONYMOUS_STRUCT struct {
2792  } DUMMYSTRUCTNAME;
2795  } DUMMYUNIONNAME;
2796  } SetFile;
2797  struct {
2798  ULONG Length;
2802  } QueryEa;
2803  struct {
2804  ULONG Length;
2805  } SetEa;
2806  struct {
2807  ULONG Length;
2809  } QueryVolume;
2810  struct {
2811  ULONG Length;
2813  } SetVolume;
2814  struct {
2819  } FileSystemControl;
2820  struct {
2824  } LockControl;
2825  struct {
2829  PVOID Type3InputBuffer;
2830  } DeviceIoControl;
2831  struct {
2834  } QuerySecurity;
2835  struct {
2838  } SetSecurity;
2839  struct {
2840  PVPB Vpb;
2841  PDEVICE_OBJECT DeviceObject;
2842  } MountVolume;
2843  struct {
2844  PVPB Vpb;
2845  PDEVICE_OBJECT DeviceObject;
2846  } VerifyVolume;
2847  struct {
2849  } Scsi;
2850  struct {
2851  ULONG Length;
2855  } QueryQuota;
2856  struct {
2857  ULONG Length;
2858  } SetQuota;
2859  struct {
2861  } QueryDeviceRelations;
2862  struct {
2866  PINTERFACE Interface;
2868  } QueryInterface;
2869  struct {
2870  PDEVICE_CAPABILITIES Capabilities;
2872  struct {
2874  } FilterResourceRequirements;
2875  struct {
2880  } ReadWriteConfig;
2881  struct {
2883  } SetLock;
2884  struct {
2886  } QueryId;
2887  struct {
2890  } QueryDeviceText;
2891  struct {
2895  } UsageNotification;
2896  struct {
2898  } WaitWake;
2899  struct {
2901  } PowerSequence;
2902  struct {
2907  } Power;
2908  struct {
2911  } StartDevice;
2912  struct {
2916  PVOID Buffer;
2917  } WMI;
2918  struct {
2923  } Others;
2924  } Parameters;
2925  PDEVICE_OBJECT DeviceObject;
2930 #if !defined(_AMD64_) && !defined(_IA64_)
2931 #include <poppack.h>
2932 #endif
2933 
2934 /* IO_STACK_LOCATION.Control */
2935 
2936 #define SL_PENDING_RETURNED 0x01
2937 #define SL_ERROR_RETURNED 0x02
2938 #define SL_INVOKE_ON_CANCEL 0x20
2939 #define SL_INVOKE_ON_SUCCESS 0x40
2940 #define SL_INVOKE_ON_ERROR 0x80
2941 
2942 $endif (_WDMDDK_)
2943 $if (_WDMDDK_ || _DEVIOCTL_)
2944 #define METHOD_BUFFERED 0
2945 #define METHOD_IN_DIRECT 1
2946 #define METHOD_OUT_DIRECT 2
2947 #define METHOD_NEITHER 3
2948 
2949 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2950 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2951 
2953 $if (_WDMDDK_)
2954 #define FILE_SUPERSEDED 0x00000000
2955 #define FILE_OPENED 0x00000001
2956 #define FILE_CREATED 0x00000002
2957 #define FILE_OVERWRITTEN 0x00000003
2958 #define FILE_EXISTS 0x00000004
2959 #define FILE_DOES_NOT_EXIST 0x00000005
2960 
2961 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
2962 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
2963 
2964 /* also in winnt.h */
2965 #define FILE_LIST_DIRECTORY 0x00000001
2966 #define FILE_READ_DATA 0x00000001
2967 #define FILE_ADD_FILE 0x00000002
2968 #define FILE_WRITE_DATA 0x00000002
2969 #define FILE_ADD_SUBDIRECTORY 0x00000004
2970 #define FILE_APPEND_DATA 0x00000004
2971 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
2972 #define FILE_READ_EA 0x00000008
2973 #define FILE_WRITE_EA 0x00000010
2974 #define FILE_EXECUTE 0x00000020
2975 #define FILE_TRAVERSE 0x00000020
2976 #define FILE_DELETE_CHILD 0x00000040
2977 #define FILE_READ_ATTRIBUTES 0x00000080
2978 #define FILE_WRITE_ATTRIBUTES 0x00000100
2979 
2980 #define FILE_SHARE_READ 0x00000001
2981 #define FILE_SHARE_WRITE 0x00000002
2982 #define FILE_SHARE_DELETE 0x00000004
2983 #define FILE_SHARE_VALID_FLAGS 0x00000007
2984 
2985 #define FILE_ATTRIBUTE_READONLY 0x00000001
2986 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
2987 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
2988 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
2989 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
2990 #define FILE_ATTRIBUTE_DEVICE 0x00000040
2991 #define FILE_ATTRIBUTE_NORMAL 0x00000080
2992 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
2993 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
2994 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
2995 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
2996 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
2997 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
2998 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
2999 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3000 
3001 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3002 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3003 
3004 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3005 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3006 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3007 #define FILE_VALID_SET_FLAGS 0x00000036
3008 
3009 #define FILE_SUPERSEDE 0x00000000
3010 #define FILE_OPEN 0x00000001
3011 #define FILE_CREATE 0x00000002
3012 #define FILE_OPEN_IF 0x00000003
3013 #define FILE_OVERWRITE 0x00000004
3014 #define FILE_OVERWRITE_IF 0x00000005
3015 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3016 
3017 #define FILE_DIRECTORY_FILE 0x00000001
3018 #define FILE_WRITE_THROUGH 0x00000002
3019 #define FILE_SEQUENTIAL_ONLY 0x00000004
3020 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3021 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3022 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3023 #define FILE_NON_DIRECTORY_FILE 0x00000040
3024 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3025 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3026 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3027 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3028 #define FILE_RANDOM_ACCESS 0x00000800
3029 #define FILE_DELETE_ON_CLOSE 0x00001000
3030 #define FILE_OPEN_BY_FILE_ID 0x00002000
3031 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3032 #define FILE_NO_COMPRESSION 0x00008000
3033 #if (NTDDI_VERSION >= NTDDI_WIN7)
3034 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3035 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3036 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3037 #define FILE_RESERVE_OPFILTER 0x00100000
3038 #define FILE_OPEN_REPARSE_POINT 0x00200000
3039 #define FILE_OPEN_NO_RECALL 0x00400000
3040 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3041 
3042 $endif (_WDMDDK_)
3043 $if (_WDMDDK_ || _DEVIOCTL_)
3044 #define FILE_ANY_ACCESS 0x00000000
3045 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3046 #define FILE_READ_ACCESS 0x00000001
3047 #define FILE_WRITE_ACCESS 0x00000002
3048 
3050 $if (_WDMDDK_)
3051 #define FILE_ALL_ACCESS \
3052  (STANDARD_RIGHTS_REQUIRED | \
3053  SYNCHRONIZE | \
3054  0x1FF)
3055 
3056 #define FILE_GENERIC_EXECUTE \
3057  (STANDARD_RIGHTS_EXECUTE | \
3058  FILE_READ_ATTRIBUTES | \
3059  FILE_EXECUTE | \
3060  SYNCHRONIZE)
3061 
3062 #define FILE_GENERIC_READ \
3063  (STANDARD_RIGHTS_READ | \
3064  FILE_READ_DATA | \
3065  FILE_READ_ATTRIBUTES | \
3066  FILE_READ_EA | \
3067  SYNCHRONIZE)
3068 
3069 #define FILE_GENERIC_WRITE \
3070  (STANDARD_RIGHTS_WRITE | \
3071  FILE_WRITE_DATA | \
3072  FILE_WRITE_ATTRIBUTES | \
3073  FILE_WRITE_EA | \
3074  FILE_APPEND_DATA | \
3075  SYNCHRONIZE)
3076 
3077 /* end winnt.h */
3078 
3079 #define WMIREG_ACTION_REGISTER 1
3080 #define WMIREG_ACTION_DEREGISTER 2
3081 #define WMIREG_ACTION_REREGISTER 3
3082 #define WMIREG_ACTION_UPDATE_GUIDS 4
3083 #define WMIREG_ACTION_BLOCK_IRPS 5
3084 
3085 #define WMIREGISTER 0
3086 #define WMIUPDATE 1
3087 
3090 typedef VOID
3091 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3092  PVOID Wnode,
3093  PVOID Context);
3094 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3095 
3096 #ifndef _PCI_X_
3097 #define _PCI_X_
3098 
3099 typedef struct _PCI_SLOT_NUMBER {
3100  union {
3101  struct {
3103  ULONG FunctionNumber:3;
3105  } bits;
3107  } u;
3109 
3110 #define PCI_TYPE0_ADDRESSES 6
3111 #define PCI_TYPE1_ADDRESSES 2
3112 #define PCI_TYPE2_ADDRESSES 5
3113 
3114 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3115  inheritance, even from a struct renders the type non-POD. So we use
3116  this hack */
3117 #define PCI_COMMON_HEADER_LAYOUT \
3118  USHORT VendorID; \
3119  USHORT DeviceID; \
3120  USHORT Command; \
3121  USHORT Status; \
3122  UCHAR RevisionID; \
3123  UCHAR ProgIf; \
3124  UCHAR SubClass; \
3125  UCHAR BaseClass; \
3126  UCHAR CacheLineSize; \
3127  UCHAR LatencyTimer; \
3128  UCHAR HeaderType; \
3129  UCHAR BIST; \
3130  union { \
3131  struct _PCI_HEADER_TYPE_0 { \
3132  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3133  ULONG CIS; \
3134  USHORT SubVendorID; \
3135  USHORT SubSystemID; \
3136  ULONG ROMBaseAddress; \
3137  UCHAR CapabilitiesPtr; \
3138  UCHAR Reserved1[3]; \
3139  ULONG Reserved2; \
3140  UCHAR InterruptLine; \
3141  UCHAR InterruptPin; \
3142  UCHAR MinimumGrant; \
3143  UCHAR MaximumLatency; \
3144  } type0; \
3145  struct _PCI_HEADER_TYPE_1 { \
3146  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3147  UCHAR PrimaryBus; \
3148  UCHAR SecondaryBus; \
3149  UCHAR SubordinateBus; \
3150  UCHAR SecondaryLatency; \
3151  UCHAR IOBase; \
3152  UCHAR IOLimit; \
3153  USHORT SecondaryStatus; \
3154  USHORT MemoryBase; \
3155  USHORT MemoryLimit; \
3156  USHORT PrefetchBase; \
3157  USHORT PrefetchLimit; \
3158  ULONG PrefetchBaseUpper32; \
3159  ULONG PrefetchLimitUpper32; \
3160  USHORT IOBaseUpper16; \
3161  USHORT IOLimitUpper16; \
3162  UCHAR CapabilitiesPtr; \
3163  UCHAR Reserved1[3]; \
3164  ULONG ROMBaseAddress; \
3165  UCHAR InterruptLine; \
3166  UCHAR InterruptPin; \
3167  USHORT BridgeControl; \
3168  } type1; \
3169  struct _PCI_HEADER_TYPE_2 { \
3170  ULONG SocketRegistersBaseAddress; \
3171  UCHAR CapabilitiesPtr; \
3172  UCHAR Reserved; \
3173  USHORT SecondaryStatus; \
3174  UCHAR PrimaryBus; \
3175  UCHAR SecondaryBus; \
3176  UCHAR SubordinateBus; \
3177  UCHAR SecondaryLatency; \
3178  struct { \
3179  ULONG Base; \
3180  ULONG Limit; \
3181  } Range[PCI_TYPE2_ADDRESSES-1]; \
3182  UCHAR InterruptLine; \
3183  UCHAR InterruptPin; \
3184  USHORT BridgeControl; \
3185  } type2; \
3186  } u;
3187 
3188 typedef struct _PCI_COMMON_HEADER {
3191 
3192 #ifdef __cplusplus
3193 typedef struct _PCI_COMMON_CONFIG {
3195  UCHAR DeviceSpecific[192];
3197 #else
3198 typedef struct _PCI_COMMON_CONFIG {
3200  UCHAR DeviceSpecific[192];
3202 #endif
3203 
3204 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3205 
3206 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3207 
3208 #define PCI_MAX_DEVICES 32
3209 #define PCI_MAX_FUNCTION 8
3210 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3211 #define PCI_INVALID_VENDORID 0xFFFF
3212 
3213 /* PCI_COMMON_CONFIG.HeaderType */
3214 #define PCI_MULTIFUNCTION 0x80
3215 #define PCI_DEVICE_TYPE 0x00
3216 #define PCI_BRIDGE_TYPE 0x01
3217 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3218 
3219 #define PCI_CONFIGURATION_TYPE(PciData) \
3220  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3221 
3222 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3223  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3224 
3225 /* PCI_COMMON_CONFIG.Command */
3226 #define PCI_ENABLE_IO_SPACE 0x0001
3227 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3228 #define PCI_ENABLE_BUS_MASTER 0x0004
3229 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3230 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3231 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3232 #define PCI_ENABLE_PARITY 0x0040
3233 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3234 #define PCI_ENABLE_SERR 0x0100
3235 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3236 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3237 
3238 /* PCI_COMMON_CONFIG.Status */
3239 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3240 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3241 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3242 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3243 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3244 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3245 #define PCI_STATUS_DEVSEL 0x0600
3246 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3247 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3248 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3249 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3250 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3251 
3252 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3253 
3254 #define PCI_WHICHSPACE_CONFIG 0x0
3255 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3256 
3257 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3258 #define PCI_CAPABILITY_ID_AGP 0x02
3259 #define PCI_CAPABILITY_ID_VPD 0x03
3260 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3261 #define PCI_CAPABILITY_ID_MSI 0x05
3262 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3263 #define PCI_CAPABILITY_ID_PCIX 0x07
3264 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3265 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3266 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3267 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3268 #define PCI_CAPABILITY_ID_SHPC 0x0C
3269 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3270 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3271 #define PCI_CAPABILITY_ID_SECURE 0x0F
3272 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3273 #define PCI_CAPABILITY_ID_MSIX 0x11
3274 
3279 
3280 typedef struct _PCI_PMC {
3282  UCHAR PMEClock:1;
3283  UCHAR Rsvd1:1;
3284  UCHAR DeviceSpecificInitialization:1;
3285  UCHAR Rsvd2:2;
3286  struct _PM_SUPPORT {
3287  UCHAR Rsvd2:1;
3288  UCHAR D1:1;
3289  UCHAR D2:1;
3290  UCHAR PMED0:1;
3291  UCHAR PMED1:1;
3292  UCHAR PMED2:1;
3293  UCHAR PMED3Hot:1;
3294  UCHAR PMED3Cold:1;
3295  } Support;
3296 } PCI_PMC, *PPCI_PMC;
3297 
3298 typedef struct _PCI_PMCSR {
3300  USHORT Rsvd1:6;
3301  USHORT PMEEnable:1;
3302  USHORT DataSelect:4;
3303  USHORT DataScale:2;
3304  USHORT PMEStatus:1;
3305 } PCI_PMCSR, *PPCI_PMCSR;
3306 
3307 typedef struct _PCI_PMCSR_BSE {
3308  UCHAR Rsvd1:6;
3309  UCHAR D3HotSupportsStopClock:1;
3310  UCHAR BusPowerClockControlEnabled:1;
3312 
3313 typedef struct _PCI_PM_CAPABILITY {
3315  union {
3318  } PMC;
3319  union {
3321  USHORT AsUSHORT;
3322  } PMCSR;
3323  union {
3326  } PMCSR_BSE;
3329 
3330 typedef struct {
3332  union {
3333  struct {
3334  USHORT DataParityErrorRecoveryEnable:1;
3335  USHORT EnableRelaxedOrdering:1;
3336  USHORT MaxMemoryReadByteCount:2;
3337  USHORT MaxOutstandingSplitTransactions:3;
3339  } bits;
3341  } Command;
3342  union {
3343  struct {
3344  ULONG FunctionNumber:3;
3347  ULONG Device64Bit:1;
3348  ULONG Capable133MHz:1;
3349  ULONG SplitCompletionDiscarded:1;
3350  ULONG UnexpectedSplitCompletion:1;
3351  ULONG DeviceComplexity:1;
3352  ULONG DesignedMaxMemoryReadByteCount:2;
3353  ULONG DesignedMaxOutstandingSplitTransactions:3;
3354  ULONG DesignedMaxCumulativeReadSize:3;
3355  ULONG ReceivedSplitCompletionErrorMessage:1;
3356  ULONG CapablePCIX266:1;
3357  ULONG CapablePCIX533:1;
3358  } bits;
3360  } Status;
3362 
3363 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3364 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3365 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3366 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3367 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3368 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3369 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3370 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3371 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3372 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3373 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3374 
3378  USHORT Next:12;
3380 
3386 
3388  _ANONYMOUS_STRUCT struct {
3389  ULONG Undefined:1;
3391  ULONG DataLinkProtocolError:1;
3392  ULONG SurpriseDownError:1;
3394  ULONG PoisonedTLP:1;
3395  ULONG FlowControlProtocolError:1;
3396  ULONG CompletionTimeout:1;
3397  ULONG CompleterAbort:1;
3398  ULONG UnexpectedCompletion:1;
3399  ULONG ReceiverOverflow:1;
3400  ULONG MalformedTLP:1;
3401  ULONG ECRCError:1;
3402  ULONG UnsupportedRequestError:1;
3404  } DUMMYSTRUCTNAME;
3407 
3409  _ANONYMOUS_STRUCT struct {
3410  ULONG Undefined:1;
3412  ULONG DataLinkProtocolError:1;
3413  ULONG SurpriseDownError:1;
3415  ULONG PoisonedTLP:1;
3416  ULONG FlowControlProtocolError:1;
3417  ULONG CompletionTimeout:1;
3418  ULONG CompleterAbort:1;
3419  ULONG UnexpectedCompletion:1;
3420  ULONG ReceiverOverflow:1;
3421  ULONG MalformedTLP:1;
3422  ULONG ECRCError:1;
3423  ULONG UnsupportedRequestError:1;
3425  } DUMMYSTRUCTNAME;
3428 
3430  _ANONYMOUS_STRUCT struct {
3431  ULONG Undefined:1;
3433  ULONG DataLinkProtocolError:1;
3434  ULONG SurpriseDownError:1;
3436  ULONG PoisonedTLP:1;
3437  ULONG FlowControlProtocolError:1;
3438  ULONG CompletionTimeout:1;
3439  ULONG CompleterAbort:1;
3440  ULONG UnexpectedCompletion:1;
3441  ULONG ReceiverOverflow:1;
3442  ULONG MalformedTLP:1;
3443  ULONG ECRCError:1;
3444  ULONG UnsupportedRequestError:1;
3446  } DUMMYSTRUCTNAME;
3449 
3451  _ANONYMOUS_STRUCT struct {
3452  ULONG ReceiverError:1;
3454  ULONG BadTLP:1;
3455  ULONG BadDLLP:1;
3456  ULONG ReplayNumRollover:1;
3458  ULONG ReplayTimerTimeout:1;
3459  ULONG AdvisoryNonFatalError:1;
3461  } DUMMYSTRUCTNAME;
3464 
3466  _ANONYMOUS_STRUCT struct {
3467  ULONG ReceiverError:1;
3469  ULONG BadTLP:1;
3470  ULONG BadDLLP:1;
3471  ULONG ReplayNumRollover:1;
3473  ULONG ReplayTimerTimeout:1;
3474  ULONG AdvisoryNonFatalError:1;
3476  } DUMMYSTRUCTNAME;
3479 
3481  _ANONYMOUS_STRUCT struct {
3482  ULONG FirstErrorPointer:5;
3483  ULONG ECRCGenerationCapable:1;
3484  ULONG ECRCGenerationEnable:1;
3485  ULONG ECRCCheckCapable:1;
3486  ULONG ECRCCheckEnable:1;
3488  } DUMMYSTRUCTNAME;
3491 
3493  _ANONYMOUS_STRUCT struct {
3494  ULONG CorrectableErrorReportingEnable:1;
3495  ULONG NonFatalErrorReportingEnable:1;
3496  ULONG FatalErrorReportingEnable:1;
3498  } DUMMYSTRUCTNAME;
3501 
3503  _ANONYMOUS_STRUCT struct {
3504  ULONG CorrectableErrorReceived:1;
3505  ULONG MultipleCorrectableErrorsReceived:1;
3506  ULONG UncorrectableErrorReceived:1;
3507  ULONG MultipleUncorrectableErrorsReceived:1;
3508  ULONG FirstUncorrectableFatal:1;
3509  ULONG NonFatalErrorMessagesReceived:1;
3510  ULONG FatalErrorMessagesReceived:1;
3512  ULONG AdvancedErrorInterruptMessageNumber:5;
3513  } DUMMYSTRUCTNAME;
3516 
3518  _ANONYMOUS_STRUCT struct {
3519  USHORT CorrectableSourceIdFun:3;
3520  USHORT CorrectableSourceIdDev:5;
3521  USHORT CorrectableSourceIdBus:8;
3522  USHORT UncorrectableSourceIdFun:3;
3523  USHORT UncorrectableSourceIdDev:5;
3524  USHORT UncorrectableSourceIdBus:8;
3525  } DUMMYSTRUCTNAME;
3528 
3530  _ANONYMOUS_STRUCT struct {
3531  ULONG TargetAbortOnSplitCompletion:1;
3532  ULONG MasterAbortOnSplitCompletion:1;
3533  ULONG ReceivedTargetAbort:1;
3534  ULONG ReceivedMasterAbort:1;
3535  ULONG RsvdZ:1;
3536  ULONG UnexpectedSplitCompletionError:1;
3537  ULONG UncorrectableSplitCompletion:1;
3538  ULONG UncorrectableDataError:1;
3539  ULONG UncorrectableAttributeError:1;
3540  ULONG UncorrectableAddressError:1;
3541  ULONG DelayedTransactionDiscardTimerExpired:1;
3542  ULONG PERRAsserted:1;
3543  ULONG SERRAsserted:1;
3544  ULONG InternalBridgeError:1;
3546  } DUMMYSTRUCTNAME;
3549 
3551  _ANONYMOUS_STRUCT struct {
3552  ULONG TargetAbortOnSplitCompletion:1;
3553  ULONG MasterAbortOnSplitCompletion:1;
3554  ULONG ReceivedTargetAbort:1;
3555  ULONG ReceivedMasterAbort:1;
3556  ULONG RsvdZ:1;
3557  ULONG UnexpectedSplitCompletionError:1;
3558  ULONG UncorrectableSplitCompletion:1;
3559  ULONG UncorrectableDataError:1;
3560  ULONG UncorrectableAttributeError:1;
3561  ULONG UncorrectableAddressError:1;
3562  ULONG DelayedTransactionDiscardTimerExpired:1;
3563  ULONG PERRAsserted:1;
3564  ULONG SERRAsserted:1;
3565  ULONG InternalBridgeError:1;
3567  } DUMMYSTRUCTNAME;
3570 
3572  _ANONYMOUS_STRUCT struct {
3573  ULONG TargetAbortOnSplitCompletion:1;
3574  ULONG MasterAbortOnSplitCompletion:1;
3575  ULONG ReceivedTargetAbort:1;
3576  ULONG ReceivedMasterAbort:1;
3577  ULONG RsvdZ:1;
3578  ULONG UnexpectedSplitCompletionError:1;
3579  ULONG UncorrectableSplitCompletion:1;
3580  ULONG UncorrectableDataError:1;
3581  ULONG UncorrectableAttributeError:1;
3582  ULONG UncorrectableAddressError:1;
3583  ULONG DelayedTransactionDiscardTimerExpired:1;
3584  ULONG PERRAsserted:1;
3585  ULONG SERRAsserted:1;
3586  ULONG InternalBridgeError:1;
3588  } DUMMYSTRUCTNAME;
3591 
3593  _ANONYMOUS_STRUCT struct {
3594  ULONG SecondaryUncorrectableFirstErrorPtr:5;
3596  } DUMMYSTRUCTNAME;
3599 
3600 #define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001
3601 #define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002
3602 #define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004
3603 
3604 #define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \
3605  (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \
3606  ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \
3607  ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING)
3608 
3617  ULONG HeaderLog[4];
3622  ULONG SecHeaderLog[4];
3624 
3633  ULONG HeaderLog[4];
3638 
3647  ULONG HeaderLog[4];
3652  ULONG SecHeaderLog[4];
3654 
3656  _ANONYMOUS_STRUCT struct {
3657  ULONG VFMigrationCapable:1;
3659  ULONG VFMigrationInterruptNumber:11;
3660  } DUMMYSTRUCTNAME;
3663 
3665  _ANONYMOUS_STRUCT struct {
3666  USHORT VFEnable:1;
3667  USHORT VFMigrationEnable:1;
3668  USHORT VFMigrationInterruptEnable:1;
3669  USHORT VFMemorySpaceEnable:1;
3670  USHORT ARICapableHierarchy:1;
3672  } DUMMYSTRUCTNAME;
3675 
3677  _ANONYMOUS_STRUCT struct {
3678  USHORT VFMigrationStatus:1;
3680  } DUMMYSTRUCTNAME;
3683 
3685  _ANONYMOUS_STRUCT struct {
3686  ULONG VFMigrationStateBIR:3;
3687  ULONG VFMigrationStateOffset:29;
3688  } DUMMYSTRUCTNAME;
3691 
3708  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
3711 
3712 /* PCI device classes */
3713 #define PCI_CLASS_PRE_20 0x00
3714 #define PCI_CLASS_MASS_STORAGE_CTLR 0x01
3715 #define PCI_CLASS_NETWORK_CTLR 0x02
3716 #define PCI_CLASS_DISPLAY_CTLR 0x03
3717 #define PCI_CLASS_MULTIMEDIA_DEV 0x04
3718 #define PCI_CLASS_MEMORY_CTLR 0x05
3719 #define PCI_CLASS_BRIDGE_DEV 0x06
3720 #define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07
3721 #define PCI_CLASS_BASE_SYSTEM_DEV 0x08
3722 #define PCI_CLASS_INPUT_DEV 0x09
3723 #define PCI_CLASS_DOCKING_STATION 0x0a
3724 #define PCI_CLASS_PROCESSOR 0x0b
3725 #define PCI_CLASS_SERIAL_BUS_CTLR 0x0c
3726 #define PCI_CLASS_WIRELESS_CTLR 0x0d
3727 #define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e
3728 #define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f
3729 #define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10
3730 #define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11
3731 #define PCI_CLASS_NOT_DEFINED 0xff
3732 
3733 /* PCI device subclasses for class 0 */
3734 #define PCI_SUBCLASS_PRE_20_NON_VGA 0x00
3735 #define PCI_SUBCLASS_PRE_20_VGA 0x01
3736 
3737 /* PCI device subclasses for class 1 (mass storage controllers)*/
3738 #define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00
3739 #define PCI_SUBCLASS_MSC_IDE_CTLR 0x01
3740 #define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02
3741 #define PCI_SUBCLASS_MSC_IPI_CTLR 0x03
3742 #define PCI_SUBCLASS_MSC_RAID_CTLR 0x04
3743 #define PCI_SUBCLASS_MSC_OTHER 0x80
3744 
3745 /* PCI device subclasses for class 2 (network controllers)*/
3746 #define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00
3747 #define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01
3748 #define PCI_SUBCLASS_NET_FDDI_CTLR 0x02
3749 #define PCI_SUBCLASS_NET_ATM_CTLR 0x03
3750 #define PCI_SUBCLASS_NET_ISDN_CTLR 0x04
3751 #define PCI_SUBCLASS_NET_OTHER 0x80
3752 
3753 /* PCI device subclasses for class 3 (display controllers)*/
3754 #define PCI_SUBCLASS_VID_VGA_CTLR 0x00
3755 #define PCI_SUBCLASS_VID_XGA_CTLR 0x01
3756 #define PCI_SUBCLASS_VID_3D_CTLR 0x02
3757 #define PCI_SUBCLASS_VID_OTHER 0x80
3758 
3759 /* PCI device subclasses for class 4 (multimedia device)*/
3760 #define PCI_SUBCLASS_MM_VIDEO_DEV 0x00
3761 #define PCI_SUBCLASS_MM_AUDIO_DEV 0x01
3762 #define PCI_SUBCLASS_MM_TELEPHONY_DEV 0x02
3763 #define PCI_SUBCLASS_MM_OTHER 0x80
3764 
3765 /* PCI device subclasses for class 5 (memory controller)*/
3766 #define PCI_SUBCLASS_MEM_RAM 0x00
3767 #define PCI_SUBCLASS_MEM_FLASH 0x01
3768 #define PCI_SUBCLASS_MEM_OTHER 0x80
3769 
3770 /* PCI device subclasses for class 6 (bridge device)*/
3771 #define PCI_SUBCLASS_BR_HOST 0x00
3772 #define PCI_SUBCLASS_BR_ISA 0x01
3773 #define PCI_SUBCLASS_BR_EISA 0x02
3774 #define PCI_SUBCLASS_BR_MCA 0x03
3775 #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
3776 #define PCI_SUBCLASS_BR_PCMCIA 0x05
3777 #define PCI_SUBCLASS_BR_NUBUS 0x06
3778 #define PCI_SUBCLASS_BR_CARDBUS 0x07
3779 #define PCI_SUBCLASS_BR_RACEWAY 0x08
3780 #define PCI_SUBCLASS_BR_OTHER 0x80
3781 
3782 #define PCI_SUBCLASS_COM_SERIAL 0x00
3783 #define PCI_SUBCLASS_COM_PARALLEL 0x01
3784 #define PCI_SUBCLASS_COM_MULTIPORT 0x02
3785 #define PCI_SUBCLASS_COM_MODEM 0x03
3786 #define PCI_SUBCLASS_COM_OTHER 0x80
3787 
3788 #define PCI_SUBCLASS_SYS_INTERRUPT_CTLR 0x00
3789 #define PCI_SUBCLASS_SYS_DMA_CTLR 0x01
3790 #define PCI_SUBCLASS_SYS_SYSTEM_TIMER 0x02
3791 #define PCI_SUBCLASS_SYS_REAL_TIME_CLOCK 0x03
3792 #define PCI_SUBCLASS_SYS_GEN_HOTPLUG_CTLR 0x04
3793 #define PCI_SUBCLASS_SYS_SDIO_CTRL 0x05
3794 #define PCI_SUBCLASS_SYS_OTHER 0x80
3795 
3796 #define PCI_SUBCLASS_INP_KEYBOARD 0x00
3797 #define PCI_SUBCLASS_INP_DIGITIZER 0x01
3798 #define PCI_SUBCLASS_INP_MOUSE 0x02