mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[KBDHID][MOUHID]
- Use pool tagging - Remove unnecessary casts svn path=/trunk/; revision=58994
This commit is contained in:
parent
aec2159f30
commit
88b692d160
4 changed files with 52 additions and 53 deletions
|
@ -48,7 +48,7 @@ KbdHid_InsertScanCodes(
|
|||
CHAR Prefix = 0;
|
||||
|
||||
/* get device extension */
|
||||
DeviceExtension = (PKBDHID_DEVICE_EXTENSION)Context;
|
||||
DeviceExtension = Context;
|
||||
|
||||
for(Index = 0; Index < Length; Index++)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ KbdHid_ReadCompletion(
|
|||
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 @@ KbdHid_Create(
|
|||
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 @@ KbdHid_Close(
|
|||
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 @@ KbdHid_InternalDeviceControl(
|
|||
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 @@ KbdHid_InternalDeviceControl(
|
|||
}
|
||||
|
||||
/* get output buffer */
|
||||
Attributes = (PKEYBOARD_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer;
|
||||
Attributes = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
/* copy attributes */
|
||||
RtlCopyMemory(Attributes,
|
||||
|
@ -412,7 +412,7 @@ KbdHid_InternalDeviceControl(
|
|||
}
|
||||
|
||||
/* 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 @@ KbdHid_DeviceControl(
|
|||
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 @@ KbdHid_SubmitRequest(
|
|||
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 @@ KbdHid_StartDevice(
|
|||
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 @@ KbdHid_StartDevice(
|
|||
}
|
||||
|
||||
/* 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 @@ KbdHid_StartDevice(
|
|||
{
|
||||
/* 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 @@ KbdHid_StartDevice(
|
|||
{
|
||||
/* 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 @@ KbdHid_StartDevice(
|
|||
/* 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 @@ KbdHid_StartDevice(
|
|||
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 @@ KbdHid_FreeResources(
|
|||
/* 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 @@ KbdHid_FreeResources(
|
|||
|
||||
if (DeviceExtension->Report)
|
||||
{
|
||||
ExFreePool(DeviceExtension->Report);
|
||||
ExFreePoolWithTag(DeviceExtension->Report, KBDHID_TAG);
|
||||
DeviceExtension->Report = NULL;
|
||||
}
|
||||
|
||||
|
@ -822,7 +822,7 @@ KbdHid_Flush(
|
|||
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 @@ KbdHid_Pnp(
|
|||
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 @@ KbdHid_AddDevice(
|
|||
}
|
||||
|
||||
/* get device extension */
|
||||
DeviceExtension = (PKBDHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
/* zero extension */
|
||||
RtlZeroMemory(DeviceExtension, sizeof(KBDHID_DEVICE_EXTENSION));
|
||||
|
|
|
@ -120,9 +120,7 @@ typedef struct
|
|||
//
|
||||
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 @@ typedef struct
|
|||
#define MICROSOFT_KBD_101_TYPE 0
|
||||
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
KbdHid_InitiateRead(
|
||||
IN PKBDHID_DEVICE_EXTENSION DeviceExtension);
|
||||
|
||||
#define KBDHID_TAG 'diHK'
|
||||
|
|
|
@ -256,7 +256,7 @@ MouHid_ReadCompletion(
|
|||
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 @@ MouHid_Create(
|
|||
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 @@ MouHid_Close(
|
|||
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 @@ MouHid_InternalDeviceControl(
|
|||
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 @@ MouHid_InternalDeviceControl(
|
|||
}
|
||||
|
||||
/* get output buffer */
|
||||
Attributes = (PMOUSE_ATTRIBUTES)Irp->AssociatedIrp.SystemBuffer;
|
||||
Attributes = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
/* type of mouse */
|
||||
Attributes->MouseIdentifier = DeviceExtension->MouseIdentifier;
|
||||
|
@ -575,7 +575,7 @@ MouHid_InternalDeviceControl(
|
|||
}
|
||||
|
||||
/* 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 @@ MouHid_DeviceControl(
|
|||
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 @@ MouHid_SubmitRequest(
|
|||
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 @@ MouHid_StartDevice(
|
|||
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 @@ MouHid_StartDevice(
|
|||
}
|
||||
|
||||
/* 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 @@ MouHid_StartDevice(
|
|||
{
|
||||
/* 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 @@ MouHid_StartDevice(
|
|||
{
|
||||
/* 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 @@ MouHid_StartDevice(
|
|||
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 @@ MouHid_StartDevice(
|
|||
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 @@ MouHid_StartDeviceCompletion(
|
|||
IN PIRP Irp,
|
||||
IN PVOID Context)
|
||||
{
|
||||
KeSetEvent((PKEVENT)Context, 0, FALSE);
|
||||
KeSetEvent(Context, 0, FALSE);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
@ -915,13 +915,13 @@ MouHid_FreeResources(
|
|||
/* 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 @@ MouHid_FreeResources(
|
|||
|
||||
if (DeviceExtension->Report)
|
||||
{
|
||||
ExFreePool(DeviceExtension->Report);
|
||||
ExFreePoolWithTag(DeviceExtension->Report, MOUHID_TAG);
|
||||
DeviceExtension->Report = NULL;
|
||||
}
|
||||
|
||||
|
@ -953,7 +953,7 @@ MouHid_Flush(
|
|||
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 @@ MouHid_Pnp(
|
|||
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 @@ MouHid_AddDevice(
|
|||
}
|
||||
|
||||
/* get device extension */
|
||||
DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
/* zero extension */
|
||||
RtlZeroMemory(DeviceExtension, sizeof(MOUHID_DEVICE_EXTENSION));
|
||||
|
|
|
@ -124,11 +124,12 @@ typedef struct
|
|||
//
|
||||
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'
|
||||
|
|
Loading…
Reference in a new issue