[Bug 37402] New: WINAPI is not correct
wine-bugs at winehq.org
wine-bugs at winehq.org
Tue Oct 14 08:32:45 CDT 2014
https://bugs.winehq.org/show_bug.cgi?id=37402
Bug ID: 37402
Summary: WINAPI is not correct
Product: Wine
Version: unspecified
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: -unknown
Assignee: wine-bugs at winehq.org
Reporter: k1-801 at mail.ru
Distribution: ---
I've found a strang bug while testing my program.
I used few WINAPI funcs for codepage converting (the file path was in UTF-8,
and to open it, I needed to convert it to the Windows's awkward wchar_t and
back). I hadn't a copy of Windows that time, so I tested it on wine. There's
the tested code:
char* WcharToUTF8(wchar_t *in)
{
uint64_t len = WideCharToMultiByte(CP_UTF8, MB_ERR_INVALID_CHARS, in, -1,
NULL, 0, NULL, NULL);
char *out = (char*)calloc((len + 1) * 6, sizeof(char));
WideCharToMultiByte(CP_UTF8, MB_ERR_INVALID_CHARS, in, -1, out, len, NULL,
NULL);
return out;
}
It worked on wine. On wine it returns correctly converted string. On real
Windows it returns nothing, and empty string crashes the program.
After replasing MB_ERR_INVALID_CHARS with 0 it worked on both wine and Windows.
char* WcharToUTF8(wchar_t *in)
{
uint64_t len = WideCharToMultiByte(CP_UTF8, 0, in, -1, NULL, 0, NULL,
NULL);
char *out = (char*)calloc(len + 1, sizeof(char));
WideCharToMultiByte(CP_UTF8, 0, in, -1, out, len, NULL, NULL);
return out;
}
Also, the code was stolen from MSDN page about codepages, and there was a note
about "nothing will work correctly WITHOUT MB_ERR_INVALID_CHARS".
Windows bug? Wine bug? Wine did work as said in MSDN, Windows did not.
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list