YongHao Hu : msvcp110: Add tr2_sys__Rename_wchar implementation and test.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 21 09:07:19 CDT 2015


Module: wine
Branch: master
Commit: 64eb3813c47c0db2b8bab39dc2ab3f93610d6ec7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=64eb3813c47c0db2b8bab39dc2ab3f93610d6ec7

Author: YongHao Hu <christopherwuy at gmail.com>
Date:   Wed Aug 19 01:27:27 2015 +0800

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 49ff921..91e1503 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1724,8 +1724,8 @@
 @ cdecl -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z(wstr) tr2_sys__Remove_dir_wchar
 @ cdecl -arch=win32 ?_Rename at sys@tr2 at std@@YAHPBD0 at Z(str str) tr2_sys__Rename
 @ cdecl -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEBD0 at Z(str str) tr2_sys__Rename
-@ stub -arch=win32 ?_Rename at sys@tr2 at std@@YAHPB_W0 at Z
-@ stub -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z
+@ cdecl -arch=win32 ?_Rename at sys@tr2 at std@@YAHPB_W0 at Z(wstr wstr) tr2_sys__Rename_wchar
+@ cdecl -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z(wstr wstr) tr2_sys__Rename_wchar
 @ cdecl -arch=win32 ?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@DI at Z(ptr ptr long ptr long long) num_put_char__Rep
 @ cdecl -arch=win64 ?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@D_K at Z(ptr ptr ptr long long) num_put_char__Rep
 @ cdecl -arch=win32 ?_Rep@?$num_put at GV?$ostreambuf_iterator at GU?$char_traits at G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at GU?$char_traits at G@std@@@2 at V32@GI at Z(ptr ptr long ptr long long) num_put_wchar__Rep
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 2a73662..745fecb 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1685,8 +1685,8 @@
 @ cdecl -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z(wstr) tr2_sys__Remove_dir_wchar
 @ cdecl -arch=win32 ?_Rename at sys@tr2 at std@@YAHPBD0 at Z(str str) tr2_sys__Rename
 @ cdecl -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEBD0 at Z(str str) tr2_sys__Rename
-@ stub -arch=win32 ?_Rename at sys@tr2 at std@@YAHPB_W0 at Z
-@ stub -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z
+@ cdecl -arch=win32 ?_Rename at sys@tr2 at std@@YAHPB_W0 at Z(wstr wstr) tr2_sys__Rename_wchar
+@ cdecl -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z(wstr wstr) tr2_sys__Rename_wchar
 @ cdecl -arch=win32 ?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@DI at Z(ptr ptr long ptr long long) num_put_char__Rep
 @ cdecl -arch=win64 ?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@D_K at Z(ptr ptr ptr long long) num_put_char__Rep
 @ cdecl -arch=win32 ?_Rep@?$num_put at GV?$ostreambuf_iterator at GU?$char_traits at G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at GU?$char_traits at G@std@@@2 at V32@GI at 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 08effda..dc833e9 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 at sys@tr2 at std@@YAHPEB_W0_N at Z");
         SET(p_tr2_sys__Rename,
                 "?_Rename at sys@tr2 at std@@YAHPEBD0 at Z");
+        SET(p_tr2_sys__Rename_wchar,
+                "?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z");
         SET(p_tr2_sys__Statvfs,
                 "?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z");
         SET(p_tr2_sys__Stat,
@@ -185,6 +188,8 @@ static BOOL init(void)
                 "?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z");
         SET(p_tr2_sys__Rename,
                 "?_Rename at sys@tr2 at std@@YAHPBD0 at Z");
+        SET(p_tr2_sys__Rename_wchar,
+                "?_Rename at sys@tr2 at std@@YAHPB_W0 at Z");
         SET(p_tr2_sys__Statvfs,
                 "?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at 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 06a2e2d..c5e4da0 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1685,8 +1685,8 @@
 @ cdecl -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z(wstr) msvcp120.?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z
 @ cdecl -arch=win32 ?_Rename at sys@tr2 at std@@YAHPBD0 at Z(str str) msvcp120.?_Rename at sys@tr2 at std@@YAHPBD0 at Z
 @ cdecl -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEBD0 at Z(str str) msvcp120.?_Rename at sys@tr2 at std@@YAHPEBD0 at Z
-@ stub -arch=win32 ?_Rename at sys@tr2 at std@@YAHPB_W0 at Z
-@ stub -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z
+@ cdecl -arch=win32 ?_Rename at sys@tr2 at std@@YAHPB_W0 at Z(wstr wstr) msvcp120.?_Rename at sys@tr2 at std@@YAHPB_W0 at Z
+@ cdecl -arch=win64 ?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z(wstr wstr) msvcp120.?_Rename at sys@tr2 at std@@YAHPEB_W0 at Z
 @ cdecl -arch=win32 ?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@DI at Z(ptr ptr long ptr long long) msvcp120.?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@DI at Z
 @ cdecl -arch=win64 ?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@D_K at Z(ptr ptr ptr long long) msvcp120.?_Rep@?$num_put at DV?$ostreambuf_iterator at DU?$char_traits at D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator at DU?$char_traits at D@std@@@2 at V32@D_K at Z
 @ cdecl -arch=win32 ?_Rep@?$num_put at GV?$ostreambuf_iterator at GU?$char_traits at G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at GU?$char_traits at G@std@@@2 at V32@GI at Z(ptr ptr long ptr long long) msvcp120.?_Rep@?$num_put at GV?$ostreambuf_iterator at GU?$char_traits at G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator at GU?$char_traits at G@std@@@2 at V32@GI at Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 532c7cf..c7a3be9 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 at sys@tr2 at std@@YAHPB_W0 at Z */
+/* ?_Rename at sys@tr2 at std@@YAHPEB_W0 at 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 at std@@QAE at XZ */
 /* ??1_Winit at std@@QAE at XZ */
 DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)




More information about the wine-cvs mailing list