From: Derek Lesho Subject: [PATCH 2/3] Replace HeapAlloc with VirtualAlloc in Ex(Allocate/Free)PoolWithTag Message-Id: <20180901054101.2032-2-dereklesho52@Gmail.com> Date: Sat, 1 Sep 2018 01:41:00 -0400 In-Reply-To: <20180901054101.2032-1-dereklesho52@Gmail.com> References: <20180901054101.2032-1-dereklesho52@Gmail.com> Switches the use of HeapAlloc with VirtualAlloc in order to allow for executable memory to be allocated, which is needed when the NonPagedPoolExecute POOL_TYPE is specified as a parameter. Signed-off-by: Derek Lesho --- dlls/ntoskrnl.exe/ntoskrnl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 577f5b3ba4..53cf37febe 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -1933,7 +1933,7 @@ PVOID WINAPI ExAllocatePoolWithQuota( POOL_TYPE type, SIZE_T size ) PVOID WINAPI ExAllocatePoolWithTag( POOL_TYPE type, SIZE_T size, ULONG tag ) { /* FIXME: handle page alignment constraints */ - void *ret = HeapAlloc( GetProcessHeap(), 0, size ); + void *ret = VirtualAlloc( NULL, size, (MEM_RESERVE | MEM_COMMIT), PAGE_READWRITE ); TRACE( "%lu pool %u -> %p\n", size, type, ret ); return ret; } @@ -1993,7 +1993,7 @@ void WINAPI ExFreePool( void *ptr ) void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag ) { TRACE( "%p\n", ptr ); - HeapFree( GetProcessHeap(), 0, ptr ); + VirtualFree( ptr, 0, MEM_RELEASE ); } -- 2.18.0