wcstombs

UINT64 __stdcall wcstombs(PSTR s, PWCHAR pwcs, UINT64 n){
  __int64 v3; 
  NTSTATUS v4; 
  UINT64 BytesInUnicodeString; 
  UINT64 BytesInMultiByteString; 

  BytesInMultiByteString = 0i64;
  v3 = -1i64;
  do
    ++v3;
  while( pwcs[v3] );
  if( s )
  {
    LODWORD(BytesInUnicodeString) = 2 * v3 + 2;
    v4 = RtlUnicodeToMultiByteN(s, (unsigned int)n, (PULONG)&BytesInMultiByteString, pwcs, BytesInUnicodeString);
  }
  else
  {
    v4 = RtlUnicodeToMultiByteSize(&BytesInMultiByteString, pwcs, (unsigned int)(2 * v3 + 2));
  }
  if( v4 >= 0 )
    return BytesInMultiByteString - 1;
  gbl_errno = 42;
  return -1i64;
}

Referenced by:

No references.