[ros-dev] [ros-diffs] [tfaber] 64889: [NTOS:MM] - Add a way to generate a pool tag from the calling driver name if none is specified. Disabled by default.
Timo Kreuzer
timo.kreuzer at web.de
Wed Oct 22 19:19:07 UTC 2014
Simpler:
+ if (LdrEntry)
+ {
+ ULONG i;
+ Tag = '____'; // IMO better than ' '
+ for (i = 0; i < min(4, LdrEntry->BaseDllName.Length / sizeof(WCHAR)); i++)
+ ((PCHAR)&Tag)[i] = (LdrEntry->BaseDllName.Buffer[i] & 0xff);
+ }
Maybe we can also add support for tracking backtraces of pool allocations.
Am 22.10.2014 15:26, schrieb tfaber at svn.reactos.org:
> Author: tfaber
> Date: Wed Oct 22 13:26:50 2014
> New Revision: 64889
>
> URL: http://svn.reactos.org/svn/reactos?rev=64889&view=rev
> Log:
> [NTOS:MM]
> - Add a way to generate a pool tag from the calling driver name if none is specified. Disabled by default.
>
> Modified:
> trunk/reactos/ntoskrnl/mm/ARM3/expool.c
>
> Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?rev=64889&r1=64888&r2=64889&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Wed Oct 22 13:26:50 2014
> @@ -2046,10 +2046,25 @@
> 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 @@
> //
> // Allocate the pool
> //
> - return ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, 'enoN');
> + return ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, TAG_NONE);
> }
>
> /*
>
>
>
More information about the Ros-dev
mailing list