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 - See COPYING in the top level directory
4 * FILE: drivers/usb/usbstor/disk.c
5 * PURPOSE: USB block storage device driver.
6 * PROGRAMMERS:
7 * James Tabor
8 * Michael Martin (michael.martin@reactos.org)
9 * Johannes Anderwald (johannes.anderwald@reactos.org)
10 */
11
12#include "usbstor.h"
13
14#define NDEBUG
15#include <debug.h>
16
20 IN PIRP Irp)
21{
22 PIO_STACK_LOCATION IoStack;
24 PPDO_DEVICE_EXTENSION PDODeviceExtension;
26
27 //
28 // get current stack location
29 //
31
32 //
33 // get request block
34 //
35 Request = (PSCSI_REQUEST_BLOCK)IoStack->Parameters.Others.Argument1;
36
37 //
38 // sanity check
39 //
41
42 //
43 // get device extension
44 //
45 PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
46
47 //
48 // sanity check
49 //
50 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
51
52 switch(Request->Function)
53 {
55 {
56 DPRINT("SRB_FUNCTION_EXECUTE_SCSI\n");
57
58 //
59 // check if request is valid
60 //
62 {
63 //
64 // data is transferred with this irp
65 //
67 Request->DataTransferLength == 0 ||
68 Irp->MdlAddress == NULL)
69 {
70 //
71 // invalid parameter
72 //
74 break;
75 }
76 }
77 else
78 {
79 //
80 // sense buffer request
81 //
82 if (Request->DataTransferLength ||
83 Request->DataBuffer ||
84 Irp->MdlAddress)
85 {
86 //
87 // invalid parameter
88 //
90 break;
91 }
92 }
93
94 //
95 // add the request
96 //
97 if (!USBSTOR_QueueAddIrp(PDODeviceExtension->LowerDeviceObject, Irp))
98 {
99 //
100 // irp was not added to the queue
101 //
102 IoStartPacket(PDODeviceExtension->LowerDeviceObject, Irp, &Request->QueueSortKey, USBSTOR_CancelIo);
103 }
104
105 //
106 // irp pending
107 //
108 return STATUS_PENDING;
109 }
111 {
112 DPRINT1("SRB_FUNCTION_RELEASE_DEVICE\n");
113 //
114 // sanity check
115 //
116 ASSERT(PDODeviceExtension->Claimed == TRUE);
117
118 //
119 // release claim
120 //
121 PDODeviceExtension->Claimed = FALSE;
123 break;
124 }
126 {
127 DPRINT1("SRB_FUNCTION_CLAIM_DEVICE\n");
128 //
129 // check if the device has been claimed
130 //
131 if (PDODeviceExtension->Claimed)
132 {
133 //
134 // device has already been claimed
135 //
137 Request->SrbStatus = SRB_STATUS_BUSY;
138 break;
139 }
140
141 //
142 // claim device
143 //
144 PDODeviceExtension->Claimed = TRUE;
145
146 //
147 // output device object
148 //
149 Request->DataBuffer = DeviceObject;
150
151 //
152 // completed successfully
153 //
155 break;
156 }
158 {
159 DPRINT1("SRB_FUNCTION_RELEASE_QUEUE\n");
160
161 //
162 // release queue
163 //
164 USBSTOR_QueueRelease(PDODeviceExtension->LowerDeviceObject);
165
166 //
167 // set status success
168 //
169 Request->SrbStatus = SRB_STATUS_SUCCESS;
171 break;
172 }
173
177 {
178 DPRINT1("SRB_FUNCTION_FLUSH / SRB_FUNCTION_FLUSH_QUEUE / SRB_FUNCTION_SHUTDOWN\n");
179
180 // HACK: don't flush pending requests
181#if 0 // we really need a proper storage stack
182 //
183 // wait for pending requests to finish
184 //
185 USBSTOR_QueueWaitForPendingRequests(PDODeviceExtension->LowerDeviceObject);
186#endif
187 //
188 // set status success
189 //
190 Request->SrbStatus = SRB_STATUS_SUCCESS;
192 break;
193 }
194 default:
195 {
196 //
197 // not supported
198 //
200 Request->SrbStatus = SRB_STATUS_ERROR;
201 }
202 }
203
204 //
205 // complete request
206 //
207 Irp->IoStatus.Status = Status;
209 return Status;
210}
211
212ULONG
214 IN PUCHAR Name,
215 IN ULONG MaxLength)
216{
217 ULONG Index;
218 ULONG LastCharacterPosition = 0;
219
220 //
221 // scan the field and return last position which contains a valid character
222 //
223 for(Index = 0; Index < MaxLength; Index++)
224 {
225 if (Name[Index] != ' ')
226 {
227 //
228 // trim white spaces from field
229 //
230 LastCharacterPosition = Index;
231 }
232 }
233
234 //
235 // convert from zero based index to length
236 //
237 return LastCharacterPosition + 1;
238}
239
243 IN PIRP Irp)
244{
245 PIO_STACK_LOCATION IoStack;
246 PSTORAGE_PROPERTY_QUERY PropertyQuery;
247 PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader;
248 PSTORAGE_ADAPTER_DESCRIPTOR AdapterDescriptor;
249 ULONG FieldLengthVendor, FieldLengthProduct, FieldLengthRevision, TotalLength, FieldLengthSerialNumber;
250 PPDO_DEVICE_EXTENSION PDODeviceExtension;
251 PUFI_INQUIRY_RESPONSE InquiryData;
254 PFDO_DEVICE_EXTENSION FDODeviceExtension;
258
259 DPRINT("USBSTOR_HandleQueryProperty\n");
260
261 //
262 // get current stack location
263 //
265
266 //
267 // sanity check
268 //
269 ASSERT(IoStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(STORAGE_PROPERTY_QUERY));
270 ASSERT(Irp->AssociatedIrp.SystemBuffer);
271
272 //
273 // get property query
274 //
275 PropertyQuery = (PSTORAGE_PROPERTY_QUERY)Irp->AssociatedIrp.SystemBuffer;
276
277 //
278 // check property type
279 //
280 if (PropertyQuery->PropertyId != StorageDeviceProperty &&
281 PropertyQuery->PropertyId != StorageAdapterProperty)
282 {
283 //
284 // only device property / adapter property are supported
285 //
287 }
288
289 //
290 // check query type
291 //
292 if (PropertyQuery->QueryType == PropertyExistsQuery)
293 {
294 //
295 // device property / adapter property is supported
296 //
297 return STATUS_SUCCESS;
298 }
299
300 if (PropertyQuery->QueryType != PropertyStandardQuery)
301 {
302 //
303 // only standard query and exists query are supported
304 //
306 }
307
308 //
309 // check if it is a device property
310 //
311 if (PropertyQuery->PropertyId == StorageDeviceProperty)
312 {
313 DPRINT("USBSTOR_HandleQueryProperty StorageDeviceProperty OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
314
315 //
316 // get device extension
317 //
318 PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
319 ASSERT(PDODeviceExtension);
320 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
321
322 //
323 // get device extension
324 //
325 FDODeviceExtension = (PFDO_DEVICE_EXTENSION)PDODeviceExtension->LowerDeviceObject->DeviceExtension;
326 ASSERT(FDODeviceExtension);
327 ASSERT(FDODeviceExtension->Common.IsFDO);
328
329 //
330 // get inquiry data
331 //
332 InquiryData = (PUFI_INQUIRY_RESPONSE)PDODeviceExtension->InquiryData;
333 ASSERT(InquiryData);
334
335 //
336 // compute extra parameters length
337 //
338 FieldLengthVendor = USBSTOR_GetFieldLength(InquiryData->Vendor, 8);
339 FieldLengthProduct = USBSTOR_GetFieldLength(InquiryData->Product, 16);
340 FieldLengthRevision = USBSTOR_GetFieldLength(InquiryData->Revision, 4);
341
342 //
343 // is there a serial number
344 //
345 if (FDODeviceExtension->SerialNumber)
346 {
347 //
348 // get length
349 //
350 FieldLengthSerialNumber = wcslen(FDODeviceExtension->SerialNumber->bString);
351 }
352 else
353 {
354 //
355 // no serial number
356 //
357 FieldLengthSerialNumber = 0;
358 }
359
360 //
361 // total length required is sizeof(STORAGE_DEVICE_DESCRIPTOR) + FieldLength + 4 extra null bytes - 1
362 // -1 due STORAGE_DEVICE_DESCRIPTOR contains one byte length of parameter data
363 //
364 TotalLength = sizeof(STORAGE_DEVICE_DESCRIPTOR) + FieldLengthVendor + FieldLengthProduct + FieldLengthRevision + FieldLengthSerialNumber + 3;
365
366 //
367 // check if output buffer is long enough
368 //
369 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < TotalLength)
370 {
371 //
372 // buffer too small
373 //
374 DescriptorHeader = (PSTORAGE_DESCRIPTOR_HEADER)Irp->AssociatedIrp.SystemBuffer;
375 ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(STORAGE_DESCRIPTOR_HEADER));
376
377 //
378 // return required size
379 //
380 DescriptorHeader->Version = TotalLength;
381 DescriptorHeader->Size = TotalLength;
382
383 Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
384 return STATUS_SUCCESS;
385 }
386
387 //
388 // get device descriptor
389 //
390 DeviceDescriptor = (PSTORAGE_DEVICE_DESCRIPTOR)Irp->AssociatedIrp.SystemBuffer;
391
392 //
393 // initialize device descriptor
394 //
395 DeviceDescriptor->Version = TotalLength;
397 DeviceDescriptor->DeviceType = InquiryData->DeviceType;
398 DeviceDescriptor->DeviceTypeModifier = (InquiryData->RMB & 0x7F);
399 DeviceDescriptor->RemovableMedia = (InquiryData->RMB & 0x80) ? TRUE : FALSE;
400 DeviceDescriptor->CommandQueueing = FALSE;
401 DeviceDescriptor->BusType = BusTypeUsb;
402 DeviceDescriptor->VendorIdOffset = sizeof(STORAGE_DEVICE_DESCRIPTOR) - sizeof(UCHAR);
403 DeviceDescriptor->ProductIdOffset = DeviceDescriptor->VendorIdOffset + FieldLengthVendor + 1;
404 DeviceDescriptor->ProductRevisionOffset = DeviceDescriptor->ProductIdOffset + FieldLengthProduct + 1;
405 DeviceDescriptor->SerialNumberOffset = (FieldLengthSerialNumber > 0 ? DeviceDescriptor->ProductRevisionOffset + FieldLengthRevision + 1 : 0);
406 DeviceDescriptor->RawPropertiesLength = FieldLengthVendor + FieldLengthProduct + FieldLengthRevision + FieldLengthSerialNumber + 3 + (FieldLengthSerialNumber > 0 ? + 1 : 0);
407
408 //
409 // copy descriptors
410 //
412
413 //
414 // copy vendor
415 //
416 RtlCopyMemory(Buffer, InquiryData->Vendor, FieldLengthVendor);
417 Buffer[FieldLengthVendor] = '\0';
418 Buffer += FieldLengthVendor + 1;
419
420 //
421 // copy product
422 //
423 RtlCopyMemory(Buffer, InquiryData->Product, FieldLengthProduct);
424 Buffer[FieldLengthProduct] = '\0';
425 Buffer += FieldLengthProduct + 1;
426
427 //
428 // copy revision
429 //
430 RtlCopyMemory(Buffer, InquiryData->Revision, FieldLengthRevision);
431 Buffer[FieldLengthRevision] = '\0';
432 Buffer += FieldLengthRevision + 1;
433
434 //
435 // copy serial number
436 //
437 if (FieldLengthSerialNumber)
438 {
439 //
440 // init unicode string
441 //
442 RtlInitUnicodeString(&SerialNumber, FDODeviceExtension->SerialNumber->bString);
443
444 //
445 // init ansi string
446 //
447 AnsiString.Buffer = (PCHAR)Buffer;
448 AnsiString.Length = 0;
449 AnsiString.MaximumLength = FieldLengthSerialNumber * sizeof(WCHAR);
450
451 //
452 // convert to ansi code
453 //
456 }
457
458
459 DPRINT("Vendor %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->VendorIdOffset));
460 DPRINT("Product %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->ProductIdOffset));
461 DPRINT("Revision %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->ProductRevisionOffset));
462 DPRINT("Serial %s\n", (LPCSTR)((ULONG_PTR)DeviceDescriptor + DeviceDescriptor->SerialNumberOffset));
463
464 //
465 // done
466 //
467 Irp->IoStatus.Information = TotalLength;
468 return STATUS_SUCCESS;
469 }
470 else
471 {
472 //
473 // adapter property query request
474 //
475 DPRINT("USBSTOR_HandleQueryProperty StorageAdapterProperty OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
476
477 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR))
478 {
479 //
480 // buffer too small
481 //
482 DescriptorHeader = (PSTORAGE_DESCRIPTOR_HEADER)Irp->AssociatedIrp.SystemBuffer;
483 ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(STORAGE_DESCRIPTOR_HEADER));
484
485 //
486 // return required size
487 //
488 DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
489 DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
490
491 Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
492 return STATUS_SUCCESS;
493 }
494
495 //
496 // get adapter descriptor, information is returned in the same buffer
497 //
498 AdapterDescriptor = (PSTORAGE_ADAPTER_DESCRIPTOR)Irp->AssociatedIrp.SystemBuffer;
499
500 //
501 // fill out descriptor
502 //
503 AdapterDescriptor->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
504 AdapterDescriptor->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
505 AdapterDescriptor->MaximumTransferLength = MAXULONG; //FIXME compute some sane value
506 AdapterDescriptor->MaximumPhysicalPages = 25; //FIXME compute some sane value
507 AdapterDescriptor->AlignmentMask = 0;
508 AdapterDescriptor->AdapterUsesPio = FALSE;
509 AdapterDescriptor->AdapterScansDown = FALSE;
510 AdapterDescriptor->CommandQueueing = FALSE;
511 AdapterDescriptor->AcceleratedTransfer = FALSE;
512 AdapterDescriptor->BusType = BusTypeUsb;
513 AdapterDescriptor->BusMajorVersion = 0x2; //FIXME verify
514 AdapterDescriptor->BusMinorVersion = 0x00; //FIXME
515
516 //
517 // store returned length
518 //
519 Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
520
521 //
522 // done
523 //
524 return STATUS_SUCCESS;
525 }
526}
527
531 IN PIRP Irp)
532{
533 PIO_STACK_LOCATION IoStack;
535 PPDO_DEVICE_EXTENSION PDODeviceExtension;
537 PSCSI_INQUIRY_DATA InquiryData;
538 PINQUIRYDATA ScsiInquiryData;
539 PUFI_INQUIRY_RESPONSE UFIInquiryResponse;
540
541 //
542 // get current stack location
543 //
545
546 if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_STORAGE_QUERY_PROPERTY)
547 {
548 //
549 // query property
550 //
552 }
553 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH)
554 {
555 //
556 // query scsi pass through
557 //
558 DPRINT1("USBSTOR_HandleDeviceControl IOCTL_SCSI_PASS_THROUGH NOT implemented\n");
560 }
561 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT)
562 {
563 //
564 // query scsi pass through direct
565 //
566 DPRINT1("USBSTOR_HandleDeviceControl IOCTL_SCSI_PASS_THROUGH_DIRECT NOT implemented\n");
568 }
569 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER)
570 {
571 //
572 // query serial number
573 //
574 DPRINT1("USBSTOR_HandleDeviceControl IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER NOT implemented\n");
576 }
577 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_GET_CAPABILITIES)
578 {
580
581 /* Legacy port capability query */
582 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength == sizeof(PVOID))
583 {
584 Capabilities = *((PVOID *)Irp->AssociatedIrp.SystemBuffer) = ExAllocatePoolWithTag(NonPagedPool,
585 sizeof(IO_SCSI_CAPABILITIES),
587 Irp->IoStatus.Information = sizeof(PVOID);
588 }
589 else
590 {
591 Capabilities = Irp->AssociatedIrp.SystemBuffer;
592 Irp->IoStatus.Information = sizeof(IO_SCSI_CAPABILITIES);
593 }
594
595 if (Capabilities)
596 {
597 Capabilities->MaximumTransferLength = MAXULONG;
598 Capabilities->MaximumPhysicalPages = 25;
599 Capabilities->SupportedAsynchronousEvents = 0;
600 Capabilities->AlignmentMask = 0;
601 Capabilities->TaggedQueuing = FALSE;
602 Capabilities->AdapterScansDown = FALSE;
603 Capabilities->AdapterUsesPio = FALSE;
605 }
606 else
607 {
609 }
610 }
611 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_GET_INQUIRY_DATA)
612 {
613 //
614 // get device extension
615 //
616 PDODeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
617 ASSERT(PDODeviceExtension);
618 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
619
620 //
621 // get parameters
622 //
623 BusInfo = Irp->AssociatedIrp.SystemBuffer;
624 InquiryData = (PSCSI_INQUIRY_DATA)(BusInfo + 1);
625 ScsiInquiryData = (PINQUIRYDATA)InquiryData->InquiryData;
626
627
628 //
629 // get inquiry data
630 //
631 UFIInquiryResponse = (PUFI_INQUIRY_RESPONSE)PDODeviceExtension->InquiryData;
632 ASSERT(UFIInquiryResponse);
633
634
635 BusInfo->NumberOfBuses = 1;
636 BusInfo->BusData[0].NumberOfLogicalUnits = 1; //FIXME
637 BusInfo->BusData[0].InitiatorBusId = 0;
638 BusInfo->BusData[0].InquiryDataOffset = sizeof(SCSI_ADAPTER_BUS_INFO);
639
640 InquiryData->PathId = 0;
641 InquiryData->TargetId = 0;
642 InquiryData->Lun = PDODeviceExtension->LUN & MAX_LUN;
643 InquiryData->DeviceClaimed = PDODeviceExtension->Claimed;
644 InquiryData->InquiryDataLength = sizeof(INQUIRYDATA);
645 InquiryData->NextInquiryDataOffset = 0;
646
647 RtlZeroMemory(ScsiInquiryData, sizeof(INQUIRYDATA));
648 ScsiInquiryData->DeviceType = UFIInquiryResponse->DeviceType;
649 ScsiInquiryData->DeviceTypeQualifier = (UFIInquiryResponse->RMB & 0x7F);
650
651 /* Hack for IoReadPartitionTable call in disk.sys */
652 ScsiInquiryData->RemovableMedia = ((ScsiInquiryData->DeviceType == DIRECT_ACCESS_DEVICE) ? ((UFIInquiryResponse->RMB & 0x80) ? 1 : 0) : 0);
653
654 ScsiInquiryData->Versions = 0x04;
655 ScsiInquiryData->ResponseDataFormat = 0x02;
656 ScsiInquiryData->AdditionalLength = 31;
657 ScsiInquiryData->SoftReset = 0;
658 ScsiInquiryData->CommandQueue = 0;
659 ScsiInquiryData->LinkedCommands = 0;
660 ScsiInquiryData->RelativeAddressing = 0;
661
662 RtlCopyMemory(&ScsiInquiryData->VendorId, UFIInquiryResponse->Vendor, USBSTOR_GetFieldLength(UFIInquiryResponse->Vendor, 8));
663 RtlCopyMemory(&ScsiInquiryData->ProductId, UFIInquiryResponse->Product, USBSTOR_GetFieldLength(UFIInquiryResponse->Product, 16));
664
665 Irp->IoStatus.Information = sizeof(SCSI_ADAPTER_BUS_INFO) + sizeof(SCSI_INQUIRY_DATA) + sizeof(INQUIRYDATA) - 1;
667 }
668 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SCSI_GET_ADDRESS)
669 {
670 PSCSI_ADDRESS Address = Irp->AssociatedIrp.SystemBuffer;
671
672 Address->Length = sizeof(SCSI_ADDRESS);
673 Address->PortNumber = 0;
674 Address->PathId = 0;
675 Address->TargetId = 0;
676 Address->Lun = (((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LUN & MAX_LUN);
677 Irp->IoStatus.Information = sizeof(SCSI_ADDRESS);
678
680 }
681 else
682 {
683 //
684 // unsupported
685 //
686 DPRINT("USBSTOR_HandleDeviceControl IoControl %x not supported\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
688 }
689
690 return Status;
691}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
struct _INQUIRYDATA * PINQUIRYDATA
#define DIRECT_ACCESS_DEVICE
Definition: cdrw_hw.h:1144
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_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_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
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 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)
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
STORAGE_ADAPTER_DESCRIPTOR
Definition: ntddstor.h:599
#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
* PSTORAGE_ADAPTER_DESCRIPTOR
Definition: ntddstor.h:599
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
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257
UCHAR Product[16]
Definition: usbstor.h:146
UCHAR Revision[4]
Definition: usbstor.h:147
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:84
UCHAR Versions
Definition: cdrw_hw.h:1120
UCHAR CommandQueue
Definition: cdrw_hw.h:1125
UCHAR RemovableMedia
Definition: cdrw_hw.h:1119
UCHAR ProductId[16]
Definition: cdrw_hw.h:1133
UCHAR LinkedCommands
Definition: cdrw_hw.h:1127
UCHAR RelativeAddressing
Definition: cdrw_hw.h:1131
UCHAR VendorId[8]
Definition: cdrw_hw.h:1132
UCHAR ResponseDataFormat
Definition: cdrw_hw.h:1121
UCHAR DeviceType
Definition: cdrw_hw.h:1116
UCHAR DeviceTypeQualifier
Definition: cdrw_hw.h:1117
UCHAR SoftReset
Definition: cdrw_hw.h:1124
UCHAR AdditionalLength
Definition: cdrw_hw.h:1122
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
STORAGE_QUERY_TYPE QueryType
Definition: ntddstor.h:553
STORAGE_PROPERTY_ID PropertyId
Definition: ntddstor.h:552
#define MAXULONG
Definition: typedefs.h:251
#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
struct UFI_INQUIRY_RESPONSE * PUFI_INQUIRY_RESPONSE
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_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