EngAllocMem:
 - Respect the FL_NONPAGED_MEMORY flag (actually allocate the memory from non-paged pool)
 - Fix an improper flag comparison that caused memory allocated with both FL_NONPAGED_MEMORY and FL_ZERO_MEMORY set to not be zeroed as requested

svn path=/trunk/; revision=54669
This commit is contained in:
Cameron Gutman 2011-12-17 08:35:31 +00:00
parent 70bb5d0a00
commit 94322ba2cb

View file

@ -21,12 +21,15 @@ EngAllocMem(ULONG Flags,
{ {
PVOID newMem; PVOID newMem;
newMem = ExAllocatePoolWithTag(PagedPool, MemSize, Tag); newMem = ExAllocatePoolWithTag((Flags & FL_NONPAGED_MEMORY) ? NonPagedPool : PagedPool,
MemSize,
Tag);
if (Flags == FL_ZERO_MEMORY && NULL != newMem) if (newMem == NULL)
{ return NULL;
if (Flags & FL_ZERO_MEMORY)
RtlZeroMemory(newMem, MemSize); RtlZeroMemory(newMem, MemSize);
}
return newMem; return newMem;
} }