[PATCH 2/3] Replace HeapAlloc with VirtualAlloc in Ex(Allocate/Free)PoolWithTag
Derek Lesho
dereklesho52 at gmail.com
Sat Sep 1 00:41:00 CDT 2018
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 <dereklesho52 at Gmail.com>
---
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
More information about the wine-devel
mailing list