mirror of
https://github.com/reactos/reactos.git
synced 2025-05-21 18:16:07 +00:00
make functions match their declarations
svn path=/trunk/; revision=20288
This commit is contained in:
parent
fab032457d
commit
78641fec1a
2 changed files with 286 additions and 240 deletions
|
@ -591,16 +591,16 @@ NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlCreateSecurityDescriptor(
|
RtlCreateSecurityDescriptor(
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
ULONG Revision
|
IN ULONG Revision
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlCreateSecurityDescriptorRelative(
|
RtlCreateSecurityDescriptorRelative(
|
||||||
PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
|
OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
|
||||||
ULONG Revision
|
IN ULONG Revision
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -653,9 +653,9 @@ RtlGetAce(
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlGetControlSecurityDescriptor(
|
RtlGetControlSecurityDescriptor(
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSECURITY_DESCRIPTOR_CONTROL Control,
|
OUT PSECURITY_DESCRIPTOR_CONTROL Control,
|
||||||
PULONG Revision
|
OUT PULONG Revision
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -672,10 +672,10 @@ NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlGetSaclSecurityDescriptor(
|
RtlGetSaclSecurityDescriptor(
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PBOOLEAN SaclPresent,
|
OUT PBOOLEAN SaclPresent,
|
||||||
PACL* Sacl,
|
OUT PACL* Sacl,
|
||||||
PBOOLEAN SaclDefaulted
|
OUT PBOOLEAN SaclDefaulted
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -700,8 +700,8 @@ NTSYSAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlGetSecurityDescriptorRMControl(
|
RtlGetSecurityDescriptorRMControl(
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PUCHAR RMControl
|
OUT PUCHAR RMControl
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -784,6 +784,15 @@ RtlSelfRelativeToAbsoluteSD2(
|
||||||
OUT PULONG BufferSize
|
OUT PULONG BufferSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSYSAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlSetAttributesSecurityDescriptor(
|
||||||
|
IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
|
IN SECURITY_DESCRIPTOR_CONTROL Control,
|
||||||
|
OUT PULONG Revision
|
||||||
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -797,10 +806,10 @@ NTSYSAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlSetDaclSecurityDescriptor (
|
RtlSetDaclSecurityDescriptor (
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
BOOLEAN DaclPresent,
|
IN BOOLEAN DaclPresent,
|
||||||
PACL Dacl,
|
IN PACL Dacl,
|
||||||
BOOLEAN DaclDefaulted
|
IN BOOLEAN DaclDefaulted
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -845,8 +854,8 @@ NTSYSAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlSetSecurityDescriptorRMControl(
|
RtlSetSecurityDescriptorRMControl(
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PUCHAR RMControl
|
IN PUCHAR RMControl
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
|
|
@ -67,7 +67,7 @@ RtlpQuerySecurityDescriptorPointers(IN PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlpQuerySecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSID* Owner,
|
PSID* Owner,
|
||||||
PULONG OwnerLength,
|
PULONG OwnerLength,
|
||||||
PSID* Group,
|
PSID* Group,
|
||||||
|
@ -108,9 +108,11 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlCreateSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlCreateSecurityDescriptor(OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
ULONG Revision)
|
IN ULONG Revision)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
|
@ -118,21 +120,21 @@ RtlCreateSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityDescriptor->Revision = Revision;
|
pSD->Revision = Revision;
|
||||||
SecurityDescriptor->Sbz1 = 0;
|
pSD->Sbz1 = 0;
|
||||||
SecurityDescriptor->Control = 0;
|
pSD->Control = 0;
|
||||||
SecurityDescriptor->Owner = NULL;
|
pSD->Owner = NULL;
|
||||||
SecurityDescriptor->Group = NULL;
|
pSD->Group = NULL;
|
||||||
SecurityDescriptor->Sacl = NULL;
|
pSD->Sacl = NULL;
|
||||||
SecurityDescriptor->Dacl = NULL;
|
pSD->Dacl = NULL;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlCreateSecurityDescriptorRelative (PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
|
RtlCreateSecurityDescriptorRelative (OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
|
||||||
ULONG Revision)
|
IN ULONG Revision)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
|
@ -157,7 +159,7 @@ RtlCreateSecurityDescriptorRelative (PISECURITY_DESCRIPTOR_RELATIVE SecurityDesc
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
ULONG NTAPI
|
ULONG NTAPI
|
||||||
RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
|
RtlLengthSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||||
{
|
{
|
||||||
PSID Owner, Group;
|
PSID Owner, Group;
|
||||||
PACL Sacl, Dacl;
|
PACL Sacl, Dacl;
|
||||||
|
@ -165,7 +167,7 @@ RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers((PISECURITY_DESCRIPTOR)SecurityDescriptor,
|
||||||
&Owner,
|
&Owner,
|
||||||
&Group,
|
&Group,
|
||||||
&Sacl,
|
&Sacl,
|
||||||
|
@ -199,32 +201,34 @@ RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlGetDaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlGetDaclSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PBOOLEAN DaclPresent,
|
OUT PBOOLEAN DaclPresent,
|
||||||
PACL* Dacl,
|
OUT PACL* Dacl,
|
||||||
PBOOLEAN DaclDefaulted)
|
OUT PBOOLEAN DaclDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(SecurityDescriptor->Control & SE_DACL_PRESENT))
|
if (!(pSD->Control & SE_DACL_PRESENT))
|
||||||
{
|
{
|
||||||
*DaclPresent = FALSE;
|
*DaclPresent = FALSE;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
*DaclPresent = TRUE;
|
*DaclPresent = TRUE;
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers(pSD,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
Dacl);
|
Dacl);
|
||||||
|
|
||||||
*DaclDefaulted = ((SecurityDescriptor->Control & SE_DACL_DEFAULTED) ? TRUE : FALSE);
|
*DaclDefaulted = ((pSD->Control & SE_DACL_DEFAULTED) ? TRUE : FALSE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -234,36 +238,38 @@ RtlGetDaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSetDaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetDaclSecurityDescriptor(IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
BOOLEAN DaclPresent,
|
IN BOOLEAN DaclPresent,
|
||||||
PACL Dacl,
|
IN PACL Dacl,
|
||||||
BOOLEAN DaclDefaulted)
|
IN BOOLEAN DaclDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
if (pSD->Control & SE_SELF_RELATIVE)
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DaclPresent)
|
if (!DaclPresent)
|
||||||
{
|
{
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control & ~(SE_DACL_PRESENT);
|
pSD->Control = pSD->Control & ~(SE_DACL_PRESENT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control | SE_DACL_PRESENT;
|
pSD->Dacl = Dacl;
|
||||||
SecurityDescriptor->Dacl = Dacl;
|
pSD->Control |= SE_DACL_PRESENT;
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control & ~(SE_DACL_DEFAULTED);
|
pSD->Control &= ~(SE_DACL_DEFAULTED);
|
||||||
|
|
||||||
if (DaclDefaulted)
|
if (DaclDefaulted)
|
||||||
{
|
{
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control | SE_DACL_DEFAULTED;
|
pSD->Control |= SE_DACL_DEFAULTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -274,19 +280,20 @@ RtlSetDaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN NTAPI
|
BOOLEAN NTAPI
|
||||||
RtlValidSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor)
|
RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
PSID Owner, Group;
|
PSID Owner, Group;
|
||||||
PACL Sacl, Dacl;
|
PACL Sacl, Dacl;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers(pSD,
|
||||||
&Owner,
|
&Owner,
|
||||||
&Group,
|
&Group,
|
||||||
&Sacl,
|
&Sacl,
|
||||||
|
@ -308,28 +315,30 @@ RtlValidSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor)
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSetOwnerSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetOwnerSecurityDescriptor(IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSID Owner,
|
IN PSID Owner,
|
||||||
BOOLEAN OwnerDefaulted)
|
IN BOOLEAN OwnerDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
if (pSD->Control & SE_SELF_RELATIVE)
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityDescriptor->Owner = Owner;
|
pSD->Owner = Owner;
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control & ~(SE_OWNER_DEFAULTED);
|
pSD->Control &= ~(SE_OWNER_DEFAULTED);
|
||||||
|
|
||||||
if (OwnerDefaulted)
|
if (OwnerDefaulted)
|
||||||
{
|
{
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control | SE_OWNER_DEFAULTED;
|
pSD->Control |= SE_OWNER_DEFAULTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -340,24 +349,26 @@ RtlSetOwnerSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlGetOwnerSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlGetOwnerSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSID* Owner,
|
OUT PSID* Owner,
|
||||||
PBOOLEAN OwnerDefaulted)
|
OUT PBOOLEAN OwnerDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers(pSD,
|
||||||
Owner,
|
Owner,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
*OwnerDefaulted = ((SecurityDescriptor->Control & SE_OWNER_DEFAULTED) ? TRUE : FALSE);
|
*OwnerDefaulted = ((pSD->Control & SE_OWNER_DEFAULTED) ? TRUE : FALSE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -367,27 +378,29 @@ RtlGetOwnerSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSetGroupSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetGroupSecurityDescriptor(IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSID Group,
|
IN PSID Group,
|
||||||
BOOLEAN GroupDefaulted)
|
IN BOOLEAN GroupDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
if (pSD->Control & SE_SELF_RELATIVE)
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityDescriptor->Group = Group;
|
pSD->Group = Group;
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control & ~(SE_GROUP_DEFAULTED);
|
pSD->Control &= ~(SE_GROUP_DEFAULTED);
|
||||||
if (GroupDefaulted)
|
if (GroupDefaulted)
|
||||||
{
|
{
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control | SE_GROUP_DEFAULTED;
|
pSD->Control |= SE_GROUP_DEFAULTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -398,24 +411,26 @@ RtlSetGroupSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlGetGroupSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlGetGroupSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSID* Group,
|
OUT PSID* Group,
|
||||||
PBOOLEAN GroupDefaulted)
|
OUT PBOOLEAN GroupDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers(pSD,
|
||||||
NULL,
|
NULL,
|
||||||
Group,
|
Group,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
*GroupDefaulted = ((SecurityDescriptor->Control & SE_GROUP_DEFAULTED) ? TRUE : FALSE);
|
*GroupDefaulted = ((pSD->Control & SE_GROUP_DEFAULTED) ? TRUE : FALSE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -425,9 +440,9 @@ RtlGetGroupSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSD,
|
||||||
PSECURITY_DESCRIPTOR _RelSD,
|
OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
|
||||||
PULONG BufferLength)
|
IN OUT PULONG BufferLength)
|
||||||
{
|
{
|
||||||
PSID Owner;
|
PSID Owner;
|
||||||
PSID Group;
|
PSID Group;
|
||||||
|
@ -439,12 +454,12 @@ RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
||||||
ULONG DaclLength;
|
ULONG DaclLength;
|
||||||
ULONG TotalLength;
|
ULONG TotalLength;
|
||||||
ULONG_PTR Current;
|
ULONG_PTR Current;
|
||||||
PISECURITY_DESCRIPTOR AbsSD = (PISECURITY_DESCRIPTOR)_AbsSD;
|
PISECURITY_DESCRIPTOR pAbsSD = (PISECURITY_DESCRIPTOR)AbsoluteSD;
|
||||||
PISECURITY_DESCRIPTOR_RELATIVE RelSD = (PISECURITY_DESCRIPTOR_RELATIVE)_RelSD;
|
PISECURITY_DESCRIPTOR_RELATIVE pRelSD = (PISECURITY_DESCRIPTOR_RELATIVE)SelfRelativeSD;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptor(AbsSD,
|
RtlpQuerySecurityDescriptor(pAbsSD,
|
||||||
&Owner,
|
&Owner,
|
||||||
&OwnerLength,
|
&OwnerLength,
|
||||||
&Group,
|
&Group,
|
||||||
|
@ -461,21 +476,21 @@ RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(RelSD,
|
RtlZeroMemory(pRelSD,
|
||||||
TotalLength);
|
TotalLength);
|
||||||
|
|
||||||
RelSD->Revision = AbsSD->Revision;
|
pRelSD->Revision = pAbsSD->Revision;
|
||||||
RelSD->Sbz1 = AbsSD->Sbz1;
|
pRelSD->Sbz1 = pAbsSD->Sbz1;
|
||||||
RelSD->Control = AbsSD->Control | SE_SELF_RELATIVE;
|
pRelSD->Control = pAbsSD->Control | SE_SELF_RELATIVE;
|
||||||
|
|
||||||
Current = (ULONG_PTR)(RelSD + 1);
|
Current = (ULONG_PTR)(pRelSD + 1);
|
||||||
|
|
||||||
if (SaclLength != 0)
|
if (SaclLength != 0)
|
||||||
{
|
{
|
||||||
RtlCopyMemory((PVOID)Current,
|
RtlCopyMemory((PVOID)Current,
|
||||||
Sacl,
|
Sacl,
|
||||||
SaclLength);
|
SaclLength);
|
||||||
RelSD->Sacl = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)RelSD);
|
pRelSD->Sacl = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)pRelSD);
|
||||||
Current += SaclLength;
|
Current += SaclLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +499,7 @@ RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
||||||
RtlCopyMemory((PVOID)Current,
|
RtlCopyMemory((PVOID)Current,
|
||||||
Dacl,
|
Dacl,
|
||||||
DaclLength);
|
DaclLength);
|
||||||
RelSD->Dacl = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)RelSD);
|
pRelSD->Dacl = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)pRelSD);
|
||||||
Current += DaclLength;
|
Current += DaclLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +508,7 @@ RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
||||||
RtlCopyMemory((PVOID)Current,
|
RtlCopyMemory((PVOID)Current,
|
||||||
Owner,
|
Owner,
|
||||||
OwnerLength);
|
OwnerLength);
|
||||||
RelSD->Owner = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)RelSD);
|
pRelSD->Owner = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)pRelSD);
|
||||||
Current += OwnerLength;
|
Current += OwnerLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +517,7 @@ RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
||||||
RtlCopyMemory((PVOID)Current,
|
RtlCopyMemory((PVOID)Current,
|
||||||
Group,
|
Group,
|
||||||
GroupLength);
|
GroupLength);
|
||||||
RelSD->Group = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)RelSD);
|
pRelSD->Group = (ULONG)((ULONG_PTR)Current - (ULONG_PTR)pRelSD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -513,18 +528,22 @@ RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR _AbsSD,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlAbsoluteToSelfRelativeSD(PISECURITY_DESCRIPTOR AbsSD,
|
RtlAbsoluteToSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
|
||||||
PISECURITY_DESCRIPTOR RelSD,
|
IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
|
||||||
PULONG BufferLength)
|
IN PULONG BufferLength)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pAbsSD = (PISECURITY_DESCRIPTOR)AbsoluteSecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (AbsSD->Control & SE_SELF_RELATIVE)
|
if (pAbsSD->Control & SE_SELF_RELATIVE)
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RtlMakeSelfRelativeSD(AbsSD, (PSECURITY_DESCRIPTOR)RelSD, BufferLength);
|
return RtlMakeSelfRelativeSD(AbsoluteSecurityDescriptor,
|
||||||
|
SelfRelativeSecurityDescriptor,
|
||||||
|
BufferLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -532,20 +551,22 @@ RtlAbsoluteToSelfRelativeSD(PISECURITY_DESCRIPTOR AbsSD,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlGetControlSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlGetControlSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PSECURITY_DESCRIPTOR_CONTROL Control,
|
OUT PSECURITY_DESCRIPTOR_CONTROL Control,
|
||||||
PULONG Revision)
|
OUT PULONG Revision)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
*Revision = SecurityDescriptor->Revision;
|
*Revision = pSD->Revision;
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Control = SecurityDescriptor->Control;
|
*Control = pSD->Control;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -555,24 +576,26 @@ RtlGetControlSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSetControlSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetControlSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
|
IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
|
||||||
IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
|
IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
PAGED_CODE_RTL();
|
||||||
{
|
|
||||||
return STATUS_UNKNOWN_REVISION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Zero the 'bits of interest' */
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
SecurityDescriptor->Control &= ~ControlBitsOfInterest;
|
{
|
||||||
|
return STATUS_UNKNOWN_REVISION;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the 'bits to set' */
|
/* Zero the 'bits of interest' */
|
||||||
SecurityDescriptor->Control |= (ControlBitsToSet & ControlBitsOfInterest);
|
pSD->Control &= ~ControlBitsOfInterest;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
/* Set the 'bits to set' */
|
||||||
|
pSD->Control |= (ControlBitsToSet & ControlBitsOfInterest);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -580,32 +603,34 @@ RtlSetControlSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlGetSaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlGetSaclSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PBOOLEAN SaclPresent,
|
OUT PBOOLEAN SaclPresent,
|
||||||
PACL *Sacl,
|
OUT PACL *Sacl,
|
||||||
PBOOLEAN SaclDefaulted)
|
OUT PBOOLEAN SaclDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(SecurityDescriptor->Control & SE_SACL_PRESENT))
|
if (!(pSD->Control & SE_SACL_PRESENT))
|
||||||
{
|
{
|
||||||
*SaclPresent = FALSE;
|
*SaclPresent = FALSE;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
*SaclPresent = TRUE;
|
*SaclPresent = TRUE;
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers(pSD,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
Sacl,
|
Sacl,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
*SaclDefaulted = ((SecurityDescriptor->Control & SE_SACL_DEFAULTED) ? TRUE : FALSE);
|
*SaclDefaulted = ((pSD->Control & SE_SACL_DEFAULTED) ? TRUE : FALSE);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -615,36 +640,38 @@ RtlGetSaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSetSaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetSaclSecurityDescriptor(IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
BOOLEAN SaclPresent,
|
IN BOOLEAN SaclPresent,
|
||||||
PACL Sacl,
|
IN PACL Sacl,
|
||||||
BOOLEAN SaclDefaulted)
|
IN BOOLEAN SaclDefaulted)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
if (pSD->Control & SE_SELF_RELATIVE)
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SaclPresent)
|
if (!SaclPresent)
|
||||||
{
|
{
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control & ~(SE_SACL_PRESENT);
|
pSD->Control &= ~(SE_SACL_PRESENT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control | SE_SACL_PRESENT;
|
pSD->Sacl = Sacl;
|
||||||
SecurityDescriptor->Sacl = Sacl;
|
pSD->Control |= SE_SACL_PRESENT;
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control & ~(SE_SACL_DEFAULTED);
|
pSD->Control &= ~(SE_SACL_DEFAULTED);
|
||||||
|
|
||||||
if (SaclDefaulted)
|
if (SaclDefaulted)
|
||||||
{
|
{
|
||||||
SecurityDescriptor->Control = SecurityDescriptor->Control | SE_SACL_DEFAULTED;
|
pSD->Control |= SE_SACL_DEFAULTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -655,18 +682,20 @@ RtlSetSaclSecurityDescriptor(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSelfRelativeToAbsoluteSD(PISECURITY_DESCRIPTOR RelSD,
|
RtlSelfRelativeToAbsoluteSD(IN PSECURITY_DESCRIPTOR SelfRelativeSD,
|
||||||
PISECURITY_DESCRIPTOR AbsSD,
|
OUT PSECURITY_DESCRIPTOR AbsoluteSD,
|
||||||
PDWORD AbsSDSize,
|
IN PULONG AbsoluteSDSize,
|
||||||
PACL Dacl,
|
IN PACL Dacl,
|
||||||
PDWORD DaclSize,
|
IN PULONG DaclSize,
|
||||||
PACL Sacl,
|
IN PACL Sacl,
|
||||||
PDWORD SaclSize,
|
IN PULONG SaclSize,
|
||||||
PSID Owner,
|
IN PSID Owner,
|
||||||
PDWORD OwnerSize,
|
IN PULONG OwnerSize,
|
||||||
PSID Group,
|
IN PSID PrimaryGroup,
|
||||||
PDWORD GroupSize)
|
IN PULONG PrimaryGroupSize)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pAbsSD = (PISECURITY_DESCRIPTOR)AbsoluteSD;
|
||||||
|
PISECURITY_DESCRIPTOR pRelSD = (PISECURITY_DESCRIPTOR)SelfRelativeSD;
|
||||||
ULONG OwnerLength;
|
ULONG OwnerLength;
|
||||||
ULONG GroupLength;
|
ULONG GroupLength;
|
||||||
ULONG DaclLength;
|
ULONG DaclLength;
|
||||||
|
@ -678,17 +707,17 @@ RtlSelfRelativeToAbsoluteSD(PISECURITY_DESCRIPTOR RelSD,
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (RelSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pRelSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(RelSD->Control & SE_SELF_RELATIVE))
|
if (!(pRelSD->Control & SE_SELF_RELATIVE))
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptor (RelSD,
|
RtlpQuerySecurityDescriptor (pRelSD,
|
||||||
&pOwner,
|
&pOwner,
|
||||||
&OwnerLength,
|
&OwnerLength,
|
||||||
&pGroup,
|
&pGroup,
|
||||||
|
@ -699,7 +728,7 @@ RtlSelfRelativeToAbsoluteSD(PISECURITY_DESCRIPTOR RelSD,
|
||||||
&SaclLength);
|
&SaclLength);
|
||||||
|
|
||||||
if (OwnerLength > *OwnerSize ||
|
if (OwnerLength > *OwnerSize ||
|
||||||
GroupLength > *GroupSize ||
|
GroupLength > *PrimaryGroupSize ||
|
||||||
DaclLength > *DaclSize ||
|
DaclLength > *DaclSize ||
|
||||||
SaclLength > *SaclSize)
|
SaclLength > *SaclSize)
|
||||||
{
|
{
|
||||||
|
@ -707,20 +736,20 @@ RtlSelfRelativeToAbsoluteSD(PISECURITY_DESCRIPTOR RelSD,
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlCopyMemory (Owner, pOwner, OwnerLength);
|
RtlCopyMemory (Owner, pOwner, OwnerLength);
|
||||||
RtlCopyMemory (Group, pGroup, GroupLength);
|
RtlCopyMemory (PrimaryGroup, pGroup, GroupLength);
|
||||||
RtlCopyMemory (Dacl, pDacl, DaclLength);
|
RtlCopyMemory (Dacl, pDacl, DaclLength);
|
||||||
RtlCopyMemory (Sacl, pSacl, SaclLength);
|
RtlCopyMemory (Sacl, pSacl, SaclLength);
|
||||||
|
|
||||||
AbsSD->Revision = RelSD->Revision;
|
pAbsSD->Revision = pRelSD->Revision;
|
||||||
AbsSD->Sbz1 = RelSD->Sbz1;
|
pAbsSD->Sbz1 = pRelSD->Sbz1;
|
||||||
AbsSD->Control = RelSD->Control & ~SE_SELF_RELATIVE;
|
pAbsSD->Control = pRelSD->Control & ~SE_SELF_RELATIVE;
|
||||||
AbsSD->Owner = Owner;
|
pAbsSD->Owner = Owner;
|
||||||
AbsSD->Group = Group;
|
pAbsSD->Group = PrimaryGroup;
|
||||||
AbsSD->Dacl = Dacl;
|
pAbsSD->Dacl = Dacl;
|
||||||
AbsSD->Sacl = Sacl;
|
pAbsSD->Sacl = Sacl;
|
||||||
|
|
||||||
*OwnerSize = OwnerLength;
|
*OwnerSize = OwnerLength;
|
||||||
*GroupSize = GroupLength;
|
*PrimaryGroupSize = GroupLength;
|
||||||
*DaclSize = DaclLength;
|
*DaclSize = DaclLength;
|
||||||
*SaclSize = SaclLength;
|
*SaclSize = SaclLength;
|
||||||
|
|
||||||
|
@ -732,11 +761,11 @@ RtlSelfRelativeToAbsoluteSD(PISECURITY_DESCRIPTOR RelSD,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
|
RtlSelfRelativeToAbsoluteSD2(IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
|
||||||
PULONG BufferSize)
|
OUT PULONG BufferSize)
|
||||||
{
|
{
|
||||||
PISECURITY_DESCRIPTOR AbsSD = SelfRelativeSecurityDescriptor;
|
PISECURITY_DESCRIPTOR pAbsSD = (PISECURITY_DESCRIPTOR)SelfRelativeSD;
|
||||||
PISECURITY_DESCRIPTOR_RELATIVE RelSD = (PISECURITY_DESCRIPTOR_RELATIVE)SelfRelativeSecurityDescriptor;
|
PISECURITY_DESCRIPTOR_RELATIVE pRelSD = (PISECURITY_DESCRIPTOR_RELATIVE)SelfRelativeSD;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
PVOID DataStart, DataEnd;
|
PVOID DataStart, DataEnd;
|
||||||
ULONG DataSize;
|
ULONG DataSize;
|
||||||
|
@ -753,7 +782,7 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SelfRelativeSecurityDescriptor == NULL)
|
if (SelfRelativeSD == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_PARAMETER_1;
|
return STATUS_INVALID_PARAMETER_1;
|
||||||
}
|
}
|
||||||
|
@ -762,11 +791,11 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
return STATUS_INVALID_PARAMETER_2;
|
return STATUS_INVALID_PARAMETER_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RelSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
if (pRelSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
{
|
{
|
||||||
return STATUS_UNKNOWN_REVISION;
|
return STATUS_UNKNOWN_REVISION;
|
||||||
}
|
}
|
||||||
if (!(RelSD->Control & SE_SELF_RELATIVE))
|
if (!(pRelSD->Control & SE_SELF_RELATIVE))
|
||||||
{
|
{
|
||||||
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
return STATUS_BAD_DESCRIPTOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
@ -776,7 +805,7 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptor(SelfRelativeSecurityDescriptor,
|
RtlpQuerySecurityDescriptor((PISECURITY_DESCRIPTOR)pRelSD,
|
||||||
&pOwner,
|
&pOwner,
|
||||||
&OwnerLength,
|
&OwnerLength,
|
||||||
&pGroup,
|
&pGroup,
|
||||||
|
@ -831,35 +860,35 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
descriptor! Also the data area must be located somewhere after the
|
descriptor! Also the data area must be located somewhere after the
|
||||||
end of the SECURITY_DESCRIPTOR_RELATIVE structure */
|
end of the SECURITY_DESCRIPTOR_RELATIVE structure */
|
||||||
ASSERT(DataStart != NULL);
|
ASSERT(DataStart != NULL);
|
||||||
ASSERT((ULONG_PTR)DataStart >= (ULONG_PTR)(RelSD + 1));
|
ASSERT((ULONG_PTR)DataStart >= (ULONG_PTR)(pRelSD + 1));
|
||||||
|
|
||||||
/* it's time to move the data */
|
/* it's time to move the data */
|
||||||
RtlMoveMemory((PVOID)(AbsSD + 1),
|
RtlMoveMemory((PVOID)(pAbsSD + 1),
|
||||||
DataStart,
|
DataStart,
|
||||||
DataSize);
|
DataSize);
|
||||||
|
|
||||||
MoveDelta = (LONG)((LONG_PTR)(AbsSD + 1) - (LONG_PTR)DataStart);
|
MoveDelta = (LONG)((LONG_PTR)(pAbsSD + 1) - (LONG_PTR)DataStart);
|
||||||
|
|
||||||
/* adjust the pointers if neccessary */
|
/* adjust the pointers if neccessary */
|
||||||
if (pOwner != NULL)
|
if (pOwner != NULL)
|
||||||
AbsSD->Owner = (PSID)((LONG_PTR)pOwner + MoveDelta);
|
pAbsSD->Owner = (PSID)((LONG_PTR)pOwner + MoveDelta);
|
||||||
else
|
else
|
||||||
AbsSD->Owner = NULL;
|
pAbsSD->Owner = NULL;
|
||||||
|
|
||||||
if (pGroup != NULL)
|
if (pGroup != NULL)
|
||||||
AbsSD->Group = (PSID)((LONG_PTR)pGroup + MoveDelta);
|
pAbsSD->Group = (PSID)((LONG_PTR)pGroup + MoveDelta);
|
||||||
else
|
else
|
||||||
AbsSD->Group = NULL;
|
pAbsSD->Group = NULL;
|
||||||
|
|
||||||
if (pSacl != NULL)
|
if (pSacl != NULL)
|
||||||
AbsSD->Sacl = (PACL)((LONG_PTR)pSacl + MoveDelta);
|
pAbsSD->Sacl = (PACL)((LONG_PTR)pSacl + MoveDelta);
|
||||||
else
|
else
|
||||||
AbsSD->Sacl = NULL;
|
pAbsSD->Sacl = NULL;
|
||||||
|
|
||||||
if (pDacl != NULL)
|
if (pDacl != NULL)
|
||||||
AbsSD->Dacl = (PACL)((LONG_PTR)pDacl + MoveDelta);
|
pAbsSD->Dacl = (PACL)((LONG_PTR)pDacl + MoveDelta);
|
||||||
else
|
else
|
||||||
AbsSD->Dacl = NULL;
|
pAbsSD->Dacl = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -869,18 +898,18 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
ASSERT(pSacl == NULL);
|
ASSERT(pSacl == NULL);
|
||||||
ASSERT(pDacl == NULL);
|
ASSERT(pDacl == NULL);
|
||||||
|
|
||||||
AbsSD->Owner = NULL;
|
pAbsSD->Owner = NULL;
|
||||||
AbsSD->Group = NULL;
|
pAbsSD->Group = NULL;
|
||||||
AbsSD->Sacl = NULL;
|
pAbsSD->Sacl = NULL;
|
||||||
AbsSD->Dacl = NULL;
|
pAbsSD->Dacl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear the self-relative flag */
|
/* clear the self-relative flag */
|
||||||
AbsSD->Control &= ~SE_SELF_RELATIVE;
|
pAbsSD->Control &= ~SE_SELF_RELATIVE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
RtlpQuerySecurityDescriptorPointers(SelfRelativeSecurityDescriptor,
|
RtlpQuerySecurityDescriptorPointers((PISECURITY_DESCRIPTOR)pRelSD,
|
||||||
&pOwner,
|
&pOwner,
|
||||||
&pGroup,
|
&pGroup,
|
||||||
&pSacl,
|
&pSacl,
|
||||||
|
@ -889,11 +918,11 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
ASSERT(sizeof(SECURITY_DESCRIPTOR) == sizeof(SECURITY_DESCRIPTOR_RELATIVE));
|
ASSERT(sizeof(SECURITY_DESCRIPTOR) == sizeof(SECURITY_DESCRIPTOR_RELATIVE));
|
||||||
|
|
||||||
/* clear the self-relative flag and simply convert the offsets to pointers */
|
/* clear the self-relative flag and simply convert the offsets to pointers */
|
||||||
AbsSD->Control &= ~SE_SELF_RELATIVE;
|
pAbsSD->Control &= ~SE_SELF_RELATIVE;
|
||||||
AbsSD->Owner = pOwner;
|
pAbsSD->Owner = pOwner;
|
||||||
AbsSD->Group = pGroup;
|
pAbsSD->Group = pGroup;
|
||||||
AbsSD->Sacl = pSacl;
|
pAbsSD->Sacl = pSacl;
|
||||||
AbsSD->Dacl = pDacl;
|
pAbsSD->Dacl = pDacl;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -905,22 +934,24 @@ RtlSelfRelativeToAbsoluteSD2(PISECURITY_DESCRIPTOR SelfRelativeSecurityDescripto
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN NTAPI
|
BOOLEAN NTAPI
|
||||||
RtlValidRelativeSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptorInput,
|
RtlValidRelativeSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
|
||||||
IN ULONG SecurityDescriptorLength,
|
IN ULONG SecurityDescriptorLength,
|
||||||
IN SECURITY_INFORMATION RequiredInformation)
|
IN SECURITY_INFORMATION RequiredInformation)
|
||||||
{
|
{
|
||||||
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptorInput;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptorLength < sizeof(SECURITY_DESCRIPTOR_RELATIVE) ||
|
if (SecurityDescriptorLength < sizeof(SECURITY_DESCRIPTOR_RELATIVE) ||
|
||||||
SecurityDescriptorInput->Revision != SECURITY_DESCRIPTOR_REVISION1 ||
|
SecurityDescriptorInput->Revision != SECURITY_DESCRIPTOR_REVISION1 ||
|
||||||
!(SecurityDescriptorInput->Control & SE_SELF_RELATIVE))
|
!(pSD->Control & SE_SELF_RELATIVE))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptorInput->Owner != 0)
|
if (pSD->Owner != 0)
|
||||||
{
|
{
|
||||||
PSID Owner = (PSID)((ULONG_PTR)SecurityDescriptorInput->Owner + (ULONG_PTR)SecurityDescriptorInput);
|
PSID Owner = (PSID)((ULONG_PTR)pSD->Owner + (ULONG_PTR)pSD);
|
||||||
if (!RtlValidSid(Owner))
|
if (!RtlValidSid(Owner))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -931,9 +962,9 @@ RtlValidRelativeSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptorIn
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptorInput->Group != 0)
|
if (pSD->Group != 0)
|
||||||
{
|
{
|
||||||
PSID Group = (PSID)((ULONG_PTR)SecurityDescriptorInput->Group + (ULONG_PTR)SecurityDescriptorInput);
|
PSID Group = (PSID)((ULONG_PTR)pSD->Group + (ULONG_PTR)pSD);
|
||||||
if (!RtlValidSid(Group))
|
if (!RtlValidSid(Group))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -944,10 +975,10 @@ RtlValidRelativeSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptorIn
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptorInput->Control & SE_DACL_PRESENT)
|
if (pSD->Control & SE_DACL_PRESENT)
|
||||||
{
|
{
|
||||||
if (SecurityDescriptorInput->Dacl != 0 &&
|
if (pSD->Dacl != 0 &&
|
||||||
!RtlValidAcl((PACL)((ULONG_PTR)SecurityDescriptorInput->Dacl + (ULONG_PTR)SecurityDescriptorInput)))
|
!RtlValidAcl((PACL)((ULONG_PTR)pSD->Dacl + (ULONG_PTR)pSD)))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -957,10 +988,10 @@ RtlValidRelativeSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptorIn
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityDescriptorInput->Control & SE_SACL_PRESENT)
|
if (pSD->Control & SE_SACL_PRESENT)
|
||||||
{
|
{
|
||||||
if (SecurityDescriptorInput->Sacl != 0 &&
|
if (pSD->Sacl != 0 &&
|
||||||
!RtlValidAcl((PACL)((ULONG_PTR)SecurityDescriptorInput->Sacl + (ULONG_PTR)SecurityDescriptorInput)))
|
!RtlValidAcl((PACL)((ULONG_PTR)pSD->Sacl + (ULONG_PTR)pSD)))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -978,20 +1009,22 @@ RtlValidRelativeSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptorIn
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN NTAPI
|
BOOLEAN NTAPI
|
||||||
RtlGetSecurityDescriptorRMControl(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlGetSecurityDescriptorRMControl(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PUCHAR RMControl)
|
OUT PUCHAR RMControl)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
if (!(SecurityDescriptor->Control & SE_RM_CONTROL_VALID))
|
PAGED_CODE_RTL();
|
||||||
{
|
|
||||||
*RMControl = 0;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*RMControl = SecurityDescriptor->Sbz1;
|
if (!(pSD->Control & SE_RM_CONTROL_VALID))
|
||||||
|
{
|
||||||
|
*RMControl = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
*RMControl = pSD->Sbz1;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -999,21 +1032,23 @@ RtlGetSecurityDescriptorRMControl(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
RtlSetSecurityDescriptorRMControl(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetSecurityDescriptorRMControl(IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
PUCHAR RMControl)
|
IN PUCHAR RMControl)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
if (RMControl == NULL)
|
PAGED_CODE_RTL();
|
||||||
{
|
|
||||||
SecurityDescriptor->Control &= ~SE_RM_CONTROL_VALID;
|
if (RMControl == NULL)
|
||||||
SecurityDescriptor->Sbz1 = 0;
|
{
|
||||||
}
|
pSD->Control &= ~SE_RM_CONTROL_VALID;
|
||||||
else
|
pSD->Sbz1 = 0;
|
||||||
{
|
}
|
||||||
SecurityDescriptor->Control |= SE_RM_CONTROL_VALID;
|
else
|
||||||
SecurityDescriptor->Sbz1 = *RMControl;
|
{
|
||||||
}
|
pSD->Control |= SE_RM_CONTROL_VALID;
|
||||||
|
pSD->Sbz1 = *RMControl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1021,25 +1056,27 @@ RtlSetSecurityDescriptorRMControl(PISECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlSetAttributesSecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptor,
|
RtlSetAttributesSecurityDescriptor(IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||||
IN SECURITY_DESCRIPTOR_CONTROL Control,
|
IN SECURITY_DESCRIPTOR_CONTROL Control,
|
||||||
OUT PULONG Revision)
|
OUT PULONG Revision)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PISECURITY_DESCRIPTOR pSD = (PISECURITY_DESCRIPTOR)SecurityDescriptor;
|
||||||
|
|
||||||
*Revision = SecurityDescriptor->Revision;
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
*Revision = pSD->Revision;
|
||||||
return STATUS_UNKNOWN_REVISION;
|
|
||||||
|
|
||||||
Control &=
|
if (pSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
|
||||||
~(SE_OWNER_DEFAULTED | SE_GROUP_DEFAULTED | SE_DACL_PRESENT |
|
return STATUS_UNKNOWN_REVISION;
|
||||||
SE_DACL_DEFAULTED | SE_SACL_PRESENT | SE_SACL_DEFAULTED |
|
|
||||||
SE_RM_CONTROL_VALID | SE_SELF_RELATIVE);
|
|
||||||
|
|
||||||
return RtlSetControlSecurityDescriptor(SecurityDescriptor,
|
Control &=
|
||||||
Control,
|
~(SE_OWNER_DEFAULTED | SE_GROUP_DEFAULTED | SE_DACL_PRESENT |
|
||||||
Control);
|
SE_DACL_DEFAULTED | SE_SACL_PRESENT | SE_SACL_DEFAULTED |
|
||||||
|
SE_RM_CONTROL_VALID | SE_SELF_RELATIVE);
|
||||||
|
|
||||||
|
return RtlSetControlSecurityDescriptor(SecurityDescriptor,
|
||||||
|
Control,
|
||||||
|
Control);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue