From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp140/tests/msvcp140.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index 9c18afd76fc..2abe5643e82 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -269,6 +269,7 @@ typedef enum { static FILE* (__cdecl *p__Fiopen_wchar)(const wchar_t*, int, int); static FILE* (__cdecl *p__Fiopen)(const char*, int, int);
+static unsigned int (__cdecl *p____lc_codepage_func)(void); static char* (__cdecl *p_setlocale)(int, const char*); static int (__cdecl *p_fclose)(FILE*); static int (__cdecl *p__unlink)(const char*); @@ -392,6 +393,7 @@ static BOOL init(void) pCreateSymbolicLinkW = (void*)GetProcAddress(hdll, "CreateSymbolicLinkW");
hdll = GetModuleHandleA("ucrtbase.dll"); + p____lc_codepage_func = (void*)GetProcAddress(hdll, "___lc_codepage_func"); p_setlocale = (void*)GetProcAddress(hdll, "setlocale"); p_fclose = (void*)GetProcAddress(hdll, "fclose"); p__unlink = (void*)GetProcAddress(hdll, "_unlink"); @@ -1717,6 +1719,7 @@ static void test__Fiopen(void) { "Arabic.utf8", "t\xd8\xaa\xda\x86.txt", TRUE }, { "Japanese.utf8", "t\xe3\x82\xaf\xe3\x83\xa4.txt", TRUE }, { "Chinese.utf8", "t\xe4\xb8\x82\xe9\xbd\xab.txt", TRUE }, + { "Japanese", "t\xb8\xd5.txt" }, };
for(i=0; i<ARRAY_SIZE(tests); i++) { @@ -1725,9 +1728,9 @@ static void test__Fiopen(void) continue; }
- ok(MultiByteToWideChar(CP_UTF8, 0, tests[i].path, -1, wpath, MAX_PATH), - "MultiByteToWideChar failed on %s with locale %s: %lx\n", - debugstr_a(tests[i].path), tests[i].loc, GetLastError()); + if(!MultiByteToWideChar(p____lc_codepage_func() == CP_UTF8 ? CP_UTF8 : CP_ACP, + MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, tests[i].path, -1, wpath, MAX_PATH)) + continue;
f = p__Fiopen(tests[i].path, OPENMODE_out, SH_DENYNO); ok(!!f, "failed to create %s with locale %s\n", tests[i].path, tests[i].loc);