Disable some misleading service tests because a test cannot determine wheter or not...
[reactos.git] / drivers / kmtest / kmtestassist.c
1 /*
2 * Driver Regression Tests
3 *
4 * Copyright 2009 Michael Martin <martinmnet@hotmail.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 /* INCLUDES *******************************************************************/
23
24 #include "ntddk.h"
25 #include "ntddser.h"
26
27 NTSTATUS
28 NTAPI
29 DriverDispatch(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
30 {
31 DbgPrint(" ControlCode %x\n",IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode);
32 Irp->IoStatus.Status = STATUS_SUCCESS;
33 Irp->IoStatus.Information=0;
34
35 IoCompleteRequest(Irp, IO_NO_INCREMENT);
36 return STATUS_SUCCESS;
37 }
38
39 NTSTATUS
40 NTAPI
41 DriverCreateClose(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
42 {
43 Irp->IoStatus.Status = STATUS_SUCCESS;
44 Irp->IoStatus.Information = 0;
45
46 IoCompleteRequest(Irp, IO_NO_INCREMENT);
47
48 return STATUS_SUCCESS;
49 }
50
51 VOID
52 NTAPI
53 DriverUnload(IN PDRIVER_OBJECT DriverObject)
54 {
55 UNICODE_STRING DeviceString;
56
57 RtlInitUnicodeString(&DeviceString, L"\\DosDevices\\kmtestassist");
58 IoDeleteSymbolicLink(&DeviceString);
59
60 IoDeleteDevice(DriverObject->DeviceObject);
61 }
62
63 NTSTATUS
64 NTAPI
65 DriverEntry(IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING path)
66 {
67 PDEVICE_OBJECT pDeviceObject;
68 UNICODE_STRING DriverString;
69 UNICODE_STRING DeviceString;
70
71 NTSTATUS Status= STATUS_DEVICE_CONFIGURATION_ERROR;
72
73 RtlInitUnicodeString(&DriverString, L"\\Device\\kmtestassist");
74
75 Status = IoCreateDevice(DriverObject,0,&DriverString,FILE_DEVICE_UNKNOWN,0,FALSE,&pDeviceObject);
76 if (!NT_SUCCESS(Status))
77 {
78 return Status;
79 }
80
81 RtlInitUnicodeString(&DeviceString, L"\\DosDevices\\kmtestassist");
82
83 Status = IoCreateSymbolicLink(&DeviceString, &DriverString);
84 if (!NT_SUCCESS(Status))
85 {
86 // Delete device object if not successful
87 IoDeleteDevice(pDeviceObject);
88 return Status;
89 }
90
91 DriverObject->DriverUnload = DriverUnload;
92 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverDispatch;
93 DriverObject->MajorFunction[IRP_MJ_CREATE] = DriverCreateClose;
94 DriverObject->MajorFunction[IRP_MJ_CLOSE] = DriverCreateClose;
95
96 return Status;
97 }