mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[NTOS:MM] Randomly allocate from special pool
This commit is contained in:
parent
cf373fbc57
commit
3ccbd2a842
2 changed files with 5 additions and 4 deletions
|
@ -26,7 +26,7 @@ MM_PAGED_POOL_INFO MmPagedPoolInfo;
|
|||
SIZE_T MmAllocatedNonPagedPool;
|
||||
SIZE_T MmTotalNonPagedPoolQuota;
|
||||
SIZE_T MmTotalPagedPoolQuota;
|
||||
ULONG MmSpecialPoolTag;
|
||||
ULONG MmSpecialPoolTag = 1;
|
||||
ULONG MmConsumedPoolPercentage;
|
||||
BOOLEAN MmProtectFreedNonPagedPool;
|
||||
SLIST_HEADER MiNonPagedPoolSListHead;
|
||||
|
|
|
@ -76,18 +76,19 @@ BOOLEAN
|
|||
NTAPI
|
||||
MmUseSpecialPool(SIZE_T NumberOfBytes, ULONG Tag)
|
||||
{
|
||||
static ULONG Seed = 0x5eed1234;
|
||||
/* Special pool is not suitable for allocations bigger than 1 page */
|
||||
if (NumberOfBytes > (PAGE_SIZE - sizeof(POOL_HEADER)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (MmSpecialPoolTag == '*')
|
||||
if (Tag == 'enoN')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return Tag == MmSpecialPoolTag;
|
||||
Seed = Seed * 16807 % 0x7fffffff;
|
||||
return Seed % 11 == 2;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
Loading…
Reference in a new issue