[PATCH 3/3] Specify PAGE_EXECUTE_READWRITE when NonPagedPoolExecute is requested.

Derek Lesho dereklesho52 at gmail.com
Sat Sep 1 00:41:01 CDT 2018


Make wine allocate executable memory when the driver requests it.
BEDaisy.sys, battleye's driver uses this POOL_TYPE, resulting in a page
fault on execute access if the memory is not executable.

Signed-off-by: Derek Lesho <dereklesho52 at Gmail.com>
---
 dlls/ntoskrnl.exe/ntoskrnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 53cf37febe..f32ef58080 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 = VirtualAlloc( NULL, size, (MEM_RESERVE | MEM_COMMIT), PAGE_READWRITE );
+    void *ret = VirtualAlloc( NULL, size, (MEM_RESERVE | MEM_COMMIT), (type==NonPagedPoolExecute) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE );
     TRACE( "%lu pool %u -> %p\n", size, type, ret );
     return ret;
 }
-- 
2.18.0




More information about the wine-devel mailing list