1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifdef DEFINE_GUID
|
---|
7 |
|
---|
8 | #ifndef FAR
|
---|
9 | #define FAR
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | DEFINE_GUID(ScsiRawInterfaceGuid,0x53f56309,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
|
---|
13 | DEFINE_GUID(WmiScsiAddressGuid,0x53f5630f,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
|
---|
14 | #endif /* DEFINE_GUID */
|
---|
15 |
|
---|
16 | #ifndef _NTDDSCSIH_
|
---|
17 | #define _NTDDSCSIH_
|
---|
18 |
|
---|
19 | #ifdef __cplusplus
|
---|
20 | extern "C" {
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER
|
---|
24 |
|
---|
25 | #define DD_SCSI_DEVICE_NAME "\\Device\\ScsiPort"
|
---|
26 | #define DD_SCSI_DEVICE_NAME_U L"\\Device\\ScsiPort"
|
---|
27 |
|
---|
28 | #define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE,0x0401,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
29 | #define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE,0x0402,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
30 | #define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE,0x0403,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
31 | #define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE,0x0404,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
32 | #define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE,0x0405,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
33 | #define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE,0x0406,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
34 | #define IOCTL_SCSI_RESCAN_BUS CTL_CODE(IOCTL_SCSI_BASE,0x0407,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
35 | #define IOCTL_SCSI_GET_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE,0x0408,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
36 | #define IOCTL_SCSI_FREE_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE,0x0409,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
37 | #define IOCTL_IDE_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE,0x040a,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
38 | #define IOCTL_ATA_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE,0x040b,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
39 | #define IOCTL_ATA_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE,0x040c,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
40 |
|
---|
41 | typedef struct _SCSI_PASS_THROUGH {
|
---|
42 | USHORT Length;
|
---|
43 | UCHAR ScsiStatus;
|
---|
44 | UCHAR PathId;
|
---|
45 | UCHAR TargetId;
|
---|
46 | UCHAR Lun;
|
---|
47 | UCHAR CdbLength;
|
---|
48 | UCHAR SenseInfoLength;
|
---|
49 | UCHAR DataIn;
|
---|
50 | ULONG DataTransferLength;
|
---|
51 | ULONG TimeOutValue;
|
---|
52 | ULONG_PTR DataBufferOffset;
|
---|
53 | ULONG SenseInfoOffset;
|
---|
54 | UCHAR Cdb[16];
|
---|
55 | }SCSI_PASS_THROUGH,*PSCSI_PASS_THROUGH;
|
---|
56 |
|
---|
57 | typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
---|
58 | USHORT Length;
|
---|
59 | UCHAR ScsiStatus;
|
---|
60 | UCHAR PathId;
|
---|
61 | UCHAR TargetId;
|
---|
62 | UCHAR Lun;
|
---|
63 | UCHAR CdbLength;
|
---|
64 | UCHAR SenseInfoLength;
|
---|
65 | UCHAR DataIn;
|
---|
66 | ULONG DataTransferLength;
|
---|
67 | ULONG TimeOutValue;
|
---|
68 | PVOID DataBuffer;
|
---|
69 | ULONG SenseInfoOffset;
|
---|
70 | UCHAR Cdb[16];
|
---|
71 | }SCSI_PASS_THROUGH_DIRECT,*PSCSI_PASS_THROUGH_DIRECT;
|
---|
72 |
|
---|
73 | #if defined(_WIN64)
|
---|
74 | typedef struct _SCSI_PASS_THROUGH32 {
|
---|
75 | USHORT Length;
|
---|
76 | UCHAR ScsiStatus;
|
---|
77 | UCHAR PathId;
|
---|
78 | UCHAR TargetId;
|
---|
79 | UCHAR Lun;
|
---|
80 | UCHAR CdbLength;
|
---|
81 | UCHAR SenseInfoLength;
|
---|
82 | UCHAR DataIn;
|
---|
83 | ULONG DataTransferLength;
|
---|
84 | ULONG TimeOutValue;
|
---|
85 | ULONG32 DataBufferOffset;
|
---|
86 | ULONG SenseInfoOffset;
|
---|
87 | UCHAR Cdb[16];
|
---|
88 | } SCSI_PASS_THROUGH32,*PSCSI_PASS_THROUGH32;
|
---|
89 |
|
---|
90 | typedef struct _SCSI_PASS_THROUGH_DIRECT32 {
|
---|
91 | USHORT Length;
|
---|
92 | UCHAR ScsiStatus;
|
---|
93 | UCHAR PathId;
|
---|
94 | UCHAR TargetId;
|
---|
95 | UCHAR Lun;
|
---|
96 | UCHAR CdbLength;
|
---|
97 | UCHAR SenseInfoLength;
|
---|
98 | UCHAR DataIn;
|
---|
99 | ULONG DataTransferLength;
|
---|
100 | ULONG TimeOutValue;
|
---|
101 | VOID *DataBuffer;
|
---|
102 | ULONG SenseInfoOffset;
|
---|
103 | UCHAR Cdb[16];
|
---|
104 | } SCSI_PASS_THROUGH_DIRECT32,*PSCSI_PASS_THROUGH_DIRECT32;
|
---|
105 | #endif /* _WIN64 */
|
---|
106 |
|
---|
107 | typedef struct _ATA_PASS_THROUGH_EX {
|
---|
108 | USHORT Length;
|
---|
109 | USHORT AtaFlags;
|
---|
110 | UCHAR PathId;
|
---|
111 | UCHAR TargetId;
|
---|
112 | UCHAR Lun;
|
---|
113 | UCHAR ReservedAsUchar;
|
---|
114 | ULONG DataTransferLength;
|
---|
115 | ULONG TimeOutValue;
|
---|
116 | ULONG ReservedAsUlong;
|
---|
117 | ULONG_PTR DataBufferOffset;
|
---|
118 | UCHAR PreviousTaskFile[8];
|
---|
119 | UCHAR CurrentTaskFile[8];
|
---|
120 | } ATA_PASS_THROUGH_EX,*PATA_PASS_THROUGH_EX;
|
---|
121 |
|
---|
122 | typedef struct _ATA_PASS_THROUGH_DIRECT {
|
---|
123 | USHORT Length;
|
---|
124 | USHORT AtaFlags;
|
---|
125 | UCHAR PathId;
|
---|
126 | UCHAR TargetId;
|
---|
127 | UCHAR Lun;
|
---|
128 | UCHAR ReservedAsUchar;
|
---|
129 | ULONG DataTransferLength;
|
---|
130 | ULONG TimeOutValue;
|
---|
131 | ULONG ReservedAsUlong;
|
---|
132 | PVOID DataBuffer;
|
---|
133 | UCHAR PreviousTaskFile[8];
|
---|
134 | UCHAR CurrentTaskFile[8];
|
---|
135 | } ATA_PASS_THROUGH_DIRECT,*PATA_PASS_THROUGH_DIRECT;
|
---|
136 |
|
---|
137 | #if defined(_WIN64)
|
---|
138 |
|
---|
139 | typedef struct _ATA_PASS_THROUGH_EX32 {
|
---|
140 | USHORT Length;
|
---|
141 | USHORT AtaFlags;
|
---|
142 | UCHAR PathId;
|
---|
143 | UCHAR TargetId;
|
---|
144 | UCHAR Lun;
|
---|
145 | UCHAR ReservedAsUchar;
|
---|
146 | ULONG DataTransferLength;
|
---|
147 | ULONG TimeOutValue;
|
---|
148 | ULONG ReservedAsUlong;
|
---|
149 | ULONG32 DataBufferOffset;
|
---|
150 | UCHAR PreviousTaskFile[8];
|
---|
151 | UCHAR CurrentTaskFile[8];
|
---|
152 | } ATA_PASS_THROUGH_EX32,*PATA_PASS_THROUGH_EX32;
|
---|
153 |
|
---|
154 | typedef struct _ATA_PASS_THROUGH_DIRECT32 {
|
---|
155 | USHORT Length;
|
---|
156 | USHORT AtaFlags;
|
---|
157 | UCHAR PathId;
|
---|
158 | UCHAR TargetId;
|
---|
159 | UCHAR Lun;
|
---|
160 | UCHAR ReservedAsUchar;
|
---|
161 | ULONG DataTransferLength;
|
---|
162 | ULONG TimeOutValue;
|
---|
163 | ULONG ReservedAsUlong;
|
---|
164 | VOID *DataBuffer;
|
---|
165 | UCHAR PreviousTaskFile[8];
|
---|
166 | UCHAR CurrentTaskFile[8];
|
---|
167 | } ATA_PASS_THROUGH_DIRECT32,*PATA_PASS_THROUGH_DIRECT32;
|
---|
168 | #endif /* _WIN64 */
|
---|
169 |
|
---|
170 | #define ATA_FLAGS_DRDY_REQUIRED (1 << 0)
|
---|
171 | #define ATA_FLAGS_DATA_IN (1 << 1)
|
---|
172 | #define ATA_FLAGS_DATA_OUT (1 << 2)
|
---|
173 | #define ATA_FLAGS_48BIT_COMMAND (1 << 3)
|
---|
174 | #define ATA_FLAGS_USE_DMA (1 << 4)
|
---|
175 |
|
---|
176 | typedef struct _SCSI_BUS_DATA {
|
---|
177 | UCHAR NumberOfLogicalUnits;
|
---|
178 | UCHAR InitiatorBusId;
|
---|
179 | ULONG InquiryDataOffset;
|
---|
180 | }SCSI_BUS_DATA,*PSCSI_BUS_DATA;
|
---|
181 |
|
---|
182 | typedef struct _SCSI_ADAPTER_BUS_INFO {
|
---|
183 | UCHAR NumberOfBuses;
|
---|
184 | SCSI_BUS_DATA BusData[1];
|
---|
185 | } SCSI_ADAPTER_BUS_INFO,*PSCSI_ADAPTER_BUS_INFO;
|
---|
186 |
|
---|
187 | typedef struct _SCSI_INQUIRY_DATA {
|
---|
188 | UCHAR PathId;
|
---|
189 | UCHAR TargetId;
|
---|
190 | UCHAR Lun;
|
---|
191 | BOOLEAN DeviceClaimed;
|
---|
192 | ULONG InquiryDataLength;
|
---|
193 | ULONG NextInquiryDataOffset;
|
---|
194 | UCHAR InquiryData[1];
|
---|
195 | }SCSI_INQUIRY_DATA,*PSCSI_INQUIRY_DATA;
|
---|
196 |
|
---|
197 | typedef struct _SRB_IO_CONTROL {
|
---|
198 | ULONG HeaderLength;
|
---|
199 | UCHAR Signature[8];
|
---|
200 | ULONG Timeout;
|
---|
201 | ULONG ControlCode;
|
---|
202 | ULONG ReturnCode;
|
---|
203 | ULONG Length;
|
---|
204 | } SRB_IO_CONTROL,*PSRB_IO_CONTROL;
|
---|
205 |
|
---|
206 | typedef struct _IO_SCSI_CAPABILITIES {
|
---|
207 | ULONG Length;
|
---|
208 | ULONG MaximumTransferLength;
|
---|
209 | ULONG MaximumPhysicalPages;
|
---|
210 | ULONG SupportedAsynchronousEvents;
|
---|
211 | ULONG AlignmentMask;
|
---|
212 | BOOLEAN TaggedQueuing;
|
---|
213 | BOOLEAN AdapterScansDown;
|
---|
214 | BOOLEAN AdapterUsesPio;
|
---|
215 | } IO_SCSI_CAPABILITIES,*PIO_SCSI_CAPABILITIES;
|
---|
216 |
|
---|
217 | typedef struct _SCSI_ADDRESS {
|
---|
218 | ULONG Length;
|
---|
219 | UCHAR PortNumber;
|
---|
220 | UCHAR PathId;
|
---|
221 | UCHAR TargetId;
|
---|
222 | UCHAR Lun;
|
---|
223 | } SCSI_ADDRESS,*PSCSI_ADDRESS;
|
---|
224 |
|
---|
225 | struct _ADAPTER_OBJECT;
|
---|
226 |
|
---|
227 | typedef struct _DUMP_POINTERS {
|
---|
228 | struct _ADAPTER_OBJECT *AdapterObject;
|
---|
229 | PVOID MappedRegisterBase;
|
---|
230 | PVOID DumpData;
|
---|
231 | PVOID CommonBufferVa;
|
---|
232 | LARGE_INTEGER CommonBufferPa;
|
---|
233 | ULONG CommonBufferSize;
|
---|
234 | BOOLEAN AllocateCommonBuffers;
|
---|
235 | BOOLEAN UseDiskDump;
|
---|
236 | UCHAR Spare1[2];
|
---|
237 | PVOID DeviceObject;
|
---|
238 | } DUMP_POINTERS,*PDUMP_POINTERS;
|
---|
239 |
|
---|
240 | #define SCSI_IOCTL_DATA_OUT 0
|
---|
241 | #define SCSI_IOCTL_DATA_IN 1
|
---|
242 | #define SCSI_IOCTL_DATA_UNSPECIFIED 2
|
---|
243 |
|
---|
244 | #ifdef __cplusplus
|
---|
245 | }
|
---|
246 | #endif
|
---|
247 |
|
---|
248 | #endif /* _NTDDSCSIH_ */
|
---|
249 |
|
---|