[ros-dev] Re: [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

Hartmut Birr hartmut.birr at gmx.de
Mon Jul 11 22:41:41 CEST 2005


greatlrd at svn.reactos.com wrote:

>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 @@
>
>@@ -133,7 +133,7 @@
>  
>
> 		}
> 	}
> 
>  
>
>-	return (VarValue.Length / sizeof(WCHAR));
>  
>
>+	return (VarValue.Length / sizeof(WCHAR) + sizeof(WCHAR));
>  
>
> }
> 
> 
>  
>
Hi,

this change is wrong. The MSDN library says:

If the function succeeds, the return value is the number of TCHARs
stored into the buffer pointed to by /lpBuffer/, not including the
terminating null character.

Please revert your change.

- Hartmut




More information about the Ros-dev mailing list