From 70806391db42effa7f691bf80a9f414c6ddb7ef8 Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Sun, 31 May 2009 12:39:45 +0000 Subject: [PATCH] Sync GetNamedSecurityInfoA with Wine. RtlCreateUnicodeStringFromAsciiz is unwanted since the call to GetNamedSecurityInfoW checks for NULL and in this case sets ERROR_INVALID_PARAMETER. svn path=/trunk/; revision=41216 --- reactos/dll/win32/advapi32/sec/misc.c | 31 ++++++++++++--------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/reactos/dll/win32/advapi32/sec/misc.c b/reactos/dll/win32/advapi32/sec/misc.c index 5c382a5fc0b..7e8b3fd0c5f 100644 --- a/reactos/dll/win32/advapi32/sec/misc.c +++ b/reactos/dll/win32/advapi32/sec/misc.c @@ -1874,29 +1874,26 @@ GetNamedSecurityInfoA(LPSTR pObjectName, PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor) { - UNICODE_STRING ObjectName; - NTSTATUS Status; - DWORD Ret; + DWORD len; + LPWSTR wstr = NULL; + DWORD r; - Status = RtlCreateUnicodeStringFromAsciiz(&ObjectName, - pObjectName); - if (!NT_SUCCESS(Status)) + TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo, + ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor); + + if( pObjectName ) { - return RtlNtStatusToDosError(Status); + len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 ); + wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len ); } - Ret = GetNamedSecurityInfoW(ObjectName.Buffer, - ObjectType, - SecurityInfo, - ppsidOwner, - ppsidGroup, - ppDacl, - ppSacl, - ppSecurityDescriptor); + r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner, + ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor ); - RtlFreeUnicodeString(&ObjectName); + HeapFree( GetProcessHeap(), 0, wstr ); - return Ret; + return r; }