Commit 6d5d0eaa authored by Mikolaj Zalewski's avatar Mikolaj Zalewski Committed by Alexandre Julliard

advapi32: Make ConvertSidToStringSid use helper functions of…

advapi32: Make ConvertSidToStringSid use helper functions of ConvertSecurityDescriptorToStringSecurityDescriptor.
parent 3198809f
...@@ -4000,37 +4000,19 @@ BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid) ...@@ -4000,37 +4000,19 @@ BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid)
*/ */
BOOL WINAPI ConvertSidToStringSidW( PSID pSid, LPWSTR *pstr ) BOOL WINAPI ConvertSidToStringSidW( PSID pSid, LPWSTR *pstr )
{ {
DWORD sz, i; DWORD len = 0;
LPWSTR str; LPWSTR wstr, wptr;
WCHAR fmt[] = { 'S','-','%','u','-','%','d',0 };
WCHAR subauthfmt[] = { '-','%','u',0 };
SID* pisid=pSid;
TRACE("%p %p\n", pSid, pstr ); TRACE("%p %p\n", pSid, pstr );
if( !IsValidSid( pSid ) ) len = 0;
return FALSE; if (!DumpSidNumeric(pSid, NULL, &len))
if (pisid->Revision != SDDL_REVISION)
return FALSE;
if (pisid->IdentifierAuthority.Value[0] ||
pisid->IdentifierAuthority.Value[1])
{
FIXME("not matching MS' bugs\n");
return FALSE; return FALSE;
} wstr = wptr = LocalAlloc(0, (len+1) * sizeof(WCHAR));
DumpSidNumeric(pSid, &wptr, NULL);
sz = 14 + pisid->SubAuthorityCount * 11; *wptr = 0;
str = LocalAlloc( 0, sz*sizeof(WCHAR) );
sprintfW( str, fmt, pisid->Revision, MAKELONG(
MAKEWORD( pisid->IdentifierAuthority.Value[5],
pisid->IdentifierAuthority.Value[4] ),
MAKEWORD( pisid->IdentifierAuthority.Value[3],
pisid->IdentifierAuthority.Value[2] ) ) );
for( i=0; i<pisid->SubAuthorityCount; i++ )
sprintfW( str + strlenW(str), subauthfmt, pisid->SubAuthority[i] );
*pstr = str;
*pstr = wstr;
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment