Fix the calculation of the executable's base size.


svn path=/trunk/; revision=67587
This commit is contained in:
Aleksandar Andrejevic 2015-05-07 00:36:14 +00:00
parent 6dede8eba6
commit 17fd1cc052

View file

@ -409,7 +409,8 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
Header = (PIMAGE_DOS_HEADER)Address;
/* Get the base size of the file, in paragraphs (rounded up) */
BaseSize = (((Header->e_cp - 1) * 512) + Header->e_cblp + 0x0F) >> 4;
BaseSize = (((Header->e_cp - (Header->e_cblp != 0)) * 512)
+ Header->e_cblp - Header->e_cparhdr + 0x0F) >> 4;
if (LoadType != DOS_LOAD_OVERLAY)
{