From 8a43a43a9c201fa4d8cd052f99e50b72dad4cf5c Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Wed, 9 Feb 2022 20:35:21 +0100 Subject: [PATCH] Update pool.c --- Sandboxie/common/pool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sandboxie/common/pool.c b/Sandboxie/common/pool.c index c0e523bf..7551ed42 100644 --- a/Sandboxie/common/pool.c +++ b/Sandboxie/common/pool.c @@ -373,7 +373,7 @@ static const WCHAR *Pool_large_chunks_lock_Name = L"PoolLockL"; ALIGNED void *Pool_Alloc_Mem(ULONG size, ULONG tag) { - void *ptr; + void *ptr = NULL; Pool_Timing(NULL); @@ -382,7 +382,9 @@ ALIGNED void *Pool_Alloc_Mem(ULONG size, ULONG tag) #ifdef KERNEL_MODE ptr = ExAllocatePoolWithTag(PagedPool, size, tag); #else - ptr = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, + //ptr = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, + ULONG_PTR RegionSize = size; + NtAllocateVirtualMemory(NtCurrentProcess(), &ptr, 0, &RegionSize, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, ((UCHAR)tag == 0xFF ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE)); #endif // printf("Allocated %d bytes at %08X\n", size, ptr);