[PATCH] advapi32: Set *lpSize properly in GetUserNameA (try2)

Marcus Meissner marcus at jet.franken.de
Mon Jul 4 02:26:06 CDT 2011


On Sat, Jul 02, 2011 at 11:49:44AM +0300, Alex Stanev wrote:
> 

> ---
>  dlls/advapi32/advapi.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c
> index e135fa5..7025a21 100644
> --- a/dlls/advapi32/advapi.c
> +++ b/dlls/advapi32/advapi.c
> @@ -65,7 +65,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
>  
>      ret = GetUserNameW( buffer, &sizeW );
>      if (ret)
> -        WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL );
> +        *lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL );
>      else
>          *lpSize = sizeW;

For completeness, the else part also needs to convert the wide character cound in
"sizeW" to the A character cound in *lpSize.

Not sure how though.

Ciao, Marcus



More information about the wine-patches mailing list