FsRtlIsHpfsDbcsLegal

BOOL __stdcall FsRtlIsHpfsDbcsLegal(
        ANSI_STRING *struct_ptr,
        BOOL WildCardsPermissible,
        BOOL PathNamePermissible,
        BOOL LeadingBackslashPermissible){
  char *Buffer; 
  unsigned __int16 Length; 
  bool v6; 
  char *v7; 
  struct _STRING v8; 
  BOOL v9; 
  unsigned int v10; 
  unsigned __int64 v11; 
  __int64 v12; 
  struct _STRING RemainingName; 
  struct _STRING FirstName; 
  ANSI_STRING Path; 
  Length = struct_ptr->Length;
  v6 = WildCardsPermissible;
  if( !struct_ptr->Length )
    goto LABEL_33;
  if( WildCardsPermissible )
  {
    if( Length == 1 )
    {
      Buffer = struct_ptr->Buffer;
      if( *Buffer == 46 || *Buffer == 34 )
        goto LABEL_20;
    }
    if( Length == 2 )
    {
      Buffer = struct_ptr->Buffer;
      if( *(_WORD *)Buffer == 11822 || *Buffer == 34 && Buffer[1] == 34 )
        goto LABEL_20;
    }
  }
  v7 = struct_ptr->Buffer;
  if( *v7 != 92 )
    goto LABEL_14;
  if( !LeadingBackslashPermissible )
  {
LABEL_33:
    LOBYTE(Buffer) = 0;
    return(int)Buffer;
  }
  if( Length <= 1u )
    goto LABEL_20;
  ++v7;
  --Length;
  struct_ptr->Buffer = v7;
  --struct_ptr->MaximumLength;
  struct_ptr->Length = Length;
LABEL_14:
  if( PathNamePermissible )
  {
    v8 = *struct_ptr;
    LODWORD(Buffer) = _mm_cvtsi128_si32(*(__m128i *)struct_ptr);
    FirstName = 0i64;
    RemainingName = v8;
    if( (_WORD)Buffer )
    {
      while( 1 )
      {
        Buffer = (char *)_mm_srli_si128((__m128i)v8, 8).m128i_u64[0];
        if( *Buffer == 92 )
          goto LABEL_33;
        Path = v8;
        FsRtlDissectDbcs(&Path, &FirstName, &RemainingName);
        Path = FirstName;
        LOBYTE(v9) = v6;
        LODWORD(Buffer) = FsRtlIsHpfsDbcsLegal(&Path, v9, 0, 0);
        if( !(_BYTE)Buffer )
          goto LABEL_33;
        if( !RemainingName.Length )
          break;
        v8 = RemainingName;
      }
    }
  }
  else
  {
    LODWORD(Buffer) = 255;
    if( Length > 0xFFu )
      goto LABEL_33;
    v10 = 0;
    if( Length )
    {
      do
      {
        LODWORD(Buffer) = v10;
        v11 = (unsigned __int8)v7[v10];
        if( (unsigned __int8)v11 >= 0x80u && (_BYTE)NlsMbOemCodePageTag && *((_WORD *)&NlsOemLeadByteInfoTable + v11) )
        {
          LODWORD(Buffer) = Length - 1;
          if( v10 == (_DWORD)Buffer )
            goto LABEL_33;
          ++v10;
        }
        else if( (v11 & 0x80u) == 0i64
               && ((WildCardsPermissible ? 10 : 2) & *((unsigned __int8 *)qword_140011770 + v11)) == 0 )
        {
          goto LABEL_33;
        }
        ++v10;
      }
      while( v10 < Length );
      if( (unsigned __int8)v11 <= 0x2Eu )
      {
        v12 = 0x400500000000i64;
        if( _bittest64(&v12, v11) )
          goto LABEL_33;
      }
    }
  }
LABEL_20:
  LOBYTE(Buffer) = 1;
  return(int)Buffer;
}

Referenced by:

FsRtlIsHpfsDbcsLegal