ReactOS 0.4.15-dev-5669-g09dde2c
parport.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: Parallel Port Function Driver
4 * PURPOSE: Parport driver loading/unloading
5 */
6
7#include "parport.h"
8
9static DRIVER_UNLOAD DriverUnload;
15DRIVER_INITIALIZE DriverEntry;
16
17
18/* FUNCTIONS ****************************************************************/
19
20static
21VOID
24{
25 DPRINT("Parport DriverUnload\n");
26}
27
28
29static
33 IN PIRP Irp)
34{
35 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
36 return FdoCreate(DeviceObject, Irp);
37 else
38 return PdoCreate(DeviceObject, Irp);
39}
40
41
42static
46 IN PIRP Irp)
47{
48 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
49 return FdoClose(DeviceObject, Irp);
50 else
51 return PdoClose(DeviceObject, Irp);
52}
53
54
55static
59 IN PIRP Irp)
60{
61 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
63 else
65}
66
67
68static
72 IN PIRP Irp)
73{
74 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
75 return FdoRead(DeviceObject, Irp);
76 else
77 return PdoRead(DeviceObject, Irp);
78}
79
80
81static
85 IN PIRP Irp)
86{
87 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
88 return FdoWrite(DeviceObject, Irp);
89 else
90 return PdoWrite(DeviceObject, Irp);
91}
92
93
94static
98 IN PIRP Irp)
99{
100 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
101 return FdoPnp(DeviceObject, Irp);
102 else
103 return PdoPnp(DeviceObject, Irp);
104}
105
106
107static
109NTAPI
111 IN PIRP Irp)
112{
113 if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
114 return FdoPower(DeviceObject, Irp);
115 else
116 return PdoPower(DeviceObject, Irp);
117}
118
119
121NTAPI
123 IN PUNICODE_STRING RegPath)
124{
125 ULONG i;
126
127 DPRINT("Parport DriverEntry\n");
128
129 DriverObject->DriverUnload = DriverUnload;
130 DriverObject->DriverExtension->AddDevice = AddDevice;
131
132 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
133 DriverObject->MajorFunction[i] = ForwardIrpAndForget;
134
135 DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate;
136 DriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose;
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;
144
145 return STATUS_SUCCESS;
146}
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PIRP Irp
Definition: csq.h:116
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSTATUS NTAPI FdoRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:477
NTSTATUS NTAPI FdoClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:442
NTSTATUS NTAPI FdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:505
NTSTATUS NTAPI FdoCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:409
NTSTATUS NTAPI FdoPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:607
NTSTATUS NTAPI FdoWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:491
NTSTATUS NTAPI FdoCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:462
static DRIVER_DISPATCH DispatchPower
Definition: parport.c:14
static DRIVER_DISPATCH DispatchCreate
Definition: parport.c:10
static DRIVER_DISPATCH DispatchClose
Definition: parport.c:11
DRIVER_INITIALIZE DriverEntry
Definition: parport.c:15
static DRIVER_DISPATCH DispatchCleanup
Definition: parport.c:12
static NTSTATUS NTAPI DispatchWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: parport.c:84
static DRIVER_DISPATCH DispatchPnp
Definition: parport.c:13
static DRIVER_UNLOAD DriverUnload
Definition: parport.c:9
static NTSTATUS NTAPI DispatchRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: parport.c:71
NTSTATUS NTAPI PdoWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:95
NTSTATUS NTAPI PdoRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:81
NTSTATUS NTAPI PdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:161
DRIVER_ADD_DEVICE AddDevice
Definition: parport.h:72
NTSTATUS NTAPI PdoCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:67
NTSTATUS NTAPI PdoCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:14
NTSTATUS NTAPI PdoClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:47
NTSTATUS NTAPI PdoPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:175
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define IRP_MJ_POWER
#define IRP_MJ_CLEANUP
#define IRP_MJ_MAXIMUM_FUNCTION