RtlLengthSecurityDescriptor

NTSTATUS __fastcall RtlLengthSecurityDescriptor(INT64 a1){
  __int16 v1; 
  NTSTATUS result; 
  __int64 v4; 
  INT64 v5; 
  __int64 v6; 
  INT64 v7; 
  __int64 v8; 
  INT64 v9; 
  __int64 v10; 
  INT64 v11; 

  v1 = *(_WORD *)(a1 + 2);
  result = ((v1 >> 31) & 0xFFFFFFEC) + 40;
  if( v1 >= 0 )
  {
    v5 = *(_QWORD *)(a1 + 8);
  }
  else
  {
    v4 = *(unsigned int *)(a1 + 4);
    if( !(_DWORD)v4 )
      goto LABEL_6;
    v5 = a1 + v4;
  }
  if( v5 )
    result += (4 * *(unsigned __int8 *)(v5 + 1) + 11) & 0xFFFFFFFC;
LABEL_6:
  if( v1 >= 0 )
  {
    v7 = *(_QWORD *)(a1 + 16);
  }
  else
  {
    v6 = *(unsigned int *)(a1 + 8);
    if( !(_DWORD)v6 )
      goto LABEL_11;
    v7 = a1 + v6;
  }
  if( v7 )
    result += (4 * *(unsigned __int8 *)(v7 + 1) + 11) & 0xFFFFFFFC;
LABEL_11:
  if( (v1 & 4) == 0 )
    goto LABEL_17;
  if( v1 >= 0 )
  {
    v9 = *(_QWORD *)(a1 + 32);
  }
  else
  {
    v8 = *(unsigned int *)(a1 + 16);
    if( !(_DWORD)v8 )
      goto LABEL_17;
    v9 = a1 + v8;
  }
  if( v9 )
    result += (*(unsigned __int16 *)(v9 + 2) + 3) & 0xFFFFFFFC;
LABEL_17:
  if( (v1 & 0x10) == 0 )
    return result;
  if( v1 >= 0 )
  {
    v11 = *(_QWORD *)(a1 + 24);
  }
  else
  {
    v10 = *(unsigned int *)(a1 + 12);
    if( !(_DWORD)v10 )
      return result;
    v11 = a1 + v10;
  }
  if( v11 )
    result += (*(unsigned __int16 *)(v11 + 2) + 3) & 0xFFFFFFFC;
  return result;
}

Referenced by:

AdtpBuildAccessReasonAuditString
BiCreateKeySecurityDescriptor
CmGetRegKeySecurityDescriptor
CmSetDeviceRegPropWorker
CmSetInstallerClassRegPropWorker
DrvDbGetSecurityDescriptor
ExpWnfLookupPermanentName
IopUpdateSecureDeviceClassState
ObLogSecurityDescriptor
ObpSetObjectAuditInfo
PiAuCreateLocalSystemSecurityObject
PiAuCreateStandardSecurityObject
PiAuGetDriverDataDirectorySecurityObject
PiAuGetServiceStateSecurityObject
PiAuGetStateDirectorySecurityObject
PiDevCfgGetKeySecurityDescriptor
PnpGetEnumSecurityDescriptor
PnpGetPropertiesSecurityDescriptor
PnpValidatePropertyData
WmipGetGuidSecurityDescriptor
WmipSaveGuidSecurityDescriptor