[NTOSKRNL] Add support for callback when enumerating large pool allocations

This commit is contained in:
Pierre Schweitzer 2019-01-15 22:07:35 +01:00
parent 7e396787ed
commit d9a3fd16d4
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -218,7 +218,9 @@ static
VOID VOID
ExpKdbgExtPoolFindLargePool( ExpKdbgExtPoolFindLargePool(
ULONG Tag, ULONG Tag,
ULONG Mask) ULONG Mask,
VOID (NTAPI* FoundCallback)(PVOID, PVOID),
PVOID CallbackContext)
{ {
ULONG i; ULONG i;
@ -234,10 +236,17 @@ ExpKdbgExtPoolFindLargePool(
if ((PoolBigPageTable[i].Key & Mask) == (Tag & Mask)) if ((PoolBigPageTable[i].Key & Mask) == (Tag & Mask))
{ {
/* Print the line */ if (FoundCallback != NULL)
KdbpPrint("%p: tag %.4s, size: %I64x\n", {
PoolBigPageTable[i].Va, (PCHAR)&PoolBigPageTable[i].Key, FoundCallback(PoolBigPageTable[i].Va, CallbackContext);
PoolBigPageTable[i].NumberOfPages << PAGE_SHIFT); }
else
{
/* Print the line */
KdbpPrint("%p: tag %.4s, size: %I64x\n",
PoolBigPageTable[i].Va, (PCHAR)&PoolBigPageTable[i].Key,
PoolBigPageTable[i].NumberOfPages << PAGE_SHIFT);
}
} }
} }
} }
@ -456,7 +465,7 @@ ExpKdbgExtPoolFind(
} }
/* First search for large allocations */ /* First search for large allocations */
ExpKdbgExtPoolFindLargePool(Tag, Mask); ExpKdbgExtPoolFindLargePool(Tag, Mask, NULL, NULL);
if (PoolType == NonPagedPool) if (PoolType == NonPagedPool)
{ {