Author: hbelusca
Date: Sat Feb 8 22:22:21 2014
New Revision: 62060
URL:
http://svn.reactos.org/svn/reactos?rev=62060&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/kernel32/client/proc.c
Modified: trunk/reactos/dll/win32/kernel32/client/proc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Sat Feb 8 22:22:21 2014
@@ -673,9 +673,8 @@
if (lpEnvironment)
{
/* Find the environment size */
- while ((ScanChar[0]) || (ScanChar[1])) ++ScanChar;
- ScanChar += (2 * sizeof(UNICODE_NULL));
- EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment;
+ while (*ScanChar++) while (*ScanChar++);
+ EnviroSize = (ULONG)((ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment);
/* Allocate and Initialize new Environment Block */
Size = EnviroSize;