Marcus Meissner : ntdll: Check and fix PE header protections.

Alexandre Julliard julliard at winehq.org
Thu Dec 2 16:30:53 CST 2010


Module: wine
Branch: stable
Commit: ab3d4bc27b2ef39f432ff9d73b76820d3bc8c659
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab3d4bc27b2ef39f432ff9d73b76820d3bc8c659

Author: Marcus Meissner <meissner at suse.de>
Date:   Mon Nov  8 03:34:27 2010 +0100

ntdll: Check and fix PE header protections.

(cherry picked from commit 2e7dc3578663f052b8ee1d39df4a2ad41ed02300)

---

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

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 1428be0..7e2fb8b 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1416,10 +1416,13 @@ NTSTATUS virtual_create_builtin_view( void *module )
 
     if (status) return status;
 
+    /* The PE header is always read-only, no write, no execute. */
+    view->prot[0] = VPROT_COMMITTED | VPROT_READ;
+
     sec = (IMAGE_SECTION_HEADER *)((char *)&nt->OptionalHeader + nt->FileHeader.SizeOfOptionalHeader);
     for (i = 0; i < nt->FileHeader.NumberOfSections; i++)
     {
-        DWORD flags = VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED;
+        BYTE flags = VPROT_COMMITTED;
 
         if (sec[i].Characteristics & IMAGE_SCN_MEM_EXECUTE) flags |= VPROT_EXEC;
         if (sec[i].Characteristics & IMAGE_SCN_MEM_READ) flags |= VPROT_READ;




More information about the wine-cvs mailing list