mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Use a tag when allocating/freeing some memory
svn path=/trunk/; revision=26990
This commit is contained in:
parent
e4d5c105d9
commit
6b63d35926
9 changed files with 92 additions and 102 deletions
|
@ -10,6 +10,16 @@
|
|||
#define INITGUID
|
||||
#include "kbdclass.h"
|
||||
|
||||
static DRIVER_UNLOAD DriverUnload;
|
||||
static DRIVER_DISPATCH ClassCreate;
|
||||
static DRIVER_DISPATCH ClassClose;
|
||||
static DRIVER_DISPATCH ClassCleanup;
|
||||
static DRIVER_DISPATCH ClassRead;
|
||||
static DRIVER_DISPATCH ClassDeviceControl;
|
||||
static DRIVER_DISPATCH IrpStub;
|
||||
static DRIVER_ADD_DEVICE ClassAddDevice;
|
||||
static DRIVER_STARTIO ClassStartIo;
|
||||
|
||||
static VOID NTAPI
|
||||
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
|
@ -212,11 +222,11 @@ ReadRegistryEntries(
|
|||
|
||||
ParametersRegistryKey.Length = 0;
|
||||
ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
|
||||
ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
|
||||
ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, CLASS_TAG);
|
||||
if (!ParametersRegistryKey.Buffer)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
|
||||
RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
|
||||
|
@ -276,6 +286,7 @@ ReadRegistryEntries(
|
|||
Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
ExFreePoolWithTag(ParametersRegistryKey.Buffer, CLASS_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -303,11 +314,11 @@ CreateClassDeviceObject(
|
|||
+ DriverExtension->DeviceBaseName.Length /* "KeyboardClass" */
|
||||
+ 4 * sizeof(WCHAR) /* Id between 0 and 9999 */
|
||||
+ sizeof(UNICODE_NULL); /* Final NULL char */
|
||||
DeviceNameU.Buffer = ExAllocatePool(PagedPool, DeviceNameU.MaximumLength);
|
||||
DeviceNameU.Buffer = ExAllocatePoolWithTag(PagedPool, DeviceNameU.MaximumLength, CLASS_TAG);
|
||||
if (!DeviceNameU.Buffer)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
Status = RtlAppendUnicodeToString(&DeviceNameU, L"\\Device\\");
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -348,7 +359,7 @@ CreateClassDeviceObject(
|
|||
cleanup:
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(DeviceNameU.Buffer);
|
||||
ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -361,11 +372,11 @@ cleanup:
|
|||
KeInitializeSpinLock(&DeviceExtension->SpinLock);
|
||||
DeviceExtension->ReadIsPending = FALSE;
|
||||
DeviceExtension->InputCount = 0;
|
||||
DeviceExtension->PortData = ExAllocatePool(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA));
|
||||
DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA), CLASS_TAG);
|
||||
if (!DeviceExtension->PortData)
|
||||
{
|
||||
ExFreePool(DeviceNameU.Buffer);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
DeviceExtension->DeviceName = DeviceNameU.Buffer;
|
||||
Fdo->Flags |= DO_POWER_PAGABLE;
|
||||
|
@ -548,8 +559,7 @@ ConnectPortDriver(
|
|||
CONNECT_DATA ConnectData;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Connecting PortDO %p [%wZ] to ClassDO %p\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName, ClassDO);
|
||||
DPRINT("Connecting PortDO %p to ClassDO %p\n", PortDO, ClassDO);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
|
||||
|
@ -605,8 +615,7 @@ DestroyPortDriver(
|
|||
KIRQL OldIrql;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Destroying PortDO %p [%wZ]\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName);
|
||||
DPRINT("Destroying PortDO %p\n", PortDO);
|
||||
|
||||
DeviceExtension = (PPORT_DEVICE_EXTENSION)PortDO->DeviceExtension;
|
||||
ClassDeviceExtension = DeviceExtension->ClassDO->DeviceExtension;
|
||||
|
@ -644,8 +653,8 @@ DestroyPortDriver(
|
|||
|
||||
if (!DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
|
||||
{
|
||||
ExFreePool(ClassDeviceExtension->PortData);
|
||||
ExFreePool((PVOID)ClassDeviceExtension->DeviceName);
|
||||
ExFreePoolWithTag(ClassDeviceExtension->PortData, CLASS_TAG);
|
||||
ExFreePoolWithTag((PVOID)ClassDeviceExtension->DeviceName, CLASS_TAG);
|
||||
IoDeleteDevice(DeviceExtension->ClassDO);
|
||||
}
|
||||
|
||||
|
@ -838,11 +847,11 @@ SearchForLegacyDrivers(
|
|||
|
||||
/* Allocate memory */
|
||||
Size = sizeof(KEY_VALUE_BASIC_INFORMATION) + MAX_PATH;
|
||||
KeyValueInformation = ExAllocatePool(PagedPool, Size);
|
||||
KeyValueInformation = ExAllocatePoolWithTag(PagedPool, Size, CLASS_TAG);
|
||||
if (!KeyValueInformation)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -893,7 +902,7 @@ SearchForLegacyDrivers(
|
|||
DPRINT("IoGetDeviceObjectPointer(%wZ) failed with status 0x%08lx\n", &PortName, Status);
|
||||
continue;
|
||||
}
|
||||
DPRINT("Legacy driver found: %wZ\n", &PortDeviceObject->DriverObject->DriverName);
|
||||
DPRINT("Legacy driver found\n");
|
||||
|
||||
Status = ClassAddDevice(DriverObject, PortDeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -905,7 +914,7 @@ SearchForLegacyDrivers(
|
|||
|
||||
cleanup:
|
||||
if (KeyValueInformation != NULL)
|
||||
ExFreePool(KeyValueInformation);
|
||||
ExFreePoolWithTag(KeyValueInformation, CLASS_TAG);
|
||||
if (hDeviceMapKey != (HANDLE)-1)
|
||||
ZwClose(hDeviceMapKey);
|
||||
if (hPortKey != (HANDLE)-1)
|
||||
|
|
|
@ -2,27 +2,16 @@
|
|||
#include <kbdmou.h>
|
||||
#include <ntddkbd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#include <pseh/pseh.h>
|
||||
#include <debug.h>
|
||||
#elif defined(_MSC_VER)
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||
#define DPRINT
|
||||
#define CHECKPOINT
|
||||
#define _SEH_TRY __try
|
||||
#define _SEH_HANDLE __except(1)
|
||||
#define _SEH_END
|
||||
#define _SEH_GetExceptionCode() GetExceptionCode()
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
#include <pseh/pseh.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
#define CLASS_TAG TAG('K', 'b', 'd', 'C')
|
||||
|
||||
typedef enum
|
||||
{
|
||||
dsStopped,
|
||||
|
@ -83,10 +72,7 @@ ForwardIrpAndWait(
|
|||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
ForwardIrpAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
DRIVER_DISPATCH ForwardIrpAndForget;
|
||||
|
||||
NTSTATUS
|
||||
DuplicateUnicodeString(
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "kbdclass.h"
|
||||
|
||||
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
ForwardIrpAndWaitCompletion(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -35,7 +37,7 @@ ForwardIrpAndWait(
|
|||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
||||
DPRINT("Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
DPRINT("Calling lower device %p\n", LowerDevice);
|
||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
|
@ -93,7 +95,7 @@ DuplicateUnicodeString(
|
|||
if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
|
||||
DestMaxLength += sizeof(UNICODE_NULL);
|
||||
|
||||
DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
|
||||
DestinationString->Buffer = ExAllocatePoolWithTag(PagedPool, DestMaxLength, CLASS_TAG);
|
||||
if (DestinationString->Buffer == NULL)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "mouclass.h"
|
||||
|
||||
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
ForwardIrpAndWaitCompletion(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -35,7 +37,7 @@ ForwardIrpAndWait(
|
|||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
||||
DPRINT("Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
DPRINT("Calling lower device %p\n", LowerDevice);
|
||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
|
@ -93,7 +95,7 @@ DuplicateUnicodeString(
|
|||
if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
|
||||
DestMaxLength += sizeof(UNICODE_NULL);
|
||||
|
||||
DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
|
||||
DestinationString->Buffer = ExAllocatePoolWithTag(PagedPool, DestMaxLength, CLASS_TAG);
|
||||
if (DestinationString->Buffer == NULL)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
|
|
|
@ -10,6 +10,16 @@
|
|||
#define INITGUID
|
||||
#include "mouclass.h"
|
||||
|
||||
static DRIVER_UNLOAD DriverUnload;
|
||||
static DRIVER_DISPATCH ClassCreate;
|
||||
static DRIVER_DISPATCH ClassClose;
|
||||
static DRIVER_DISPATCH ClassCleanup;
|
||||
static DRIVER_DISPATCH ClassRead;
|
||||
static DRIVER_DISPATCH ClassDeviceControl;
|
||||
static DRIVER_DISPATCH IrpStub;
|
||||
static DRIVER_ADD_DEVICE ClassAddDevice;
|
||||
static DRIVER_STARTIO ClassStartIo;
|
||||
|
||||
static VOID NTAPI
|
||||
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
|
@ -189,11 +199,11 @@ ReadRegistryEntries(
|
|||
|
||||
ParametersRegistryKey.Length = 0;
|
||||
ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
|
||||
ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
|
||||
ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, CLASS_TAG);
|
||||
if (!ParametersRegistryKey.Buffer)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
|
||||
RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
|
||||
|
@ -253,6 +263,7 @@ ReadRegistryEntries(
|
|||
Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
ExFreePoolWithTag(ParametersRegistryKey.Buffer, CLASS_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -280,11 +291,11 @@ CreateClassDeviceObject(
|
|||
+ DriverExtension->DeviceBaseName.Length /* "PointerClass" */
|
||||
+ 4 * sizeof(WCHAR) /* Id between 0 and 9999 */
|
||||
+ sizeof(UNICODE_NULL); /* Final NULL char */
|
||||
DeviceNameU.Buffer = ExAllocatePool(PagedPool, DeviceNameU.MaximumLength);
|
||||
DeviceNameU.Buffer = ExAllocatePoolWithTag(PagedPool, DeviceNameU.MaximumLength, CLASS_TAG);
|
||||
if (!DeviceNameU.Buffer)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
Status = RtlAppendUnicodeToString(&DeviceNameU, L"\\Device\\");
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -325,7 +336,7 @@ CreateClassDeviceObject(
|
|||
cleanup:
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(DeviceNameU.Buffer);
|
||||
ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -338,11 +349,11 @@ cleanup:
|
|||
KeInitializeSpinLock(&DeviceExtension->SpinLock);
|
||||
DeviceExtension->ReadIsPending = FALSE;
|
||||
DeviceExtension->InputCount = 0;
|
||||
DeviceExtension->PortData = ExAllocatePool(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(MOUSE_INPUT_DATA));
|
||||
DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA), CLASS_TAG);
|
||||
if (!DeviceExtension->PortData)
|
||||
{
|
||||
ExFreePool(DeviceNameU.Buffer);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
DeviceExtension->DeviceName = DeviceNameU.Buffer;
|
||||
Fdo->Flags |= DO_POWER_PAGABLE;
|
||||
|
@ -524,8 +535,7 @@ ConnectPortDriver(
|
|||
CONNECT_DATA ConnectData;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Connecting PortDO %p [%wZ] to ClassDO %p\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName, ClassDO);
|
||||
DPRINT("Connecting PortDO %p to ClassDO %p\n", PortDO, ClassDO);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
|
||||
|
@ -581,8 +591,7 @@ DestroyPortDriver(
|
|||
KIRQL OldIrql;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Destroying PortDO %p [%wZ]\n",
|
||||
PortDO, &PortDO->DriverObject->DriverName);
|
||||
DPRINT("Destroying PortDO %p\n", PortDO);
|
||||
|
||||
DeviceExtension = (PPORT_DEVICE_EXTENSION)PortDO->DeviceExtension;
|
||||
ClassDeviceExtension = DeviceExtension->ClassDO->DeviceExtension;
|
||||
|
@ -620,8 +629,8 @@ DestroyPortDriver(
|
|||
|
||||
if (!DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
|
||||
{
|
||||
ExFreePool(ClassDeviceExtension->PortData);
|
||||
ExFreePool((PVOID)ClassDeviceExtension->DeviceName);
|
||||
ExFreePoolWithTag(ClassDeviceExtension->PortData, CLASS_TAG);
|
||||
ExFreePoolWithTag((PVOID)ClassDeviceExtension->DeviceName, CLASS_TAG);
|
||||
IoDeleteDevice(DeviceExtension->ClassDO);
|
||||
}
|
||||
|
||||
|
@ -814,11 +823,11 @@ SearchForLegacyDrivers(
|
|||
|
||||
/* Allocate memory */
|
||||
Size = sizeof(KEY_VALUE_BASIC_INFORMATION) + MAX_PATH;
|
||||
KeyValueInformation = ExAllocatePool(PagedPool, Size);
|
||||
KeyValueInformation = ExAllocatePoolWithTag(PagedPool, Size, CLASS_TAG);
|
||||
if (!KeyValueInformation)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -869,7 +878,7 @@ SearchForLegacyDrivers(
|
|||
DPRINT("IoGetDeviceObjectPointer(%wZ) failed with status 0x%08lx\n", &PortName, Status);
|
||||
continue;
|
||||
}
|
||||
DPRINT("Legacy driver found: %wZ\n", &PortDeviceObject->DriverObject->DriverName);
|
||||
DPRINT("Legacy driver found\n");
|
||||
|
||||
Status = ClassAddDevice(DriverObject, PortDeviceObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -881,7 +890,7 @@ SearchForLegacyDrivers(
|
|||
|
||||
cleanup:
|
||||
if (KeyValueInformation != NULL)
|
||||
ExFreePool(KeyValueInformation);
|
||||
ExFreePoolWithTag(KeyValueInformation, CLASS_TAG);
|
||||
if (hDeviceMapKey != (HANDLE)-1)
|
||||
ZwClose(hDeviceMapKey);
|
||||
if (hPortKey != (HANDLE)-1)
|
||||
|
|
|
@ -2,27 +2,16 @@
|
|||
#include <kbdmou.h>
|
||||
#include <ntddkbd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#include <pseh/pseh.h>
|
||||
#include <debug.h>
|
||||
#elif defined(_MSC_VER)
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||
#define DPRINT
|
||||
#define CHECKPOINT
|
||||
#define _SEH_TRY __try
|
||||
#define _SEH_HANDLE __except(1)
|
||||
#define _SEH_END
|
||||
#define _SEH_GetExceptionCode() GetExceptionCode()
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
#include <pseh/pseh.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
#define CLASS_TAG TAG('M', 'o', 'u', 'C')
|
||||
|
||||
typedef enum
|
||||
{
|
||||
dsStopped,
|
||||
|
@ -83,10 +72,7 @@ ForwardIrpAndWait(
|
|||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
ForwardIrpAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
DRIVER_DISPATCH ForwardIrpAndForget;
|
||||
|
||||
NTSTATUS
|
||||
DuplicateUnicodeString(
|
||||
|
|
|
@ -186,9 +186,12 @@ SermousePnp(
|
|||
PDEVICE_RELATIONS DeviceRelations = NULL;
|
||||
DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
|
||||
|
||||
DeviceRelations = ExAllocatePool(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS, Objects));
|
||||
DeviceRelations = ExAllocatePoolWithTag(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS, Objects), SERMOUSE_TAG);
|
||||
if (!DeviceRelations)
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
{
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
DeviceRelations->Count = 0;
|
||||
|
|
|
@ -43,11 +43,11 @@ ReadRegistryEntries(
|
|||
|
||||
ParametersRegistryKey.Length = 0;
|
||||
ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
|
||||
ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
|
||||
ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, SERMOUSE_TAG);
|
||||
if (!ParametersRegistryKey.Buffer)
|
||||
{
|
||||
DPRINT("ExAllocatePool() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
|
||||
RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
|
||||
|
@ -80,7 +80,7 @@ ReadRegistryEntries(
|
|||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ExFreePool(ParametersRegistryKey.Buffer);
|
||||
ExFreePoolWithTag(ParametersRegistryKey.Buffer, SERMOUSE_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,17 +2,10 @@
|
|||
#include <kbdmou.h>
|
||||
#include <ntddser.h>
|
||||
#include <ntddmou.h>
|
||||
#include <debug.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#include <debug.h>
|
||||
#elif defined(_MSC_VER)
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||
#define DPRINT
|
||||
#define CHECKPOINT
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
#define SERMOUSE_TAG TAG('S', 'M', 'o', 'u')
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue