PATCH: PE / DOS exe detection fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

There is a demo executable that is detected as DOS exe instead of PE exe (which it is).
The problem is that the programmer shortened it by pointing the PE header into MZ header.

Apparently this is valid on Windows, so I drop this check in MODULE_GetBinaryType.

This is from Bug 1919.

Ciao, Marcus

Changelog:
	Removed too strict header check to enable execution of handcoded PE exes.


Index: dlls/kernel/module.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/module.c,v
retrieving revision 1.2
diff -u -r1.2 module.c
--- dlls/kernel/module.c	27 Nov 2003 00:59:36 -0000	1.2
+++ dlls/kernel/module.c	30 Dec 2003 16:53:53 -0000
@@ -196,8 +196,12 @@
          * structure encompasses the "Offset to extended header"
          * field.
          */
-        if (header.mz.e_lfanew < sizeof(IMAGE_DOS_HEADER))
-            return BINARY_DOS;
+        /* This check is too strict. Some funny demo programmers use a pointer into 
+	 * the MZ header to shorten their binaries. Rely that the other magic triggers
+	 * for invalid files. Marcus
+	 * if (header.mz.e_lfanew < sizeof(IMAGE_DOS_HEADER))
+         *   return BINARY_DOS;
+	 */
         if (SetFilePointer( hfile, header.mz.e_lfanew, NULL, SEEK_SET ) == -1)
             return BINARY_DOS;
         if (!ReadFile( hfile, magic, sizeof(magic), &len, NULL ) || len != sizeof(magic))
-- 


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux