PATCH: (resubmit) make section with EntryPoint executable

Marcus Meissner marcus at jet.franken.de
Sat May 6 08:16:39 CDT 2006


Hi,

One of the game cracks reportedly had the section
of the AddressOfEntryPoint in not executable.

This does not make sense, so I added a workaround for this.

Ciao, Marcus

Changelog:
	Make the section with AddressOfEntryPoint in it executable.

Index: dlls/ntdll/virtual.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/virtual.c,v
retrieving revision 1.88
diff -u -r1.88 virtual.c
--- dlls/ntdll/virtual.c	8 Apr 2006 18:13:41 -0000	1.88
+++ dlls/ntdll/virtual.c	6 May 2006 13:15:25 -0000
@@ -1072,6 +1072,12 @@
         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;
+
+	/* Dumb game crack let the AOEP point into a data section. Adjust. */
+        if (	(nt->OptionalHeader.AddressOfEntryPoint >= sec->VirtualAddress) &&
+        	(nt->OptionalHeader.AddressOfEntryPoint < sec->VirtualAddress + size)
+	)
+		vprot |= VPROT_EXEC;
         VIRTUAL_SetProt( view, ptr + sec->VirtualAddress, size, vprot );
     }
 



More information about the wine-patches mailing list