From 64eb3813c47c0db2b8bab39dc2ab3f93610d6ec7 Mon Sep 17 00:00:00 2001 From: YongHao Hu Date: Wed, 19 Aug 2015 01:27:27 +0800 Subject: [PATCH] msvcp110: Add tr2_sys__Rename_wchar implementation and test. --- dlls/msvcp110/msvcp110.spec | 4 ++-- dlls/msvcp120/msvcp120.spec | 4 ++-- dlls/msvcp120/tests/msvcp120.c | 11 ++++++++++- dlls/msvcp120_app/msvcp120_app.spec | 4 ++-- dlls/msvcp90/ios.c | 14 ++++++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 49ff9213fc2..91e150324e7 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1724,8 +1724,8 @@ @ cdecl -arch=win64 ?_Remove_dir@sys@tr2@std@@YA_NPEB_W@Z(wstr) tr2_sys__Remove_dir_wchar @ cdecl -arch=win32 ?_Rename@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Rename @ cdecl -arch=win64 ?_Rename@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Rename -@ stub -arch=win32 ?_Rename@sys@tr2@std@@YAHPB_W0@Z -@ stub -arch=win64 ?_Rename@sys@tr2@std@@YAHPEB_W0@Z +@ cdecl -arch=win32 ?_Rename@sys@tr2@std@@YAHPB_W0@Z(wstr wstr) tr2_sys__Rename_wchar +@ cdecl -arch=win64 ?_Rename@sys@tr2@std@@YAHPEB_W0@Z(wstr wstr) tr2_sys__Rename_wchar @ cdecl -arch=win32 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@DI@Z(ptr ptr long ptr long long) num_put_char__Rep @ cdecl -arch=win64 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@D_K@Z(ptr ptr ptr long long) num_put_char__Rep @ cdecl -arch=win32 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@GI@Z(ptr ptr long ptr long long) num_put_wchar__Rep diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 2a73662b463..745fecbc563 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1685,8 +1685,8 @@ @ cdecl -arch=win64 ?_Remove_dir@sys@tr2@std@@YA_NPEB_W@Z(wstr) tr2_sys__Remove_dir_wchar @ cdecl -arch=win32 ?_Rename@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Rename @ cdecl -arch=win64 ?_Rename@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Rename -@ stub -arch=win32 ?_Rename@sys@tr2@std@@YAHPB_W0@Z -@ stub -arch=win64 ?_Rename@sys@tr2@std@@YAHPEB_W0@Z +@ cdecl -arch=win32 ?_Rename@sys@tr2@std@@YAHPB_W0@Z(wstr wstr) tr2_sys__Rename_wchar +@ cdecl -arch=win64 ?_Rename@sys@tr2@std@@YAHPEB_W0@Z(wstr wstr) tr2_sys__Rename_wchar @ cdecl -arch=win32 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@DI@Z(ptr ptr long ptr long long) num_put_char__Rep @ cdecl -arch=win64 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@D_K@Z(ptr ptr ptr long long) num_put_char__Rep @ cdecl -arch=win32 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@GI@Z(ptr ptr long ptr long long) num_put_wchar__Rep diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 08effda4360..dc833e9bd82 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -87,6 +87,7 @@ 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 int (__cdecl *p_tr2_sys__Rename_wchar)(WCHAR const*, WCHAR const*); static struct space_info (__cdecl *p_tr2_sys__Statvfs)(char const*); static enum file_type (__cdecl *p_tr2_sys__Stat)(char const*, int *); static enum file_type (__cdecl *p_tr2_sys__Lstat)(char const*, int *); @@ -148,6 +149,8 @@ static BOOL init(void) "?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z"); SET(p_tr2_sys__Rename, "?_Rename@sys@tr2@std@@YAHPEBD0@Z"); + SET(p_tr2_sys__Rename_wchar, + "?_Rename@sys@tr2@std@@YAHPEB_W0@Z"); SET(p_tr2_sys__Statvfs, "?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PEBD@Z"); SET(p_tr2_sys__Stat, @@ -185,6 +188,8 @@ static BOOL init(void) "?_Copy_file@sys@tr2@std@@YAHPB_W0_N@Z"); SET(p_tr2_sys__Rename, "?_Rename@sys@tr2@std@@YAHPBD0@Z"); + SET(p_tr2_sys__Rename_wchar, + "?_Rename@sys@tr2@std@@YAHPB_W0@Z"); SET(p_tr2_sys__Statvfs, "?_Statvfs@sys@tr2@std@@YA?AUspace_info@123@PBD@Z"); SET(p_tr2_sys__Stat, @@ -694,6 +699,8 @@ static void test_tr2_sys__Rename(void) BY_HANDLE_FILE_INFORMATION info1, info2; char temp_path[MAX_PATH], current_path[MAX_PATH]; LARGE_INTEGER file_size; + WCHAR testW[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','1',0}; + WCHAR testW2[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','w',0}; struct { char const *old_path; char const *new_path; @@ -756,8 +763,10 @@ static void test_tr2_sys__Rename(void) ok(ret == ERROR_ALREADY_EXISTS, "test_tr2_sys__Rename(): expect: ERROR_ALREADY_EXISTS, got %d\n", ret); ok(p_tr2_sys__File_size("tr2_test_dir\\f1") == 7, "test_tr2_sys__Rename(): expect: 7, got %s\n", debugstr_longlong(p_tr2_sys__File_size("tr2_test_dir\\f1"))); ok(p_tr2_sys__File_size("tr2_test_dir\\f1_rename") == 0, "test_tr2_sys__Rename(): expect: 0, got %s\n",debugstr_longlong(p_tr2_sys__File_size("tr2_test_dir\\f1_rename"))); + ret = p_tr2_sys__Rename_wchar(testW, testW2); + ok(ret == ERROR_SUCCESS, "tr2_sys__Rename_wchar(): expect: ERROR_SUCCESS, got %d\n", ret); - ok(DeleteFileA("tr2_test_dir\\f1"), "expect f1 to exist\n"); + ok(DeleteFileW(testW2), "expect fw to exist\n"); ok(DeleteFileA("tr2_test_dir\\f1_rename"), "expect f1_rename to exist\n"); ret = p_tr2_sys__Remove_dir("tr2_test_dir"); ok(ret == 1, "test_tr2_sys__Remove_dir(): expect %d got %d\n", 1, ret); diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index 06a2e2da317..c5e4da028f4 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1685,8 +1685,8 @@ @ cdecl -arch=win64 ?_Remove_dir@sys@tr2@std@@YA_NPEB_W@Z(wstr) msvcp120.?_Remove_dir@sys@tr2@std@@YA_NPEB_W@Z @ cdecl -arch=win32 ?_Rename@sys@tr2@std@@YAHPBD0@Z(str str) msvcp120.?_Rename@sys@tr2@std@@YAHPBD0@Z @ cdecl -arch=win64 ?_Rename@sys@tr2@std@@YAHPEBD0@Z(str str) msvcp120.?_Rename@sys@tr2@std@@YAHPEBD0@Z -@ stub -arch=win32 ?_Rename@sys@tr2@std@@YAHPB_W0@Z -@ stub -arch=win64 ?_Rename@sys@tr2@std@@YAHPEB_W0@Z +@ cdecl -arch=win32 ?_Rename@sys@tr2@std@@YAHPB_W0@Z(wstr wstr) msvcp120.?_Rename@sys@tr2@std@@YAHPB_W0@Z +@ cdecl -arch=win64 ?_Rename@sys@tr2@std@@YAHPEB_W0@Z(wstr wstr) msvcp120.?_Rename@sys@tr2@std@@YAHPEB_W0@Z @ cdecl -arch=win32 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@DI@Z(ptr ptr long ptr long long) msvcp120.?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@DI@Z @ cdecl -arch=win64 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@D_K@Z(ptr ptr ptr long long) msvcp120.?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@D_K@Z @ cdecl -arch=win32 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@GI@Z(ptr ptr long ptr long long) msvcp120.?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@GI@Z diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 532c7cf8365..c7a3be91306 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -14844,6 +14844,20 @@ int __cdecl tr2_sys__Copy_file_wchar(WCHAR const* source, WCHAR const* dest, MSV return GetLastError(); } +/* ?_Rename@sys@tr2@std@@YAHPB_W0@Z */ +/* ?_Rename@sys@tr2@std@@YAHPEB_W0@Z */ +int __cdecl tr2_sys__Rename_wchar(WCHAR const* old_path, WCHAR const* new_path) +{ + TRACE("(%s %s)\n", debugstr_w(old_path), debugstr_w(new_path)); + + if(!old_path || !new_path) + return ERROR_INVALID_PARAMETER; + + if(MoveFileExW(old_path, new_path, MOVEFILE_COPY_ALLOWED)) + return ERROR_SUCCESS; + return GetLastError(); +} + /* ??1_Winit@std@@QAE@XZ */ /* ??1_Winit@std@@QAE@XZ */ DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)