PnpValidatePropertyData

__int64 __fastcall PnpValidatePropertyData(
        PSECURITY_DESCRIPTOR SecurityDescriptor,
        ULONG SecurityDescriptorLength,
        int a3){
  unsigned int v3; 
  UINT64 v4; 
  unsigned int v6; 
  int BaseTypeSize; 
  unsigned int v8; 
  __int16 v9; 
  int v10; 
  int v11; 
  bool v12; 
  unsigned int v14; 
  unsigned int v15; 
  unsigned int v16; 
  UINT64 v17; 
  __int64 v18; 
  size_t v19; 
  unsigned int v20; 
  bool v21; 
  size_t pcbLength; 
  v3 = 0;
  v4 = SecurityDescriptorLength;
  pcbLength = 0i64;
  if( (a3 & 0xFFFF0000) != 0 )
    return(unsigned int)-1073741811;
  v6 = a3 & 0xFFF;
  if( v6 > 0x19 )
    return(unsigned int)-1073741811;
  BaseTypeSize = GetBaseTypeSize(v6);
  v10 = v9 & 0xF000;
  if( !BaseTypeSize )
    goto LABEL_9;
  if( v10 == 4096 )
  {
    if( v8 <= 1 || !IsFixedSizeType(v9) || (unsigned int)v4 < v20 )
      return(unsigned int)-1073741811;
    v21 = (unsigned int)v4 % v20 == 0;
  }
  else
  {
    if( v10 != 0x2000 )
    {
      if( (v9 & 0xF000) != 0 || IsFixedSizeType(v9) && (_DWORD)v4 != v11 )
        return(unsigned int)-1073741811;
      goto LABEL_9;
    }
    if( v8 == 18 )
      goto LABEL_9;
    v21 = v8 == 20;
  }
  if( !v21 )
    return(unsigned int)-1073741811;
LABEL_9:
  if( v8 <= 1 )
  {
    v12 = (_DWORD)v4 == 0;
LABEL_22:
    if( v12 )
      return v3;
    return(unsigned int)-1073741811;
  }
  switch( v8 )
  {
    case 0x12u:
      goto LABEL_16;
    case 0x11u:
      if( SecurityDescriptor )
      {
        v14 = 0;
        if( !(_DWORD)v4 )
          return v3;
        while( *(_BYTE *)SecurityDescriptor == 0xFF || *(_BYTE *)SecurityDescriptor == 0 )
        {
          ++v14;
          SecurityDescriptor = (char *)SecurityDescriptor + 1;
          if( v14 >= (unsigned int)v4 )
            return v3;
        }
      }
      return(unsigned int)-1073741811;
    case 0x10u:
      if( SecurityDescriptor )
      {
        v15 = (unsigned int)v4 >> 3;
        v16 = 0;
        if( !v15 )
          return v3;
        while( *(__int64 *)SecurityDescriptor >= 0 )
        {
          ++v16;
          SecurityDescriptor = (char *)SecurityDescriptor + 8;
          if( v16 >= v15 )
            return v3;
        }
      }
      return(unsigned int)-1073741811;
    case 0x19u:
      goto LABEL_16;
    case 0x13u:
      if( !SecurityDescriptor || !RtlValidRelativeSecurityDescriptor(SecurityDescriptor, (unsigned int)v4, 0i64) )
        return(unsigned int)-1073741811;
      v12 = (unsigned int)RtlLengthSecurityDescriptor(SecurityDescriptor) == (_DWORD)v4;
      goto LABEL_22;
    case 0x14u:
LABEL_16:
      if( !SecurityDescriptor || (unsigned int)v4 < 2 )
        return(unsigned int)-1073741811;
      if( (v10 & 0x2000) != 0 )
      {
        v17 = 0i64;
        while( *(_WORD *)SecurityDescriptor )
        {
          if( (int)RtlStringCbLengthW((const WCHAR *)SecurityDescriptor, v4 - v17, &pcbLength) < 0 )
            return(unsigned int)-1073741811;
          if( (pcbLength & 1) != 0 )
            return(unsigned int)-1073741811;
          v19 = pcbLength + 2;
          pcbLength = v19;
          if( v19 > 0xFFFE )
            return(unsigned int)-1073741811;
          v17 = v19 + v18;
          if( v17 > v4 )
            return(unsigned int)-1073741811;
          SecurityDescriptor = (char *)SecurityDescriptor + 2 * (v19 >> 1);
        }
        v12 = v17 + 2 == v4;
      }
      else
      {
        if( (int)RtlStringCbLengthW((const WCHAR *)SecurityDescriptor, v4, &pcbLength) < 0 || pcbLength + 2 > 0xFFFE )
          return(unsigned int)-1073741811;
        v12 = pcbLength + 2 == v4;
      }
      goto LABEL_22;
  }
  return v3;
}

Referenced by:

PiDqQueryValidateQueryData
PiSwValidatePropertyArray
PnpGetObjectPropertyWorker
PnpSetObjectPropertyWorker
ValidFilter