Author: aandrejevic Date: Wed Apr 29 01:21:58 2015 New Revision: 67477
URL: http://svn.reactos.org/svn/reactos?rev=67477&view=rev Log: [NTVDM] If both e_minalloc and e_maxalloc are 0, the program should be loaded high.
Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/d... ============================================================================== --- trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] Wed Apr 29 01:21:58 2015 @@ -297,6 +297,7 @@ 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 @@ /* 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);
@@ -516,6 +523,9 @@ if (EnvBlock) DosFreeMemory(EnvBlock); if (Segment) DosFreeMemory(Segment); } + + /* Restore the old allocation strategy */ + DosAllocStrategy = OldStrategy;
/* Unmap the file*/ if (Address != NULL) UnmapViewOfFile(Address);