Module: wine Branch: master Commit: 6d5d0eaafa26e245bbbde725bbbb2c7c0f82fb7c URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d5d0eaafa26e245bbbde725bb...
Author: Mikolaj Zalewski mikolajz@google.com Date: Tue Sep 25 13:13:38 2007 -0700
advapi32: Make ConvertSidToStringSid use helper functions of ConvertSecurityDescriptorToStringSecurityDescriptor.
---
dlls/advapi32/security.c | 34 ++++++++-------------------------- 1 files changed, 8 insertions(+), 26 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 3dfe504..9323c07 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -4000,37 +4000,19 @@ BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid) */ BOOL WINAPI ConvertSidToStringSidW( PSID pSid, LPWSTR *pstr ) { - DWORD sz, i; - LPWSTR str; - WCHAR fmt[] = { 'S','-','%','u','-','%','d',0 }; - WCHAR subauthfmt[] = { '-','%','u',0 }; - SID* pisid=pSid; + DWORD len = 0; + LPWSTR wstr, wptr;
TRACE("%p %p\n", pSid, pstr );
- if( !IsValidSid( pSid ) ) - return FALSE; - - if (pisid->Revision != SDDL_REVISION) - return FALSE; - if (pisid->IdentifierAuthority.Value[0] || - pisid->IdentifierAuthority.Value[1]) - { - FIXME("not matching MS' bugs\n"); + len = 0; + if (!DumpSidNumeric(pSid, NULL, &len)) return FALSE; - } - - sz = 14 + pisid->SubAuthorityCount * 11; - 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; + wstr = wptr = LocalAlloc(0, (len+1) * sizeof(WCHAR)); + DumpSidNumeric(pSid, &wptr, NULL); + *wptr = 0;
+ *pstr = wstr; return TRUE; }