ReactOS  0.4.11-dev-791-gf6f1255
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 
1279 
1280 typedef struct _FILE_POSITION_INFORMATION {
1281  LARGE_INTEGER CurrentByteOffset;
1283 
1284 typedef struct _FILE_BASIC_INFORMATION {
1285  LARGE_INTEGER CreationTime;
1286  LARGE_INTEGER LastAccessTime;
1287  LARGE_INTEGER LastWriteTime;
1288  LARGE_INTEGER ChangeTime;
1291 
1295 
1297  ULONG Flags;
1299 
1304 
1308 
1312 
1315  ULONG_PTR ProcessIdList[1];
1317 
1318 typedef struct _FILE_STANDARD_INFORMATION {
1320  LARGE_INTEGER EndOfFile;
1321  ULONG NumberOfLinks;
1322  BOOLEAN DeletePending;
1325 
1326 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1327  LARGE_INTEGER CreationTime;
1328  LARGE_INTEGER LastAccessTime;
1329  LARGE_INTEGER LastWriteTime;
1330  LARGE_INTEGER ChangeTime;
1332  LARGE_INTEGER EndOfFile;
1335 
1336 typedef enum _FSINFOCLASS {
1349 
1350 typedef struct _FILE_FS_DEVICE_INFORMATION {
1352  ULONG Characteristics;
1354 
1355 typedef struct _FILE_FULL_EA_INFORMATION {
1356  ULONG NextEntryOffset;
1357  UCHAR Flags;
1358  UCHAR EaNameLength;
1359  USHORT EaValueLength;
1360  CHAR EaName[1];
1362 
1371 
1377 
1378 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1379 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1380 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1381 
1382 #define FM_LOCK_BIT (0x1)
1383 #define FM_LOCK_BIT_V (0x0)
1384 #define FM_LOCK_WAITER_WOKEN (0x2)
1385 #define FM_LOCK_WAITER_INC (0x4)
1386 
1387 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1389 typedef BOOLEAN
1390 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1391  _In_ struct _FILE_OBJECT *FileObject,
1393  _In_ ULONG Length,
1394  _In_ BOOLEAN Wait,
1395  _In_ ULONG LockKey,
1397  _Out_ PIO_STATUS_BLOCK IoStatus,
1399 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1400 
1401 _Function_class_(FAST_IO_READ)
1403 typedef BOOLEAN
1404 (NTAPI FAST_IO_READ)(
1405  _In_ struct _FILE_OBJECT *FileObject,
1406  _In_ PLARGE_INTEGER FileOffset,
1407  _In_ ULONG Length,
1408  _In_ BOOLEAN Wait,
1409  _In_ ULONG LockKey,
1410  _Out_ PVOID Buffer,
1411  _Out_ PIO_STATUS_BLOCK IoStatus,
1412  _In_ struct _DEVICE_OBJECT *DeviceObject);
1413 typedef FAST_IO_READ *PFAST_IO_READ;
1414 
1415 _Function_class_(FAST_IO_WRITE)
1417 typedef BOOLEAN
1418 (NTAPI FAST_IO_WRITE)(
1419  _In_ struct _FILE_OBJECT *FileObject,
1420  _In_ PLARGE_INTEGER FileOffset,
1421  _In_ ULONG Length,
1422  _In_ BOOLEAN Wait,
1423  _In_ ULONG LockKey,
1424  _In_ PVOID Buffer,
1425  _Out_ PIO_STATUS_BLOCK IoStatus,
1426  _In_ struct _DEVICE_OBJECT *DeviceObject);
1427 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1428 
1429 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1431 typedef BOOLEAN
1432 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1433  _In_ struct _FILE_OBJECT *FileObject,
1434  _In_ BOOLEAN Wait,
1436  _Out_ PIO_STATUS_BLOCK IoStatus,
1437  _In_ struct _DEVICE_OBJECT *DeviceObject);
1438 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1439 
1440 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1442 typedef BOOLEAN
1443 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1444  _In_ struct _FILE_OBJECT *FileObject,
1445  _In_ BOOLEAN Wait,
1447  _Out_ PIO_STATUS_BLOCK IoStatus,
1448  _In_ struct _DEVICE_OBJECT *DeviceObject);
1449 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1450 
1451 _Function_class_(FAST_IO_LOCK)
1453 typedef BOOLEAN
1454 (NTAPI FAST_IO_LOCK)(
1455  _In_ struct _FILE_OBJECT *FileObject,
1456  _In_ PLARGE_INTEGER FileOffset,
1457  _In_ PLARGE_INTEGER Length,
1459  _In_ ULONG Key,
1462  _Out_ PIO_STATUS_BLOCK IoStatus,
1463  _In_ struct _DEVICE_OBJECT *DeviceObject);
1464 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1465 
1466 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1468 typedef BOOLEAN
1469 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1470  _In_ struct _FILE_OBJECT *FileObject,
1471  _In_ PLARGE_INTEGER FileOffset,
1472  _In_ PLARGE_INTEGER Length,
1473  _In_ PEPROCESS ProcessId,
1474  _In_ ULONG Key,
1475  _Out_ PIO_STATUS_BLOCK IoStatus,
1476  _In_ struct _DEVICE_OBJECT *DeviceObject);
1477 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1478 
1479 _Function_class_(FAST_IO_UNLOCK_ALL)
1481 typedef BOOLEAN
1482 (NTAPI FAST_IO_UNLOCK_ALL)(
1483  _In_ struct _FILE_OBJECT *FileObject,
1484  _In_ PEPROCESS ProcessId,
1485  _Out_ PIO_STATUS_BLOCK IoStatus,
1486  _In_ struct _DEVICE_OBJECT *DeviceObject);
1487 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1488 
1489 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1491 typedef BOOLEAN
1492 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1493  _In_ struct _FILE_OBJECT *FileObject,
1494  _In_ PVOID ProcessId,
1495  _In_ ULONG Key,
1496  _Out_ PIO_STATUS_BLOCK IoStatus,
1497  _In_ struct _DEVICE_OBJECT *DeviceObject);
1498 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1499 
1500 _Function_class_(FAST_IO_DEVICE_CONTROL)
1502 typedef BOOLEAN
1503 (NTAPI FAST_IO_DEVICE_CONTROL)(
1504  _In_ struct _FILE_OBJECT *FileObject,
1511  _Out_ PIO_STATUS_BLOCK IoStatus,
1512  _In_ struct _DEVICE_OBJECT *DeviceObject);
1513 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1514 
1515 _Function_class_(FAST_IO_ACQUIRE_FILE)
1517 typedef VOID
1518 (NTAPI FAST_IO_ACQUIRE_FILE)(
1519  _In_ struct _FILE_OBJECT *FileObject);
1520 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1521 
1522 _Function_class_(FAST_IO_RELEASE_FILE)
1524 typedef VOID
1525 (NTAPI FAST_IO_RELEASE_FILE)(
1526  _In_ struct _FILE_OBJECT *FileObject);
1527 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1528 
1529 _Function_class_(FAST_IO_DETACH_DEVICE)
1531 typedef VOID
1532 (NTAPI FAST_IO_DETACH_DEVICE)(
1535 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1536 
1537 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1539 typedef BOOLEAN
1540 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1541  _In_ struct _FILE_OBJECT *FileObject,
1542  _In_ BOOLEAN Wait,
1544  _Out_ struct _IO_STATUS_BLOCK *IoStatus,
1545  _In_ struct _DEVICE_OBJECT *DeviceObject);
1546 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1547 
1548 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1550 typedef NTSTATUS
1551 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1552  _In_ struct _FILE_OBJECT *FileObject,
1555  _In_ struct _DEVICE_OBJECT *DeviceObject);
1556 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1557 
1558 _Function_class_(FAST_IO_MDL_READ)
1560 typedef BOOLEAN
1561 (NTAPI FAST_IO_MDL_READ)(
1562  _In_ struct _FILE_OBJECT *FileObject,
1563  _In_ PLARGE_INTEGER FileOffset,
1564  _In_ ULONG Length,
1565  _In_ ULONG LockKey,
1566  _Out_ PMDL *MdlChain,
1567  _Out_ PIO_STATUS_BLOCK IoStatus,
1568  _In_ struct _DEVICE_OBJECT *DeviceObject);
1569 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1570 
1571 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1573 typedef BOOLEAN
1574 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1575  _In_ struct _FILE_OBJECT *FileObject,
1576  _In_ PMDL MdlChain,
1577  _In_ struct _DEVICE_OBJECT *DeviceObject);
1578 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1579 
1580 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1582 typedef BOOLEAN
1583 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1584  _In_ struct _FILE_OBJECT *FileObject,
1585  _In_ PLARGE_INTEGER FileOffset,
1586  _In_ ULONG Length,
1587  _In_ ULONG LockKey,
1588  _Out_ PMDL *MdlChain,
1589  _Out_ PIO_STATUS_BLOCK IoStatus,
1590  _In_ struct _DEVICE_OBJECT *DeviceObject);
1591 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1592 
1593 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1595 typedef BOOLEAN
1596 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1597  _In_ struct _FILE_OBJECT *FileObject,
1598  _In_ PLARGE_INTEGER FileOffset,
1599  _In_ PMDL MdlChain,
1600  _In_ struct _DEVICE_OBJECT *DeviceObject);
1601 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1602 
1603 _Function_class_(FAST_IO_READ_COMPRESSED)
1605 typedef BOOLEAN
1606 (NTAPI FAST_IO_READ_COMPRESSED)(
1607  _In_ struct _FILE_OBJECT *FileObject,
1608  _In_ PLARGE_INTEGER FileOffset,
1609  _In_ ULONG Length,
1610  _In_ ULONG LockKey,
1611  _Out_ PVOID Buffer,
1612  _Out_ PMDL *MdlChain,
1613  _Out_ PIO_STATUS_BLOCK IoStatus,
1616  _In_ struct _DEVICE_OBJECT *DeviceObject);
1617 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1618 
1619 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1621 typedef BOOLEAN
1622 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1623  _In_ struct _FILE_OBJECT *FileObject,
1624  _In_ PLARGE_INTEGER FileOffset,
1625  _In_ ULONG Length,
1626  _In_ ULONG LockKey,
1627  _In_ PVOID Buffer,
1628  _Out_ PMDL *MdlChain,
1629  _Out_ PIO_STATUS_BLOCK IoStatus,
1630  _In_ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
1631  _In_ ULONG CompressedDataInfoLength,
1632  _In_ struct _DEVICE_OBJECT *DeviceObject);
1633 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1634 
1635 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1637 typedef BOOLEAN
1638 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1639  _In_ struct _FILE_OBJECT *FileObject,
1640  _In_ PMDL MdlChain,
1641  _In_ struct _DEVICE_OBJECT *DeviceObject);
1642 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1643 
1644 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1646 typedef BOOLEAN
1647 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1648  _In_ struct _FILE_OBJECT *FileObject,
1649  _In_ PLARGE_INTEGER FileOffset,
1650  _In_ PMDL MdlChain,
1651  _In_ struct _DEVICE_OBJECT *DeviceObject);
1652 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1653 
1654 _Function_class_(FAST_IO_QUERY_OPEN)
1656 typedef BOOLEAN
1657 (NTAPI FAST_IO_QUERY_OPEN)(
1658  _Inout_ struct _IRP *Irp,
1660  _In_ struct _DEVICE_OBJECT *DeviceObject);
1661 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1662 
1663 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1665 typedef NTSTATUS
1666 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1667  _In_ struct _FILE_OBJECT *FileObject,
1668  _In_ struct _ERESOURCE *ResourceToRelease,
1669  _In_ struct _DEVICE_OBJECT *DeviceObject);
1670 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1671 
1672 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1674 typedef NTSTATUS
1675 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1676  _In_ struct _FILE_OBJECT *FileObject,
1677  _In_ struct _DEVICE_OBJECT *DeviceObject);
1678 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1679 
1680 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1682 typedef NTSTATUS
1683 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1684  _In_ struct _FILE_OBJECT *FileObject,
1685  _In_ struct _DEVICE_OBJECT *DeviceObject);
1686 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1687 
1690  PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
1691  PFAST_IO_READ FastIoRead;
1692  PFAST_IO_WRITE FastIoWrite;
1693  PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
1694  PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
1695  PFAST_IO_LOCK FastIoLock;
1696  PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
1697  PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
1698  PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
1699  PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
1700  PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
1701  PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
1702  PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
1703  PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
1704  PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
1705  PFAST_IO_MDL_READ MdlRead;
1706  PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
1707  PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
1708  PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
1709  PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
1710  PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
1711  PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
1712  PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
1713  PFAST_IO_QUERY_OPEN FastIoQueryOpen;
1714  PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
1715  PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
1716  PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
1718 
1719 typedef struct _SECTION_OBJECT_POINTERS {
1720  PVOID DataSectionObject;
1721  PVOID SharedCacheMap;
1724 
1725 typedef struct _IO_COMPLETION_CONTEXT {
1729 
1730 /* FILE_OBJECT.Flags */
1731 #define FO_FILE_OPEN 0x00000001
1732 #define FO_SYNCHRONOUS_IO 0x00000002
1733 #define FO_ALERTABLE_IO 0x00000004
1734 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1735 #define FO_WRITE_THROUGH 0x00000010
1736 #define FO_SEQUENTIAL_ONLY 0x00000020
1737 #define FO_CACHE_SUPPORTED 0x00000040
1738 #define FO_NAMED_PIPE 0x00000080
1739 #define FO_STREAM_FILE 0x00000100
1740 #define FO_MAILSLOT 0x00000200
1741 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1742 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1743 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1744 #define FO_FILE_MODIFIED 0x00001000
1745 #define FO_FILE_SIZE_CHANGED 0x00002000
1746 #define FO_CLEANUP_COMPLETE 0x00004000
1747 #define FO_TEMPORARY_FILE 0x00008000
1748 #define FO_DELETE_ON_CLOSE 0x00010000
1749 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1750 #define FO_HANDLE_CREATED 0x00040000
1751 #define FO_FILE_FAST_IO_READ 0x00080000
1752 #define FO_RANDOM_ACCESS 0x00100000
1753 #define FO_FILE_OPEN_CANCELLED 0x00200000
1754 #define FO_VOLUME_OPEN 0x00400000
1755 #define FO_REMOTE_ORIGIN 0x01000000
1756 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1757 #define FO_SKIP_COMPLETION_PORT 0x02000000
1758 #define FO_SKIP_SET_EVENT 0x04000000
1759 #define FO_SKIP_SET_FAST_IO 0x08000000
1760 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1761 
1762 /* VPB.Flags */
1763 #define VPB_MOUNTED 0x0001
1764 #define VPB_LOCKED 0x0002
1765 #define VPB_PERSISTENT 0x0004
1766 #define VPB_REMOVE_PENDING 0x0008
1767 #define VPB_RAW_MOUNT 0x0010
1768 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1769 
1770 /* IO_STACK_LOCATION.Flags */
1771 
1772 #define SL_FORCE_ACCESS_CHECK 0x01
1773 #define SL_OPEN_PAGING_FILE 0x02
1774 #define SL_OPEN_TARGET_DIRECTORY 0x04
1775 #define SL_STOP_ON_SYMLINK 0x08
1776 #define SL_CASE_SENSITIVE 0x80
1777 
1778 #define SL_KEY_SPECIFIED 0x01
1779 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1780 #define SL_WRITE_THROUGH 0x04
1781 #define SL_FT_SEQUENTIAL_WRITE 0x08
1782 #define SL_FORCE_DIRECT_WRITE 0x10
1783 #define SL_REALTIME_STREAM 0x20
1784 
1785 #define SL_READ_ACCESS_GRANTED 0x01
1786 #define SL_WRITE_ACCESS_GRANTED 0x04
1787 
1788 #define SL_FAIL_IMMEDIATELY 0x01
1789 #define SL_EXCLUSIVE_LOCK 0x02
1790 
1791 #define SL_RESTART_SCAN 0x01
1792 #define SL_RETURN_SINGLE_ENTRY 0x02
1793 #define SL_INDEX_SPECIFIED 0x04
1794 
1795 #define SL_WATCH_TREE 0x01
1796 
1797 #define SL_ALLOW_RAW_MOUNT 0x01
1798 
1799 $endif (_WDMDDK_)
1800 $if (_WDMDDK_ || _DEVIOCTL_)
1801 #define CTL_CODE(DeviceType, Function, Method, Access) \
1802  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1803 
1804 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1805 
1806 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1807 
1809 $if (_WDMDDK_)
1810 
1811 /* IRP.Flags */
1812 #define IRP_NOCACHE 0x00000001
1813 #define IRP_PAGING_IO 0x00000002
1814 #define IRP_MOUNT_COMPLETION 0x00000002
1815 #define IRP_SYNCHRONOUS_API 0x00000004
1816 #define IRP_ASSOCIATED_IRP 0x00000008
1817 #define IRP_BUFFERED_IO 0x00000010
1818 #define IRP_DEALLOCATE_BUFFER 0x00000020
1819 #define IRP_INPUT_OPERATION 0x00000040
1820 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1821 #define IRP_CREATE_OPERATION 0x00000080
1822 #define IRP_READ_OPERATION 0x00000100
1823 #define IRP_WRITE_OPERATION 0x00000200
1824 #define IRP_CLOSE_OPERATION 0x00000400
1825 #define IRP_DEFER_IO_COMPLETION 0x00000800
1826 #define IRP_OB_QUERY_NAME 0x00001000
1827 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1828 /* The following 2 are missing in latest WDK */
1829 #define IRP_RETRY_IO_COMPLETION 0x00004000
1830 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1831 
1832 /* IRP.AllocationFlags */
1833 #define IRP_QUOTA_CHARGED 0x01
1834 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1835 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1836 #define IRP_LOOKASIDE_ALLOCATION 0x08
1837 
1838 /*
1839 ** IRP function codes
1840 */
1841 
1842 #define IRP_MJ_CREATE 0x00
1843 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1844 #define IRP_MJ_CLOSE 0x02
1845 #define IRP_MJ_READ 0x03
1846 #define IRP_MJ_WRITE 0x04
1847 #define IRP_MJ_QUERY_INFORMATION 0x05
1848 #define IRP_MJ_SET_INFORMATION 0x06
1849 #define IRP_MJ_QUERY_EA 0x07
1850 #define IRP_MJ_SET_EA 0x08
1851 #define IRP_MJ_FLUSH_BUFFERS 0x09
1852 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1853 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1854 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1855 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1856 #define IRP_MJ_DEVICE_CONTROL 0x0e
1857 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1858 #define IRP_MJ_SCSI 0x0f
1859 #define IRP_MJ_SHUTDOWN 0x10
1860 #define IRP_MJ_LOCK_CONTROL 0x11
1861 #define IRP_MJ_CLEANUP 0x12
1862 #define IRP_MJ_CREATE_MAILSLOT 0x13
1863 #define IRP_MJ_QUERY_SECURITY 0x14
1864 #define IRP_MJ_SET_SECURITY 0x15
1865 #define IRP_MJ_POWER 0x16
1866 #define IRP_MJ_SYSTEM_CONTROL 0x17
1867 #define IRP_MJ_DEVICE_CHANGE 0x18
1868 #define IRP_MJ_QUERY_QUOTA 0x19
1869 #define IRP_MJ_SET_QUOTA 0x1a
1870 #define IRP_MJ_PNP 0x1b
1871 #define IRP_MJ_PNP_POWER 0x1b
1872 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1873 
1874 #define IRP_MN_SCSI_CLASS 0x01
1875 
1876 #define IRP_MN_START_DEVICE 0x00
1877 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1878 #define IRP_MN_REMOVE_DEVICE 0x02
1879 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1880 #define IRP_MN_STOP_DEVICE 0x04
1881 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1882 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1883 
1884 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1885 #define IRP_MN_QUERY_INTERFACE 0x08
1886 #define IRP_MN_QUERY_CAPABILITIES 0x09
1887 #define IRP_MN_QUERY_RESOURCES 0x0A
1888 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1889 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1890 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1891 
1892 #define IRP_MN_READ_CONFIG 0x0F
1893 #define IRP_MN_WRITE_CONFIG 0x10
1894 #define IRP_MN_EJECT 0x11
1895 #define IRP_MN_SET_LOCK 0x12
1896 #define IRP_MN_QUERY_ID 0x13
1897 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1898 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1899 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1900 #define IRP_MN_SURPRISE_REMOVAL 0x17
1901 #if (NTDDI_VERSION >= NTDDI_WIN7)
1902 #define IRP_MN_DEVICE_ENUMERATED 0x19
1903 #endif
1904 
1905 #define IRP_MN_WAIT_WAKE 0x00
1906 #define IRP_MN_POWER_SEQUENCE 0x01
1907 #define IRP_MN_SET_POWER 0x02
1908 #define IRP_MN_QUERY_POWER 0x03
1909 
1910 #define IRP_MN_QUERY_ALL_DATA 0x00
1911 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1912 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1913 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1914 #define IRP_MN_ENABLE_EVENTS 0x04
1915 #define IRP_MN_DISABLE_EVENTS 0x05
1916 #define IRP_MN_ENABLE_COLLECTION 0x06
1917 #define IRP_MN_DISABLE_COLLECTION 0x07
1918 #define IRP_MN_REGINFO 0x08
1919 #define IRP_MN_EXECUTE_METHOD 0x09
1920 
1921 #define IRP_MN_REGINFO_EX 0x0b
1922 
1923 typedef struct _FILE_OBJECT {
1924  CSHORT Type;
1925  CSHORT Size;
1926  PDEVICE_OBJECT DeviceObject;
1927  PVPB Vpb;
1928  PVOID FsContext;
1929  PVOID FsContext2;
1931  PVOID PrivateCacheMap;
1932  NTSTATUS FinalStatus;
1933  struct _FILE_OBJECT *RelatedFileObject;
1934  BOOLEAN LockOperation;
1935  BOOLEAN DeletePending;
1938  BOOLEAN DeleteAccess;
1939  BOOLEAN SharedRead;
1940  BOOLEAN SharedWrite;
1941  BOOLEAN SharedDelete;
1942  ULONG Flags;
1944  LARGE_INTEGER CurrentByteOffset;
1945  volatile ULONG Waiters;
1946  volatile ULONG Busy;
1947  PVOID LastLock;
1948  KEVENT Lock;
1949  KEVENT Event;
1951  KSPIN_LOCK IrpListLock;
1952  LIST_ENTRY IrpList;
1953  volatile PVOID FileObjectExtension;
1955 
1956 typedef struct _IO_ERROR_LOG_PACKET {
1971 
1972 typedef struct _IO_ERROR_LOG_MESSAGE {
1980 
1981 /* See ndk/lpctypes.h */
1982 #ifdef _WIN64
1983 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
1984 #else
1985 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
1986 #endif
1987 
1988 #define ERROR_LOG_LIMIT_SIZE 240
1989 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1990  sizeof(IO_ERROR_LOG_PACKET) + \
1991  (sizeof(WCHAR) * 40))
1992 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
1993  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1994 #define IO_ERROR_LOG_MESSAGE_LENGTH \
1995  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
1996  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
1997  PORT_MAXIMUM_MESSAGE_LENGTH)
1998 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
1999  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2000 
2001 typedef enum _DMA_WIDTH {
2006 } DMA_WIDTH, *PDMA_WIDTH;
2007 
2008 typedef enum _DMA_SPEED {
2015 } DMA_SPEED, *PDMA_SPEED;
2016 
2017 /* DEVICE_DESCRIPTION.Version */
2018 
2019 #define DEVICE_DESCRIPTION_VERSION 0x0000
2020 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2021 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2022 
2023 typedef struct _DEVICE_DESCRIPTION {
2041 
2051 
2052 typedef struct _DEVICE_RELATIONS {
2054  PDEVICE_OBJECT Objects[1];
2056 
2057 typedef struct _DEVOBJ_EXTENSION {
2060  PDEVICE_OBJECT DeviceObject;
2062 
2063 typedef struct _SCATTER_GATHER_ELEMENT {
2068 
2069 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2070 
2071 #if defined(_MSC_VER)
2072 #if _MSC_VER >= 1200
2073 #pragma warning(push)
2074 #endif
2075 #pragma warning(disable:4200)
2076 #endif /* _MSC_VER */
2077 
2078 typedef struct _SCATTER_GATHER_LIST {
2079  ULONG NumberOfElements;
2083 
2084 #if defined(_MSC_VER)
2085 #if _MSC_VER >= 1200
2086 #pragma warning(pop)
2087 #else
2088 #pragma warning(default:4200)
2089 #endif
2090 #endif /* _MSC_VER */
2091 
2092 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2093 
2094 struct _SCATTER_GATHER_LIST;
2095 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2096 
2097 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2098 
2099 _Function_class_(DRIVER_ADD_DEVICE)
2103 typedef NTSTATUS
2104 (NTAPI DRIVER_ADD_DEVICE)(
2107 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2108 
2111  PDRIVER_ADD_DEVICE AddDevice;
2115 
2116 #define DRVO_UNLOAD_INVOKED 0x00000001
2117 #define DRVO_LEGACY_DRIVER 0x00000002
2118 #define DRVO_BUILTIN_DRIVER 0x00000004
2119 
2120 _Function_class_(DRIVER_INITIALIZE)
2122 typedef NTSTATUS
2123 (NTAPI DRIVER_INITIALIZE)(
2126 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2127 
2128 _Function_class_(DRIVER_STARTIO)
2132 typedef VOID
2133 (NTAPI DRIVER_STARTIO)(
2135  _Inout_ struct _IRP *Irp);
2136 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2137 
2138 _Function_class_(DRIVER_UNLOAD)
2141 typedef VOID
2142 (NTAPI DRIVER_UNLOAD)(
2143  _In_ struct _DRIVER_OBJECT *DriverObject);
2144 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2145 
2149 typedef NTSTATUS
2151  _In_ struct _DEVICE_OBJECT *DeviceObject,
2152  _Inout_ struct _IRP *Irp);
2155 
2159 typedef NTSTATUS
2160 (NTAPI DRIVER_DISPATCH_PAGED)(
2161  _In_ struct _DEVICE_OBJECT *DeviceObject,
2162  _Inout_ struct _IRP *Irp);
2163 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2164 
2168  PDEVICE_OBJECT DeviceObject;
2177  PDRIVER_INITIALIZE DriverInit;
2178  PDRIVER_STARTIO DriverStartIo;
2179  PDRIVER_UNLOAD DriverUnload;
2180  PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
2182 
2183 typedef struct _DMA_ADAPTER {
2188 
2189 typedef VOID
2191  PDMA_ADAPTER DmaAdapter);
2192 
2193 typedef PVOID
2195  _In_ PDMA_ADAPTER DmaAdapter,
2196  _In_ ULONG Length,
2197  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2198  _In_ BOOLEAN CacheEnabled);
2199 
2200 typedef VOID
2202  _In_ PDMA_ADAPTER DmaAdapter,
2203  _In_ ULONG Length,
2204  _In_ PHYSICAL_ADDRESS LogicalAddress,
2206  _In_ BOOLEAN CacheEnabled);
2207 
2208 typedef NTSTATUS
2210  _In_ PDMA_ADAPTER DmaAdapter,
2211  _In_ PDEVICE_OBJECT DeviceObject,
2214  _In_ PVOID Context);
2215 
2216 typedef BOOLEAN
2218  _In_ PDMA_ADAPTER DmaAdapter,
2219  _In_ PMDL Mdl,
2221  _In_ PVOID CurrentVa,
2222  _In_ ULONG Length,
2223  _In_ BOOLEAN WriteToDevice);
2224 
2225 typedef VOID
2227  _In_ PDMA_ADAPTER DmaAdapter);
2228 
2229 typedef VOID
2231  _In_ PDMA_ADAPTER DmaAdapter,
2234 
2235 typedef PHYSICAL_ADDRESS
2237  _In_ PDMA_ADAPTER DmaAdapter,
2238  _In_ PMDL Mdl,
2240  _In_ PVOID CurrentVa,
2242  _In_ BOOLEAN WriteToDevice);
2243 
2244 typedef ULONG
2246  _In_ PDMA_ADAPTER DmaAdapter);
2247 
2248 typedef ULONG
2250  _In_ PDMA_ADAPTER DmaAdapter);
2251 
2252 _Function_class_(DRIVER_LIST_CONTROL)
2254 typedef VOID
2255 (NTAPI DRIVER_LIST_CONTROL)(
2257  _In_ struct _IRP *Irp,
2258  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2259  _In_ PVOID Context);
2260 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2261 
2262 typedef NTSTATUS
2264  _In_ PDMA_ADAPTER DmaAdapter,
2265  _In_ PDEVICE_OBJECT DeviceObject,
2266  _In_ PMDL Mdl,
2267  _In_ PVOID CurrentVa,
2268  _In_ ULONG Length,
2269  _In_ PDRIVER_LIST_CONTROL ExecutionRoutine,
2270  _In_ PVOID Context,
2271  _In_ BOOLEAN WriteToDevice);
2272 
2273 typedef VOID
2275  _In_ PDMA_ADAPTER DmaAdapter,
2276  _In_ PSCATTER_GATHER_LIST ScatterGather,
2277  _In_ BOOLEAN WriteToDevice);
2278 
2279 typedef NTSTATUS
2281  _In_ PDMA_ADAPTER DmaAdapter,
2282  _In_ PMDL Mdl OPTIONAL,
2283  _In_ PVOID CurrentVa,
2284  _In_ ULONG Length,
2285  _Out_ PULONG ScatterGatherListSize,
2286  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2287 
2288 typedef NTSTATUS
2290  _In_ PDMA_ADAPTER DmaAdapter,
2291  _In_ PDEVICE_OBJECT DeviceObject,
2292  _In_ PMDL Mdl,
2293  _In_ PVOID CurrentVa,
2294  _In_ ULONG Length,
2295  _In_ PDRIVER_LIST_CONTROL ExecutionRoutine,
2296  _In_ PVOID Context,
2297  _In_ BOOLEAN WriteToDevice,
2298  _In_ PVOID ScatterGatherBuffer,
2299  _In_ ULONG ScatterGatherLength);
2300 
2301 typedef NTSTATUS
2303  _In_ PDMA_ADAPTER DmaAdapter,
2304  _In_ PSCATTER_GATHER_LIST ScatterGather,
2305  _In_ PMDL OriginalMdl,
2306  _Out_ PMDL *TargetMdl);
2307 
2310  PPUT_DMA_ADAPTER PutDmaAdapter;
2311  PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
2312  PFREE_COMMON_BUFFER FreeCommonBuffer;
2313  PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
2314  PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
2315  PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
2316  PFREE_MAP_REGISTERS FreeMapRegisters;
2317  PMAP_TRANSFER MapTransfer;
2318  PGET_DMA_ALIGNMENT GetDmaAlignment;
2319  PREAD_DMA_COUNTER ReadDmaCounter;
2326 
2327 typedef struct _IO_RESOURCE_DESCRIPTOR {
2328  UCHAR Option;
2329  UCHAR Type;
2330  UCHAR ShareDisposition;
2331  UCHAR Spare1;
2332  USHORT Flags;
2333  USHORT Spare2;
2334  union {
2335  struct {
2336  ULONG Length;
2337  ULONG Alignment;
2338  PHYSICAL_ADDRESS MinimumAddress;
2339  PHYSICAL_ADDRESS MaximumAddress;
2340  } Port;
2341  struct {
2342  ULONG Length;
2343  ULONG Alignment;
2344  PHYSICAL_ADDRESS MinimumAddress;
2345  PHYSICAL_ADDRESS MaximumAddress;
2346  } Memory;
2347  struct {
2348  ULONG MinimumVector;
2349  ULONG MaximumVector;
2350  } Interrupt;
2351  struct {
2352  ULONG MinimumChannel;
2353  ULONG MaximumChannel;
2354  } Dma;
2355  struct {
2356  ULONG Length;
2357  ULONG Alignment;
2358  PHYSICAL_ADDRESS MinimumAddress;
2359  PHYSICAL_ADDRESS MaximumAddress;
2360  } Generic;
2361  struct {
2362  ULONG Data[3];
2363  } DevicePrivate;
2364  struct {
2365  ULONG Length;
2366  ULONG MinBusNumber;
2367  ULONG MaxBusNumber;
2368  ULONG Reserved;
2369  } BusNumber;
2370  struct {
2371  ULONG Priority;
2372  ULONG Reserved1;
2373  ULONG Reserved2;
2374  } ConfigData;
2375  } u;
2377 
2378 typedef struct _IO_RESOURCE_LIST {
2382  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2384 
2394 
2395 _Function_class_(DRIVER_CANCEL)
2396 _Requires_lock_held_(_Global_cancel_spin_lock_)
2397 _Releases_lock_(_Global_cancel_spin_lock_)
2400 typedef VOID
2401 (NTAPI DRIVER_CANCEL)(
2404 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2405 
2407  CSHORT Type;
2408  USHORT Size;
2409  struct _MDL *MdlAddress;
2410  ULONG Flags;
2411  union {
2412  struct _IRP *MasterIrp;
2413  volatile LONG IrpCount;
2414  PVOID SystemBuffer;
2415  } AssociatedIrp;
2416  LIST_ENTRY ThreadListEntry;
2418  KPROCESSOR_MODE RequestorMode;
2419  BOOLEAN PendingReturned;
2420  CHAR StackCount;
2421  CHAR CurrentLocation;
2422  BOOLEAN Cancel;
2423  KIRQL CancelIrql;
2424  CCHAR ApcEnvironment;
2425  UCHAR AllocationFlags;
2426  PIO_STATUS_BLOCK UserIosb;
2427  PKEVENT UserEvent;
2428  union {
2429  struct {
2430  _ANONYMOUS_UNION union {
2431  PIO_APC_ROUTINE UserApcRoutine;
2432  PVOID IssuingProcess;
2433  } DUMMYUNIONNAME;
2434  PVOID UserApcContext;
2435  } AsynchronousParameters;
2437  } Overlay;
2438  volatile PDRIVER_CANCEL CancelRoutine;
2439  PVOID UserBuffer;
2440  union {
2441  struct {
2442  _ANONYMOUS_UNION union {
2444  _ANONYMOUS_STRUCT struct {
2445  PVOID DriverContext[4];
2446  } DUMMYSTRUCTNAME;
2447  } DUMMYUNIONNAME;
2448  PETHREAD Thread;
2449  PCHAR AuxiliaryBuffer;
2450  _ANONYMOUS_STRUCT struct {
2451  LIST_ENTRY ListEntry;
2452  _ANONYMOUS_UNION union {
2453  struct _IO_STACK_LOCATION *CurrentStackLocation;
2454  ULONG PacketType;
2455  } DUMMYUNIONNAME;
2456  } DUMMYSTRUCTNAME;
2457  struct _FILE_OBJECT *OriginalFileObject;
2458  } Overlay;
2459  KAPC Apc;
2460  PVOID CompletionKey;
2461  } Tail;
2462 } IRP, *PIRP;
2463 
2464 typedef enum _IO_PAGING_PRIORITY {
2471 
2472 _Function_class_(IO_COMPLETION_ROUTINE)
2474 typedef NTSTATUS
2475 (NTAPI IO_COMPLETION_ROUTINE)(
2477  _In_ struct _IRP *Irp,
2478  _In_opt_ PVOID Context);
2479 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2480 
2481 _Function_class_(IO_DPC_ROUTINE)
2485 typedef VOID
2486 (NTAPI IO_DPC_ROUTINE)(
2487  _In_ struct _KDPC *Dpc,
2488  _In_ struct _DEVICE_OBJECT *DeviceObject,
2489  _Inout_ struct _IRP *Irp,
2490  _In_opt_ PVOID Context);
2491 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2492 
2493 typedef NTSTATUS
2496 
2497 typedef NTSTATUS
2499  VOID);
2500 
2501 _Function_class_(IO_TIMER_ROUTINE)
2503 typedef VOID
2504 (NTAPI IO_TIMER_ROUTINE)(
2505  _In_ struct _DEVICE_OBJECT *DeviceObject,
2506  _In_opt_ PVOID Context);
2507 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2508 
2515 
2516 struct _IO_CSQ;
2517 
2518 typedef struct _IO_CSQ_IRP_CONTEXT {
2519  ULONG Type;
2520  struct _IRP *Irp;
2521  struct _IO_CSQ *Csq;
2523 
2524 typedef VOID
2525 (NTAPI IO_CSQ_INSERT_IRP)(
2526  _In_ struct _IO_CSQ *Csq,
2528 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2529 
2530 typedef NTSTATUS
2531 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2532  _In_ struct _IO_CSQ *Csq,
2535 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2536 
2537 typedef VOID
2538 (NTAPI IO_CSQ_REMOVE_IRP)(
2539  _In_ struct _IO_CSQ *Csq,
2540  _In_ PIRP Irp);
2541 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2542 
2543 typedef PIRP
2544 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2545  _In_ struct _IO_CSQ *Csq,
2548 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2549 
2550 typedef VOID
2551 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2552  _In_ struct _IO_CSQ *Csq,
2554 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2555 
2556 typedef VOID
2557 (NTAPI IO_CSQ_RELEASE_LOCK)(
2558  _In_ struct _IO_CSQ *Csq,
2559  _In_ KIRQL Irql);
2560 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2561 
2562 typedef VOID
2563 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2564  _In_ struct _IO_CSQ *Csq,
2565  _In_ PIRP Irp);
2566 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2567 
2568 typedef struct _IO_CSQ {
2569  ULONG Type;
2576  PVOID ReservePointer;
2577 } IO_CSQ, *PIO_CSQ;
2578 
2579 typedef enum _BUS_QUERY_ID_TYPE {
2586 
2587 typedef enum _DEVICE_TEXT_TYPE {
2591 
2592 typedef BOOLEAN
2594  PVOID,
2595  PVOID);
2596 
2599 typedef NTSTATUS
2600 (NTAPI *PGPE_CONNECT_VECTOR)(
2601  PDEVICE_OBJECT,
2604  BOOLEAN,
2605  PGPE_SERVICE_ROUTINE,
2606  PVOID,
2607  PVOID);
2608 
2611 typedef NTSTATUS
2612 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2613  PVOID);
2614 
2617 typedef NTSTATUS
2618 (NTAPI *PGPE_ENABLE_EVENT)(
2619  PDEVICE_OBJECT,
2620  PVOID);
2621 
2624 typedef NTSTATUS
2625 (NTAPI *PGPE_DISABLE_EVENT)(
2626  PDEVICE_OBJECT,
2627  PVOID);
2628 
2631 typedef NTSTATUS
2632 (NTAPI *PGPE_CLEAR_STATUS)(
2633  PDEVICE_OBJECT,
2634  PVOID);
2635 
2636 typedef VOID
2638  PVOID,
2639  ULONG);
2640 
2643 typedef NTSTATUS
2644 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2645  PDEVICE_OBJECT,
2647  PVOID);
2648 
2650 typedef VOID
2651 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2652  PDEVICE_OBJECT,
2653  PDEVICE_NOTIFY_CALLBACK);
2654 
2658  PVOID Context;
2659  PINTERFACE_REFERENCE InterfaceReference;
2660  PINTERFACE_DEREFERENCE InterfaceDereference;
2661  PGPE_CONNECT_VECTOR GpeConnectVector;
2662  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
2663  PGPE_ENABLE_EVENT GpeEnableEvent;
2664  PGPE_DISABLE_EVENT GpeDisableEvent;
2665  PGPE_CLEAR_STATUS GpeClearStatus;
2666  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
2667  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
2669 
2670 typedef BOOLEAN
2674 
2677 typedef NTSTATUS
2678 (NTAPI *PGPE_CONNECT_VECTOR2)(
2679  PVOID Context,
2683  PGPE_SERVICE_ROUTINE ServiceRoutine,
2685  PVOID *ObjectContext);
2686 
2689 typedef NTSTATUS
2690 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
2691  PVOID Context,
2692  PVOID ObjectContext);
2693 
2696 typedef NTSTATUS
2697 (NTAPI *PGPE_ENABLE_EVENT2)(
2698  PVOID Context,
2699  PVOID ObjectContext);
2700 
2703 typedef NTSTATUS
2704 (NTAPI *PGPE_DISABLE_EVENT2)(
2705  PVOID Context,
2706  PVOID ObjectContext);
2707 
2710 typedef NTSTATUS
2711 (NTAPI *PGPE_CLEAR_STATUS2)(
2712  PVOID Context,
2713  PVOID ObjectContext);
2714 
2716 typedef VOID
2717 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
2720 
2723 typedef NTSTATUS
2724 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2725  PVOID Context,
2726  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
2727  PVOID NotificationContext);
2728 
2730 typedef VOID
2731 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2732  PVOID Context);
2733 
2738  PINTERFACE_REFERENCE InterfaceReference;
2739  PINTERFACE_DEREFERENCE InterfaceDereference;
2740  PGPE_CONNECT_VECTOR2 GpeConnectVector;
2741  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
2742  PGPE_ENABLE_EVENT2 GpeEnableEvent;
2743  PGPE_DISABLE_EVENT2 GpeDisableEvent;
2744  PGPE_CLEAR_STATUS2 GpeClearStatus;
2745  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
2746  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
2748 
2749 #if !defined(_AMD64_) && !defined(_ARM_)
2750 #include <pshpack4.h>
2751 #endif
2752 
2753 typedef struct _IO_STACK_LOCATION {
2758  union {
2759  struct {
2765  } Create;
2766  struct {
2768  ULONG Options;
2772  } CreatePipe;
2773  struct {
2774  PIO_SECURITY_CONTEXT SecurityContext;
2775  ULONG Options;
2779  } CreateMailslot;
2780  struct {
2784  } Read;
2785  struct {
2786  ULONG Length;
2789  } Write;
2790  struct {
2791  ULONG Length;
2795  } QueryDirectory;
2796  struct {
2797  ULONG Length;
2799  } NotifyDirectory;
2800  struct {
2801  ULONG Length;
2804  } NotifyDirectoryEx;
2805  struct {
2806  ULONG Length;
2808  } QueryFile;
2809  struct {
2810  ULONG Length;
2813  _ANONYMOUS_UNION union {
2814  _ANONYMOUS_STRUCT struct {
2817  } DUMMYSTRUCTNAME;
2820  } DUMMYUNIONNAME;
2821  } SetFile;
2822  struct {
2823  ULONG Length;
2827  } QueryEa;
2828  struct {
2829  ULONG Length;
2830  } SetEa;
2831  struct {
2832  ULONG Length;
2834  } QueryVolume;
2835  struct {
2836  ULONG Length;
2838  } SetVolume;
2839  struct {
2844  } FileSystemControl;
2845  struct {
2849  } LockControl;
2850  struct {
2854  PVOID Type3InputBuffer;
2855  } DeviceIoControl;
2856  struct {
2859  } QuerySecurity;
2860  struct {
2863  } SetSecurity;
2864  struct {
2865  PVPB Vpb;
2866  PDEVICE_OBJECT DeviceObject;
2867  } MountVolume;
2868  struct {
2869  PVPB Vpb;
2870  PDEVICE_OBJECT DeviceObject;
2871  } VerifyVolume;
2872  struct {
2874  } Scsi;
2875  struct {
2876  ULONG Length;
2880  } QueryQuota;
2881  struct {
2882  ULONG Length;
2883  } SetQuota;
2884  struct {
2886  } QueryDeviceRelations;
2887  struct {
2891  PINTERFACE Interface;
2893  } QueryInterface;
2894  struct {
2895  PDEVICE_CAPABILITIES Capabilities;
2897  struct {
2899  } FilterResourceRequirements;
2900  struct {
2905  } ReadWriteConfig;
2906  struct {
2908  } SetLock;
2909  struct {
2911  } QueryId;
2912  struct {
2915  } QueryDeviceText;
2916  struct {
2920  } UsageNotification;
2921  struct {
2923  } WaitWake;
2924  struct {
2926  } PowerSequence;
2927  struct {
2928  union {
2930 #if (NTDDI_VERSION >= NTDDI_VISTA)
2932 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
2933  };
2937  } Power;
2938  struct {
2941  } StartDevice;
2942  struct {
2946  PVOID Buffer;
2947  } WMI;
2948  struct {
2953  } Others;
2954  } Parameters;
2955  PDEVICE_OBJECT DeviceObject;
2960 
2961 #if !defined(_AMD64_) && !defined(_ARM_)
2962 #include "poppack.h"
2963 #endif
2964 
2965 
2966 /* IO_STACK_LOCATION.Control */
2967 
2968 #define SL_PENDING_RETURNED 0x01
2969 #define SL_ERROR_RETURNED 0x02
2970 #define SL_INVOKE_ON_CANCEL 0x20
2971 #define SL_INVOKE_ON_SUCCESS 0x40
2972 #define SL_INVOKE_ON_ERROR 0x80
2973 
2974 $endif (_WDMDDK_)
2975 $if (_WDMDDK_ || _DEVIOCTL_)
2976 #define METHOD_BUFFERED 0
2977 #define METHOD_IN_DIRECT 1
2978 #define METHOD_OUT_DIRECT 2
2979 #define METHOD_NEITHER 3
2980 
2981 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2982 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2983 
2985 $if (_WDMDDK_)
2986 #define FILE_SUPERSEDED 0x00000000
2987 #define FILE_OPENED 0x00000001
2988 #define FILE_CREATED 0x00000002
2989 #define FILE_OVERWRITTEN 0x00000003
2990 #define FILE_EXISTS 0x00000004
2991 #define FILE_DOES_NOT_EXIST 0x00000005
2992 
2993 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
2994 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
2995 
2996 /* also in winnt.h */
2997 #define FILE_LIST_DIRECTORY 0x00000001
2998 #define FILE_READ_DATA 0x00000001
2999 #define FILE_ADD_FILE 0x00000002
3000 #define FILE_WRITE_DATA 0x00000002
3001 #define FILE_ADD_SUBDIRECTORY 0x00000004
3002 #define FILE_APPEND_DATA 0x00000004
3003 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3004 #define FILE_READ_EA 0x00000008
3005 #define FILE_WRITE_EA 0x00000010
3006 #define FILE_EXECUTE 0x00000020
3007 #define FILE_TRAVERSE 0x00000020
3008 #define FILE_DELETE_CHILD 0x00000040
3009 #define FILE_READ_ATTRIBUTES 0x00000080
3010 #define FILE_WRITE_ATTRIBUTES 0x00000100
3011 
3012 #define FILE_SHARE_READ 0x00000001
3013 #define FILE_SHARE_WRITE 0x00000002
3014 #define FILE_SHARE_DELETE 0x00000004
3015 #define FILE_SHARE_VALID_FLAGS 0x00000007
3016 
3017 #define FILE_ATTRIBUTE_READONLY 0x00000001
3018 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3019 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3020 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3021 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3022 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3023 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3024 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3025 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3026 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3027 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3028 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3029 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3030 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3031 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3032 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3033 
3034 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3035 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3036 
3037 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3038 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3039 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3040 #define FILE_VALID_SET_FLAGS 0x00000036
3041 
3042 #define FILE_SUPERSEDE 0x00000000
3043 #define FILE_OPEN 0x00000001
3044 #define FILE_CREATE 0x00000002
3045 #define FILE_OPEN_IF 0x00000003
3046 #define FILE_OVERWRITE 0x00000004
3047 #define FILE_OVERWRITE_IF 0x00000005
3048 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3049 
3050 #define FILE_DIRECTORY_FILE 0x00000001
3051 #define FILE_WRITE_THROUGH 0x00000002
3052 #define FILE_SEQUENTIAL_ONLY 0x00000004
3053 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3054 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3055 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3056 #define FILE_NON_DIRECTORY_FILE 0x00000040
3057 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3058 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3059 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3060 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3061 #define FILE_RANDOM_ACCESS 0x00000800
3062 #define FILE_DELETE_ON_CLOSE 0x00001000
3063 #define FILE_OPEN_BY_FILE_ID 0x00002000
3064 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3065 #define FILE_NO_COMPRESSION 0x00008000
3066 #if (NTDDI_VERSION >= NTDDI_WIN7)
3067 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3068 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3069 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3070 #define FILE_RESERVE_OPFILTER 0x00100000
3071 #define FILE_OPEN_REPARSE_POINT 0x00200000
3072 #define FILE_OPEN_NO_RECALL 0x00400000
3073 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3074 
3075 $endif (_WDMDDK_)
3076 $if (_WDMDDK_ || _DEVIOCTL_)
3077 #define FILE_ANY_ACCESS 0x00000000
3078 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3079 #define FILE_READ_ACCESS 0x00000001
3080 #define FILE_WRITE_ACCESS 0x00000002
3081 
3083 $if (_WDMDDK_)
3084 #define FILE_ALL_ACCESS \
3085  (STANDARD_RIGHTS_REQUIRED | \
3086  SYNCHRONIZE | \
3087  0x1FF)
3088 
3089 #define FILE_GENERIC_EXECUTE \
3090  (STANDARD_RIGHTS_EXECUTE | \
3091  FILE_READ_ATTRIBUTES | \
3092  FILE_EXECUTE | \
3093  SYNCHRONIZE)
3094 
3095 #define FILE_GENERIC_READ \
3096  (STANDARD_RIGHTS_READ | \
3097  FILE_READ_DATA | \
3098  FILE_READ_ATTRIBUTES | \
3099  FILE_READ_EA | \
3100  SYNCHRONIZE)
3101 
3102 #define FILE_GENERIC_WRITE \
3103  (STANDARD_RIGHTS_WRITE | \
3104  FILE_WRITE_DATA | \
3105  FILE_WRITE_ATTRIBUTES | \
3106  FILE_WRITE_EA | \
3107  FILE_APPEND_DATA | \
3108  SYNCHRONIZE)
3109 
3110 /* end winnt.h */
3111 
3112 #define WMIREG_ACTION_REGISTER 1
3113 #define WMIREG_ACTION_DEREGISTER 2
3114 #define WMIREG_ACTION_REREGISTER 3
3115 #define WMIREG_ACTION_UPDATE_GUIDS 4
3116 #define WMIREG_ACTION_BLOCK_IRPS 5
3117 
3118 #define WMIREGISTER 0
3119 #define WMIUPDATE 1
3120 
3123 typedef VOID
3124 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3125  PVOID Wnode,
3126  PVOID Context);
3127 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3128 
3129 #ifndef _PCI_X_
3130 #define _PCI_X_
3131 
3132 typedef struct _PCI_SLOT_NUMBER {
3133  union {
3134  struct {
3136  ULONG FunctionNumber:3;
3138  } bits;
3140  } u;
3142 
3143 #define PCI_TYPE0_ADDRESSES 6
3144 #define PCI_TYPE1_ADDRESSES 2
3145 #define PCI_TYPE2_ADDRESSES 5
3146 
3147 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3148  inheritance, even from a struct renders the type non-POD. So we use
3149  this hack */
3150 #define PCI_COMMON_HEADER_LAYOUT \
3151  USHORT VendorID; \
3152  USHORT DeviceID; \
3153  USHORT Command; \
3154  USHORT Status; \
3155  UCHAR RevisionID; \
3156  UCHAR ProgIf; \
3157  UCHAR SubClass; \
3158  UCHAR BaseClass; \
3159  UCHAR CacheLineSize; \
3160  UCHAR LatencyTimer; \
3161  UCHAR HeaderType; \
3162  UCHAR BIST; \
3163  union { \
3164  struct _PCI_HEADER_TYPE_0 { \
3165  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3166  ULONG CIS; \
3167  USHORT SubVendorID; \
3168  USHORT SubSystemID; \
3169  ULONG ROMBaseAddress; \
3170  UCHAR CapabilitiesPtr; \
3171  UCHAR Reserved1[3]; \
3172  ULONG Reserved2; \
3173  UCHAR InterruptLine; \
3174  UCHAR InterruptPin; \
3175  UCHAR MinimumGrant; \
3176  UCHAR MaximumLatency; \
3177  } type0; \
3178  struct _PCI_HEADER_TYPE_1 { \
3179  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3180  UCHAR PrimaryBus; \
3181  UCHAR SecondaryBus; \
3182  UCHAR SubordinateBus; \
3183  UCHAR SecondaryLatency; \
3184  UCHAR IOBase; \
3185  UCHAR IOLimit; \
3186  USHORT SecondaryStatus; \
3187  USHORT MemoryBase; \
3188  USHORT MemoryLimit; \
3189  USHORT PrefetchBase; \
3190  USHORT PrefetchLimit; \
3191  ULONG PrefetchBaseUpper32; \
3192  ULONG PrefetchLimitUpper32; \
3193  USHORT IOBaseUpper16; \
3194  USHORT IOLimitUpper16; \
3195  UCHAR CapabilitiesPtr; \
3196  UCHAR Reserved1[3]; \
3197  ULONG ROMBaseAddress; \
3198  UCHAR InterruptLine; \
3199  UCHAR InterruptPin; \
3200  USHORT BridgeControl; \
3201  } type1; \
3202  struct _PCI_HEADER_TYPE_2 { \
3203  ULONG SocketRegistersBaseAddress; \
3204  UCHAR CapabilitiesPtr; \
3205  UCHAR Reserved; \
3206  USHORT SecondaryStatus; \
3207  UCHAR PrimaryBus; \
3208  UCHAR SecondaryBus; \
3209  UCHAR SubordinateBus; \
3210  UCHAR SecondaryLatency; \
3211  struct { \
3212  ULONG Base; \
3213  ULONG Limit; \
3214  } Range[PCI_TYPE2_ADDRESSES-1]; \
3215  UCHAR InterruptLine; \
3216  UCHAR InterruptPin; \
3217  USHORT BridgeControl; \
3218  } type2; \
3219  } u;
3220 
3221 typedef struct _PCI_COMMON_HEADER {
3224 
3225 #ifdef __cplusplus
3226 typedef struct _PCI_COMMON_CONFIG {
3228  UCHAR DeviceSpecific[192];
3230 #else
3231 typedef struct _PCI_COMMON_CONFIG {
3233  UCHAR DeviceSpecific[192];
3235 #endif
3236 
3237 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3238 
3239 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3240 
3241 #define PCI_MAX_DEVICES 32
3242 #define PCI_MAX_FUNCTION 8
3243 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3244 #define PCI_INVALID_VENDORID 0xFFFF
3245 
3246 /* PCI_COMMON_CONFIG.HeaderType */
3247 #define PCI_MULTIFUNCTION 0x80
3248 #define PCI_DEVICE_TYPE 0x00
3249 #define PCI_BRIDGE_TYPE 0x01
3250 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3251 
3252 #define PCI_CONFIGURATION_TYPE(PciData) \
3253  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3254 
3255 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3256  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3257 
3258 /* PCI_COMMON_CONFIG.Command */
3259 #define PCI_ENABLE_IO_SPACE 0x0001
3260 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3261 #define PCI_ENABLE_BUS_MASTER 0x0004
3262 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3263 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3264 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3265 #define PCI_ENABLE_PARITY 0x0040
3266 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3267 #define PCI_ENABLE_SERR 0x0100
3268 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3269 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3270 
3271 /* PCI_COMMON_CONFIG.Status */
3272 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3273 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3274 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3275 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3276 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3277 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3278 #define PCI_STATUS_DEVSEL 0x0600
3279 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3280 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3281 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3282 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3283 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3284 
3285 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3286 
3287 #define PCI_WHICHSPACE_CONFIG 0x0
3288 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3289 
3290 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3291 #define PCI_CAPABILITY_ID_AGP 0x02
3292 #define PCI_CAPABILITY_ID_VPD 0x03
3293 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3294 #define PCI_CAPABILITY_ID_MSI 0x05
3295 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3296 #define PCI_CAPABILITY_ID_PCIX 0x07
3297 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3298 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3299 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3300 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3301 #define PCI_CAPABILITY_ID_SHPC 0x0C
3302 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3303 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3304 #define PCI_CAPABILITY_ID_SECURE 0x0F
3305 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3306 #define PCI_CAPABILITY_ID_MSIX 0x11
3307 
3312 
3313 typedef struct _PCI_PMC {
3315  UCHAR PMEClock:1;
3316  UCHAR Rsvd1:1;
3317  UCHAR DeviceSpecificInitialization:1;
3318  UCHAR Rsvd2:2;
3319  struct _PM_SUPPORT {
3320  UCHAR Rsvd2:1;
3321  UCHAR D1:1;
3322  UCHAR D2:1;
3323  UCHAR PMED0:1;
3324  UCHAR PMED1:1;
3325  UCHAR PMED2:1;
3326  UCHAR PMED3Hot:1;
3327  UCHAR PMED3Cold:1;
3328  } Support;
3329 } PCI_PMC, *PPCI_PMC;
3330 
3331 typedef struct _PCI_PMCSR {
3333  USHORT Rsvd1:6;
3334  USHORT PMEEnable:1;
3335  USHORT DataSelect:4;
3336  USHORT DataScale:2;
3337  USHORT PMEStatus:1;
3338 } PCI_PMCSR, *PPCI_PMCSR;
3339 
3340 typedef struct _PCI_PMCSR_BSE {
3341  UCHAR Rsvd1:6;
3342  UCHAR D3HotSupportsStopClock:1;
3343  UCHAR BusPowerClockControlEnabled:1;
3345 
3346 typedef struct _PCI_PM_CAPABILITY {
3348  union {
3351  } PMC;
3352  union {
3354  USHORT AsUSHORT;
3355  } PMCSR;
3356  union {
3359  } PMCSR_BSE;
3362 
3363 typedef struct {
3365  union {
3366  struct {
3367  USHORT DataParityErrorRecoveryEnable:1;
3368  USHORT EnableRelaxedOrdering:1;
3369  USHORT MaxMemoryReadByteCount:2;
3370  USHORT MaxOutstandingSplitTransactions:3;
3372  } bits;
3374  } Command;
3375  union {
3376  struct {
3377  ULONG FunctionNumber:3;
3380  ULONG Device64Bit:1;
3381  ULONG Capable133MHz:1;
3382  ULONG SplitCompletionDiscarded:1;
3383  ULONG UnexpectedSplitCompletion:1;
3384  ULONG DeviceComplexity:1;
3385  ULONG DesignedMaxMemoryReadByteCount:2;
3386  ULONG DesignedMaxOutstandingSplitTransactions:3;
3387  ULONG DesignedMaxCumulativeReadSize:3;
3388  ULONG ReceivedSplitCompletionErrorMessage:1;
3389  ULONG CapablePCIX266:1;
3390  ULONG CapablePCIX533:1;
3391  } bits;
3393  } Status;
3395 
3396 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3397 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3398 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3399 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3400 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3401 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3402 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3403 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3404 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3405 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3406 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3407 
3411  USHORT Next:12;
3413 
3419 
3421  _ANONYMOUS_STRUCT struct {
3422  ULONG Undefined:1;
3424  ULONG DataLinkProtocolError:1;
3425  ULONG SurpriseDownError:1;
3427  ULONG PoisonedTLP:1;
3428  ULONG FlowControlProtocolError:1;
3429  ULONG CompletionTimeout:1;
3430  ULONG CompleterAbort:1;
3431  ULONG UnexpectedCompletion:1;
3432  ULONG ReceiverOverflow:1;
3433  ULONG MalformedTLP:1;
3434  ULONG ECRCError:1;
3435  ULONG UnsupportedRequestError:1;
3437  } DUMMYSTRUCTNAME;
3440 
3442  _ANONYMOUS_STRUCT struct {
3443  ULONG Undefined:1;
3445  ULONG DataLinkProtocolError:1;
3446  ULONG SurpriseDownError:1;
3448  ULONG PoisonedTLP:1;
3449  ULONG FlowControlProtocolError:1;
3450  ULONG CompletionTimeout:1;
3451  ULONG CompleterAbort:1;
3452  ULONG UnexpectedCompletion:1;
3453  ULONG ReceiverOverflow:1;
3454  ULONG MalformedTLP:1;
3455  ULONG ECRCError:1;
3456  ULONG UnsupportedRequestError:1;
3458  } DUMMYSTRUCTNAME;
3461 
3463  _ANONYMOUS_STRUCT struct {
3464  ULONG Undefined:1;
3466  ULONG DataLinkProtocolError:1;
3467  ULONG SurpriseDownError:1;
3469  ULONG PoisonedTLP:1;
3470  ULONG FlowControlProtocolError:1;
3471  ULONG CompletionTimeout:1;
3472  ULONG CompleterAbort:1;
3473  ULONG UnexpectedCompletion:1;
3474  ULONG ReceiverOverflow:1;
3475  ULONG MalformedTLP:1;
3476  ULONG ECRCError:1;
3477  ULONG UnsupportedRequestError:1;
3479  } DUMMYSTRUCTNAME;
3482 
3484  _ANONYMOUS_STRUCT struct {
3485  ULONG ReceiverError:1;
3487  ULONG BadTLP:1;
3488  ULONG BadDLLP:1;
3489  ULONG ReplayNumRollover:1;
3491  ULONG ReplayTimerTimeout:1;
3492  ULONG AdvisoryNonFatalError:1;
3494  } DUMMYSTRUCTNAME;
3497 
3499  _ANONYMOUS_STRUCT struct {
3500  ULONG ReceiverError:1;
3502  ULONG BadTLP:1;
3503  ULONG BadDLLP:1;
3504  ULONG ReplayNumRollover:1;
3506  ULONG ReplayTimerTimeout:1;
3507  ULONG AdvisoryNonFatalError:1;
3509  } DUMMYSTRUCTNAME;
3512 
3514  _ANONYMOUS_STRUCT struct {
3515  ULONG FirstErrorPointer:5;
3516  ULONG ECRCGenerationCapable:1;
3517  ULONG ECRCGenerationEnable:1;
3518  ULONG ECRCCheckCapable:1;
3519  ULONG ECRCCheckEnable:1;
3521  } DUMMYSTRUCTNAME;
3524 
3526  _ANONYMOUS_STRUCT struct {
3527  ULONG CorrectableErrorReportingEnable:1;
3528  ULONG NonFatalErrorReportingEnable:1;
3529  ULONG FatalErrorReportingEnable:1;
3531  } DUMMYSTRUCTNAME;
3534 
3536  _ANONYMOUS_STRUCT struct {
3537  ULONG CorrectableErrorReceived:1;
3538  ULONG MultipleCorrectableErrorsReceived:1;
3539  ULONG UncorrectableErrorReceived:1;
3540  ULONG MultipleUncorrectableErrorsReceived:1;
3541  ULONG FirstUncorrectableFatal:1;
3542  ULONG NonFatalErrorMessagesReceived:1;
3543  ULONG FatalErrorMessagesReceived:1;
3545  ULONG AdvancedErrorInterruptMessageNumber:5;
3546  } DUMMYSTRUCTNAME;
3549 
3551  _ANONYMOUS_STRUCT struct {
3552  USHORT CorrectableSourceIdFun:3;
3553  USHORT CorrectableSourceIdDev:5;
3554  USHORT CorrectableSourceIdBus:8;
3555  USHORT UncorrectableSourceIdFun:3;
3556  USHORT UncorrectableSourceIdDev:5;
3557  USHORT UncorrectableSourceIdBus:8;
3558  } DUMMYSTRUCTNAME;
3561 
3563  _ANONYMOUS_STRUCT struct {
3564  ULONG TargetAbortOnSplitCompletion:1;
3565  ULONG MasterAbortOnSplitCompletion:1;
3566  ULONG ReceivedTargetAbort:1;
3567  ULONG ReceivedMasterAbort:1;
3568  ULONG RsvdZ:1;
3569  ULONG UnexpectedSplitCompletionError:1;
3570  ULONG UncorrectableSplitCompletion:1;
3571  ULONG UncorrectableDataError:1;
3572  ULONG UncorrectableAttributeError:1;
3573  ULONG UncorrectableAddressError:1;
3574  ULONG DelayedTransactionDiscardTimerExpired:1;
3575  ULONG PERRAsserted:1;
3576  ULONG SERRAsserted:1;
3577  ULONG InternalBridgeError:1;
3579  } DUMMYSTRUCTNAME;
3582 
3584  _ANONYMOUS_STRUCT struct {
3585  ULONG TargetAbortOnSplitCompletion:1;
3586  ULONG MasterAbortOnSplitCompletion:1;
3587  ULONG ReceivedTargetAbort:1;
3588  ULONG ReceivedMasterAbort:1;
3589  ULONG RsvdZ:1;
3590  ULONG UnexpectedSplitCompletionError:1;
3591  ULONG UncorrectableSplitCompletion:1;
3592  ULONG UncorrectableDataError:1;
3593  ULONG UncorrectableAttributeError:1;
3594  ULONG UncorrectableAddressError:1;
3595  ULONG DelayedTransactionDiscardTimerExpired:1;
3596  ULONG PERRAsserted:1;
3597  ULONG SERRAsserted:1;
3598  ULONG InternalBridgeError:1;
3600  } DUMMYSTRUCTNAME;
3603 
3605  _ANONYMOUS_STRUCT struct {
3606  ULONG TargetAbortOnSplitCompletion:1;
3607  ULONG MasterAbortOnSplitCompletion:1;
3608  ULONG ReceivedTargetAbort:1;
3609  ULONG ReceivedMasterAbort:1;
3610  ULONG RsvdZ:1;
3611  ULONG UnexpectedSplitCompletionError:1;
3612  ULONG UncorrectableSplitCompletion:1;
3613  ULONG UncorrectableDataError:1;
3614  ULONG UncorrectableAttributeError:1;
3615  ULONG UncorrectableAddressError:1;
3616  ULONG DelayedTransactionDiscardTimerExpired:1;
3617  ULONG PERRAsserted:1;
3618  ULONG SERRAsserted:1;
3619  ULONG InternalBridgeError:1;
3621  } DUMMYSTRUCTNAME;
3624 
3626  _ANONYMOUS_STRUCT struct {
3627  ULONG SecondaryUncorrectableFirstErrorPtr:5;
3629  } DUMMYSTRUCTNAME;
3632 
3633 #define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001
3634 #define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002
3635 #define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004
3636 
3637 #define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \
3638  (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \
3639  ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \
3640  ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING)
3641 
3650  ULONG HeaderLog[4];
3655  ULONG SecHeaderLog[4];
3657 
3666  ULONG HeaderLog[4];
3671 
3680  ULONG HeaderLog[4];
3685  ULONG SecHeaderLog[4];
3687 
3689  _ANONYMOUS_STRUCT struct {
3690  ULONG VFMigrationCapable:1;
3692  ULONG VFMigrationInterruptNumber:11;
3693  } DUMMYSTRUCTNAME;
3696 
3698  _ANONYMOUS_STRUCT struct {
3699  USHORT VFEnable:1;
3700  USHORT VFMigrationEnable:1;
3701  USHORT VFMigrationInterruptEnable:1;
3702  USHORT VFMemorySpaceEnable:1;
3703  USHORT ARICapableHierarchy:1;
3705  } DUMMYSTRUCTNAME;
3708 
3710  _ANONYMOUS_STRUCT struct {
3711  USHORT VFMigrationStatus:1;
3713  } DUMMYSTRUCTNAME;
3716 
3718  _ANONYMOUS_STRUCT struct {
3719  ULONG VFMigrationStateBIR:3;
3720  ULONG VFMigrationStateOffset:29;
3721  } DUMMYSTRUCTNAME;
3724 
3741  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
3744 
3745 /* PCI device classes */
3746 #define PCI_CLASS_PRE_20 0x00
3747 #define PCI_CLASS_MASS_STORAGE_CTLR 0x01
3748 #define PCI_CLASS_NETWORK_CTLR 0x02
3749 #define PCI_CLASS_DISPLAY_CTLR 0x03
3750 #define PCI_CLASS_MULTIMEDIA_DEV 0x04
3751 #define PCI_CLASS_MEMORY_CTLR 0x05
3752 #define PCI_CLASS_BRIDGE_DEV 0x06
3753 #define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07
3754 #define PCI_CLASS_BASE_SYSTEM_DEV 0x08
3755 #define PCI_CLASS_INPUT_DEV 0x09
3756 #define PCI_CLASS_DOCKING_STATION 0x0a
3757 #define PCI_CLASS_PROCESSOR 0x0b
3758 #define PCI_CLASS_SERIAL_BUS_CTLR 0x0c
3759 #define PCI_CLASS_WIRELESS_CTLR 0x0d
3760 #define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e
3761 #define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f
3762 #define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10
3763 #define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11
3764 #define PCI_CLASS_NOT_DEFINED 0xff
3765 
3766 /* PCI device subclasses for class 0 */
3767 #define PCI_SUBCLASS_PRE_20_NON_VGA 0x00
3768 #define PCI_SUBCLASS_PRE_20_VGA 0x01
3769 
3770 /* PCI device subclasses for class 1 (mass storage controllers)*/
3771 #define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00
3772 #define PCI_SUBCLASS_MSC_IDE_CTLR 0x01
3773 #define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02
3774 #define PCI_SUBCLASS_MSC_IPI_CTLR 0x03
3775 #define PCI_SUBCLASS_MSC_RAID_CTLR 0x04
3776 #define PCI_SUBCLASS_MSC_OTHER 0x80
3777 
3778 /* PCI device subclasses for class 2 (network controllers)*/
3779 #define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00
3780 #define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01
3781 #define PCI_SUBCLASS_NET_FDDI_CTLR 0x02
3782 #define PCI_SUBCLASS_NET_ATM_CTLR 0x03
3783 #define PCI_SUBCLASS_NET_ISDN_CTLR 0x04
3784 #define PCI_SUBCLASS_NET_OTHER 0x80
3785 
3786 /* PCI device subclasses for class 3 (display controllers)*/
3787 #define PCI_SUBCLASS_VID_VGA_CTLR 0x00
3788 #define PCI_SUBCLASS_VID_XGA_CTLR 0x01
3789 #define PCI_SUBCLASS_VID_3D_CTLR 0x02
3790 #define PCI_SUBCLASS_VID_OTHER