2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: services/test/test.c
5 * PURPOSE: Testing driver
6 * PROGRAMMER: David Welch (welch@mcmail.com)
9 * 18/06/98: Made more NT like
12 /* INCLUDES ****************************************************************/
14 #include <ddk/ntddk.h>
16 /* FUNCTIONS **************************************************************/
20 NTSTATUS STDCALL
TestWrite(PIRP Irp
, PIO_STACK_LOCATION Stk
)
24 Address
= MmGetSystemAddressForMdl(Irp
->MdlAddress
);
25 DbgPrint("Asked to write '%s'\n",(PCH
)Address
);
26 return(STATUS_SUCCESS
);
29 NTSTATUS STDCALL
TestDispatch(PDEVICE_OBJECT DeviceObject
, PIRP Irp
)
31 * FUNCTION: Handles user mode requests
33 * DeviceObject = Device for request
34 * Irp = I/O request packet describing request
35 * RETURNS: Success or failure
38 PIO_STACK_LOCATION Stack
= IoGetCurrentIrpStackLocation(Irp
);
42 switch (Stack
->MajorFunction
)
45 DbgPrint("(Test Driver) Creating\n");
46 status
= STATUS_SUCCESS
;
50 status
= STATUS_SUCCESS
;
54 DbgPrint("(Test Driver) Writing\n");
55 status
= TestWrite(Irp
,Stack
);
59 status
= STATUS_NOT_IMPLEMENTED
;
63 Irp
->IoStatus
.Status
= status
;
64 Irp
->IoStatus
.Information
= 0;
66 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
72 NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject
, PUNICODE_STRING RegistryPath
)
74 * FUNCTION: Called by the system to initalize the driver
76 * DriverObject = object describing this driver
77 * RegistryPath = path to our configuration entries
78 * RETURNS: Success or failure
81 PDEVICE_OBJECT DeviceObject
;
86 DbgPrint("Test Driver 0.0.1\n");
89 RtlInitAnsiString(&astr
,"\\Device\\Test");
90 RtlAnsiStringToUnicodeString(&ustr
,&astr
,TRUE
);
91 ret
= IoCreateDevice(DriverObject
,0,&ustr
,
92 FILE_DEVICE_PARALLEL_PORT
,0,FALSE
,&DeviceObject
);
93 if (ret
!=STATUS_SUCCESS
)
98 DeviceObject
->Flags
=DO_DIRECT_IO
;
99 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = TestDispatch
;
100 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = TestDispatch
;
101 DriverObject
->MajorFunction
[IRP_MJ_WRITE
] = TestDispatch
;
102 DriverObject
->MajorFunction
[IRP_MJ_WRITE
] = TestDispatch
;
103 DriverObject
->DriverUnload
= NULL
;
105 return(STATUS_SUCCESS
);