advapi32: Support GetSecurityInfo() with special root HKEY constants.
This fixes a message box with the ASCOM Platform installer. Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e9ea436052
commit
e030234354
|
@ -1467,6 +1467,9 @@ BOOL WINAPI PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceNa
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define HKEY_SPECIAL_ROOT_FIRST HKEY_CLASSES_ROOT
|
||||
#define HKEY_SPECIAL_ROOT_LAST HKEY_DYN_DATA
|
||||
|
||||
/******************************************************************************
|
||||
* GetSecurityInfo [ADVAPI32.@]
|
||||
*
|
||||
|
@ -1522,17 +1525,43 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR
|
|||
}
|
||||
else
|
||||
{
|
||||
HKEY key = NULL;
|
||||
|
||||
if (type == SE_REGISTRY_KEY && (HandleToUlong(handle) >= HandleToUlong(HKEY_SPECIAL_ROOT_FIRST))
|
||||
&& (HandleToUlong(handle) <= HandleToUlong(HKEY_SPECIAL_ROOT_LAST)))
|
||||
{
|
||||
REGSAM access = READ_CONTROL;
|
||||
DWORD ret;
|
||||
|
||||
if (SecurityInfo & SACL_SECURITY_INFORMATION)
|
||||
access |= ACCESS_SYSTEM_SECURITY;
|
||||
|
||||
if ((ret = RegCreateKeyExW( handle, NULL, 0, NULL, 0, access, NULL, &key, NULL )))
|
||||
return ret;
|
||||
|
||||
handle = key;
|
||||
}
|
||||
|
||||
status = NtQuerySecurityObject( handle, SecurityInfo, NULL, 0, &size );
|
||||
if (status != STATUS_SUCCESS && status != STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
RegCloseKey( key );
|
||||
return RtlNtStatusToDosError( status );
|
||||
}
|
||||
|
||||
if (!(sd = LocalAlloc( 0, size ))) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
if (!(sd = LocalAlloc( 0, size )))
|
||||
{
|
||||
RegCloseKey( key );
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
if ((status = NtQuerySecurityObject( handle, SecurityInfo, sd, size, &size )))
|
||||
{
|
||||
RegCloseKey( key );
|
||||
LocalFree(sd);
|
||||
return RtlNtStatusToDosError( status );
|
||||
}
|
||||
RegCloseKey( key );
|
||||
}
|
||||
|
||||
if (ppsidOwner)
|
||||
|
|
|
@ -7913,12 +7913,12 @@ static void test_pseudo_handle_security(void)
|
|||
ret = GetSecurityInfo(keys[i], SE_REGISTRY_KEY,
|
||||
DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL, &sd_ptr);
|
||||
if (keys[i] == HKEY_PERFORMANCE_DATA)
|
||||
ok(ret == ERROR_INVALID_HANDLE, "key %p: got error %u\n", keys[i], ret);
|
||||
todo_wine ok(ret == ERROR_INVALID_HANDLE, "key %p: got error %u\n", keys[i], ret);
|
||||
else if (keys[i] == HKEY_DYN_DATA)
|
||||
todo_wine ok(ret == ERROR_CALL_NOT_IMPLEMENTED || broken(ret == ERROR_INVALID_HANDLE) /* <7 */,
|
||||
"key %p: got error %u\n", keys[i], ret);
|
||||
else
|
||||
todo_wine ok(!ret, "key %p: got error %u\n", keys[i], ret);
|
||||
ok(!ret, "key %p: got error %u\n", keys[i], ret);
|
||||
LocalFree(sd_ptr);
|
||||
|
||||
ret = GetSecurityInfo(keys[i], SE_KERNEL_OBJECT,
|
||||
|
|
Loading…
Reference in New Issue