RtlLengthSecurityDescriptor

UINT64 __fastcall RtlLengthSecurityDescriptor(VOID *SecurityDescriptor){
  __int16 v1; 
  UINT64 result; 
  __int64 v4; 
  char *v5; 
  __int64 v6; 
  char *v7; 
  __int64 v8; 
  char *v9; 
  __int64 v10; 
  char *v11; 
  v1 = *((_WORD *)SecurityDescriptor + 1);
  result = ((v1 >> 31) & 0xFFFFFFEC) + 40;
  if( v1 >= 0 )
  {
    v5 = (char *)*((_QWORD *)SecurityDescriptor + 1);
  }
  else
  {
    v4 = *((unsigned int *)SecurityDescriptor + 1);
    if( !(_DWORD)v4 )
      goto LABEL_6;
    v5 = (char *)SecurityDescriptor + v4;
  }
  if( v5 )
    result = ((4 * (unsigned __int8)v5[1] + 11) & 0xFFFFFFFC) + (unsigned int)result;
LABEL_6:
  if( v1 >= 0 )
  {
    v7 = (char *)*((_QWORD *)SecurityDescriptor + 2);
  }
  else
  {
    v6 = *((unsigned int *)SecurityDescriptor + 2);
    if( !(_DWORD)v6 )
      goto LABEL_11;
    v7 = (char *)SecurityDescriptor + v6;
  }
  if( v7 )
    result = ((4 * (unsigned __int8)v7[1] + 11) & 0xFFFFFFFC) + (unsigned int)result;
LABEL_11:
  if( (v1 & 4) == 0 )
    goto LABEL_17;
  if( v1 >= 0 )
  {
    v9 = (char *)*((_QWORD *)SecurityDescriptor + 4);
  }
  else
  {
    v8 = *((unsigned int *)SecurityDescriptor + 4);
    if( !(_DWORD)v8 )
      goto LABEL_17;
    v9 = (char *)SecurityDescriptor + v8;
  }
  if( v9 )
    result = ((*((unsigned __int16 *)v9 + 1) + 3) & 0xFFFFFFFC) + (unsigned int)result;
LABEL_17:
  if( (v1 & 0x10) == 0 )
    return result;
  if( v1 >= 0 )
  {
    v11 = (char *)*((_QWORD *)SecurityDescriptor + 3);
  }
  else
  {
    v10 = *((unsigned int *)SecurityDescriptor + 3);
    if( !(_DWORD)v10 )
      return result;
    v11 = (char *)SecurityDescriptor + v10;
  }
  if( v11 )
    return((*((unsigned __int16 *)v11 + 1) + 3) & 0xFFFFFFFC) + (unsigned int)result;
  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