GetNextWchar

WCHAR __stdcall GetNextWchar(
        const _UNICODE_STRING *Name,
        UINT64 *CurrentIndex,
        UINT8 SkipDots,
        UINT8 AllowExtendedCharacters){
  unsigned int v4; 
  unsigned int Length; 
  wchar_t v6; 
  int v11; 
  WCHAR Char; 

  v4 = *(_DWORD *)CurrentIndex;
  Length = Name->Length;
  v6 = 0;
  while( v4 < Length >> 1 )
  {
    v6 = Name->Buffer[v4];
    *(_DWORD *)CurrentIndex = v4 + 1;
    Char = v6;
    if( v6 <= 0x20u )
      goto LABEL_13;
    if( v6 >= 0x7Fu )
    {
      if( !AllowExtendedCharacters || !RtlIsValidOemCharacter(&Char) )
        goto LABEL_13;
      v6 = Char;
    }
    if( v6 != 46 )
    {
      if( v6 < 0x80u )
      {
LABEL_7:
        v11 = RtlFatIllegalTable[(unsigned __int64)v6 >> 5];
        if( _bittest(&v11, v6 & 0x1F) )
          v6 = 95;
      }
      if( (unsigned __int16)(v6 - 97) <= 0x19u )
        v6 -= 32;
      return v6;
    }
    if( !SkipDots )
      goto LABEL_7;
LABEL_13:
    v4 = *(_DWORD *)CurrentIndex;
    v6 = 0;
    Length = Name->Length;
  }
  return v6;
}

Referenced by:

RtlGenerate8dot3Name