mirror of
https://github.com/reactos/reactos.git
synced 2024-10-22 13:56:16 +00:00
[NTVDM]
Add the program name after the environment block. svn path=/branches/ntvdm/; revision=59559
This commit is contained in:
parent
87fc3759e3
commit
be2e1f0907
|
@ -54,7 +54,7 @@ static VOID DosCombineFreeBlocks(WORD StartBlock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORD DosCopyEnvironmentBlock(WORD SourceSegment)
|
static WORD DosCopyEnvironmentBlock(WORD SourceSegment, LPCSTR ProgramName)
|
||||||
{
|
{
|
||||||
PCHAR Ptr, SourceBuffer, DestBuffer = NULL;
|
PCHAR Ptr, SourceBuffer, DestBuffer = NULL;
|
||||||
ULONG TotalSize = 0;
|
ULONG TotalSize = 0;
|
||||||
|
@ -70,6 +70,9 @@ static WORD DosCopyEnvironmentBlock(WORD SourceSegment)
|
||||||
}
|
}
|
||||||
TotalSize++;
|
TotalSize++;
|
||||||
|
|
||||||
|
/* Add the string buffer size */
|
||||||
|
TotalSize += strlen(ProgramName) + 1;
|
||||||
|
|
||||||
/* Allocate the memory for the environment block */
|
/* Allocate the memory for the environment block */
|
||||||
DestSegment = DosAllocateMemory((TotalSize + 0x0F) >> 4, NULL);
|
DestSegment = DosAllocateMemory((TotalSize + 0x0F) >> 4, NULL);
|
||||||
if (!DestSegment) return 0;
|
if (!DestSegment) return 0;
|
||||||
|
@ -91,7 +94,10 @@ static WORD DosCopyEnvironmentBlock(WORD SourceSegment)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the final zero */
|
/* Set the final zero */
|
||||||
*DestBuffer = 0;
|
*(DestBuffer++) = 0;
|
||||||
|
|
||||||
|
/* Copy the program name after the environment block */
|
||||||
|
strcpy(DestBuffer, ProgramName);
|
||||||
|
|
||||||
return DestSegment;
|
return DestSegment;
|
||||||
}
|
}
|
||||||
|
@ -846,7 +852,8 @@ BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock)
|
||||||
/* No, copy the one from the parent */
|
/* No, copy the one from the parent */
|
||||||
EnvBlock = DosCopyEnvironmentBlock((CurrentPsp != SYSTEM_PSP)
|
EnvBlock = DosCopyEnvironmentBlock((CurrentPsp != SYSTEM_PSP)
|
||||||
? SEGMENT_TO_PSP(CurrentPsp)->EnvBlock
|
? SEGMENT_TO_PSP(CurrentPsp)->EnvBlock
|
||||||
: SYSTEM_ENV_BLOCK);
|
: SYSTEM_ENV_BLOCK,
|
||||||
|
ProgramFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this is an EXE file or a COM file */
|
/* Check if this is an EXE file or a COM file */
|
||||||
|
|
Loading…
Reference in a new issue