Correct ConvertSidToStringSidW with test

Alexandre Julliard julliard at winehq.org
Mon Sep 13 17:13:52 CDT 2004


Juan Lang <juan_lang at yahoo.com> writes:

> @@ -2230,13 +2232,23 @@
>  
>      sz = 14 + pisid->SubAuthorityCount * 11;
>      str = LocalAlloc( 0, sz*sizeof(WCHAR) );
> -    sprintfW( str, fmt, pisid->Revision,
> -         pisid->IdentifierAuthority.Value[2],
> -         pisid->IdentifierAuthority.Value[3],
> -         pisid->IdentifierAuthority.Value[0]&0x0f,
> -         pisid->IdentifierAuthority.Value[4]&0x0f,
> -         pisid->IdentifierAuthority.Value[1]&0x0f,
> -         pisid->IdentifierAuthority.Value[5]&0x0f);
> +    sprintfW( str, fmt, pisid->Revision );
> +    for( i=2; i<=3; i++ )
> +    {
> +        if( pisid->IdentifierAuthority.Value[i] )
> +            printingIdent = TRUE;
> +        if( printingIdent )
> +            sprintfW( str + lstrlenW( str ), identAuthFmt,
> +             pisid->IdentifierAuthority.Value[i] );
> +    }

That doesn't look right, you'd need something like %02x for the second
value if the first was printed. It seems it would be a lot easier to
simply build an int from the various values and then format it with a
single %x.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list