- Implement EnumServicesStatusW.
[reactos.git] / reactos / drivers / usb / usbstor / usbstor.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2001, 2002, 2003, 2004, 2005 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 */
20 /*
21 * Universal Serial Bus Bulk Storage Driver
22 *
23 * Written by James Tabor
24 *
25 */
26
27 /* INCLUDES ******************************************************************/
28
29 #define NDEBUG
30 #define INITGUID
31 #include "usbstor.h"
32
33 /* PUBLIC AND PRIVATE FUNCTIONS **********************************************/
34
35 NTSTATUS STDCALL
36 IrpStub(IN PDEVICE_OBJECT DeviceObject,
37 IN PIRP Irp)
38 {
39 NTSTATUS Status = STATUS_NOT_SUPPORTED;
40 Irp->IoStatus.Status = Status;
41 IoCompleteRequest(Irp, IO_NO_INCREMENT);
42 return Status;
43 }
44
45 NTSTATUS STDCALL
46 AddDevice(IN PDRIVER_OBJECT DriverObject,
47 IN PDEVICE_OBJECT pdo)
48 {
49 return STATUS_SUCCESS;
50 }
51
52 VOID STDCALL
53 DriverUnload(PDRIVER_OBJECT DriverObject)
54 {
55 }
56
57 VOID STDCALL
58 StartIo(PUSBSTOR_DEVICE_EXTENSION DeviceExtension,
59 PIRP Irp)
60 {
61 }
62
63 static NTSTATUS STDCALL
64 DispatchClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
65 {
66 Irp->IoStatus.Information = 0;
67 Irp->IoStatus.Status = STATUS_SUCCESS;
68 IoCompleteRequest(Irp, IO_NO_INCREMENT);
69 return STATUS_SUCCESS;
70 }
71
72 static NTSTATUS STDCALL
73 DispatchCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
74 {
75 return STATUS_SUCCESS;
76 }
77
78 static NTSTATUS STDCALL
79 DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
80 {
81 return STATUS_SUCCESS;
82 }
83
84
85 static NTSTATUS STDCALL
86 DispatchScsi(PDEVICE_OBJECT DeviceObject, PIRP Irp)
87 {
88 return STATUS_SUCCESS;
89 }
90
91 static NTSTATUS STDCALL
92 DispatchReadWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
93 {
94 return STATUS_SUCCESS;
95 }
96
97 static NTSTATUS STDCALL
98 DispatchSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
99 {
100 return STATUS_SUCCESS;
101 }
102
103 static NTSTATUS STDCALL
104 DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
105 {
106 return STATUS_SUCCESS;
107 }
108
109 static NTSTATUS STDCALL
110 DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
111 {
112 DPRINT1("USBSTOR: IRP_MJ_POWER unimplemented\n");
113 Irp->IoStatus.Information = 0;
114 Irp->IoStatus.Status = STATUS_SUCCESS;
115 IoCompleteRequest(Irp, IO_NO_INCREMENT);
116 return STATUS_SUCCESS;
117 }
118
119
120
121 /*
122 * Standard DriverEntry method.
123 */
124 NTSTATUS STDCALL
125 DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
126 {
127 ULONG i;
128 DPRINT("********* USB Storage *********\n");
129
130 DriverObject->DriverUnload = DriverUnload;
131 DriverObject->DriverExtension->AddDevice = AddDevice;
132
133 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
134 DriverObject->MajorFunction[i] = IrpStub;
135
136 DriverObject->DriverStartIo = (PVOID)StartIo;
137
138 DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchClose;
139 DriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose;
140 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DispatchCleanup;
141 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
142 DriverObject->MajorFunction[IRP_MJ_READ] = DispatchReadWrite;
143 DriverObject->MajorFunction[IRP_MJ_WRITE] = DispatchReadWrite;
144
145 /* Scsi Miniport support */
146 DriverObject->MajorFunction[IRP_MJ_SCSI] = DispatchScsi;
147 DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = DispatchSystemControl;
148
149 DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
150 DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower;
151
152 return STATUS_SUCCESS;
153 }
154