mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 01:13:38 +00:00
[NTVDM]
Fix the calculation of TotalSize in DosCopyEnvironmentBlock. Return the correct error code in DosLoadExecutable. svn path=/trunk/; revision=64368
This commit is contained in:
parent
b0555a5004
commit
1f933c38fc
|
@ -419,6 +419,9 @@ static WORD DosCopyEnvironmentBlock(LPCVOID Environment, LPCSTR ProgramName)
|
|||
/* Add the string buffer size */
|
||||
TotalSize += strlen(ProgramName) + 1;
|
||||
|
||||
/* Add the two extra bytes */
|
||||
TotalSize += 2;
|
||||
|
||||
/* Allocate the memory for the environment block */
|
||||
DestSegment = DosAllocateMemory((WORD)((TotalSize + 0x0F) >> 4), NULL);
|
||||
if (!DestSegment) return 0;
|
||||
|
@ -1012,7 +1015,7 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
|
|||
/* Check if at least the lowest allocation was successful */
|
||||
if (Segment == 0)
|
||||
{
|
||||
Result = ERROR_NOT_ENOUGH_MEMORY;
|
||||
Result = DosLastError;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1084,7 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
|
|||
Segment = DosAllocateMemory(MaxAllocSize, NULL);
|
||||
if (Segment == 0)
|
||||
{
|
||||
Result = ERROR_ARENA_TRASHED;
|
||||
Result = DosLastError;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue