PATCH: mark section with AddressOfEntryPoint executable

Marcus Meissner marcus at jet.franken.de
Sat Apr 22 08:28:49 CDT 2006


Hi,

Some broken game cracks create non-executable sections
with the AddressOfEntryPoint pointing into them.

This marks them as executable.

Ciao, Marcus

Changelog:
	Mark the section with the program entry point as 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	22 Apr 2006 12:53:46 -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