* 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>
|
2004-04-13 Gerd Spalink <Gerd.Spalink@t-online.de>
|
||||||
|
|
||||||
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Add optional
|
* 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)
|
LoadDLLfuncEx (NtQueryInformationProcess, 20, ntdll, 1)
|
||||||
LoadDLLfuncEx2 (NtQueryObject, 20, ntdll, 1, 1)
|
LoadDLLfuncEx2 (NtQueryObject, 20, ntdll, 1, 1)
|
||||||
LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1)
|
LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1)
|
||||||
|
LoadDLLfuncEx (NtQuerySecurityObject, 20, ntdll, 1)
|
||||||
LoadDLLfuncEx (NtQueryVirtualMemory, 24, ntdll, 1)
|
LoadDLLfuncEx (NtQueryVirtualMemory, 24, ntdll, 1)
|
||||||
LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1)
|
LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1)
|
||||||
LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
|
LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
|
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
|
||||||
|
#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xc0000023)
|
||||||
#define PDI_MODULES 0x01
|
#define PDI_MODULES 0x01
|
||||||
#define PDI_HEAPS 0x04
|
#define PDI_HEAPS 0x04
|
||||||
#define LDRP_IMAGE_DLL 0x00000004
|
#define LDRP_IMAGE_DLL 0x00000004
|
||||||
|
@ -407,6 +408,8 @@ extern "C"
|
||||||
ULONG, ULONG *);
|
ULONG, ULONG *);
|
||||||
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
|
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
|
||||||
PVOID, ULONG, PULONG);
|
PVOID, ULONG, PULONG);
|
||||||
|
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
|
||||||
|
PSECURITY_DESCRIPTOR, ULONG, PULONG);
|
||||||
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
|
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
|
||||||
PVOID, ULONG, PULONG);
|
PVOID, ULONG, PULONG);
|
||||||
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
|
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
|
||||||
|
|
|
@ -1374,44 +1374,35 @@ get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type,
|
||||||
{
|
{
|
||||||
security_descriptor sd;
|
security_descriptor sd;
|
||||||
PSECURITY_DESCRIPTOR psd = NULL;
|
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 */
|
if (!sd.malloc (len))
|
||||||
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))
|
|
||||||
set_errno (ENOMEM);
|
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
|
else
|
||||||
psd = sd;
|
ret = NtQuerySecurityObject (handle,
|
||||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
DACL_SECURITY_INFORMATION
|
||||||
|
| GROUP_SECURITY_INFORMATION
|
||||||
|
| OWNER_SECURITY_INFORMATION,
|
||||||
|
sd, len, &len);
|
||||||
}
|
}
|
||||||
else if ((ret = GetSecurityInfo (handle, object_type,
|
if (ret != STATUS_SUCCESS)
|
||||||
DACL_SECURITY_INFORMATION
|
|
||||||
| GROUP_SECURITY_INFORMATION
|
|
||||||
| OWNER_SECURITY_INFORMATION,
|
|
||||||
NULL, NULL, NULL, NULL, &psd)))
|
|
||||||
{
|
{
|
||||||
__seterrno_from_win_error (ret);
|
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||||
return -1;
|
if (object_type == SE_FILE_OBJECT)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
psd = sd;
|
||||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||||
LocalFree (psd);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue