Author: spetreolle Date: Sun May 31 16:39:45 2009 New Revision: 41216
URL: http://svn.reactos.org/svn/reactos?rev=41216&view=rev Log: Sync GetNamedSecurityInfoA with Wine. RtlCreateUnicodeStringFromAsciiz is unwanted since the call to GetNamedSecurityInfoW checks for NULL and in this case sets ERROR_INVALID_PARAMETER.
Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c
Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/misc... ============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] Sun May 31 16:39:45 2009 @@ -1874,29 +1874,26 @@ PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor) { - UNICODE_STRING ObjectName; - NTSTATUS Status; - DWORD Ret; - - Status = RtlCreateUnicodeStringFromAsciiz(&ObjectName, - pObjectName); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - Ret = GetNamedSecurityInfoW(ObjectName.Buffer, - ObjectType, - SecurityInfo, - ppsidOwner, - ppsidGroup, - ppDacl, - ppSacl, - ppSecurityDescriptor); - - RtlFreeUnicodeString(&ObjectName); - - return Ret; + DWORD len; + LPWSTR wstr = NULL; + DWORD r; + + TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo, + ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor); + + if( pObjectName ) + { + len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 ); + wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len ); + } + + r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner, + ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor ); + + HeapFree( GetProcessHeap(), 0, wstr ); + + return r; }