ReactOS 0.4.15-dev-5666-gc548b97
disk.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Universal Serial Bus Bulk Storage Driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: USB block storage device driver.
5 * COPYRIGHT: 2005-2006 James Tabor
6 * 2011-2012 Michael Martin (michael.martin@reactos.org)
7 * 2011-2013 Johannes Anderwald (johannes.anderwald@reactos.org)
8 * 2017 Vadim Galyant
9 */
10
11#include "usbstor.h"
12
13#define NDEBUG
14#include <debug.h>
15
16
17static
20{
21 ULONG TransferLength;
22 PIO_STACK_LOCATION IoStack;
24
26 Srb = IoStack->Parameters.Scsi.Srb;
27
29 {
31 {
32 DPRINT1("IsRequestValid: Invalid Srb. Srb->SrbFlags - %X\n", Srb->SrbFlags);
33 return FALSE;
34 }
35
36 TransferLength = Srb->DataTransferLength;
37
38 if (Irp->MdlAddress == NULL)
39 {
40 DPRINT1("IsRequestValid: Invalid Srb. Irp->MdlAddress == NULL\n");
41 return FALSE;
42 }
43
44 if (TransferLength == 0)
45 {
46 DPRINT1("IsRequestValid: Invalid Srb. TransferLength == 0\n");
47 return FALSE;
48 }
49
50 if (TransferLength > USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH)
51 {
52 DPRINT1("IsRequestValid: Invalid Srb. TransferLength > 0x10000\n");
53 return FALSE;
54 }
55 }
56 else
57 {
59 {
60 DPRINT1("IsRequestValid: Invalid Srb. Srb->DataTransferLength != 0\n");
61 return FALSE;
62 }
63
64 if (Srb->DataBuffer)
65 {
66 DPRINT1("IsRequestValid: Invalid Srb. Srb->DataBuffer != NULL\n");
67 return FALSE;
68 }
69
70 if (Irp->MdlAddress)
71 {
72 DPRINT1("IsRequestValid: Invalid Srb. Irp->MdlAddress != NULL\n");
73 return FALSE;
74 }
75 }
76
77 return TRUE;
78}
79
83 IN PIRP Irp)
84{
85 PIO_STACK_LOCATION IoStack;
87 PPDO_DEVICE_EXTENSION PDODeviceExtension;
89
91 Request = (PSCSI_REQUEST_BLOCK)IoStack->Parameters.Others.Argument1;
93 PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
94 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
95
96 switch(Request->Function)
97 {
99 {
100 DPRINT("SRB_FUNCTION_EXECUTE_SCSI\n");
101
102 if (!IsRequestValid(Irp))
103 {
105 break;
106 }
107
108 if (Request->Cdb[0] == SCSIOP_MODE_SENSE)
109 {
110 DPRINT("USBSTOR_Scsi: SRB_FUNCTION_EXECUTE_SCSI - FIXME SCSIOP_MODE_SENSE\n");
111 // FIXME Get from registry WriteProtect for StorageDevicePolicies;
112 // L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\StorageDevicePolicies"
113 // QueryTable[0].Name = L"WriteProtect"
114 }
115
117 Request->SrbStatus = SRB_STATUS_PENDING;
118
119 // add the request
120 if (!USBSTOR_QueueAddIrp(PDODeviceExtension->LowerDeviceObject, Irp))
121 {
122 IoStartPacket(PDODeviceExtension->LowerDeviceObject, Irp, &Request->QueueSortKey, USBSTOR_CancelIo);
123 }
124
125 return STATUS_PENDING;
126 }
128 {
129 DPRINT1("SRB_FUNCTION_RELEASE_DEVICE\n");
130 ASSERT(PDODeviceExtension->Claimed == TRUE);
131
132 // release claim
133 PDODeviceExtension->Claimed = FALSE;
135 break;
136 }
138 {
139 DPRINT1("SRB_FUNCTION_CLAIM_DEVICE\n");
140
141 // check if the device has been claimed
142 if (PDODeviceExtension->Claimed)
143 {
144 // device has already been claimed
146 Request->SrbStatus = SRB_STATUS_BUSY;
147 break;
148 }
149
150 // claim device
151 PDODeviceExtension->Claimed = TRUE;
152
153 // output device object
154 Request->DataBuffer = DeviceObject;
155
157 break;
158 }
160 {
161 DPRINT1("SRB_FUNCTION_RELEASE_QUEUE\n");
162
163 USBSTOR_QueueRelease(PDODeviceExtension->LowerDeviceObject);
164
165 Request->SrbStatus = SRB_STATUS_SUCCESS;
167 break;
168 }
169
173 {
174 DPRINT1("SRB_FUNCTION_FLUSH / SRB_FUNCTION_FLUSH_QUEUE / SRB_FUNCTION_SHUTDOWN\n");
175
176 // wait for pending requests to finish
177 USBSTOR_QueueWaitForPendingRequests(PDODeviceExtension->LowerDeviceObject);
178
179 Request->SrbStatus = SRB_STATUS_SUCCESS;
181 break;
182 }
183 default:
184 {
185 //
186 // not supported
187 //
189 Request->SrbStatus = SRB_STATUS_ERROR;
190 }
191 }
192
193 Irp->IoStatus.Status = Status;
195 return Status;
196}
197
198ULONG
200 IN PUCHAR Name,
201 IN ULONG MaxLength)
202{
203 ULONG Index;
204 ULONG LastCharacterPosition = 0;
205
206 // scan the field and return last position which contains a valid character
207 for(Index = 0; Index < MaxLength; Index++)
208 {
209 if (Name[Index] != ' ')
210 {
211 // trim white spaces from field
212 LastCharacterPosition = Index;
213 }
214 }
215
216 // convert from zero based index to length
217 return LastCharacterPosition + 1;
218}
219
223 IN PIRP Irp)
224{
225 PIO_STACK_LOCATION IoStack;
226 PSTORAGE_PROPERTY_QUERY PropertyQuery;
227 PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader;
228 PSTORAGE_ADAPTER_DESCRIPTOR_WIN8 AdapterDescriptor;
229 ULONG FieldLengthVendor, FieldLengthProduct, FieldLengthRevision, TotalLength, FieldLengthSerialNumber;
230 PPDO_DEVICE_EXTENSION PDODeviceExtension;
231 PINQUIRYDATA InquiryData;
234 PFDO_DEVICE_EXTENSION FDODeviceExtension;
238
239 DPRINT("USBSTOR_HandleQueryProperty\n");
240
242 ASSERT(IoStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(STORAGE_PROPERTY_QUERY));
243 ASSERT(Irp->AssociatedIrp.SystemBuffer);
244
245 PropertyQuery = (PSTORAGE_PROPERTY_QUERY)Irp->AssociatedIrp.SystemBuffer;
246
247 // check property type
248 if (PropertyQuery->PropertyId != StorageDeviceProperty &&
249 PropertyQuery->PropertyId != StorageAdapterProperty)
250 {
251 // only device property / adapter property are supported
253 }
254
255 // check query type
256 if (PropertyQuery->QueryType == PropertyExistsQuery)
257 {
258 // device property / adapter property is supported
259 return STATUS_SUCCESS;
260 }
261
262 if (PropertyQuery->QueryType != PropertyStandardQuery)
263 {
264 // only standard query and exists query are supported
266 }
267
268 // check if it is a device property
269 if (PropertyQuery->PropertyId == StorageDeviceProperty)
270 {
271 DPRINT("USBSTOR_HandleQueryProperty StorageDeviceProperty OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
272
273 PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
274 ASSERT(PDODeviceExtension);
275 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
276
277 FDODeviceExtension = (PFDO_DEVICE_EXTENSION)PDODeviceExtension->LowerDeviceObject->DeviceExtension;
278 ASSERT(FDODeviceExtension);
279 ASSERT(FDODeviceExtension->Common.IsFDO);
280
281 InquiryData = (PINQUIRYDATA)&PDODeviceExtension->InquiryData;
282
283 // compute extra parameters length
284 FieldLengthVendor = USBSTOR_GetFieldLength(InquiryData->VendorId, 8);
285 FieldLengthProduct = USBSTOR_GetFieldLength(InquiryData->ProductId, 16);
286 FieldLengthRevision = USBSTOR_GetFieldLength(InquiryData->ProductRevisionLevel, 4);
287
288 if (FDODeviceExtension->SerialNumber)
289 {
290 FieldLengthSerialNumber = wcslen(FDODeviceExtension->SerialNumber->bString);
291 }
292 else
293 {
294 FieldLengthSerialNumber = 0;
295 }
296
297 // total length required is sizeof(STORAGE_DEVICE_DESCRIPTOR) + FieldLength + 4 extra null bytes - 1
298 // -1 due STORAGE_DEVICE_DESCRIPTOR contains one byte length of parameter data
299 TotalLength = sizeof(STORAGE_DEVICE_DESCRIPTOR) + FieldLengthVendor + FieldLengthProduct + FieldLengthRevision + FieldLengthSerialNumber + 3;
300
301 // check if output buffer is long enough
302 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < TotalLength)
303 {
304 // buffer too small
305 DescriptorHeader = (PSTORAGE_DESCRIPTOR_HEADER)Irp->AssociatedIrp.SystemBuffer;
306 ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(STORAGE_DESCRIPTOR_HEADER));
307
308 // return required size
309 DescriptorHeader->Version = TotalLength;
310 DescriptorHeader->Size = TotalLength;
311
312 Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
313 return STATUS_SUCCESS;
314 }
315
316 // initialize the device descriptor
317 DeviceDescriptor = (PSTORAGE_DEVICE_DESCRIPTOR)Irp->AssociatedIrp.SystemBuffer;
318
321 DeviceDescriptor->DeviceType = InquiryData->DeviceType;
322 DeviceDescriptor->DeviceTypeModifier = InquiryData->DeviceTypeModifier;
323 DeviceDescriptor->RemovableMedia = InquiryData->RemovableMedia;
324 DeviceDescriptor->CommandQueueing = FALSE;
325 DeviceDescriptor->BusType = BusTypeUsb;
326 DeviceDescriptor->VendorIdOffset = sizeof(STORAGE_DEVICE_DESCRIPTOR) - sizeof(UCHAR);
327 DeviceDescriptor->ProductIdOffset = DeviceDescriptor->VendorIdOffset + FieldLengthVendor + 1;
328 DeviceDescriptor->ProductRevisionOffset = DeviceDescriptor->ProductIdOffset + FieldLengthProduct + 1;
329 DeviceDescriptor->SerialNumberOffset = (FieldLengthSerialNumber > 0 ? DeviceDescriptor->ProductRevisionOffset + FieldLengthRevision + 1 : 0);
330 DeviceDescriptor->RawPropertiesLength = FieldLengthVendor + FieldLengthProduct + FieldLengthRevision + FieldLengthSerialNumber + 3 + (FieldLengthSerialNumber > 0 ? + 1 : 0);
331
332 // copy descriptors
334
335 RtlCopyMemory(Buffer, InquiryData->VendorId, FieldLengthVendor);
336 Buffer[FieldLengthVendor] = '\0';
337 Buffer += FieldLengthVendor + 1;
338
339 RtlCopyMemory(Buffer, InquiryData->ProductId, FieldLengthProduct);
340 Buffer[FieldLengthProduct] = '\0';
341 Buffer += FieldLengthProduct + 1;
342
343 RtlCopyMemory(Buffer, InquiryData->ProductRevisionLevel, FieldLengthRevision);
344 Buffer[FieldLengthRevision] = '\0';
345 Buffer += FieldLengthRevision + 1;
346
347 if (FieldLengthSerialNumber)
348 {
349 RtlInitUnicodeString(&SerialNumber, FDODeviceExtension->SerialNumber->bString);
350
351 AnsiString.Buffer = (PCHAR)Buffer;
352 AnsiString.Length = 0;
353 AnsiString.MaximumLength = FieldLengthSerialNumber * sizeof(WCHAR);
354
357 }
358
359 DPRINT("Vendor %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->VendorIdOffset));
360 DPRINT("Product %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->ProductIdOffset));
361 DPRINT("Revision %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->ProductRevisionOffset));
362 DPRINT("Serial %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->SerialNumberOffset));
363
364 Irp->IoStatus.Information = TotalLength;
365 return STATUS_SUCCESS;
366 }
367 else
368 {
369 // adapter property query request
370
371 DPRINT("USBSTOR_HandleQueryProperty StorageAdapterProperty OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
372
373 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8))
374 {
375 // buffer too small
376 DescriptorHeader = (PSTORAGE_DESCRIPTOR_HEADER)Irp->AssociatedIrp.SystemBuffer;
377 ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(STORAGE_DESCRIPTOR_HEADER));
378
379 // return required size
380 DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
381 DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
382
383 Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
384 return STATUS_SUCCESS;
385 }
386
387 // get adapter descriptor, information is returned in the same buffer
388 AdapterDescriptor = Irp->AssociatedIrp.SystemBuffer;
389
390 // fill out descriptor
391 // NOTE: STORAGE_ADAPTER_DESCRIPTOR_WIN8 may vary in size, so it's important to zero out
392 // all unused fields
393 *AdapterDescriptor = (STORAGE_ADAPTER_DESCRIPTOR_WIN8) {
396 .MaximumTransferLength = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH,
397 .MaximumPhysicalPages = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH / PAGE_SIZE + 1, // See CORE-10515 and CORE-10755
398 .BusType = BusTypeUsb,
399 .BusMajorVersion = 2, //FIXME verify
400 .BusMinorVersion = 0 //FIXME
401 };
402
403 // __debugbreak();
404
405 // store returned length
406 Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
407
408 return STATUS_SUCCESS;
409 }
410}
411
415 IN PIRP Irp)
416{
417 PIO_STACK_LOCATION IoStack;
419 PPDO_DEVICE_EXTENSION PDODeviceExtension;
421 PSCSI_INQUIRY_DATA ScsiInquiryData;
422 PINQUIRYDATA InquiryData;
423
425
426 switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
427 {
430 break;
432 DPRINT1("USBSTOR_HandleDeviceControl IOCTL_SCSI_PASS_THROUGH NOT implemented\n");
434 break;
436 DPRINT1("USBSTOR_HandleDeviceControl IOCTL_SCSI_PASS_THROUGH_DIRECT NOT implemented\n");
438 break;
440 DPRINT1("USBSTOR_HandleDeviceControl IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER NOT implemented\n");
442 break;
444 {
446
447 // Legacy port capability query
448 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength == sizeof(PVOID))
449 {
450 Capabilities = *((PVOID *)Irp->AssociatedIrp.SystemBuffer) = ExAllocatePoolWithTag(NonPagedPool,
451 sizeof(IO_SCSI_CAPABILITIES),
453 Irp->IoStatus.Information = sizeof(PVOID);
454 }
455 else
456 {
457 Capabilities = Irp->AssociatedIrp.SystemBuffer;
458 Irp->IoStatus.Information = sizeof(IO_SCSI_CAPABILITIES);
459 }
460
461 if (Capabilities)
462 {
463 Capabilities->MaximumTransferLength = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH;
464 Capabilities->MaximumPhysicalPages = USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH / PAGE_SIZE + 1; // See CORE-10515 and CORE-10755
465 Capabilities->SupportedAsynchronousEvents = 0;
466 Capabilities->AlignmentMask = 0;
467 Capabilities->TaggedQueuing = FALSE;
468 Capabilities->AdapterScansDown = FALSE;
469 Capabilities->AdapterUsesPio = FALSE;
471 }
472 else
473 {
475 }
476
477 break;
478 }
480 {
481 PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
482 ASSERT(PDODeviceExtension);
483 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
484
485 // get parameters
486 BusInfo = Irp->AssociatedIrp.SystemBuffer;
487 ScsiInquiryData = (PSCSI_INQUIRY_DATA)(BusInfo + 1);
488 InquiryData = (PINQUIRYDATA)ScsiInquiryData->InquiryData;
489
490
491 BusInfo->NumberOfBuses = 1;
492 BusInfo->BusData[0].NumberOfLogicalUnits = 1; //FIXME
493 BusInfo->BusData[0].InitiatorBusId = 0;
494 BusInfo->BusData[0].InquiryDataOffset = sizeof(SCSI_ADAPTER_BUS_INFO);
495
496 ScsiInquiryData->PathId = 0;
497 ScsiInquiryData->TargetId = 0;
498 ScsiInquiryData->Lun = PDODeviceExtension->LUN & MAX_LUN;
499 ScsiInquiryData->DeviceClaimed = PDODeviceExtension->Claimed;
500 ScsiInquiryData->InquiryDataLength = sizeof(INQUIRYDATA);
501 ScsiInquiryData->NextInquiryDataOffset = 0;
502
503 // Note: INQUIRYDATA structure is larger than INQUIRYDATABUFFERSIZE
504 RtlZeroMemory(InquiryData, sizeof(INQUIRYDATA));
505 RtlCopyMemory(InquiryData, &PDODeviceExtension->InquiryData, sizeof(PDODeviceExtension->InquiryData));
506
507 InquiryData->Versions = 0x04;
508 InquiryData->ResponseDataFormat = 0x02; // some devices set this to 1
509
510 Irp->IoStatus.Information = sizeof(SCSI_ADAPTER_BUS_INFO) + sizeof(SCSI_INQUIRY_DATA) + sizeof(INQUIRYDATA) - 1;
512
513 break;
514 }
516 {
517 PSCSI_ADDRESS Address = Irp->AssociatedIrp.SystemBuffer;
518
519 Address->Length = sizeof(SCSI_ADDRESS);
520 Address->PortNumber = 0;
521 Address->PathId = 0;
522 Address->TargetId = 0;
523 Address->Lun = (((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LUN & MAX_LUN);
524 Irp->IoStatus.Information = sizeof(SCSI_ADDRESS);
525
527
528 break;
529 }
530 default:
531 DPRINT("USBSTOR_HandleDeviceControl IoControl %x not supported\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
533 break;
534 }
535
536 return Status;
537}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989
struct _INQUIRYDATA * PINQUIRYDATA
#define SCSIOP_MODE_SENSE
Definition: cdrw_hw.h:896
struct _INQUIRYDATA INQUIRYDATA
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ AnsiString
Definition: dnslib.h:19
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define SRB_FUNCTION_RELEASE_DEVICE
Definition: srb.h:321
#define SRB_FUNCTION_CLAIM_DEVICE
Definition: srb.h:316
#define SRB_FUNCTION_RELEASE_QUEUE
Definition: srb.h:319
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:315
#define SRB_FLAGS_DATA_OUT
Definition: srb.h:401
#define SRB_STATUS_PENDING
Definition: srb.h:340
#define SRB_FUNCTION_FLUSH
Definition: srb.h:323
#define SRB_FUNCTION_FLUSH_QUEUE
Definition: srb.h:329
#define SRB_FUNCTION_SHUTDOWN
Definition: srb.h:322
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
#define SRB_FLAGS_DATA_IN
Definition: srb.h:400
#define SRB_STATUS_ERROR
Definition: srb.h:344
#define SRB_FLAGS_UNSPECIFIED_DIRECTION
Definition: srb.h:403
#define SRB_STATUS_BUSY
Definition: srb.h:345
#define SRB_STATUS_SUCCESS
Definition: srb.h:341
NTSTATUS USBSTOR_HandleQueryProperty(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: disk.c:221
ULONG USBSTOR_GetFieldLength(IN PUCHAR Name, IN ULONG MaxLength)
Definition: disk.c:199
NTSTATUS USBSTOR_HandleInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: disk.c:81
static BOOLEAN IsRequestValid(PIRP Irp)
Definition: disk.c:19
NTSTATUS USBSTOR_HandleDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: disk.c:413
BOOLEAN USBSTOR_QueueAddIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: queue.c:75
VOID USBSTOR_QueueRelease(IN PDEVICE_OBJECT DeviceObject)
Definition: queue.c:262
VOID USBSTOR_QueueWaitForPendingRequests(IN PDEVICE_OBJECT DeviceObject)
Definition: queue.c:171
VOID NTAPI USBSTOR_CancelIo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: queue.c:28
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
IoMarkIrpPending(Irp)
if(dx< 0)
Definition: linetemp.h:194
void * PVOID
Definition: retypes.h:9
unsigned char * PUCHAR
Definition: retypes.h:3
unsigned int ULONG
Definition: retypes.h:1
#define PCHAR
Definition: match.c:90
#define ASSERT(a)
Definition: mode.c:44
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:178
* PSTORAGE_DESCRIPTOR_HEADER
Definition: ntddstor.h:560
STORAGE_DESCRIPTOR_HEADER
Definition: ntddstor.h:560
#define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER
Definition: ntddstor.h:151
@ BusTypeUsb
Definition: ntddstor.h:445
* PSTORAGE_DEVICE_DESCRIPTOR
Definition: ntddstor.h:576
@ StorageAdapterProperty
Definition: ntddstor.h:513
@ StorageDeviceProperty
Definition: ntddstor.h:512
struct _STORAGE_PROPERTY_QUERY * PSTORAGE_PROPERTY_QUERY
STORAGE_DEVICE_DESCRIPTOR
Definition: ntddstor.h:576
@ PropertyExistsQuery
Definition: ntddstor.h:506
@ PropertyStandardQuery
Definition: ntddstor.h:505
VOID NTAPI IoStartPacket(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PULONG Key, IN PDRIVER_CANCEL CancelFunction)
Definition: device.c:1876
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
static WCHAR Address[46]
Definition: ping.c:68
ULONG SerialNumber
Definition: rxce.c:117
#define IOCTL_SCSI_PASS_THROUGH
Definition: scsi_port.h:47
#define IOCTL_SCSI_GET_ADDRESS
Definition: scsi_port.h:52
#define IOCTL_SCSI_GET_CAPABILITIES
Definition: scsi_port.h:50
struct _SCSI_ADAPTER_BUS_INFO SCSI_ADAPTER_BUS_INFO
#define IOCTL_SCSI_PASS_THROUGH_DIRECT
Definition: scsi_port.h:51
struct _SCSI_INQUIRY_DATA * PSCSI_INQUIRY_DATA
struct _SCSI_ADDRESS SCSI_ADDRESS
#define IOCTL_SCSI_GET_INQUIRY_DATA
Definition: scsi_port.h:49
struct _IO_SCSI_CAPABILITIES IO_SCSI_CAPABILITIES
struct _STORAGE_ADAPTER_DESCRIPTOR_WIN8 STORAGE_ADAPTER_DESCRIPTOR_WIN8
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:84
UCHAR Versions
Definition: cdrw_hw.h:1120
UCHAR RemovableMedia
Definition: cdrw_hw.h:1119
UCHAR ProductId[16]
Definition: cdrw_hw.h:1133
UCHAR ProductRevisionLevel[4]
Definition: cdrw_hw.h:1134
UCHAR DeviceTypeModifier
Definition: cdrw_hw.h:1118
UCHAR VendorId[8]
Definition: cdrw_hw.h:1132
UCHAR ResponseDataFormat
Definition: cdrw_hw.h:1121
UCHAR DeviceType
Definition: cdrw_hw.h:1116
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:59
SCSI_BUS_DATA BusData[1]
Definition: scsi_port.h:106
ULONG InquiryDataOffset
Definition: scsi_port.h:98
UCHAR NumberOfLogicalUnits
Definition: scsi_port.h:96
UCHAR InitiatorBusId
Definition: scsi_port.h:97
UCHAR InquiryData[1]
Definition: scsi_port.h:119
ULONG NextInquiryDataOffset
Definition: scsi_port.h:118
ULONG InquiryDataLength
Definition: scsi_port.h:117
BOOLEAN DeviceClaimed
Definition: scsi_port.h:116
PVOID DataBuffer
Definition: srb.h:263
ULONG DataTransferLength
Definition: srb.h:261
ULONG SrbFlags
Definition: srb.h:260
STORAGE_QUERY_TYPE QueryType
Definition: ntddstor.h:553
STORAGE_PROPERTY_ID PropertyId
Definition: ntddstor.h:552
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG TotalLength
Definition: usbdlib.h:158
#define MAX_LUN
Definition: usbstor.h:61
#define USB_STOR_TAG
Definition: usbstor.h:10
#define USBSTOR_DEFAULT_MAX_TRANSFER_LENGTH
Definition: usbstor.h:62
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598
const char * LPCSTR
Definition: xmlstorage.h:183
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180