Alexandre Julliard : ntdll: Fix protection flags for uninitialized sections .

Alexandre Julliard julliard at winehq.org
Fri Sep 9 10:56:45 CDT 2011


Module: wine
Branch: master
Commit: 33b0f0edffa0c8a06b4ee8831c92fdc373f83ece
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=33b0f0edffa0c8a06b4ee8831c92fdc373f83ece

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Sep  9 12:29:20 2011 +0200

ntdll: Fix protection flags for uninitialized sections.

---

 dlls/ntdll/virtual.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 6699de1..10fba17 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1341,8 +1341,14 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
             size = ROUND_SIZE( sec->VirtualAddress, sec->SizeOfRawData );
 
         if (sec->Characteristics & IMAGE_SCN_MEM_READ)    vprot |= VPROT_READ;
-        if (sec->Characteristics & IMAGE_SCN_MEM_WRITE)   vprot |= VPROT_READ | VPROT_WRITECOPY;
         if (sec->Characteristics & IMAGE_SCN_MEM_EXECUTE) vprot |= VPROT_EXEC;
+        if (sec->Characteristics & IMAGE_SCN_MEM_WRITE)
+        {
+            if (sec->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
+                vprot |= VPROT_READ | VPROT_WRITE;
+            else
+                vprot |= VPROT_READ | VPROT_WRITECOPY;
+        }
 
         /* Dumb game crack lets the AOEP point into a data section. Adjust. */
         if ((nt->OptionalHeader.AddressOfEntryPoint >= sec->VirtualAddress) &&




More information about the wine-cvs mailing list