Write section access also assumes read access

Dmitry Timoshkov dmitry at baikal.ru
Mon Feb 16 18:54:49 CST 2004


Hello,

This patch fixes resource access for some (broken) DLLs, which
have only IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE
set in their .rsrc section. An example of such a DLL is fmres.dll
provided by FrameMaker.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Write section access also assumes read access.

--- cvs/hq/wine/dlls/ntdll/virtual.c	2004-02-12 15:35:46.000000000 +0800
+++ wine/dlls/ntdll/virtual.c	2004-02-17 08:42:48.000000000 +0800
@@ -350,7 +350,7 @@ static int VIRTUAL_GetUnixProt( BYTE vpr
     if ((vprot & VPROT_COMMITTED) && !(vprot & VPROT_GUARD))
     {
         if (vprot & VPROT_READ) prot |= PROT_READ;
-        if (vprot & VPROT_WRITE) prot |= PROT_WRITE;
+        if (vprot & VPROT_WRITE) prot |= PROT_READ | PROT_WRITE;
         if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE;
         if (vprot & VPROT_EXEC) prot |= PROT_EXEC;
     }
@@ -763,7 +763,7 @@ static NTSTATUS map_image( HANDLE hmappi
         DWORD size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
         BYTE vprot = VPROT_COMMITTED;
         if (sec->Characteristics & IMAGE_SCN_MEM_READ)    vprot |= VPROT_READ;
-        if (sec->Characteristics & IMAGE_SCN_MEM_WRITE)   vprot |= VPROT_WRITE|VPROT_WRITECOPY;
+        if (sec->Characteristics & IMAGE_SCN_MEM_WRITE)   vprot |= PROT_READ|VPROT_WRITE|VPROT_WRITECOPY;
         if (sec->Characteristics & IMAGE_SCN_MEM_EXECUTE) vprot |= VPROT_EXEC;
 
         /* make sure the import directory is writable */






More information about the wine-patches mailing list