Reactos

[RTL] Improve usage of absolte vs self-relative security descriptors

- RtlpQuerySecurityDescriptor: Change argument type of first parameter from PISECURITY_DESCRIPTOR to PSECURITY_DESCRIPTOR, since it handles both absolute and self-relative SDs.
- RtlMakeSelfRelativeSD: rename first parameter from AbsoluteSD to SecurityDescriptor, since it handles both absolute and self-relative SDs.
- SepGetGroupFromDescriptor/SepGetOwnerFromDescriptor/SepGetDaclFromDescriptor/SepGetSaclFromDescriptor: Change parameter type from PVOID to PSECURITY_DESCRIPTOR for clarity.

+8 -9
+4 -4
ntoskrnl/include/internal/se.h
··· 87 87 FORCEINLINE 88 88 PSID 89 89 SepGetGroupFromDescriptor( 90 - _Inout_ PVOID _Descriptor) 90 + _Inout_ PSECURITY_DESCRIPTOR _Descriptor) 91 91 { 92 92 PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor; 93 93 PISECURITY_DESCRIPTOR_RELATIVE SdRel; ··· 107 107 FORCEINLINE 108 108 PSID 109 109 SepGetOwnerFromDescriptor( 110 - _Inout_ PVOID _Descriptor) 110 + _Inout_ PSECURITY_DESCRIPTOR _Descriptor) 111 111 { 112 112 PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor; 113 113 PISECURITY_DESCRIPTOR_RELATIVE SdRel; ··· 127 127 FORCEINLINE 128 128 PACL 129 129 SepGetDaclFromDescriptor( 130 - _Inout_ PVOID _Descriptor) 130 + _Inout_ PSECURITY_DESCRIPTOR _Descriptor) 131 131 { 132 132 PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor; 133 133 PISECURITY_DESCRIPTOR_RELATIVE SdRel; ··· 149 149 FORCEINLINE 150 150 PACL 151 151 SepGetSaclFromDescriptor( 152 - _Inout_ PVOID _Descriptor) 152 + _Inout_ PSECURITY_DESCRIPTOR _Descriptor) 153 153 { 154 154 PISECURITY_DESCRIPTOR Descriptor = (PISECURITY_DESCRIPTOR)_Descriptor; 155 155 PISECURITY_DESCRIPTOR_RELATIVE SdRel;
+4 -5
sdk/lib/rtl/sd.c
··· 42 42 43 43 VOID 44 44 NTAPI 45 - RtlpQuerySecurityDescriptor(IN PISECURITY_DESCRIPTOR SecurityDescriptor, 45 + RtlpQuerySecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, 46 46 OUT PSID *Owner, 47 47 OUT PULONG OwnerSize, 48 48 OUT PSID *PrimaryGroup, ··· 644 644 */ 645 645 NTSTATUS 646 646 NTAPI 647 - RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR AbsoluteSD, 647 + RtlMakeSelfRelativeSD(IN PSECURITY_DESCRIPTOR SecurityDescriptor, 648 648 OUT PSECURITY_DESCRIPTOR SelfRelativeSD, 649 649 IN OUT PULONG BufferLength) 650 650 { ··· 652 652 PACL Sacl, Dacl; 653 653 ULONG OwnerLength, GroupLength, SaclLength, DaclLength, TotalLength; 654 654 ULONG_PTR Current; 655 - PISECURITY_DESCRIPTOR Sd = (PISECURITY_DESCRIPTOR)AbsoluteSD; 656 655 PISECURITY_DESCRIPTOR_RELATIVE RelSd = (PISECURITY_DESCRIPTOR_RELATIVE)SelfRelativeSD; 657 656 PAGED_CODE_RTL(); 658 657 659 658 /* Query all components */ 660 - RtlpQuerySecurityDescriptor(Sd, 659 + RtlpQuerySecurityDescriptor(SecurityDescriptor, 661 660 &Owner, 662 661 &OwnerLength, 663 662 &Group, ··· 687 686 688 687 /* Copy the header fields */ 689 688 RtlCopyMemory(RelSd, 690 - Sd, 689 + SecurityDescriptor, 691 690 FIELD_OFFSET(SECURITY_DESCRIPTOR_RELATIVE, Owner)); 692 691 693 692 /* Set the current copy pointer */