merge ROS Shell without integrated explorer part into trunk
[reactos.git] / reactos / drivers / dd / test / test.c
1 /*
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)
7 * UPDATE HISTORY:
8 * ??/??/??: Created
9 * 18/06/98: Made more NT like
10 */
11
12 /* INCLUDES ****************************************************************/
13
14 #include <ddk/ntddk.h>
15
16 /* FUNCTIONS **************************************************************/
17
18 #if 0
19
20 NTSTATUS STDCALL TestWrite(PIRP Irp, PIO_STACK_LOCATION Stk)
21 {
22 PVOID Address;
23
24 Address = MmGetSystemAddressForMdl(Irp->MdlAddress);
25 DbgPrint("Asked to write '%s'\n",(PCH)Address);
26 return(STATUS_SUCCESS);
27 }
28
29 NTSTATUS STDCALL TestDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
30 /*
31 * FUNCTION: Handles user mode requests
32 * ARGUMENTS:
33 * DeviceObject = Device for request
34 * Irp = I/O request packet describing request
35 * RETURNS: Success or failure
36 */
37 {
38 PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
39 NTSTATUS status;
40 int i;
41
42 switch (Stack->MajorFunction)
43 {
44 case IRP_MJ_CREATE:
45 DbgPrint("(Test Driver) Creating\n");
46 status = STATUS_SUCCESS;
47 break;
48
49 case IRP_MJ_CLOSE:
50 status = STATUS_SUCCESS;
51 break;
52
53 case IRP_MJ_WRITE:
54 DbgPrint("(Test Driver) Writing\n");
55 status = TestWrite(Irp,Stack);
56 break;
57
58 default:
59 status = STATUS_NOT_IMPLEMENTED;
60 break;
61 }
62
63 Irp->IoStatus.Status = status;
64 Irp->IoStatus.Information = 0;
65
66 IoCompleteRequest(Irp, IO_NO_INCREMENT);
67 return(status);
68 }
69
70 #endif
71
72 NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
73 /*
74 * FUNCTION: Called by the system to initalize the driver
75 * ARGUMENTS:
76 * DriverObject = object describing this driver
77 * RegistryPath = path to our configuration entries
78 * RETURNS: Success or failure
79 */
80 {
81 PDEVICE_OBJECT DeviceObject;
82 NTSTATUS ret;
83 ANSI_STRING astr;
84 UNICODE_STRING ustr;
85
86 DbgPrint("Test Driver 0.0.1\n");
87
88 #if 0
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)
94 {
95 return(ret);
96 }
97
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;
104 #endif
105 return(STATUS_SUCCESS);
106 }
107