RtlIsNameLegalDOS8Dot3

UINT8 __stdcall RtlIsNameLegalDOS8Dot3(_UNICODE_STRING *Name, _STRING *OemName, UINT8 *NameContainsSpaces){
  bool v3; 
  _STRING *v5; 
  char v6; 
  UINT8 v7; 
  unsigned int Length; 
  unsigned int v10; 
  char *v11; 
  unsigned __int64 v12; 
  int v13; 
  char *Buffer; 
  __int128 v15; 
  char v16; 

  v3 = Name->Length <= 0x18u;
  v5 = OemName;
  v6 = 0;
  v7 = 0;
  v15 = 0i64;
  if( !v3 )
    return 0;
  if( !OemName )
  {
    LODWORD(v15) = 786432;
    *((_QWORD *)&v15 + 1) = &v16;
    v5 = (_STRING *)&v15;
  }
  if( RtlUpcaseUnicodeStringToCountedOemString(v5, Name, 0) < 0 )
    return 0;
  Length = v5->Length;
  if( (_WORD)Length == 1 && *v5->Buffer == 46 || Length == 2 && (Buffer = v5->Buffer, *Buffer == 46) && Buffer[1] == 46 )
  {
    if( NameContainsSpaces )
      *NameContainsSpaces = 0;
    return 1;
  }
  v10 = 0;
  if( v5->Length )
  {
    v11 = v5->Buffer;
    do
    {
      v12 = (unsigned __int8)v11[v10];
      if( (_BYTE)NlsMbOemCodePageTag && NlsOemLeadByteInfoTable[v12] )
      {
        if( !v6 && v10 >= 7 || v10 == Length - 1 )
          return 0;
        ++v10;
      }
      else
      {
        if( (unsigned __int8)v12 < 0x80u )
        {
          v13 = RtlFatIllegalTable[v12 >> 5];
          if( _bittest(&v13, v12 & 0x1F) )
            return 0;
        }
        if( (_BYTE)v12 == 32 )
          v7 = 1;
        if( (_BYTE)v12 == 46 )
        {
          if( v6 || !v10 || v11[v10 - 1] == 32 || Length - v10 - 1 > 3 )
            return 0;
          v6 = 1;
        }
        if( v10 >= 8 && !v6 )
          return 0;
      }
      ++v10;
    }
    while( v10 < Length );
    if( (_BYTE)v12 == 32 || (_BYTE)v12 == 46 )
      return 0;
  }
  if( NameContainsSpaces )
    *NameContainsSpaces = v7;
  return 1;
}

Referenced by:

No references.