Fix the calculation of TotalSize in DosCopyEnvironmentBlock.
Return the correct error code in DosLoadExecutable.
svn path=/trunk/; revision=64368
/* 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;
/* Check if at least the lowest allocation was successful */
if (Segment == 0)
{
- Result = ERROR_NOT_ENOUGH_MEMORY;
+ Result = DosLastError;
goto Cleanup;
}
Segment = DosAllocateMemory(MaxAllocSize, NULL);
if (Segment == 0)
{
- Result = ERROR_ARENA_TRASHED;
+ Result = DosLastError;
goto Cleanup;
}