From 3ddbd236d0363a8ea8753f70b4e74a0fc2cfae3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 22 May 2017 15:59:45 +0200 Subject: [PATCH] msvcp: Implement the wchar version of _Read_dir. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Dösinger Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp110/msvcp110.spec | 4 ++-- dlls/msvcp120/msvcp120.spec | 4 ++-- dlls/msvcp120_app/msvcp120_app.spec | 4 ++-- dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp90/ios.c | 28 +++++++++++++++++++++------- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 0627aed61f8..4001b68190a 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1713,8 +1713,8 @@ @ cdecl ?_Random_device@std@@YAIXZ() _Random_device @ cdecl -arch=win32 ?_Read_dir@sys@tr2@std@@YAPADPADPAXAAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir @ cdecl -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEADPEADPEAXAEAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir -@ stub -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WPA_WPAXAAW4file_type@123@@Z -@ stub -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEA_WPEA_WPEAXAEAW4file_type@123@@Z +@ cdecl -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WPA_WPAXAAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir_wchar +@ cdecl -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEA_WPEA_WPEAXAEAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir_wchar @ cdecl -arch=arm ?_Release@_Pad@std@@QAAXXZ(ptr) _Pad__Release @ thiscall -arch=i386 ?_Release@_Pad@std@@QAEXXZ(ptr) _Pad__Release @ cdecl -arch=win64 ?_Release@_Pad@std@@QEAAXXZ(ptr) _Pad__Release diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index a2b82cbc25d..7cd3514df28 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1674,8 +1674,8 @@ @ cdecl ?_Random_device@std@@YAIXZ() _Random_device @ cdecl -arch=win32 ?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir @ cdecl -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir -@ stub -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WAAY0BAE@_WPAXAAW4file_type@123@@Z -@ stub -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEA_WAEAY0BAE@_WPEAXAEAW4file_type@123@@Z +@ cdecl -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WAAY0BAE@_WPAXAAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir_wchar +@ cdecl -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEA_WAEAY0BAE@_WPEAXAEAW4file_type@123@@Z(ptr ptr ptr) tr2_sys__Read_dir_wchar @ cdecl -arch=arm ?_Release@_Pad@std@@QAAXXZ(ptr) _Pad__Release @ thiscall -arch=i386 ?_Release@_Pad@std@@QAEXXZ(ptr) _Pad__Release @ cdecl -arch=win64 ?_Release@_Pad@std@@QEAAXXZ(ptr) _Pad__Release diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index be11ca10009..6a74f84c421 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1674,8 +1674,8 @@ @ cdecl ?_Random_device@std@@YAIXZ() msvcp120.?_Random_device@std@@YAIXZ @ cdecl -arch=win32 ?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z(ptr ptr ptr) msvcp120.?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z @ cdecl -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z(ptr ptr ptr) msvcp120.?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z -@ stub -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WAAY0BAE@_WPAXAAW4file_type@123@@Z -@ stub -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEA_WAEAY0BAE@_WPEAXAEAW4file_type@123@@Z +@ cdecl -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WAAY0BAE@_WPAXAAW4file_type@123@@Z(ptr ptr ptr) msvcp120.?_Read_dir@sys@tr2@std@@YAPA_WAAY0BAE@_WPAXAAW4file_type@123@@Z +@ cdecl -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEA_WAEAY0BAE@_WPEAXAEAW4file_type@123@@Z(ptr ptr ptr) msvcp120.?_Read_dir@sys@tr2@std@@YAPEA_WAEAY0BAE@_WPEAXAEAW4file_type@123@@Z @ cdecl -arch=arm ?_Release@_Pad@std@@QAAXXZ(ptr) msvcp120.?_Release@_Pad@std@@QAAXXZ @ thiscall -arch=i386 ?_Release@_Pad@std@@QAEXXZ(ptr) msvcp120.?_Release@_Pad@std@@QAEXXZ @ cdecl -arch=win64 ?_Release@_Pad@std@@QEAAXXZ(ptr) msvcp120.?_Release@_Pad@std@@QEAAXXZ diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index faf0578de96..d5cedf9cbdf 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3692,7 +3692,7 @@ @ cdecl _Open_dir(ptr wstr long long) tr2_sys__Open_dir_wchar @ cdecl -ret64 _Query_perf_counter() @ cdecl -ret64 _Query_perf_frequency() -@ stub _Read_dir +@ cdecl _Read_dir(ptr ptr ptr) tr2_sys__Read_dir_wchar @ stub _Remove_dir @ stub _Rename @ stub _Resize diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 838abf3d6b9..8e3376c9619 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -14962,23 +14962,25 @@ void* __cdecl tr2_sys__Open_dir(char* target, char const* dest, int* err_code, e return handle; } -/* ?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z */ -/* ?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z */ -char* __cdecl tr2_sys__Read_dir(char* target, void* handle, enum file_type* type) +/* ??_Read_dir@sys@tr2@std@@YAPA_WPA_WPAXAAW4file_type@123@@Z */ +/* ??_Read_dir@sys@tr2@std@@YAPEA_WPEA_WPEAXAEAW4file_type@123@@Z */ +wchar_t* __cdecl tr2_sys__Read_dir_wchar(wchar_t* target, void* handle, enum file_type* type) { - WIN32_FIND_DATAA data; + WIN32_FIND_DATAW data; + static const wchar_t dot[] = {'.', 0}; + static const wchar_t dotdot[] = {'.', '.', 0}; TRACE("(%p %p %p)\n", target, handle, type); do { - if(!FindNextFileA(handle, &data)) { + if(!FindNextFileW(handle, &data)) { *type = status_unknown; *target = '\0'; return target; } - } while(!strcmp(data.cFileName, ".") || !strcmp(data.cFileName, "..")); + } while(!wcscmp(data.cFileName, dot) || !wcscmp(data.cFileName, dotdot)); - strcpy(target, data.cFileName); + wcscpy(target, data.cFileName); if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) *type = directory_file; else @@ -14986,6 +14988,18 @@ char* __cdecl tr2_sys__Read_dir(char* target, void* handle, enum file_type* type return target; } +/* ?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z */ +/* ?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z */ +char* __cdecl tr2_sys__Read_dir(char* target, void* handle, enum file_type* type) +{ + wchar_t target_w[MAX_PATH]; + + tr2_sys__Read_dir_wchar(target_w, handle, type); + WideCharToMultiByte(CP_ACP, 0, target_w, -1, target, MAX_PATH, NULL, NULL); + + return target; +} + /* ?_Close_dir@sys@tr2@std@@YAXPAX@Z */ /* ?_Close_dir@sys@tr2@std@@YAXPEAX@Z */ void __cdecl tr2_sys__Close_dir(void* handle)