2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: Parallel Port Function Driver
4 * PURPOSE: Parport driver loading/unloading
9 static DRIVER_UNLOAD DriverUnload
;
10 static DRIVER_DISPATCH DispatchCreate
;
11 static DRIVER_DISPATCH DispatchClose
;
12 static DRIVER_DISPATCH DispatchCleanup
;
13 static DRIVER_DISPATCH DispatchPnp
;
14 static DRIVER_DISPATCH DispatchPower
;
15 DRIVER_INITIALIZE DriverEntry
;
18 /* FUNCTIONS ****************************************************************/
23 DriverUnload(IN PDRIVER_OBJECT DriverObject
)
25 DPRINT("Parport DriverUnload\n");
32 DispatchCreate(IN PDEVICE_OBJECT DeviceObject
,
35 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
36 return FdoCreate(DeviceObject
, Irp
);
38 return PdoCreate(DeviceObject
, Irp
);
45 DispatchClose(IN PDEVICE_OBJECT DeviceObject
,
48 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
49 return FdoClose(DeviceObject
, Irp
);
51 return PdoClose(DeviceObject
, Irp
);
58 DispatchCleanup(IN PDEVICE_OBJECT DeviceObject
,
61 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
62 return FdoCleanup(DeviceObject
, Irp
);
64 return PdoCleanup(DeviceObject
, Irp
);
71 DispatchRead(IN PDEVICE_OBJECT DeviceObject
,
74 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
75 return FdoRead(DeviceObject
, Irp
);
77 return PdoRead(DeviceObject
, Irp
);
84 DispatchWrite(IN PDEVICE_OBJECT DeviceObject
,
87 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
88 return FdoWrite(DeviceObject
, Irp
);
90 return PdoWrite(DeviceObject
, Irp
);
97 DispatchPnp(IN PDEVICE_OBJECT DeviceObject
,
100 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
101 return FdoPnp(DeviceObject
, Irp
);
103 return PdoPnp(DeviceObject
, Irp
);
110 DispatchPower(IN PDEVICE_OBJECT DeviceObject
,
113 if (((PFDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->Common
.IsFDO
)
114 return FdoPower(DeviceObject
, Irp
);
116 return PdoPower(DeviceObject
, Irp
);
122 DriverEntry(IN PDRIVER_OBJECT DriverObject
,
123 IN PUNICODE_STRING RegPath
)
127 DPRINT("Parport DriverEntry\n");
129 DriverObject
->DriverUnload
= DriverUnload
;
130 DriverObject
->DriverExtension
->AddDevice
= AddDevice
;
132 for (i
= 0; i
<= IRP_MJ_MAXIMUM_FUNCTION
; i
++)
133 DriverObject
->MajorFunction
[i
] = ForwardIrpAndForget
;
135 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = DispatchCreate
;
136 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = DispatchClose
;
137 DriverObject
->MajorFunction
[IRP_MJ_CLEANUP
] = DispatchCleanup
;
138 DriverObject
->MajorFunction
[IRP_MJ_READ
] = DispatchRead
;
139 DriverObject
->MajorFunction
[IRP_MJ_WRITE
] = DispatchWrite
;
140 // DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
141 // DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = DispatchQueryInformation;
142 DriverObject
->MajorFunction
[IRP_MJ_PNP
] = DispatchPnp
;
143 DriverObject
->MajorFunction
[IRP_MJ_POWER
] = DispatchPower
;
145 return STATUS_SUCCESS
;