[KERNEL32]

Fix finding the environment multi-string size (use the same code as in RtlpInitEnvironment instead of using hackish and broken code; the two while() are here because the environment string is a "multi-string", hence a list of strings, each terminated by a NULL char, and the whole multi-string is terminated by two NULL chars (the one of the last string plus an empty string).
Also fix a cast.
This fixes the launch of some programs, and this was triggered by tring to compiling the host-tools of the ReactOS source code with RosBE, on ReactOS.
CORE-7870 #resolve #comment Fixed in revision 62060.

svn path=/trunk/; revision=62060
This commit is contained in:
Hermès Bélusca-Maïto 2014-02-08 22:22:21 +00:00
parent 535049cf93
commit cc269f9cb4

View file

@ -673,9 +673,8 @@ BasePushProcessParameters(IN ULONG ParameterFlags,
if (lpEnvironment) if (lpEnvironment)
{ {
/* Find the environment size */ /* Find the environment size */
while ((ScanChar[0]) || (ScanChar[1])) ++ScanChar; while (*ScanChar++) while (*ScanChar++);
ScanChar += (2 * sizeof(UNICODE_NULL)); EnviroSize = (ULONG)((ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment);
EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment;
/* Allocate and Initialize new Environment Block */ /* Allocate and Initialize new Environment Block */
Size = EnviroSize; Size = EnviroSize;