[NTOS:MM]

- Add a way to generate a pool tag from the calling driver name if none is specified. Disabled by default.

svn path=/trunk/; revision=64889
This commit is contained in:
Thomas Faber 2014-10-22 13:26:50 +00:00
parent 2e4b0e9661
commit 6256673633

View file

@ -2046,10 +2046,25 @@ NTAPI
ExAllocatePool(POOL_TYPE PoolType,
SIZE_T NumberOfBytes)
{
//
// Use a default tag of "None"
//
return ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_NONE);
ULONG Tag = TAG_NONE;
#if 0 && DBG
PLDR_DATA_TABLE_ENTRY LdrEntry;
/* Use the first four letters of the driver name, or "None" if unavailable */
LdrEntry = KeGetCurrentIrql() <= APC_LEVEL
? MiLookupDataTableEntry(_ReturnAddress())
: NULL;
if (LdrEntry)
{
ULONG i;
Tag = 0;
for (i = 0; i < min(4, LdrEntry->BaseDllName.Length / sizeof(WCHAR)); i++)
Tag = Tag >> 8 | (LdrEntry->BaseDllName.Buffer[i] & 0xff) << 24;
for (; i < 4; i++)
Tag = Tag >> 8 | ' ' << 24;
}
#endif
return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
}
/*
@ -2513,7 +2528,7 @@ ExAllocatePoolWithQuota(IN POOL_TYPE PoolType,
//
// Allocate the pool
//
return ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, 'enoN');
return ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, TAG_NONE);
}
/*