From 66f4281aa027fde77dd28ff262899780321f7685 Mon Sep 17 00:00:00 2001 From: YongHao Hu Date: Wed, 19 Aug 2015 01:27:07 +0800 Subject: [PATCH] msvcp110: Add tr2_sys__Copy_file_wchar implementation and test. --- dlls/msvcp110/msvcp110.spec | 4 ++-- dlls/msvcp120/msvcp120.spec | 4 ++-- dlls/msvcp120/tests/msvcp120.c | 9 +++++++++ dlls/msvcp120_app/msvcp120_app.spec | 4 ++-- dlls/msvcp90/ios.c | 11 +++++++++++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index fb22ca11847..49ff9213fc2 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1165,8 +1165,8 @@ @ stub -arch=win64 ?_Close_dir@sys@tr2@std@@YAXPEAX@Z @ cdecl -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPBD0_N@Z(str str long) tr2_sys__Copy_file @ cdecl -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z(str str long) tr2_sys__Copy_file -@ stub -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z -@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z +@ cdecl -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z(wstr wstr long) tr2_sys__Copy_file_wchar +@ cdecl -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z(wstr wstr long) tr2_sys__Copy_file_wchar @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADPAD@Z(ptr) tr2_sys__Current_get @ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADPEAD@Z(ptr) tr2_sys__Current_get @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WPA_W@Z(ptr) tr2_sys__Current_get_wchar diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 8a7b6d72777..2a73662b463 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1130,8 +1130,8 @@ @ stub -arch=win64 ?_Close_dir@sys@tr2@std@@YAXPEAX@Z @ cdecl -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPBD0_N@Z(str str long) tr2_sys__Copy_file @ cdecl -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z(str str long) tr2_sys__Copy_file -@ stub -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z -@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z +@ cdecl -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z(wstr wstr long) tr2_sys__Copy_file_wchar +@ cdecl -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z(wstr wstr long) tr2_sys__Copy_file_wchar @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z(ptr) tr2_sys__Current_get @ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z(ptr) tr2_sys__Current_get @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z(ptr) tr2_sys__Current_get_wchar diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 6bbe11e1f48..08effda4360 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -85,6 +85,7 @@ static int (__cdecl *p_tr2_sys__Make_dir_wchar)(WCHAR const*); static MSVCP_bool (__cdecl *p_tr2_sys__Remove_dir)(char const*); static MSVCP_bool (__cdecl *p_tr2_sys__Remove_dir_wchar)(WCHAR const*); static int (__cdecl *p_tr2_sys__Copy_file)(char const*, char const*, MSVCP_bool); +static int (__cdecl *p_tr2_sys__Copy_file_wchar)(WCHAR const*, WCHAR const*, MSVCP_bool); static int (__cdecl *p_tr2_sys__Rename)(char const*, char const*); static struct space_info (__cdecl *p_tr2_sys__Statvfs)(char const*); static enum file_type (__cdecl *p_tr2_sys__Stat)(char const*, int *); @@ -143,6 +144,8 @@ static BOOL init(void) "?_Remove_dir@sys@tr2@std@@YA_NPEB_W@Z"); SET(p_tr2_sys__Copy_file, "?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z"); + SET(p_tr2_sys__Copy_file_wchar, + "?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z"); SET(p_tr2_sys__Rename, "?_Rename@sys@tr2@std@@YAHPEBD0@Z"); SET(p_tr2_sys__Statvfs, @@ -178,6 +181,8 @@ static BOOL init(void) "?_Remove_dir@sys@tr2@std@@YA_NPB_W@Z"); SET(p_tr2_sys__Copy_file, "?_Copy_file@sys@tr2@std@@YAHPBD0_N@Z"); + SET(p_tr2_sys__Copy_file_wchar, + "?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z"); SET(p_tr2_sys__Rename, "?_Rename@sys@tr2@std@@YAHPBD0@Z"); SET(p_tr2_sys__Statvfs, @@ -624,6 +629,7 @@ static void test_tr2_sys__Copy_file(void) HANDLE file; int ret, i; LARGE_INTEGER file_size; + WCHAR testW[] = {'f','1',0}, testW2[] = {'f','w',0}; struct { char const *source; char const *dest; @@ -670,8 +676,11 @@ static void test_tr2_sys__Copy_file(void) ok(p_tr2_sys__File_size(tests[i].source) == p_tr2_sys__File_size(tests[i].dest), "test_tr2_sys__Copy_file(): test %d failed, two files' size are not equal\n", i+1); } + ret = p_tr2_sys__Copy_file_wchar(testW, testW2, TRUE); + ok(ret == ERROR_SUCCESS, "test_tr2_sys__Copy_file_wchar() expect ERROR_SUCCESS, got %d\n", ret); ok(DeleteFileA("f1"), "expect f1 to exist\n"); + ok(DeleteFileW(testW2), "expect fw to exist\n"); ok(DeleteFileA("f1_copy"), "expect f1_copy to exist\n"); ok(DeleteFileA("tr2_test_dir/f1_copy"), "expect tr2_test_dir/f1 to exist\n"); ret = p_tr2_sys__Remove_dir("tr2_test_dir"); diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index d05b3d4f890..06a2e2da317 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1130,8 +1130,8 @@ @ stub -arch=win64 ?_Close_dir@sys@tr2@std@@YAXPEAX@Z @ cdecl -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPBD0_N@Z(str str long) msvcp120.?_Copy_file@sys@tr2@std@@YAHPBD0_N@Z @ cdecl -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z(str str long) msvcp120.?_Copy_file@sys@tr2@std@@YAHPEBD0_N@Z -@ stub -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z -@ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z +@ cdecl -arch=win32 ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z(wstr wstr long) msvcp120.?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z +@ cdecl -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z(wstr wstr long) msvcp120.?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z @ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 88d64539f18..532c7cf8365 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -14833,6 +14833,17 @@ MSVCP_bool __cdecl tr2_sys__Remove_dir_wchar(WCHAR const* path) return RemoveDirectoryW(path) != 0; } +/* ?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z */ +/* ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z */ +int __cdecl tr2_sys__Copy_file_wchar(WCHAR const* source, WCHAR const* dest, MSVCP_bool fail_if_exists) +{ + TRACE("(%s %s %x)\n", debugstr_w(source), debugstr_w(dest), fail_if_exists); + + if(CopyFileW(source, dest, fail_if_exists)) + return ERROR_SUCCESS; + return GetLastError(); +} + /* ??1_Winit@std@@QAE@XZ */ /* ??1_Winit@std@@QAE@XZ */ DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)