From 17fd1cc0520dcd8184295d0de7d79e9b9a1b57f8 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Thu, 7 May 2015 00:36:14 +0000 Subject: [PATCH] [NTVDM] Fix the calculation of the executable's base size. svn path=/trunk/; revision=67587 --- reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c index ba44546047a..8606e6322ad 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c @@ -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) {