[KMTESTS]
[reactos.git] / kmtests / ntos_io / IoHelper_drv.c
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite I/O Test Helper driver
5 * PROGRAMMER: Thomas Faber <thfabba@gmx.de>
6 */
7
8 #include <kmt_test.h>
9
10 //#define NDEBUG
11 #include <debug.h>
12
13 static KMT_IRP_HANDLER TestIrpHandler;
14
15 NTSTATUS
16 TestEntry(
17 IN PDRIVER_OBJECT DriverObject,
18 IN PCUNICODE_STRING RegistryPath,
19 OUT PCWSTR *DeviceName,
20 IN OUT INT *Flags)
21 {
22 NTSTATUS Status = STATUS_SUCCESS;
23 INT i;
24
25 PAGED_CODE();
26
27 UNREFERENCED_PARAMETER(DriverObject);
28 UNREFERENCED_PARAMETER(RegistryPath);
29 UNREFERENCED_PARAMETER(Flags);
30
31 DPRINT("TestEntry. DriverObject=%p, RegistryPath=%wZ\n", DriverObject, RegistryPath);
32
33 *DeviceName = L"IoHelper";
34
35 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; ++i)
36 KmtRegisterIrpHandler(i, NULL, TestIrpHandler);
37
38 return Status;
39 }
40
41 VOID
42 TestUnload(
43 IN PDRIVER_OBJECT DriverObject)
44 {
45 PAGED_CODE();
46
47 UNREFERENCED_PARAMETER(DriverObject);
48
49 DPRINT("TestUnload. DriverObject=%p\n", DriverObject);
50 }
51
52 static
53 NTSTATUS
54 TestIrpHandler(
55 IN PDEVICE_OBJECT DeviceObject,
56 IN PIRP Irp,
57 IN PIO_STACK_LOCATION IoStackLocation)
58 {
59 NTSTATUS Status = STATUS_SUCCESS;
60
61 DPRINT("TestIrpHandler. Function=%s, DeviceObject=%p\n",
62 KmtMajorFunctionNames[IoStackLocation->MajorFunction],
63 DeviceObject);
64
65 Irp->IoStatus.Status = Status;
66 Irp->IoStatus.Information = 0;
67
68 IoCompleteRequest(Irp, IO_NO_INCREMENT);
69
70 return Status;
71 }