10#define USB_STOR_TAG 'sbsu'
11#define USB_MAXCHILDREN (16)
13#define HTONS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
14#define NTOHS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
16#define HTONL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
17 ((((unsigned long)(n) & 0xFF00)) << 8) | \
18 ((((unsigned long)(n) & 0xFF0000)) >> 8) | \
19 ((((unsigned long)(n) & 0xFF000000)) >> 24))
22#define NTOHL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
23 ((((unsigned long)(n) & 0xFF00)) << 8) | \
24 ((((unsigned long)(n) & 0xFF0000)) >> 8) | \
25 ((((unsigned long)(n) & 0xFF000000)) >> 24))
27#define USB_RECOVERABLE_ERRORS (USBD_STATUS_STALL_PID | USBD_STATUS_DEV_NOT_RESPONDING \
28 | USBD_STATUS_ENDPOINT_HALTED | USBD_STATUS_NO_BANDWIDTH)
49 UCHAR BulkInPipeIndex;
50 UCHAR BulkOutPipeIndex;
57 ULONG IrpPendingCount;
61 ULONG SrbErrorHandlingActive;
62 ULONG TimerWorkQueueEnabled;
85#define USB_BULK_GET_MAX_LUN 0xFE
86#define USB_BULK_RESET_DEVICE 0xFF
93 ULONG DataTransferLength;
96 UCHAR CommandBlockLength;
97 UCHAR CommandBlock[16];
103#define CBW_SIGNATURE 0x43425355
104#define CSW_SIGNATURE 0x53425355
132#define UFI_INQUIRY_CMD_LEN 0x6
172#define UFI_READ_WRITE_CMD_LEN (0xA)
190#define UFI_CAPACITY_CMD_LEN 0xA
201#define UFI_READ_CAPACITY_CMD_LEN 0xA
221#define UFI_SENSE_CMD_LEN (6)
265#define UFI_READ_FORMAT_CAPACITY_CMD_LEN (10)
286#define UNFORMATTED_MEDIA_CODE_DESCRIPTORY_TYPE (1)
287#define FORMAT_MEDIA_CODE_DESCRIPTOR_TYPE (2)
288#define CARTRIDGE_MEDIA_CODE_DESCRIPTOR_TYPE (3)
307#define UFI_TEST_UNIT_CMD_LEN (6)
PDEVICE_OBJECT PhysicalDeviceObject
_In_z_ PCCHAR _In_ PDEVICE_OBJECT LowerDeviceObject
static const WCHAR Signature[]
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * FunctionalDeviceObject
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
const KSDEVICE_DESCRIPTOR DeviceDescriptor
PFDO_DEVICE_EXTENSION FDODeviceExtension
PPDO_DEVICE_EXTENSION PDODeviceExtension
ULONG LastLogicBlockAddress
ULONG LastLogicalBlockAddress
UCHAR ContiguousLogicBlocksByte0
UCHAR ContiguousLogicBlocksByte1
PDEVICE_OBJECT DeviceObject
WORK_QUEUE_ITEM WorkQueueItem
IO_COMPLETION_ROUTINE USBSTOR_CSWCompletionRoutine
NTSTATUS USBSTOR_HandleExecuteSCSI(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
struct __COMMON_DEVICE_EXTENSION__ USBSTOR_COMMON_DEVICE_EXTENSION
BOOLEAN USBSTOR_QueueAddIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID USBSTOR_QueueRelease(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBSTOR_FdoHandlePnp(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
NTSTATUS USBSTOR_SyncUrbRequest(IN PDEVICE_OBJECT DeviceObject, OUT PURB UrbRequest)
NTSTATUS USBSTOR_ResetPipeWithHandle(IN PDEVICE_OBJECT DeviceObject, IN USBD_PIPE_HANDLE PipeHandle)
struct FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
NTSTATUS USBSTOR_GetMaxLUN(IN PDEVICE_OBJECT DeviceObject, IN PFDO_DEVICE_EXTENSION DeviceExtension)
NTSTATUS USBSTOR_HandleInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS USBSTOR_ResetDevice(IN PDEVICE_OBJECT DeviceObject, IN PFDO_DEVICE_EXTENSION DeviceExtension)
NTSTATUS USBSTOR_CreatePDO(IN PDEVICE_OBJECT DeviceObject, IN UCHAR LUN)
VOID USBSTOR_QueueInitialize(PFDO_DEVICE_EXTENSION FDODeviceExtension)
NTSTATUS USBSTOR_GetDescriptors(IN PDEVICE_OBJECT DeviceObject)
struct _ERRORHANDLER_WORKITEM_DATA * PERRORHANDLER_WORKITEM_DATA
VOID USBSTOR_QueueTerminateRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
PVOID AllocateItem(IN POOL_TYPE PoolType, IN ULONG ItemSize)
struct _ERRORHANDLER_WORKITEM_DATA ERRORHANDLER_WORKITEM_DATA
struct __COMMON_DEVICE_EXTENSION__ * PUSBSTOR_COMMON_DEVICE_EXTENSION
NTSTATUS USBSTOR_PdoHandlePnp(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
VOID USBSTOR_QueueWaitForPendingRequests(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI USBSTOR_GetBusInterface(IN PDEVICE_OBJECT DeviceObject, OUT PUSB_BUS_INTERFACE_USBDI_V2 BusInterface)
NTSTATUS USBSTOR_HandleDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct IRP_CONTEXT * PIRP_CONTEXT
NTSTATUS USBSTOR_GetPipeHandles(IN PFDO_DEVICE_EXTENSION DeviceExtension)
VOID USBSTOR_QueueNextRequest(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS USBSTOR_SelectConfigurationAndInterface(IN PDEVICE_OBJECT DeviceObject, IN PFDO_DEVICE_EXTENSION DeviceExtension)
NTSTATUS USBSTOR_GetEndpointStatus(IN PDEVICE_OBJECT DeviceObject, IN UCHAR bEndpointAddress, OUT PUSHORT Value)
VOID NTAPI USBSTOR_CancelIo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID FreeItem(IN PVOID Item)
VOID NTAPI USBSTOR_StartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
VOID NTAPI USBSTOR_TimerRoutine(PDEVICE_OBJECT DeviceObject, PVOID Context)
VOID NTAPI ErrorHandlerWorkItemRoutine(PVOID Context)
struct UFI_CAPACITY_CMD * PUFI_CAPACITY_CMD
NTSTATUS USBSTOR_SendCBW(PIRP_CONTEXT Context, PIRP Irp)
struct UFI_CAPACITY_RESPONSE * PUFI_CAPACITY_RESPONSE
struct UFI_READ_FORMAT_CAPACITY * PUFI_READ_FORMAT_CAPACITY
struct UFI_UNKNOWN_CMD * PUFI_UNKNOWN_CMD
VOID NTAPI ResetHandlerWorkItemRoutine(PVOID Context)
struct UFI_MODE_PARAMETER_HEADER * PUFI_MODE_PARAMETER_HEADER
struct UFI_INQUIRY_CMD * PUFI_INQUIRY_CMD
BOOLEAN USBSTOR_IsFloppy(IN PUCHAR Buffer, IN ULONG BufferLength, OUT PUCHAR MediumTypeCode)
struct UFI_CAPACITY_FORMAT_HEADER * PUFI_CAPACITY_FORMAT_HEADER
NTSTATUS NTAPI USBSTOR_SyncForwardIrp(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
VOID USBSTOR_SendCSW(PIRP_CONTEXT Context, PIRP Irp)
struct UFI_TIMER_PROTECT_PAGE * PUFI_TIMER_PROTECT_PAGE
struct UFI_TEST_UNIT_CMD * PUFI_TEST_UNIT_CMD
struct UFI_INQUIRY_RESPONSE * PUFI_INQUIRY_RESPONSE
struct UFI_CAPACITY_DESCRIPTOR * PUFI_CAPACITY_DESCRIPTOR
NTSTATUS NTAPI USBSTOR_SyncForwardIrpCompletionRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
struct UFI_SENSE_CMD * PUFI_SENSE_CMD
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Reserved_ PVOID Reserved
_Must_inspect_result_ _In_ ULONG Flags