[ros-diffs] [weiden] 17968: pass the buffer size to GetEnvironmentVariable() in characters, not bytes!

weiden at svn.reactos.com weiden at svn.reactos.com
Wed Sep 21 19:23:42 CEST 2005


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)
 	{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050921/0dab75a6/attachment.html


More information about the Ros-diffs mailing list