mirror of
https://github.com/reactos/reactos.git
synced 2024-08-01 09:01:13 +00:00
[NTVDM]
If both e_minalloc and e_maxalloc are 0, the program should be loaded high. svn path=/trunk/; revision=67477
This commit is contained in:
parent
eba20f3ad8
commit
294468d4e7
|
@ -297,6 +297,7 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
|
|||
PDWORD RelocationTable;
|
||||
PWORD RelocWord;
|
||||
LPSTR CmdLinePtr = (LPSTR)CommandLine;
|
||||
BYTE OldStrategy = DosAllocStrategy;
|
||||
|
||||
DPRINT1("DosLoadExecutable(%d, %s, %s, %s, 0x%08X, 0x%08X)\n",
|
||||
LoadType,
|
||||
|
@ -382,6 +383,12 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
|
|||
/* Make sure it does not pass 0xFFFF */
|
||||
if (ExeSize > 0xFFFF) ExeSize = 0xFFFF;
|
||||
|
||||
if (Header->e_minalloc == 0 && Header->e_maxalloc == 0)
|
||||
{
|
||||
/* This program should be loaded high */
|
||||
DosAllocStrategy = DOS_ALLOC_LAST_FIT;
|
||||
}
|
||||
|
||||
/* Try to allocate that much memory */
|
||||
Segment = DosAllocateMemory((WORD)ExeSize, &MaxAllocSize);
|
||||
|
||||
|
@ -517,6 +524,9 @@ Cleanup:
|
|||
if (Segment) DosFreeMemory(Segment);
|
||||
}
|
||||
|
||||
/* Restore the old allocation strategy */
|
||||
DosAllocStrategy = OldStrategy;
|
||||
|
||||
/* Unmap the file*/
|
||||
if (Address != NULL) UnmapViewOfFile(Address);
|
||||
|
||||
|
|
Loading…
Reference in a new issue