Skip to content
Snippets Groups Projects
Commit 3f3cc098 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Win32: fallback to normal output if WriteConsoleW() fails

This fixes console logs on Wine for me.
parent 8fe05711
No related branches found
No related tags found
No related merge requests found
......@@ -74,27 +74,24 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
{
HANDLE h = (HANDLE)((uintptr_t)_get_osfhandle (fd));
DWORD out;
/* XXX: It is not clear whether WriteConsole() wants the number of
* Unicode characters or the size of the wchar_t array. */
WriteConsoleW (h, wide, wcslen (wide), &out, NULL);
BOOL ok = WriteConsoleW (h, wide, wcslen (wide), &out, NULL);
free (wide);
if (ok)
goto out;
}
else
res = -1;
}
else
# endif
char *ansi = ToANSI (str);
if (ansi != NULL)
{
char *ansi = ToANSI (str);
if (ansi != NULL)
{
fputs (ansi, stream);
free (ansi);
}
else
res = -1;
fputs (ansi, stream);
free (ansi);
}
else
res = -1;
out:
free (str);
return res;
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment