mbstowcs

UINT64 __stdcall mbstowcs(WCHAR *pwcs, INT8 *s, UINT64 n){
  int v3; 
  int v7; 
  unsigned __int64 v8; 
  UINT64 v9; 
  UINT64 BytesInMultiByteString; 
  UINT64 BytesInUnicodeString; 

  v3 = n;
  if( pwcs && !n )
    return 0i64;
  if( n > 0x7FFFFFFF )
    return -1i64;
  if( pwcs )
  {
    LODWORD(BytesInUnicodeString) = mbstrlen(s);
    LODWORD(BytesInMultiByteString) = BytesInUnicodeString + 1;
    if( RtlMultiByteToUnicodeN(pwcs, (unsigned int)(2 * v3), &BytesInUnicodeString, s, BytesInMultiByteString) >= 0 )
    {
      v8 = (unsigned __int64)(int)BytesInUnicodeString >> 1;
      LODWORD(BytesInUnicodeString) = v8;
      v7 = v8;
      if( !pwcs[(int)v8 - 1] )
        return(int)v8 - 1;
    }
    else
    {
      gbl_errno = 42;
      v7 = -1;
      *pwcs = 0;
    }
    return v7;
  }
  else
  {
    v9 = -1i64;
    do
      ++v9;
    while( s[v9] );
    return v9;
  }
}

Referenced by:

No references.