Alexandre Julliard : ntdll: Use the right section size when setting protections.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 31 04:32:05 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: f114ba119cd495af76319dd76220f8f0f862d985
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=f114ba119cd495af76319dd76220f8f0f862d985

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Jul 30 09:59:46 2006 +0200

ntdll: Use the right section size when setting protections.

Use the same size computation when setting section protections than
when mapping it in the first place (reported by Nicholas Miell).

---

 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 65b929d..f7b829f 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1150,8 +1150,14 @@ static NTSTATUS map_image( HANDLE hmappi
     sec = (IMAGE_SECTION_HEADER*)((char *)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader);
     for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
     {
-        SIZE_T size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
+        SIZE_T size;
         BYTE vprot = VPROT_COMMITTED;
+
+        if (sec->Misc.VirtualSize)
+            size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
+        else
+            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;




More information about the wine-cvs mailing list