[ros-diffs] [greatlrd] 16528: The return size calculation's of GetEnvironmentVariable string was wrong. Thx to <Bizzy_D> to find out cd %windir% did not work. Now it will

greatlrd at svn.reactos.com greatlrd at svn.reactos.com
Mon Jul 11 00:12:20 CEST 2005


The return size calculation's of GetEnvironmentVariable string was
wrong. Thx to <Bizzy_D> to find out cd %windir% did not work. Now it
will
Modified: trunk/reactos/lib/kernel32/misc/env.c
  _____  

Modified: trunk/reactos/lib/kernel32/misc/env.c
--- trunk/reactos/lib/kernel32/misc/env.c	2005-07-10 22:05:48 UTC
(rev 16527)
+++ trunk/reactos/lib/kernel32/misc/env.c	2005-07-10 22:12:07 UTC
(rev 16528)
@@ -70,7 +70,7 @@

 		SetLastErrorByStatus (Status);
 		if (Status == STATUS_BUFFER_TOO_SMALL)
 		{
-			return VarValueU.Length / sizeof(WCHAR) + 1;
+			return VarValueU.Length / sizeof(WCHAR) +
sizeof(WCHAR);
 		}
 		else
 		{
@@ -91,7 +91,7 @@
 	/* free unicode variable name string */
 	RtlFreeUnicodeString (&VarNameU);
 
-	return (VarValueU.Length / sizeof(WCHAR));
+	return (VarValueU.Length / sizeof(WCHAR) + sizeof(WCHAR));
 }
 
 
@@ -125,7 +125,7 @@
 		SetLastErrorByStatus (Status);
 		if (Status == STATUS_BUFFER_TOO_SMALL)
 		{
-			return (VarValue.Length / sizeof(WCHAR)) + 1;
+			return (VarValue.Length / sizeof(WCHAR)) +
sizeof(WCHAR);
 		}
 		else
 		{
@@ -133,7 +133,7 @@
 		}
 	}
 
-	return (VarValue.Length / sizeof(WCHAR));
+	return (VarValue.Length / sizeof(WCHAR) + sizeof(WCHAR));
 }
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050711/5465718a/attachment.html


More information about the Ros-diffs mailing list