YongHao Hu : msvcp110: Add tr2_sys__Copy_file_wchar implementation and test.

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


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

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

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 fb22ca1..49ff921 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1165,8 +1165,8 @@
 @ stub -arch=win64 ?_Close_dir at sys@tr2 at std@@YAXPEAX at Z
 @ cdecl -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPBD0_N at Z(str str long) tr2_sys__Copy_file
 @ cdecl -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEBD0_N at Z(str str long) tr2_sys__Copy_file
-@ stub -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z
-@ stub -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z
+@ cdecl -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z(wstr wstr long) tr2_sys__Copy_file_wchar
+@ cdecl -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z(wstr wstr long) tr2_sys__Copy_file_wchar
 @ cdecl -arch=win32 ?_Current_get at sys@tr2 at std@@YAPADPAD at Z(ptr) tr2_sys__Current_get
 @ cdecl -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEADPEAD at Z(ptr) tr2_sys__Current_get
 @ cdecl -arch=win32 ?_Current_get at sys@tr2 at std@@YAPA_WPA_W at Z(ptr) tr2_sys__Current_get_wchar
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 8a7b6d7..2a73662 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1130,8 +1130,8 @@
 @ stub -arch=win64 ?_Close_dir at sys@tr2 at std@@YAXPEAX at Z
 @ cdecl -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPBD0_N at Z(str str long) tr2_sys__Copy_file
 @ cdecl -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEBD0_N at Z(str str long) tr2_sys__Copy_file
-@ stub -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z
-@ stub -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z
+@ cdecl -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z(wstr wstr long) tr2_sys__Copy_file_wchar
+@ cdecl -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z(wstr wstr long) tr2_sys__Copy_file_wchar
 @ cdecl -arch=win32 ?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z(ptr) tr2_sys__Current_get
 @ cdecl -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z(ptr) tr2_sys__Current_get
 @ cdecl -arch=win32 ?_Current_get at sys@tr2 at std@@YAPA_WAAY0BAE at _W@Z(ptr) tr2_sys__Current_get_wchar
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 6bbe11e..08effda 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 at sys@tr2 at std@@YA_NPEB_W at Z");
         SET(p_tr2_sys__Copy_file,
                 "?_Copy_file at sys@tr2 at std@@YAHPEBD0_N at Z");
+        SET(p_tr2_sys__Copy_file_wchar,
+                "?_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__Statvfs,
@@ -178,6 +181,8 @@ static BOOL init(void)
                 "?_Remove_dir at sys@tr2 at std@@YA_NPB_W at Z");
         SET(p_tr2_sys__Copy_file,
                 "?_Copy_file at sys@tr2 at std@@YAHPBD0_N at Z");
+        SET(p_tr2_sys__Copy_file_wchar,
+                "?_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__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 d05b3d4..06a2e2d 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1130,8 +1130,8 @@
 @ stub -arch=win64 ?_Close_dir at sys@tr2 at std@@YAXPEAX at Z
 @ cdecl -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPBD0_N at Z(str str long) msvcp120.?_Copy_file at sys@tr2 at std@@YAHPBD0_N at Z
 @ cdecl -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEBD0_N at Z(str str long) msvcp120.?_Copy_file at sys@tr2 at std@@YAHPEBD0_N at Z
-@ stub -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z
-@ stub -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z
+@ cdecl -arch=win32 ?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z(wstr wstr long) msvcp120.?_Copy_file at sys@tr2 at std@@YAHPB_W0_N at Z
+@ cdecl -arch=win64 ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z(wstr wstr long) msvcp120.?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at Z
 @ cdecl -arch=win32 ?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z(ptr) msvcp120.?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z
 @ cdecl -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z(ptr) msvcp120.?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z
 @ cdecl -arch=win32 ?_Current_get at sys@tr2 at std@@YAPA_WAAY0BAE at _W@Z(ptr) msvcp120.?_Current_get at sys@tr2 at std@@YAPA_WAAY0BAE at _W@Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 88d6453..532c7cf 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 at sys@tr2 at std@@YAHPB_W0_N at Z */
+/* ?_Copy_file at sys@tr2 at std@@YAHPEB_W0_N at 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 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