RtlMultiByteToUnicodeSize

NTSTATUS __stdcall RtlMultiByteToUnicodeSize(
        UINT64 *BytesInUnicodeString,
        INT8 *MultiByteString,
        UINT64 BytesInMultiByteString){
  int v4; 
  int v5; 
  __int64 v8; 
  UINT64 UTF8StringByteCount; 

  v4 = 0;
  v5 = BytesInMultiByteString;
  if( RtlpIsUtf8Process(0) )
  {
    if( v5 )
    {
      LODWORD(UTF8StringByteCount) = v5;
      RtlUTF8ToUnicodeN(0i64, 0i64, BytesInUnicodeString, MultiByteString, UTF8StringByteCount);
    }
    else
    {
      *(_DWORD *)BytesInUnicodeString = 0;
    }
  }
  else
  {
    if( !(_BYTE)NlsMbCodePageTag )
    {
      v4 = 2 * v5;
      goto LABEL_4;
    }
    for( ; v5; v4 += 2 )
    {
      v8 = (unsigned __int8)*MultiByteString;
      --v5;
      ++MultiByteString;
      if( NlsLeadByteInfoTable[v8] )
      {
        if( !v5 )
        {
          v4 += 2;
          break;
        }
        --v5;
        ++MultiByteString;
      }
    }
LABEL_4:
    *(_DWORD *)BytesInUnicodeString = v4;
  }
  return 0;
}

Referenced by:

RtlxAnsiStringToUnicodeSize
RtlxOemStringToUnicodeSize