2005-12-01 21:37:19 +00:00
|
|
|
#include <ntddk.h>
|
|
|
|
#include <usbdi.h>
|
|
|
|
#include <usbiodef.h>
|
2005-08-14 22:27:15 +00:00
|
|
|
#include <initguid.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2009-08-24 17:38:50 +00:00
|
|
|
#define USB_STOR_TAG 'sbsu'
|
2005-08-14 22:27:15 +00:00
|
|
|
#define USB_MAXCHILDREN (16)
|
|
|
|
|
2008-11-30 11:16:55 +00:00
|
|
|
NTSTATUS NTAPI
|
2005-08-14 22:27:15 +00:00
|
|
|
IoAttachDeviceToDeviceStackSafe(
|
|
|
|
IN PDEVICE_OBJECT SourceDevice,
|
|
|
|
IN PDEVICE_OBJECT TargetDevice,
|
|
|
|
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
|
|
|
|
|
|
|
typedef struct _USBSTOR_DEVICE_EXTENSION
|
|
|
|
{
|
|
|
|
BOOLEAN IsFDO;
|
|
|
|
struct usb_device* dev;
|
|
|
|
PDEVICE_OBJECT LowerDevice;
|
|
|
|
|
|
|
|
PDEVICE_OBJECT Children[USB_MAXCHILDREN];
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2005-08-14 22:27:15 +00:00
|
|
|
/* Fields valid only when IsFDO == FALSE */
|
|
|
|
UNICODE_STRING DeviceDescription; // REG_SZ
|
|
|
|
UNICODE_STRING DeviceId; // REG_SZ
|
|
|
|
UNICODE_STRING InstanceId; // REG_SZ
|
|
|
|
UNICODE_STRING HardwareIds; // REG_MULTI_SZ
|
|
|
|
UNICODE_STRING CompatibleIds; // REG_MULTI_SZ
|
|
|
|
UNICODE_STRING SymbolicLinkName;
|
|
|
|
} USBSTOR_DEVICE_EXTENSION, *PUSBSTOR_DEVICE_EXTENSION;
|
|
|
|
|
|
|
|
|
|
|
|
/* cleanup.c */
|
2008-11-30 11:16:55 +00:00
|
|
|
NTSTATUS NTAPI
|
2005-08-14 22:27:15 +00:00
|
|
|
UsbStorCleanup(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
|
|
|
/* fdo.c */
|
2008-11-30 11:16:55 +00:00
|
|
|
NTSTATUS NTAPI
|
2005-08-14 22:27:15 +00:00
|
|
|
UsbStorPnpFdo(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
UsbStorDeviceControlFdo(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
|
|
|
/* misc.c */
|
|
|
|
NTSTATUS
|
|
|
|
ForwardIrpAndWait(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
2008-11-30 11:16:55 +00:00
|
|
|
NTSTATUS NTAPI
|
2005-08-14 22:27:15 +00:00
|
|
|
ForwardIrpAndForget(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
UsbStorDuplicateUnicodeString(
|
|
|
|
OUT PUNICODE_STRING Destination,
|
|
|
|
IN PUNICODE_STRING Source,
|
|
|
|
IN POOL_TYPE PoolType);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
UsbStorInitMultiSzString(
|
|
|
|
OUT PUNICODE_STRING Destination,
|
|
|
|
... /* list of PCSZ */);
|
|
|
|
|
|
|
|
/* pdo.c */
|
2008-11-30 11:16:55 +00:00
|
|
|
NTSTATUS NTAPI
|
2005-08-14 22:27:15 +00:00
|
|
|
UsbStorPnpPdo(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
UsbStorDeviceControlPdo(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|