pass the buffer size to GetEnvironmentVariable() in characters, not bytes!
Modified: trunk/reactos/subsys/system/cmd/cmd.c
Modified: trunk/reactos/subsys/system/cmd/if.c
Modified: trunk/reactos/subsys/system/cmd/where.c

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-09-21 17:22:45 UTC (rev 17967)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-09-21 17:23:27 UTC (rev 17968)
@@ -1552,7 +1552,7 @@
 	   for you can change the EnvirommentVariable for prompt before cmd start
 	   this patch are not 100% right, if it does not exists a PROMPT value cmd should use
 	   $P$G as defualt not set EnvirommentVariable PROMPT to $P$G if it does not exists */
-	if (GetEnvironmentVariable(_T("PROMPT"),lpBuffer, 2 * sizeof(TCHAR)) == 0)
+	if (GetEnvironmentVariable(_T("PROMPT"),lpBuffer, sizeof(lpBuffer) / sizeof(lpBuffer[0])) == 0)
 	    SetEnvironmentVariable (_T("PROMPT"), _T("$P$G"));
 
 

Modified: trunk/reactos/subsys/system/cmd/if.c
--- trunk/reactos/subsys/system/cmd/if.c	2005-09-21 17:22:45 UTC (rev 17967)
+++ trunk/reactos/subsys/system/cmd/if.c	2005-09-21 17:23:27 UTC (rev 17968)
@@ -131,7 +131,7 @@
 		if (*pp)
 		{
 			*pp++ = _T('\0');
-			ValueSize = GetEnvironmentVariable(param, Value, sizeof Value);
+			ValueSize = GetEnvironmentVariable(param, Value, sizeof(Value) / sizeof(Value[0]));
 			x_flag ^= (0 == ValueSize)
 					? 0
 					: X_EXEC;

Modified: trunk/reactos/subsys/system/cmd/where.c
--- trunk/reactos/subsys/system/cmd/where.c	2005-09-21 17:22:45 UTC (rev 17967)
+++ trunk/reactos/subsys/system/cmd/where.c	2005-09-21 17:23:27 UTC (rev 17968)
@@ -157,7 +157,7 @@
 	if (dwBuffer > ENV_BUFFER_SIZE)
 	{
 		pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
-		GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer * sizeof (TCHAR));
+		GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer);
 	}
 
 
@@ -222,7 +222,7 @@
 	if (dwBuffer > ENV_BUFFER_SIZE)
 	{
 		pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
-		GetEnvironmentVariable (_T("PATHEXT"), pszBuffer, dwBuffer * sizeof (TCHAR));
+		GetEnvironmentVariable (_T("PATHEXT"), pszBuffer, dwBuffer);
 	}
 	else if (0 == dwBuffer)
 	{