[CMAKE]
[reactos.git] / drivers / usb / usbstor / usbstor.c
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/usbstor.c
5 * PURPOSE: USB block storage device driver.
6 * PROGRAMMERS:
7 * James Tabor
8 */
9
10 /* INCLUDES ******************************************************************/
11
12 #define NDEBUG
13 #define INITGUID
14 #include "usbstor.h"
15
16 /* PUBLIC AND PRIVATE FUNCTIONS **********************************************/
17
18 NTSTATUS NTAPI
19 IrpStub(IN PDEVICE_OBJECT DeviceObject,
20 IN PIRP Irp)
21 {
22 NTSTATUS Status = STATUS_NOT_SUPPORTED;
23 Irp->IoStatus.Status = Status;
24 IoCompleteRequest(Irp, IO_NO_INCREMENT);
25 return Status;
26 }
27
28 NTSTATUS NTAPI
29 AddDevice(IN PDRIVER_OBJECT DriverObject,
30 IN PDEVICE_OBJECT pdo)
31 {
32 return STATUS_SUCCESS;
33 }
34
35 VOID NTAPI
36 DriverUnload(PDRIVER_OBJECT DriverObject)
37 {
38 }
39
40 VOID NTAPI
41 StartIo(PUSBSTOR_DEVICE_EXTENSION DeviceExtension,
42 PIRP Irp)
43 {
44 }
45
46 static NTSTATUS NTAPI
47 DispatchClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
48 {
49 Irp->IoStatus.Information = 0;
50 Irp->IoStatus.Status = STATUS_SUCCESS;
51 IoCompleteRequest(Irp, IO_NO_INCREMENT);
52 return STATUS_SUCCESS;
53 }
54
55 static NTSTATUS NTAPI
56 DispatchCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
57 {
58 return STATUS_SUCCESS;
59 }
60
61 static NTSTATUS NTAPI
62 DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
63 {
64 return STATUS_SUCCESS;
65 }
66
67
68 static NTSTATUS NTAPI
69 DispatchScsi(PDEVICE_OBJECT DeviceObject, PIRP Irp)
70 {
71 return STATUS_SUCCESS;
72 }
73
74 static NTSTATUS NTAPI
75 DispatchReadWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
76 {
77 return STATUS_SUCCESS;
78 }
79
80 static NTSTATUS NTAPI
81 DispatchSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
82 {
83 return STATUS_SUCCESS;
84 }
85
86 static NTSTATUS NTAPI
87 DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
88 {
89 return STATUS_SUCCESS;
90 }
91
92 static NTSTATUS NTAPI
93 DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
94 {
95 DPRINT1("USBSTOR: IRP_MJ_POWER unimplemented\n");
96 Irp->IoStatus.Information = 0;
97 Irp->IoStatus.Status = STATUS_SUCCESS;
98 IoCompleteRequest(Irp, IO_NO_INCREMENT);
99 return STATUS_SUCCESS;
100 }
101
102
103
104 /*
105 * Standard DriverEntry method.
106 */
107 NTSTATUS NTAPI
108 DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
109 {
110 ULONG i;
111
112 DPRINT("********* USB Storage *********\n");
113
114 DriverObject->DriverUnload = DriverUnload;
115 DriverObject->DriverExtension->AddDevice = AddDevice;
116
117 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
118 DriverObject->MajorFunction[i] = IrpStub;
119
120 DriverObject->DriverStartIo = (PVOID)StartIo;
121
122 DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchClose;
123 DriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose;
124 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DispatchCleanup;
125 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
126 DriverObject->MajorFunction[IRP_MJ_READ] = DispatchReadWrite;
127 DriverObject->MajorFunction[IRP_MJ_WRITE] = DispatchReadWrite;
128
129 /* Scsi Miniport support */
130 DriverObject->MajorFunction[IRP_MJ_SCSI] = DispatchScsi;
131 DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = DispatchSystemControl;
132
133 DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
134 DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower;
135
136 return STATUS_SUCCESS;
137 }
138