Remove RtlQueryInformationAcl since it doesn't always return the correct ACL length
@@ -823,32 +823,20 @@ _Callback_ NTSTATUS PhStdGetObjectSecurity(
if (NT_SUCCESS(status) && !defaultDacl->DefaultDacl)
status = STATUS_INVALID_SECURITY_DESCR;
- if (NT_SUCCESS(status))
- {
- ACL_SIZE_INFORMATION aclSizeInfo;
-
- status = RtlQueryInformationAcl(
- defaultDacl->DefaultDacl,
- &aclSizeInfo,
- sizeof(ACL_SIZE_INFORMATION),
- AclSizeInformation
- );
-
if (NT_SUCCESS(status))
{
ULONG allocationLength;
PSECURITY_DESCRIPTOR securityDescriptor;
- allocationLength = SECURITY_DESCRIPTOR_MIN_LENGTH + aclSizeInfo.AclBytesInUse;
+ allocationLength = SECURITY_DESCRIPTOR_MIN_LENGTH + defaultDacl->DefaultDacl->AclSize;
- securityDescriptor = PhAllocateZero(allocationLength);
+ securityDescriptor = PhAllocateZero(PAGE_SIZE);
RtlCreateSecurityDescriptor(securityDescriptor, SECURITY_DESCRIPTOR_REVISION);
RtlSetDaclSecurityDescriptor(securityDescriptor, TRUE, defaultDacl->DefaultDacl, FALSE);
assert(allocationLength == RtlLengthSecurityDescriptor(securityDescriptor));
*SecurityDescriptor = securityDescriptor;
- }
PhFree(defaultDacl);
}
