DOS: fix loading of DOS exe files

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

 



Hello,

the attached patch fixes a problem when loading DOS exe files which have
4 bytes on the last page of the executable. There is no comment in the
code and i googled and couldn't find any reason or hint why having 4
bytes on the last page is special and why we should than load the full
512 bytes of the last page (i'm CC'ing wine-devel just in case). This
prevents some of the "PC Intern 4, Systemprogrammierung" DOS example
files from running with an 'invalid exe file' error.

License: LGPL, X11
Changelog:
	Michael Stefaniuc <mstefani@xxxxxxxxxx>
	- do not load the full last page of a DOS EXE if we have only 4
	  bytes in it.

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@xxxxxxxxxx
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: dlls/winedos/module.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/module.c,v
retrieving revision 1.41
diff -u -r1.41 module.c
--- dlls/winedos/module.c	9 Jan 2004 22:18:50 -0000	1.41
+++ dlls/winedos/module.c	16 Jan 2004 01:21:34 -0000
@@ -232,7 +232,7 @@
   /* calculate load size */
   image_start=mz_header.e_cparhdr<<4;
   image_size=mz_header.e_cp<<9; /* pages are 512 bytes */
-  if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp;
+  if (mz_header.e_cblp!=0) image_size-=512-mz_header.e_cblp;
   image_size-=image_start;
   min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4);
   max_size=image_size+((DWORD)mz_header.e_maxalloc<<4)+(PSP_SIZE<<4);

Attachment: pgp00214.pgp
Description: PGP signature


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

  Powered by Linux