Author: aandrejevic
Date: Sun Sep 28 17:27:54 2014
New Revision: 64368
URL:
http://svn.reactos.org/svn/reactos?rev=64368&view=rev
Log:
[NTVDM]
Fix the calculation of TotalSize in DosCopyEnvironmentBlock.
Return the correct error code in DosLoadExecutable.
Modified:
trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
Modified: trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/dos32…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] Sun Sep 28 17:27:54
2014
@@ -418,6 +418,9 @@
/* 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);
@@ -1012,7 +1015,7 @@
/* 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 @@
Segment = DosAllocateMemory(MaxAllocSize, NULL);
if (Segment == 0)
{
- Result = ERROR_ARENA_TRASHED;
+ Result = DosLastError;
goto Cleanup;
}