[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 // 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) if (!FDODeviceExtension->ReportDescriptor)
{ {
// //
@ -444,7 +446,9 @@ HidClassFDO_CopyDeviceRelations(
// //
// allocate result // 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) if (!DeviceRelations)
{ {
// //

View file

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

View file

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

View file

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