Author: aandrejevic
Date: Mon Jul 22 20:21:46 2013
New Revision: 59559
URL:
http://svn.reactos.org/svn/reactos?rev=59559&view=rev
Log:
[NTVDM]
Add the program name after the environment block.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Mon Jul 22 20:21:46 2013
@@ -54,7 +54,7 @@
}
}
-static WORD DosCopyEnvironmentBlock(WORD SourceSegment)
+static WORD DosCopyEnvironmentBlock(WORD SourceSegment, LPCSTR ProgramName)
{
PCHAR Ptr, SourceBuffer, DestBuffer = NULL;
ULONG TotalSize = 0;
@@ -70,6 +70,9 @@
}
TotalSize++;
+ /* Add the string buffer size */
+ TotalSize += strlen(ProgramName) + 1;
+
/* Allocate the memory for the environment block */
DestSegment = DosAllocateMemory((TotalSize + 0x0F) >> 4, NULL);
if (!DestSegment) return 0;
@@ -91,7 +94,10 @@
}
/* Set the final zero */
- *DestBuffer = 0;
+ *(DestBuffer++) = 0;
+
+ /* Copy the program name after the environment block */
+ strcpy(DestBuffer, ProgramName);
return DestSegment;
}
@@ -846,7 +852,8 @@
/* No, copy the one from the parent */
EnvBlock = DosCopyEnvironmentBlock((CurrentPsp != SYSTEM_PSP)
? SEGMENT_TO_PSP(CurrentPsp)->EnvBlock
- : SYSTEM_ENV_BLOCK);
+ : SYSTEM_ENV_BLOCK,
+ ProgramFilePath);
}
/* Check if this is an EXE file or a COM file */