Author: tfaber
Date: Sat May 11 12:30:52 2013
New Revision: 58994
URL:
http://svn.reactos.org/svn/reactos?rev=58994&view=rev
Log:
[KBDHID][MOUHID]
- Use pool tagging
- Remove unnecessary casts
Modified:
trunk/reactos/drivers/hid/kbdhid/kbdhid.c
trunk/reactos/drivers/hid/kbdhid/kbdhid.h
trunk/reactos/drivers/hid/mouhid/mouhid.c
trunk/reactos/drivers/hid/mouhid/mouhid.h
Modified: trunk/reactos/drivers/hid/kbdhid/kbdhid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/kbdhid/kbdhid.…
==============================================================================
--- trunk/reactos/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] Sat May 11 12:30:52 2013
@@ -48,7 +48,7 @@
CHAR Prefix = 0;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)Context;
+ DeviceExtension = Context;
for(Index = 0; Index < Length; Index++)
{
@@ -104,7 +104,7 @@
ULONG ButtonLength;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)Context;
+ DeviceExtension = Context;
if (Irp->IoStatus.Status == STATUS_PRIVILEGE_NOT_HELD ||
Irp->IoStatus.Status == STATUS_DEVICE_NOT_CONNECTED ||
@@ -247,7 +247,7 @@
DPRINT("[KBDHID]: IRP_MJ_CREATE\n");
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -318,7 +318,7 @@
PKBDHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
DPRINT("[KBDHID] IRP_MJ_CLOSE ReadReportActive %x\n",
DeviceExtension->ReadReportActive);
@@ -363,7 +363,7 @@
DPRINT("[KBDHID] InternalDeviceControl %x\n",
IoStack->Parameters.DeviceIoControl.IoControlCode);
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
{
@@ -379,7 +379,7 @@
}
/* get output buffer */
- Attributes = (PKEYBOARD_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer;
+ Attributes = Irp->AssociatedIrp.SystemBuffer;
/* copy attributes */
RtlCopyMemory(Attributes,
@@ -412,7 +412,7 @@
}
/* get connect data */
- Data = (PCONNECT_DATA)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
+ Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
/* store connect details */
DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject;
@@ -546,7 +546,7 @@
PKBDHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* skip stack location */
IoSkipCurrentIrpStackLocation(Irp);
@@ -598,7 +598,7 @@
IO_STATUS_BLOCK IoStatus;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* init event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -646,7 +646,7 @@
PUSAGE_AND_PAGE Buffer;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* query collection information */
Status = KbdHid_SubmitRequest(DeviceObject,
@@ -663,7 +663,7 @@
}
/* lets allocate space for preparsed data */
- PreparsedData = (PHIDP_PREPARSED_DATA)ExAllocatePool(NonPagedPool,
Information.DescriptorSize);
+ PreparsedData = ExAllocatePoolWithTag(NonPagedPool, Information.DescriptorSize,
KBDHID_TAG);
if (!PreparsedData)
{
/* no memory */
@@ -682,7 +682,7 @@
{
/* failed to get preparsed data */
DPRINT1("[KBDHID] failed to obtain collection information with %x\n",
Status);
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, KBDHID_TAG);
return Status;
}
@@ -692,7 +692,7 @@
{
/* failed to get capabilities */
DPRINT1("[KBDHID] failed to obtain caps with %x\n", Status);
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, KBDHID_TAG);
return Status;
}
@@ -701,7 +701,7 @@
/* init input report */
DeviceExtension->ReportLength = Capabilities.InputReportByteLength;
ASSERT(DeviceExtension->ReportLength);
- DeviceExtension->Report = (PCHAR)ExAllocatePool(NonPagedPool,
DeviceExtension->ReportLength);
+ DeviceExtension->Report = ExAllocatePoolWithTag(NonPagedPool,
DeviceExtension->ReportLength, KBDHID_TAG);
ASSERT(DeviceExtension->Report);
RtlZeroMemory(DeviceExtension->Report, DeviceExtension->ReportLength);
@@ -722,11 +722,11 @@
ASSERT(Buttons > 0);
/* now allocate an array for those buttons */
- Buffer = (PUSAGE_AND_PAGE)ExAllocatePool(NonPagedPool, sizeof(USAGE_AND_PAGE) * 4 *
Buttons);
+ Buffer = ExAllocatePoolWithTag(NonPagedPool, sizeof(USAGE_AND_PAGE) * 4 * Buttons,
KBDHID_TAG);
if (!Buffer)
{
/* no memory */
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, KBDHID_TAG);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -784,13 +784,13 @@
/* free resources */
if (DeviceExtension->PreparsedData)
{
- ExFreePool(DeviceExtension->PreparsedData);
+ ExFreePoolWithTag(DeviceExtension->PreparsedData, KBDHID_TAG);
DeviceExtension->PreparsedData = NULL;
}
if (DeviceExtension->CurrentUsageList)
{
- ExFreePool(DeviceExtension->CurrentUsageList);
+ ExFreePoolWithTag(DeviceExtension->CurrentUsageList, KBDHID_TAG);
DeviceExtension->CurrentUsageList = NULL;
DeviceExtension->PreviousUsageList = NULL;
DeviceExtension->MakeUsageList = NULL;
@@ -805,7 +805,7 @@
if (DeviceExtension->Report)
{
- ExFreePool(DeviceExtension->Report);
+ ExFreePoolWithTag(DeviceExtension->Report, KBDHID_TAG);
DeviceExtension->Report = NULL;
}
@@ -822,7 +822,7 @@
PKBDHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* skip current stack location */
IoSkipCurrentIrpStackLocation(Irp);
@@ -850,7 +850,7 @@
PKBDHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* get current irp stack */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -981,7 +981,7 @@
}
/* get device extension */
- DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* zero extension */
RtlZeroMemory(DeviceExtension, sizeof(KBDHID_DEVICE_EXTENSION));
Modified: trunk/reactos/drivers/hid/kbdhid/kbdhid.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/kbdhid/kbdhid.…
==============================================================================
--- trunk/reactos/drivers/hid/kbdhid/kbdhid.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/kbdhid/kbdhid.h [iso-8859-1] Sat May 11 12:30:52 2013
@@ -120,9 +120,7 @@
//
KEYBOARD_TYPEMATIC_PARAMETERS KeyboardTypematic;
-
-
-}KBDHID_DEVICE_EXTENSION, *PKBDHID_DEVICE_EXTENSION;
+} KBDHID_DEVICE_EXTENSION, *PKBDHID_DEVICE_EXTENSION;
/* defaults from kbfiltr.h */
#define KEYBOARD_TYPEMATIC_RATE_MINIMUM 2
@@ -138,8 +136,8 @@
#define MICROSOFT_KBD_101_TYPE 0
-
-
NTSTATUS
KbdHid_InitiateRead(
IN PKBDHID_DEVICE_EXTENSION DeviceExtension);
+
+#define KBDHID_TAG 'diHK'
Modified: trunk/reactos/drivers/hid/mouhid/mouhid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/mouhid/mouhid.…
==============================================================================
--- trunk/reactos/drivers/hid/mouhid/mouhid.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/mouhid/mouhid.c [iso-8859-1] Sat May 11 12:30:52 2013
@@ -256,7 +256,7 @@
USHORT Flags;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)Context;
+ DeviceExtension = Context;
if (Irp->IoStatus.Status == STATUS_PRIVILEGE_NOT_HELD ||
Irp->IoStatus.Status == STATUS_DEVICE_NOT_CONNECTED ||
@@ -397,7 +397,7 @@
DPRINT("MOUHID: IRP_MJ_CREATE\n");
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -468,7 +468,7 @@
PMOUHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
DPRINT("[MOUHID] IRP_MJ_CLOSE ReadReportActive %x\n",
DeviceExtension->ReadReportActive);
@@ -513,7 +513,7 @@
DPRINT("[MOUHID] InternalDeviceControl %x\n",
IoStack->Parameters.DeviceIoControl.IoControlCode);
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* handle requests */
switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
@@ -530,7 +530,7 @@
}
/* get output buffer */
- Attributes = (PMOUSE_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer;
+ Attributes = Irp->AssociatedIrp.SystemBuffer;
/* type of mouse */
Attributes->MouseIdentifier = DeviceExtension->MouseIdentifier;
@@ -575,7 +575,7 @@
}
/* get connect data */
- Data = (PCONNECT_DATA)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
+ Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
/* store connect details */
DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject;
@@ -621,7 +621,7 @@
PMOUHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* skip stack location */
IoSkipCurrentIrpStackLocation(Irp);
@@ -673,7 +673,7 @@
IO_STATUS_BLOCK IoStatus;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* init event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -723,7 +723,7 @@
PUSHORT Buffer;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* query collection information */
Status = MouHid_SubmitRequest(DeviceObject,
@@ -740,7 +740,7 @@
}
/* lets allocate space for preparsed data */
- PreparsedData = ExAllocatePool(NonPagedPool, Information.DescriptorSize);
+ PreparsedData = ExAllocatePoolWithTag(NonPagedPool, Information.DescriptorSize,
MOUHID_TAG);
if (!PreparsedData)
{
/* no memory */
@@ -759,7 +759,7 @@
{
/* failed to get preparsed data */
DPRINT1("[MOUHID] failed to obtain collection information with %x\n",
Status);
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, MOUHID_TAG);
return Status;
}
@@ -769,7 +769,7 @@
{
/* failed to get capabilities */
DPRINT1("[MOUHID] failed to obtain caps with %x\n", Status);
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, MOUHID_TAG);
return Status;
}
@@ -779,14 +779,14 @@
if ((Capabilities.Usage != HID_USAGE_GENERIC_POINTER && Capabilities.Usage !=
HID_USAGE_GENERIC_MOUSE) || Capabilities.UsagePage != HID_USAGE_PAGE_GENERIC)
{
/* not supported */
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, MOUHID_TAG);
return STATUS_UNSUCCESSFUL;
}
- /* init input report*/
+ /* init input report */
DeviceExtension->ReportLength = Capabilities.InputReportByteLength;
ASSERT(DeviceExtension->ReportLength);
- DeviceExtension->Report = (PCHAR)ExAllocatePool(NonPagedPool,
DeviceExtension->ReportLength);
+ DeviceExtension->Report = ExAllocatePoolWithTag(NonPagedPool,
DeviceExtension->ReportLength, MOUHID_TAG);
ASSERT(DeviceExtension->Report);
RtlZeroMemory(DeviceExtension->Report, DeviceExtension->ReportLength);
@@ -809,11 +809,11 @@
ASSERT(Buttons > 0);
/* now allocate an array for those buttons */
- Buffer = ExAllocatePool(NonPagedPool, sizeof(USAGE) * 4 * Buttons);
+ Buffer = ExAllocatePoolWithTag(NonPagedPool, sizeof(USAGE) * 4 * Buttons,
MOUHID_TAG);
if (!Buffer)
{
/* no memory */
- ExFreePool(PreparsedData);
+ ExFreePoolWithTag(PreparsedData, MOUHID_TAG);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -898,7 +898,7 @@
IN PIRP Irp,
IN PVOID Context)
{
- KeSetEvent((PKEVENT)Context, 0, FALSE);
+ KeSetEvent(Context, 0, FALSE);
return STATUS_MORE_PROCESSING_REQUIRED;
}
@@ -915,13 +915,13 @@
/* free resources */
if (DeviceExtension->PreparsedData)
{
- ExFreePool(DeviceExtension->PreparsedData);
+ ExFreePoolWithTag(DeviceExtension->PreparsedData, MOUHID_TAG);
DeviceExtension->PreparsedData = NULL;
}
if (DeviceExtension->CurrentUsageList)
{
- ExFreePool(DeviceExtension->CurrentUsageList);
+ ExFreePoolWithTag(DeviceExtension->CurrentUsageList, MOUHID_TAG);
DeviceExtension->CurrentUsageList = NULL;
DeviceExtension->PreviousUsageList = NULL;
DeviceExtension->MakeUsageList = NULL;
@@ -936,7 +936,7 @@
if (DeviceExtension->Report)
{
- ExFreePool(DeviceExtension->Report);
+ ExFreePoolWithTag(DeviceExtension->Report, MOUHID_TAG);
DeviceExtension->Report = NULL;
}
@@ -953,7 +953,7 @@
PMOUHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* skip current stack location */
IoSkipCurrentIrpStackLocation(Irp);
@@ -981,7 +981,7 @@
PMOUHID_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* get current irp stack */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -1124,7 +1124,7 @@
}
/* get device extension */
- DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DeviceExtension = DeviceObject->DeviceExtension;
/* zero extension */
RtlZeroMemory(DeviceExtension, sizeof(MOUHID_DEVICE_EXTENSION));
Modified: trunk/reactos/drivers/hid/mouhid/mouhid.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/mouhid/mouhid.…
==============================================================================
--- trunk/reactos/drivers/hid/mouhid/mouhid.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/mouhid/mouhid.h [iso-8859-1] Sat May 11 12:30:52 2013
@@ -124,11 +124,12 @@
//
HIDP_VALUE_CAPS ValueCapsY;
-
-}MOUHID_DEVICE_EXTENSION, *PMOUHID_DEVICE_EXTENSION;
+} MOUHID_DEVICE_EXTENSION, *PMOUHID_DEVICE_EXTENSION;
#define WHEEL_DELTA 120
NTSTATUS
MouHid_InitiateRead(
IN PMOUHID_DEVICE_EXTENSION DeviceExtension);
+
+#define MOUHID_TAG 'diHM'