Hello, License: LGPL, X11 Changelog: Michael Stefaniuc <mstefani@xxxxxxxxxx> - fix DOS EXE loader for the case where we realy have only 4 bytes on the last page of the exe 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 23:40:43 -0000 @@ -232,6 +232,9 @@ /* calculate load size */ image_start=mz_header.e_cparhdr<<4; image_size=mz_header.e_cp<<9; /* pages are 512 bytes */ + /* From Ralf Brown Interrupt List: If the word at offset 02h is 4, it should + * be treated as 00h, since pre-1.10 versions of the MS linker set it that + * way. */ if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp; image_size-=image_start; min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4); @@ -274,8 +277,12 @@ TRACE("loading DOS %s image, %08lx bytes\n",old_com?"COM":"EXE",image_size); SetFilePointer(hFile,image_start,NULL,FILE_BEGIN); if (!ReadFile(hFile,load_start,image_size,&len,NULL) || len != image_size) { - SetLastError(ERROR_BAD_FORMAT); - goto load_error; + /* check if this is due to the workaround for the pre-1.10 MS linker and we + realy had only 4 bytes on the last page */ + if (mz_header.e_cblp != 4 || image_size - len != 512 - 4) { + SetLastError(ERROR_BAD_FORMAT); + goto load_error; + } } if (mz_header.e_crlc) {
Attachment:
pgp00215.pgp
Description: PGP signature