[HIDCLASS]

- Use pool tagging

svn path=/trunk/; revision=59005
This commit is contained in:
Thomas Faber 2013-05-12 15:44:58 +00:00
parent bac0a3658f
commit 9c5af92297
4 changed files with 25 additions and 19 deletions

View file

@ -294,7 +294,9 @@ HidClassFDO_GetDescriptors(
//
// now allocate space for the report descriptor
//
FDODeviceExtension->ReportDescriptor = (PUCHAR)ExAllocatePool(NonPagedPool, FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength);
FDODeviceExtension->ReportDescriptor = ExAllocatePoolWithTag(NonPagedPool,
FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength,
HIDCLASS_TAG);
if (!FDODeviceExtension->ReportDescriptor)
{
//
@ -444,7 +446,9 @@ HidClassFDO_CopyDeviceRelations(
//
// allocate result
//
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool(NonPagedPool, sizeof(DEVICE_RELATIONS) + (FDODeviceExtension->DeviceRelations->Count-1) * sizeof(PDEVICE_OBJECT));
DeviceRelations = ExAllocatePoolWithTag(NonPagedPool,
sizeof(DEVICE_RELATIONS) + (FDODeviceExtension->DeviceRelations->Count-1) * sizeof(PDEVICE_OBJECT),
HIDCLASS_TAG);
if (!DeviceRelations)
{
//

View file

@ -184,7 +184,7 @@ HidClass_Create(
//
// allocate context
//
Context = (PHIDCLASS_FILEOP_CONTEXT)ExAllocatePool(NonPagedPool, sizeof(HIDCLASS_FILEOP_CONTEXT));
Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(HIDCLASS_FILEOP_CONTEXT), HIDCLASS_TAG);
if (!Context)
{
//
@ -344,7 +344,7 @@ HidClass_Close(
//
// free context
//
ExFreePool(IrpContext);
ExFreePoolWithTag(IrpContext, HIDCLASS_TAG);
//
// complete request
@ -462,7 +462,7 @@ HidClass_ReadCompleteIrp(
//
// free input report buffer
//
ExFreePool(IrpContext->InputReportBuffer);
ExFreePoolWithTag(IrpContext->InputReportBuffer, HIDCLASS_TAG);
//
// remove us from pending list
@ -517,7 +517,7 @@ HidClass_ReadCompleteIrp(
//
// free irp context
//
ExFreePool(IrpContext);
ExFreePoolWithTag(IrpContext, HIDCLASS_TAG);
//
// done
@ -611,7 +611,7 @@ HidClass_BuildIrp(
//
// allocate completion context
//
IrpContext = ExAllocatePool(NonPagedPool, sizeof(HIDCLASS_IRP_CONTEXT));
IrpContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(HIDCLASS_IRP_CONTEXT), HIDCLASS_TAG);
if (!IrpContext)
{
//
@ -673,14 +673,14 @@ HidClass_BuildIrp(
//
// allocate buffer
//
IrpContext->InputReportBuffer = ExAllocatePool(NonPagedPool, IrpContext->InputReportBufferLength);
IrpContext->InputReportBuffer = ExAllocatePoolWithTag(NonPagedPool, IrpContext->InputReportBufferLength, HIDCLASS_TAG);
if (!IrpContext->InputReportBuffer)
{
//
// no memory
//
IoFreeIrp(Irp);
ExFreePool(IrpContext);
ExFreePoolWithTag(IrpContext, HIDCLASS_TAG);
return STATUS_INSUFFICIENT_RESOURCES;
}

View file

@ -98,7 +98,7 @@ HidClassPDO_HandleQueryDeviceId(
//
// allocate new buffer
//
NewBuffer = (LPWSTR)ExAllocatePool(NonPagedPool, (Length + 1) * sizeof(WCHAR));
NewBuffer = ExAllocatePoolWithTag(NonPagedPool, (Length + 1) * sizeof(WCHAR), HIDCLASS_TAG);
if (!NewBuffer)
{
//
@ -127,7 +127,7 @@ HidClassPDO_HandleQueryDeviceId(
//
// free old buffer
//
ExFreePool(Buffer);
ExFreePoolWithTag(Buffer, 0);
//
// store result
@ -249,12 +249,12 @@ HidClassPDO_HandleQueryHardwareId(
//
// free old buffer
//
ExFreePool((PVOID)Irp->IoStatus.Information);
ExFreePoolWithTag((PVOID)Irp->IoStatus.Information, 0);
//
// allocate buffer
//
Ptr = (LPWSTR)ExAllocatePool(NonPagedPool, (Offset + 1) * sizeof(WCHAR));
Ptr = ExAllocatePoolWithTag(NonPagedPool, (Offset + 1) * sizeof(WCHAR), HIDCLASS_TAG);
if (!Ptr)
{
//
@ -294,7 +294,7 @@ HidClassPDO_HandleQueryInstanceId(
//
// allocate buffer
//
Buffer = ExAllocatePool(NonPagedPool, 5 * sizeof(WCHAR));
Buffer = ExAllocatePoolWithTag(NonPagedPool, 5 * sizeof(WCHAR), HIDCLASS_TAG);
if (!Buffer)
{
//
@ -322,7 +322,7 @@ HidClassPDO_HandleQueryCompatibleId(
{
LPWSTR Buffer;
Buffer = (LPWSTR)ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR));
Buffer = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), HIDCLASS_TAG);
if (!Buffer)
{
//
@ -437,7 +437,7 @@ HidClassPDO_PnP(
//
//
//
BusInformation = (PPNP_BUS_INFORMATION)ExAllocatePool(NonPagedPool, sizeof(PNP_BUS_INFORMATION));
BusInformation = ExAllocatePoolWithTag(NonPagedPool, sizeof(PNP_BUS_INFORMATION), HIDCLASS_TAG);
//
// fill in result
@ -478,7 +478,7 @@ HidClassPDO_PnP(
//
// allocate device relations
//
DeviceRelation = (PDEVICE_RELATIONS)ExAllocatePool(NonPagedPool, sizeof(DEVICE_RELATIONS));
DeviceRelation = ExAllocatePoolWithTag(NonPagedPool, sizeof(DEVICE_RELATIONS), HIDCLASS_TAG);
if (!DeviceRelation)
{
//
@ -649,7 +649,7 @@ HidClassPDO_CreatePDO(
// first allocate device relations
//
Length = sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * FDODeviceExtension->Common.DeviceDescription.CollectionDescLength;
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool(NonPagedPool, Length);
DeviceRelations = ExAllocatePoolWithTag(NonPagedPool, Length, HIDCLASS_TAG);
if (!DeviceRelations)
{
//
@ -760,7 +760,7 @@ HidClassPDO_CreatePDO(
//
// free device relations
//
ExFreePool(DeviceRelations);
ExFreePoolWithTag(DeviceRelations, HIDCLASS_TAG);
return Status;
}

View file

@ -10,6 +10,8 @@
#include <wdmguid.h>
#include <debug.h>
#define HIDCLASS_TAG 'CdiH'
typedef struct
{
PDRIVER_OBJECT DriverObject;