Second byte of BOM (0xfe) is LeadByte in Asian locales. Therefore chars after BOM matter.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39244 Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- dlls/scrrun/tests/filesystem.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index dba8c067d63..8dc08d7487e 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -1687,9 +1687,11 @@ static void test_WriteLine(void)
static void test_ReadAll(void) { + static const WCHAR firstlineW[] = L"first"; static const WCHAR secondlineW[] = L"second"; static const WCHAR aW[] = L"A"; WCHAR pathW[MAX_PATH], dirW[MAX_PATH], buffW[500]; + char buffA[MAX_PATH]; ITextStream *stream; BSTR nameW; HRESULT hr; @@ -1706,8 +1708,10 @@ static void test_ReadAll(void) hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = ITextStream_WriteLine(stream, nameW); + str = SysAllocString(firstlineW); + hr = ITextStream_WriteLine(stream, str); ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str);
str = SysAllocString(secondlineW); hr = ITextStream_WriteLine(stream, str); @@ -1735,7 +1739,9 @@ static void test_ReadAll(void) hr = ITextStream_ReadAll(stream, &str); ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); buffW[0] = 0; - MultiByteToWideChar(CP_ACP, 0, utf16bom, -1, buffW, ARRAY_SIZE(buffW)); + lstrcpyA(buffA, utf16bom); + lstrcatA(buffA, "first"); + MultiByteToWideChar(CP_ACP, 0, buffA, -1, buffW, ARRAY_SIZE(buffW)); ok(str[0] == buffW[0] && str[1] == buffW[1], "got %s, %d\n", wine_dbgstr_w(str), SysStringLen(str)); SysFreeString(str); ITextStream_Release(stream); @@ -1744,7 +1750,7 @@ static void test_ReadAll(void) hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); ok(hr == S_OK, "got 0x%08x\n", hr);
- lstrcpyW(buffW, nameW); + lstrcpyW(buffW, firstlineW); lstrcatW(buffW, L"\r\n"); lstrcatW(buffW, secondlineW); lstrcatW(buffW, L"\r\n"); @@ -1775,7 +1781,7 @@ static void test_ReadAll(void) hr = ITextStream_ReadLine(stream, &str); ok(hr == S_OK, "got 0x%08x\n", hr); ok(str != NULL, "got %p\n", str); - ok(!wcscmp(str, nameW), "got %s\n", wine_dbgstr_w(str)); + ok(!wcscmp(str, firstlineW), "got %s\n", wine_dbgstr_w(str)); SysFreeString(str);
lstrcpyW(buffW, secondlineW); -- 2.31.1