mirror of
https://github.com/reactos/reactos.git
synced 2024-08-05 11:00:55 +00:00
implement the object types SE_REGISTRY_KEY, SE_FILE_OBJECT, SE_SERVICE and SE_WINDOW_OBJECT for GetSecurityInfo()
svn path=/trunk/; revision=20968
This commit is contained in:
parent
0b0554b8ee
commit
68c3c9cf63
|
@ -49,7 +49,7 @@ AccRewriteGetHandleRights(HANDLE handle,
|
|||
PSECURITY_DESCRIPTOR* ppSecurityDescriptor)
|
||||
{
|
||||
PSECURITY_DESCRIPTOR pSD = NULL;
|
||||
ULONG RequiredSize, SDSize = 0;
|
||||
ULONG SDSize = 0;
|
||||
NTSTATUS Status;
|
||||
DWORD LastErr;
|
||||
DWORD Ret = ERROR_SUCCESS;
|
||||
|
@ -57,7 +57,8 @@ AccRewriteGetHandleRights(HANDLE handle,
|
|||
/* save the last error code */
|
||||
LastErr = GetLastError();
|
||||
|
||||
AllocBuffer:
|
||||
do
|
||||
{
|
||||
/* allocate a buffer large enough to hold the
|
||||
security descriptor we need to return */
|
||||
SDSize += 0x100;
|
||||
|
@ -76,31 +77,53 @@ AllocBuffer:
|
|||
if (pSD == NULL)
|
||||
{
|
||||
Ret = GetLastError();
|
||||
goto Cleanup;
|
||||
break;
|
||||
}
|
||||
|
||||
/* perform the actual query depending on the object type */
|
||||
switch (ObjectType)
|
||||
{
|
||||
case SE_REGISTRY_KEY:
|
||||
{
|
||||
Ret = RegGetKeySecurity((HKEY)handle,
|
||||
SecurityInfo,
|
||||
pSD,
|
||||
&SDSize);
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_FILE_OBJECT:
|
||||
case SE_KERNEL_OBJECT:
|
||||
{
|
||||
Status = NtQuerySecurityObject(handle,
|
||||
SecurityInfo,
|
||||
pSD,
|
||||
SDSize,
|
||||
&RequiredSize);
|
||||
if (Status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
/* not enough memory, increase the size of
|
||||
the buffer and try again */
|
||||
ASSERT(RequiredSize > SDSize);
|
||||
SDSize = RequiredSize;
|
||||
goto AllocBuffer;
|
||||
}
|
||||
&SDSize);
|
||||
Ret = RtlNtStatusToDosError(Status);
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_SERVICE:
|
||||
{
|
||||
Ret = QueryServiceObjectSecurity((SC_HANDLE)handle,
|
||||
SecurityInfo,
|
||||
pSD,
|
||||
SDSize,
|
||||
&SDSize);
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_WINDOW_OBJECT:
|
||||
{
|
||||
Ret = GetUserObjectSecurity(handle,
|
||||
&SecurityInfo,
|
||||
pSD,
|
||||
SDSize,
|
||||
&SDSize);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
@ -109,7 +132,8 @@ AllocBuffer:
|
|||
}
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
} while (Ret == ERROR_INSUFFICIENT_BUFFER);
|
||||
|
||||
if (Ret == ERROR_SUCCESS)
|
||||
{
|
||||
*ppSecurityDescriptor = pSD;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <windows.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <accctrl.h>
|
||||
#include <winsvc.h>
|
||||
|
||||
#ifndef HAS_FN_PROGRESSW
|
||||
#define FN_PROGRESSW FN_PROGRESS
|
||||
|
|
Loading…
Reference in a new issue