From 18b93df55d3d3d0fe841255a833b6500de527638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 22 Mar 2024 16:34:40 +0800 Subject: [PATCH] Update buffer.c --- libs/minhook/src/buffer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/minhook/src/buffer.c b/libs/minhook/src/buffer.c index 31cefa4..3c21a43 100644 --- a/libs/minhook/src/buffer.c +++ b/libs/minhook/src/buffer.c @@ -217,6 +217,12 @@ static PMEMORY_BLOCK GetMemoryBlock(LPVOID pOrigin) break; } } + + if (pBlock == NULL) + { + pBlock=(PMEMORY_BLOCK)VirtualAlloc( + (LPVOID)minAddr, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + } #else // In x86 mode, a memory block can be placed anywhere. pBlock = (PMEMORY_BLOCK)VirtualAlloc(