Alexandre Julliard : ntdll:
Added support for the HEAP_CREATE_ENABLE_EXECUTE flag.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Dec 6 05:48:56 CST 2006
Module: wine
Branch: master
Commit: a10c40df231121cf7580dad1cac6eee02fc91902
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a10c40df231121cf7580dad1cac6eee02fc91902
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 5 15:43:13 2006 +0100
ntdll: Added support for the HEAP_CREATE_ENABLE_EXECUTE flag.
---
dlls/ntdll/heap.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 53f2695..2f52aec 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -201,6 +201,12 @@ static inline unsigned int get_freelist_
return i;
}
+/* get the memory protection type to use for a given heap */
+static inline ULONG get_protection_type( DWORD flags )
+{
+ return (flags & HEAP_CREATE_ENABLE_EXECUTE) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
+}
+
static RTL_CRITICAL_SECTION_DEBUG process_heap_critsect_debug =
{
0, 0, NULL, /* will be set later */
@@ -411,7 +417,7 @@ static inline BOOL HEAP_Commit( SUBHEAP
size -= subheap->commitSize;
ptr = (char *)subheap + subheap->commitSize;
if (NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, 0,
- &size, MEM_COMMIT, PAGE_READWRITE ))
+ &size, MEM_COMMIT, get_protection_type( subheap->heap->flags ) ))
{
WARN("Could not commit %08lx bytes at %p for heap %p\n",
size, ptr, subheap->heap );
@@ -594,7 +600,7 @@ static BOOL HEAP_InitSubHeap( HEAP *heap
if (flags & HEAP_SHARED)
commitSize = totalSize; /* always commit everything in a shared heap */
if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 0,
- &commitSize, MEM_COMMIT, PAGE_READWRITE ))
+ &commitSize, MEM_COMMIT, get_protection_type( flags ) ))
{
WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
return FALSE;
@@ -690,7 +696,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP
{
/* allocate the memory block */
if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 0, &totalSize,
- MEM_RESERVE, PAGE_READWRITE ))
+ MEM_RESERVE, get_protection_type( flags ) ))
{
WARN("Could not allocate %08lx bytes\n", totalSize );
return NULL;
More information about the wine-cvs
mailing list