Author: tfaber
Date: Fri Jan 20 23:12:44 2012
New Revision: 55031
URL:
http://svn.reactos.org/svn/reactos?rev=55031&view=rev
Log:
[KMTESTS]
- Fix IRP handling, and some 64 bit warnings
Modified:
trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c
trunk/rostests/kmtests/kmtest_drv/kmtest_standalone.c
Modified: trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/kmtest…
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Fri Jan 20 23:12:44 2012
@@ -22,8 +22,13 @@
/* Prototypes */
DRIVER_INITIALIZE DriverEntry;
static DRIVER_UNLOAD DriverUnload;
+__drv_dispatchType(IRP_MJ_CREATE)
static DRIVER_DISPATCH DriverCreate;
+__drv_dispatchType(IRP_MJ_CLEANUP)
+static DRIVER_DISPATCH DriverCleanup;
+__drv_dispatchType(IRP_MJ_CLOSE)
static DRIVER_DISPATCH DriverClose;
+__drv_dispatchType(IRP_MJ_DEVICE_CONTROL)
static DRIVER_DISPATCH DriverIoControl;
/* Globals */
@@ -83,6 +88,7 @@
DriverObject->DriverUnload = DriverUnload;
DriverObject->MajorFunction[IRP_MJ_CREATE] = DriverCreate;
+ DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DriverCleanup;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = DriverClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverIoControl;
@@ -130,7 +136,7 @@
/**
* @name DriverCreate
*
- * Driver Dispatch function for CreateFile
+ * Driver Dispatch function for IRP_MJ_CREATE
*
* @param DeviceObject
* Device Object
@@ -166,9 +172,9 @@
}
/**
- * @name DriverClose
- *
- * Driver Dispatch function for CloseHandle.
+ * @name DriverCleanup
+ *
+ * Driver Dispatch function for IRP_MJ_CLEANUP
*
* @param DeviceObject
* Device Object
@@ -180,7 +186,7 @@
static
NTSTATUS
NTAPI
-DriverClose(
+DriverCleanup(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
@@ -192,7 +198,7 @@
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
- DPRINT("DriverClose. DeviceObject=%p, RequestorMode=%d, FileObject=%p,
FsContext=%p, FsContext2=%p\n",
+ DPRINT("DriverCleanup. DeviceObject=%p, RequestorMode=%d, FileObject=%p,
FsContext=%p, FsContext2=%p\n",
DeviceObject, Irp->RequestorMode, IoStackLocation->FileObject,
IoStackLocation->FileObject->FsContext,
IoStackLocation->FileObject->FsContext2);
@@ -219,9 +225,43 @@
}
/**
+ * @name DriverClose
+ *
+ * Driver Dispatch function for IRP_MJ_CLOSE
+ *
+ * @param DeviceObject
+ * Device Object
+ * @param Irp
+ * I/O request packet
+ *
+ * @return Status
+ */
+static
+NTSTATUS
+NTAPI
+DriverClose(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
+
+ DPRINT("DriverClose. DeviceObject=%p, RequestorMode=%d\n",
+ DeviceObject, Irp->RequestorMode);
+
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return Status;
+}
+
+/**
* @name DriverIoControl
*
- * Driver Dispatch function for DeviceIoControl.
+ * Driver Dispatch function for IRP_MJ_DEVICE_CONTROL
*
* @param DeviceObject
* Device Object
Modified: trunk/rostests/kmtests/kmtest_drv/kmtest_standalone.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/kmtest…
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/kmtest_standalone.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/kmtest_standalone.c [iso-8859-1] Fri Jan 20 23:12:44
2012
@@ -320,7 +320,7 @@
IrpHandlers[i].IrpHandler != NULL)
return IrpHandlers[i].IrpHandler(DeviceObject, Irp, IoStackLocation);
}
-
+
/* default handler for DeviceControl */
if (IoStackLocation->MajorFunction == IRP_MJ_DEVICE_CONTROL ||
IoStackLocation->MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL)
@@ -462,7 +462,7 @@
{
NTSTATUS Status = STATUS_SUCCESS;
ULONG ControlCode = (IoStackLocation->Parameters.DeviceIoControl.IoControlCode
& 0x00000FFC) >> 2;
- ULONG OutLength = IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength;
+ SIZE_T OutLength =
IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength;
int i;
for (i = 0; i < sizeof MessageHandlers / sizeof MessageHandlers[0]; ++i)