* autoload.cc (NtQuerySecurityObject): Add.
* ntdll.h (STATUS_BUFFER_TOO_SMALL): Add definition. (NtQuerySecurityObject): Add declaration. * security.cc (get_nt_object_attribute): Always use NtQuerySecurityObject to retrieve security descriptor.
This commit is contained in:
parent
7e044afdaf
commit
71ffba498c
|
@ -1,3 +1,11 @@
|
|||
2004-04-13 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* autoload.cc (NtQuerySecurityObject): Add.
|
||||
* ntdll.h (STATUS_BUFFER_TOO_SMALL): Add definition.
|
||||
(NtQuerySecurityObject): Add declaration.
|
||||
* security.cc (get_nt_object_attribute): Always use
|
||||
NtQuerySecurityObject to retrieve security descriptor.
|
||||
|
||||
2004-04-13 Gerd Spalink <Gerd.Spalink@t-online.de>
|
||||
|
||||
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Add optional
|
||||
|
|
|
@ -392,6 +392,7 @@ LoadDLLfuncEx (NtQueryInformationFile, 20, ntdll, 1)
|
|||
LoadDLLfuncEx (NtQueryInformationProcess, 20, ntdll, 1)
|
||||
LoadDLLfuncEx2 (NtQueryObject, 20, ntdll, 1, 1)
|
||||
LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1)
|
||||
LoadDLLfuncEx (NtQuerySecurityObject, 20, ntdll, 1)
|
||||
LoadDLLfuncEx (NtQueryVirtualMemory, 24, ntdll, 1)
|
||||
LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1)
|
||||
LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
details. */
|
||||
|
||||
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
|
||||
#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xc0000023)
|
||||
#define PDI_MODULES 0x01
|
||||
#define PDI_HEAPS 0x04
|
||||
#define LDRP_IMAGE_DLL 0x00000004
|
||||
|
@ -407,6 +408,8 @@ extern "C"
|
|||
ULONG, ULONG *);
|
||||
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
|
||||
PVOID, ULONG, PULONG);
|
||||
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
|
||||
PSECURITY_DESCRIPTOR, ULONG, PULONG);
|
||||
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
|
||||
PVOID, ULONG, PULONG);
|
||||
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
|
||||
|
|
|
@ -1374,44 +1374,35 @@ get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type,
|
|||
{
|
||||
security_descriptor sd;
|
||||
PSECURITY_DESCRIPTOR psd = NULL;
|
||||
LONG ret;
|
||||
|
||||
if (object_type == SE_REGISTRY_KEY)
|
||||
NTSTATUS ret;
|
||||
ULONG len = 0;
|
||||
ret = NtQuerySecurityObject (handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, len, &len);
|
||||
if (ret == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
/* use different code for registry handles, for performance reasons */
|
||||
DWORD len = 0;
|
||||
if ((ret = RegGetKeySecurity ((HKEY) handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, &len)) != ERROR_INSUFFICIENT_BUFFER)
|
||||
__seterrno_from_win_error (ret);
|
||||
else if (!sd.malloc (len))
|
||||
if (!sd.malloc (len))
|
||||
set_errno (ENOMEM);
|
||||
else if ((ret = RegGetKeySecurity ((HKEY) handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, &len)) != ERROR_SUCCESS)
|
||||
__seterrno_from_win_error (ret);
|
||||
else
|
||||
psd = sd;
|
||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||
ret = NtQuerySecurityObject (handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, len, &len);
|
||||
}
|
||||
else if ((ret = GetSecurityInfo (handle, object_type,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
NULL, NULL, NULL, NULL, &psd)))
|
||||
if (ret != STATUS_SUCCESS)
|
||||
{
|
||||
__seterrno_from_win_error (ret);
|
||||
return -1;
|
||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||
if (object_type == SE_FILE_OBJECT)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||
LocalFree (psd);
|
||||
}
|
||||
psd = sd;
|
||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue