Commit b4926e27 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

advapi32: Respect object type in GetSecurityInfo().

Do not try to treat types which are not kernel handles as kernel handles.
parent 39802508
...@@ -1497,6 +1497,10 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR ...@@ -1497,6 +1497,10 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR
NTSTATUS status; NTSTATUS status;
ULONG size; ULONG size;
BOOL present, defaulted; BOOL present, defaulted;
HKEY key = NULL;
if (!handle)
return ERROR_INVALID_HANDLE;
/* A NULL descriptor is allowed if any one of the other pointers is not NULL */ /* A NULL descriptor is allowed if any one of the other pointers is not NULL */
if (!(ppsidOwner||ppsidGroup||ppDacl||ppSacl||ppSecurityDescriptor)) return ERROR_INVALID_PARAMETER; if (!(ppsidOwner||ppsidGroup||ppDacl||ppSacl||ppSecurityDescriptor)) return ERROR_INVALID_PARAMETER;
...@@ -1509,8 +1513,9 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR ...@@ -1509,8 +1513,9 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR
|| ((SecurityInfo & SACL_SECURITY_INFORMATION) && !ppSacl) )) || ((SecurityInfo & SACL_SECURITY_INFORMATION) && !ppSacl) ))
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if (type == SE_SERVICE) switch (type)
{ {
case SE_SERVICE:
if (!QueryServiceObjectSecurity( handle, SecurityInfo, NULL, 0, &size ) if (!QueryServiceObjectSecurity( handle, SecurityInfo, NULL, 0, &size )
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER) && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return GetLastError(); return GetLastError();
...@@ -1522,11 +1527,12 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR ...@@ -1522,11 +1527,12 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR
LocalFree(sd); LocalFree(sd);
return GetLastError(); return GetLastError();
} }
} break;
else
{
HKEY key = NULL;
case SE_KERNEL_OBJECT:
case SE_FILE_OBJECT:
case SE_WMIGUID_OBJECT:
case SE_REGISTRY_KEY:
if (type == SE_REGISTRY_KEY && (HandleToUlong(handle) >= HandleToUlong(HKEY_SPECIAL_ROOT_FIRST)) if (type == SE_REGISTRY_KEY && (HandleToUlong(handle) >= HandleToUlong(HKEY_SPECIAL_ROOT_FIRST))
&& (HandleToUlong(handle) <= HandleToUlong(HKEY_SPECIAL_ROOT_LAST))) && (HandleToUlong(handle) <= HandleToUlong(HKEY_SPECIAL_ROOT_LAST)))
{ {
...@@ -1562,6 +1568,11 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR ...@@ -1562,6 +1568,11 @@ DWORD WINAPI GetSecurityInfo( HANDLE handle, SE_OBJECT_TYPE type, SECURITY_INFOR
return RtlNtStatusToDosError( status ); return RtlNtStatusToDosError( status );
} }
RegCloseKey( key ); RegCloseKey( key );
break;
default:
FIXME("unimplemented type %u\n", type);
return ERROR_CALL_NOT_IMPLEMENTED;
} }
if (ppsidOwner) if (ppsidOwner)
......
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