https://bugs.winehq.org/show_bug.cgi?id=37402
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- You're doing it wrong. For WideCharToMultiByte() you need to use WC_ERR_INVALID_CHARS flag. Also try to avoid wchar_t. It's possible that Wine should work too in your case, simply rejecting invalid flags, but that needs test.