mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 08:43:04 +00:00
Added security descriptor functions
svn path=/trunk/; revision=1075
This commit is contained in:
parent
753cb16c91
commit
1042f1ae27
2 changed files with 236 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
; $Id: advapi32.edf,v 1.5 1999/11/12 12:01:10 dwelch Exp $
|
; $Id: advapi32.edf,v 1.6 2000/03/18 13:48:24 ekohl Exp $
|
||||||
;
|
;
|
||||||
; advapi32.def
|
; advapi32.def
|
||||||
;
|
;
|
||||||
|
@ -146,11 +146,11 @@ GetAclInformation=GetAclInformation@16
|
||||||
;GetNumberOfEventLogRecords=GetNumberOfEventLogRecords@8
|
;GetNumberOfEventLogRecords=GetNumberOfEventLogRecords@8
|
||||||
;GetOldestEventLogRecord=GetOldestEventLogRecord@8
|
;GetOldestEventLogRecord=GetOldestEventLogRecord@8
|
||||||
;GetPrivateObjectSecurity=GetPrivateObjectSecurity@20
|
;GetPrivateObjectSecurity=GetPrivateObjectSecurity@20
|
||||||
;GetSecurityDescriptorControl=GetSecurityDescriptorControl@12
|
GetSecurityDescriptorControl=GetSecurityDescriptorControl@12
|
||||||
;GetSecurityDescriptorDacl=GetSecurityDescriptorDacl@16
|
GetSecurityDescriptorDacl=GetSecurityDescriptorDacl@16
|
||||||
;GetSecurityDescriptorGroup=GetSecurityDescriptorGroup@12
|
GetSecurityDescriptorGroup=GetSecurityDescriptorGroup@12
|
||||||
;GetSecurityDescriptorLength=GetSecurityDescriptorLength@4
|
GetSecurityDescriptorLength=GetSecurityDescriptorLength@4
|
||||||
;GetSecurityDescriptorOwner=GetSecurityDescriptorOwner@12
|
GetSecurityDescriptorOwner=GetSecurityDescriptorOwner@12
|
||||||
;GetSecurityDescriptorSacl=GetSecurityDescriptorSacl@16
|
;GetSecurityDescriptorSacl=GetSecurityDescriptorSacl@16
|
||||||
;GetSecurityInfo=GetSecurityInfo@32
|
;GetSecurityInfo=GetSecurityInfo@32
|
||||||
GetServiceDisplayNameA=GetServiceDisplayNameA@16
|
GetServiceDisplayNameA=GetServiceDisplayNameA@16
|
||||||
|
@ -178,7 +178,7 @@ GetTokenInformation=GetTokenInformation@20
|
||||||
;ImpersonateNamedPipeClient=ImpersonateNamedPipeClient@4
|
;ImpersonateNamedPipeClient=ImpersonateNamedPipeClient@4
|
||||||
;ImpersonateSelf=ImpersonateSelf@4
|
;ImpersonateSelf=ImpersonateSelf@4
|
||||||
InitializeAcl=InitializeAcl@12
|
InitializeAcl=InitializeAcl@12
|
||||||
;InitializeSecurityDescriptor=InitializeSecurityDescriptor@8
|
InitializeSecurityDescriptor=InitializeSecurityDescriptor@8
|
||||||
;InitializeSid=InitializeSid@12
|
;InitializeSid=InitializeSid@12
|
||||||
InitiateSystemShutdownA=InitiateSystemShutdownA@20
|
InitiateSystemShutdownA=InitiateSystemShutdownA@20
|
||||||
InitiateSystemShutdownW=InitiateSystemShutdownW@20
|
InitiateSystemShutdownW=InitiateSystemShutdownW@20
|
||||||
|
@ -186,7 +186,7 @@ InitiateSystemShutdownW=InitiateSystemShutdownW@20
|
||||||
;IsAccessPermittedW=IsAccessPermittedW@20
|
;IsAccessPermittedW=IsAccessPermittedW@20
|
||||||
;IsTextUnicode=IsTextUnicode@12
|
;IsTextUnicode=IsTextUnicode@12
|
||||||
IsValidAcl=IsValidAcl@4
|
IsValidAcl=IsValidAcl@4
|
||||||
;IsValidSecurityDescriptor=IsValidSecurityDescriptor@4
|
IsValidSecurityDescriptor=IsValidSecurityDescriptor@4
|
||||||
;IsValidSid=IsValidSid@4
|
;IsValidSid=IsValidSid@4
|
||||||
LockServiceDatabase=LockServiceDatabase@4
|
LockServiceDatabase=LockServiceDatabase@4
|
||||||
;LogonUserA=LogonUserA@24
|
;LogonUserA=LogonUserA@24
|
||||||
|
@ -356,9 +356,9 @@ SetAclInformation=SetAclInformation@16
|
||||||
;SetNamedSecurityInfoA=SetNamedSecurityInfoA@28
|
;SetNamedSecurityInfoA=SetNamedSecurityInfoA@28
|
||||||
;SetNamedSecurityInfoW=SetNamedSecurityInfoW@28
|
;SetNamedSecurityInfoW=SetNamedSecurityInfoW@28
|
||||||
;SetPrivateObjectSecurity=SetPrivateObjectSecurity@20
|
;SetPrivateObjectSecurity=SetPrivateObjectSecurity@20
|
||||||
;SetSecurityDescriptorDacl=SetSecurityDescriptorDacl@16
|
SetSecurityDescriptorDacl=SetSecurityDescriptorDacl@16
|
||||||
;SetSecurityDescriptorGroup=SetSecurityDescriptorGroup@12
|
SetSecurityDescriptorGroup=SetSecurityDescriptorGroup@12
|
||||||
;SetSecurityDescriptorOwner=SetSecurityDescriptorOwner@12
|
SetSecurityDescriptorOwner=SetSecurityDescriptorOwner@12
|
||||||
;SetSecurityDescriptorSacl=SetSecurityDescriptorSacl@16
|
;SetSecurityDescriptorSacl=SetSecurityDescriptorSacl@16
|
||||||
;SetSecurityInfo=SetSecurityInfo@28
|
;SetSecurityInfo=SetSecurityInfo@28
|
||||||
;SetServiceBits=SetServiceBits@16
|
;SetServiceBits=SetServiceBits@16
|
||||||
|
|
|
@ -12,16 +12,238 @@
|
||||||
#include <ntdll/rtl.h>
|
#include <ntdll/rtl.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
GetSecurityDescriptorControl (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSECURITY_DESCRIPTOR_CONTROL pControl,
|
||||||
|
LPDWORD lpdwRevision
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlGetControlSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
pControl,
|
||||||
|
lpdwRevision);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
GetSecurityDescriptorDacl (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
LPBOOL lpbDaclPresent,
|
||||||
|
PACL *pDacl,
|
||||||
|
LPBOOL lpbDaclDefaulted
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN DaclPresent;
|
||||||
|
BOOLEAN DaclDefaulted;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlGetDaclSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
&DaclPresent,
|
||||||
|
pDacl,
|
||||||
|
&DaclDefaulted);
|
||||||
|
*lpbDaclPresent = (BOOL)DaclPresent;
|
||||||
|
*lpbDaclDefaulted = (BOOL)DaclDefaulted;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
GetSecurityDescriptorGroup (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSID *pGroup,
|
||||||
|
LPBOOL lpbGroupDefaulted
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN GroupDefaulted;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlGetGroupSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
pGroup,
|
||||||
|
&GroupDefaulted);
|
||||||
|
*lpbGroupDefaulted = (BOOL)GroupDefaulted;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
GetSecurityDescriptorLength (
|
GetSecurityDescriptorLength (
|
||||||
PSECURITY_DESCRIPTOR pSecurityDescriptor
|
PSECURITY_DESCRIPTOR pSecurityDescriptor
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if 0
|
return RtlLengthSecurityDescriptor(pSecurityDescriptor);
|
||||||
return RtlLengthSecurityDescriptor(pSecurityDescriptor);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
GetSecurityDescriptorOwner (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSID *pOwner,
|
||||||
|
LPBOOL lpbOwnerDefaulted
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN OwnerDefaulted;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlGetOwnerSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
pOwner,
|
||||||
|
&OwnerDefaulted);
|
||||||
|
*lpbOwnerDefaulted = (BOOL)OwnerDefaulted;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* GetSecurityDescriptorSacl */
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
InitializeSecurityDescriptor (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
DWORD dwRevision
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlCreateSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
dwRevision);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
IsValidSecurityDescriptor (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOL Result;
|
||||||
|
|
||||||
|
Result = RtlValidSecurityDescriptor (pSecurityDescriptor);
|
||||||
|
if (Result == FALSE)
|
||||||
|
SetLastError (RtlNtStatusToDosError (STATUS_INVALID_SECURITY_DESCR));
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
SetSecurityDescriptorDacl (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
BOOL bDaclPresent,
|
||||||
|
PACL pDacl,
|
||||||
|
BOOL bDaclDefaulted
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlSetDaclSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
bDaclPresent,
|
||||||
|
pDacl,
|
||||||
|
bDaclDefaulted);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
SetSecurityDescriptorGroup (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSID pGroup,
|
||||||
|
BOOL bGroupDefaulted
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlSetGroupSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
pGroup,
|
||||||
|
bGroupDefaulted);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
SetSecurityDescriptorOwner (
|
||||||
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSID pOwner,
|
||||||
|
BOOL bOwnerDefaulted
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = RtlSetGroupSecurityDescriptor (pSecurityDescriptor,
|
||||||
|
pOwner,
|
||||||
|
bOwnerDefaulted);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastError (RtlNtStatusToDosError (Status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SetSecurityDescriptorSacl */
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue