FsRtlIsHpfsDbcsLegal

INT8 __fastcall FsRtlIsHpfsDbcsLegal(UINT16 *a1, INT8 a2, INT8 a3, INT8 a4){
  UINT16 v4; 
  char v6; 
  __int64 v7; 
  _BYTE *v8; 
  _STRING v9; 
  __int16 v10; 
  unsigned int v12; 
  unsigned __int64 v13; 
  __int64 v14; 
  _STRING RemainingName; 
  _STRING FirstName; 
  _STRING struct_ptr; 

  v4 = *a1;
  if( *a1 )
  {
    if( a2 )
    {
      if( v4 == 1 )
      {
        v6 = **((_BYTE **)a1 + 1);
        if( v6 == 46 || v6 == 34 )
          return 1;
      }
      if( v4 == 2 )
      {
        v7 = *((_QWORD *)a1 + 1);
        if( *(_WORD *)v7 == 11822 || *(_BYTE *)v7 == 34 && *(_BYTE *)(v7 + 1) == 34 )
          return 1;
      }
    }
    v8 = (_BYTE *)*((_QWORD *)a1 + 1);
    if( *v8 != 92 )
      goto LABEL_14;
    if( a4 )
    {
      if( v4 <= 1u )
        return 1;
      ++v8;
      --v4;
      *((_QWORD *)a1 + 1) = v8;
      --a1[1];
      *a1 = v4;
LABEL_14:
      if( a3 )
      {
        v9 = *(_STRING *)a1;
        v10 = _mm_cvtsi128_si32(*(__m128i *)a1);
        FirstName = 0i64;
        RemainingName = v9;
        if( v10 )
        {
          while( *(_BYTE *)_mm_srli_si128((__m128i)v9, 8).m128i_i8[0] != 92 )
          {
            struct_ptr = v9;
            FsRtlDissectDbcs(&struct_ptr, &FirstName, &RemainingName);
            struct_ptr = FirstName;
            if( !FsRtlIsHpfsDbcsLegal(&struct_ptr.Length, a2, 0, 0) )
              break;
            if( !RemainingName.Length )
              return 1;
            v9 = RemainingName;
          }
          return 0;
        }
      }
      else
      {
        if( v4 > 0xFFu )
          return 0;
        v12 = 0;
        if( v4 )
        {
          do
          {
            v13 = (unsigned __int8)v8[v12];
            if( (unsigned __int8)v13 >= 0x80u && (_BYTE)NlsMbOemCodePageTag && NlsOemLeadByteInfoTable[v13] )
            {
              if( v12 == v4 - 1 )
                return 0;
              ++v12;
            }
            else if( (v13 & 0x80u) == 0i64 && ((a2 != 0 ? 10 : 2) & *((unsigned __int8 *)qword_140011770 + v13)) == 0 )
            {
              return 0;
            }
            ++v12;
          }
          while( v12 < v4 );
          if( (unsigned __int8)v13 <= 0x2Eu )
          {
            v14 = 0x400500000000i64;
            if( _bittest64(&v14, v13) )
              return 0;
          }
        }
      }
      return 1;
    }
  }
  return 0;
}

Referenced by:

FsRtlIsHpfsDbcsLegal