YongHao Hu : msvcp110: Add tr2_sys__Make_dir_wchar implementation and test.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 17 09:01:13 CDT 2015


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

Author: YongHao Hu <christopherwuy at gmail.com>
Date:   Mon Aug 10 14:45:57 2015 +0800

msvcp110: Add tr2_sys__Make_dir_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                  | 16 ++++++++++++++++
 5 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index ff513b3..c1c6212 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1619,8 +1619,8 @@
 @ stub -arch=win64 ?_MP_Rem at std@@YAXQEA_K_K at Z
 @ cdecl -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPBD at Z(str) tr2_sys__Make_dir
 @ cdecl -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEBD at Z(str) tr2_sys__Make_dir
-@ stub -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z
-@ stub -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z
+@ cdecl -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z(wstr) tr2_sys__Make_dir_wchar
+@ cdecl -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z(wstr) tr2_sys__Make_dir_wchar
 @ cdecl -arch=win32 ?_Makeloc at _Locimp@locale at std@@CAPAV123 at ABV_Locinfo@3 at HPAV123@PBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeloc
 @ cdecl -arch=win64 ?_Makeloc at _Locimp@locale at std@@CAPEAV123 at AEBV_Locinfo@3 at HPEAV123@PEBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeloc
 @ cdecl -arch=win32 ?_Makeushloc at _Locimp@locale at std@@CAXABV_Locinfo at 3@HPAV123 at PBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeushloc
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 8348a3f..e990eaf 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1580,8 +1580,8 @@
 @ stub -arch=win64 ?_MP_Rem at std@@YAXQEA_K_K at Z
 @ cdecl -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPBD at Z(str) tr2_sys__Make_dir
 @ cdecl -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEBD at Z(str) tr2_sys__Make_dir
-@ stub -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z
-@ stub -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z
+@ cdecl -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z(wstr) tr2_sys__Make_dir_wchar
+@ cdecl -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z(wstr) tr2_sys__Make_dir_wchar
 @ cdecl -arch=win32 ?_Makeloc at _Locimp@locale at std@@CAPAV123 at ABV_Locinfo@3 at HPAV123@PBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeloc
 @ cdecl -arch=win64 ?_Makeloc at _Locimp@locale at std@@CAPEAV123 at AEBV_Locinfo@3 at HPEAV123@PEBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeloc
 @ cdecl -arch=win32 ?_Makeushloc at _Locimp@locale at std@@CAXABV_Locinfo at 3@HPAV123 at PBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeushloc
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 07277b3..85e9354 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -81,6 +81,7 @@ static WCHAR* (__cdecl *p_tr2_sys__Current_get_wchar)(WCHAR *);
 static MSVCP_bool (__cdecl *p_tr2_sys__Current_set)(char const*);
 static MSVCP_bool (__cdecl *p_tr2_sys__Current_set_wchar)(WCHAR const*);
 static int (__cdecl *p_tr2_sys__Make_dir)(char const*);
+static int (__cdecl *p_tr2_sys__Make_dir_wchar)(WCHAR const*);
 static MSVCP_bool (__cdecl *p_tr2_sys__Remove_dir)(char const*);
 static int (__cdecl *p_tr2_sys__Copy_file)(char const*, char const*, MSVCP_bool);
 static int (__cdecl *p_tr2_sys__Rename)(char const*, char const*);
@@ -133,6 +134,8 @@ static BOOL init(void)
                 "?_Current_set at sys@tr2 at std@@YA_NPEB_W at Z");
         SET(p_tr2_sys__Make_dir,
                 "?_Make_dir at sys@tr2 at std@@YAHPEBD at Z");
+        SET(p_tr2_sys__Make_dir_wchar,
+                "?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z");
         SET(p_tr2_sys__Remove_dir,
                 "?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z");
         SET(p_tr2_sys__Copy_file,
@@ -164,6 +167,8 @@ static BOOL init(void)
                 "?_Current_set at sys@tr2 at std@@YA_NPB_W at Z");
         SET(p_tr2_sys__Make_dir,
                 "?_Make_dir at sys@tr2 at std@@YAHPBD at Z");
+        SET(p_tr2_sys__Make_dir_wchar,
+                "?_Make_dir at sys@tr2 at std@@YAHPB_W at Z");
         SET(p_tr2_sys__Remove_dir,
                 "?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z");
         SET(p_tr2_sys__Copy_file,
@@ -561,6 +566,7 @@ static void test_tr2_sys__Current_set(void)
 static void test_tr2_sys__Make_dir(void)
 {
     int ret, i;
+    WCHAR testW[] = {'w','d',0};
     struct {
         char const *path;
         int val;
@@ -577,8 +583,11 @@ static void test_tr2_sys__Make_dir(void)
         ok(ret == tests[i].val, "tr2_sys__Make_dir(): test %d expect: %d, got %d\n", i+1, tests[i].val, ret);
         ok(errno == 0xdeadbeef, "tr2_sys__Make_dir(): test %d errno expect 0xdeadbeef, got %d\n", i+1, errno);
     }
+    ret = p_tr2_sys__Make_dir_wchar(testW);
+    ok(ret == 1, "tr2_sys__Make_dir(): expect: 1, got %d\n", ret);
 
-    ok(RemoveDirectoryA("tr2_test_dir"), "Expected tr2_test_dir to exist\n");
+    ok(RemoveDirectoryA("tr2_test_dir"), "expect tr2_test_dir to exist\n");
+    ok(RemoveDirectoryW(testW), "expect wd to exist\n");
 }
 
 static void test_tr2_sys__Remove_dir(void)
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 697c83c..b20d507 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1580,8 +1580,8 @@
 @ stub -arch=win64 ?_MP_Rem at std@@YAXQEA_K_K at Z
 @ cdecl -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPBD at Z(str) msvcp120.?_Make_dir at sys@tr2 at std@@YAHPBD at Z
 @ cdecl -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEBD at Z(str) msvcp120.?_Make_dir at sys@tr2 at std@@YAHPEBD at Z
-@ stub -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z
-@ stub -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z
+@ cdecl -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z(wstr) msvcp120.?_Make_dir at sys@tr2 at std@@YAHPB_W at Z
+@ cdecl -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z(wstr) msvcp120.?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z
 @ cdecl -arch=win32 ?_Makeloc at _Locimp@locale at std@@CAPAV123 at ABV_Locinfo@3 at HPAV123@PBV23@@Z(ptr long ptr ptr) msvcp120.?_Makeloc at _Locimp@locale at std@@CAPAV123 at ABV_Locinfo@3 at HPAV123@PBV23@@Z
 @ cdecl -arch=win64 ?_Makeloc at _Locimp@locale at std@@CAPEAV123 at AEBV_Locinfo@3 at HPEAV123@PEBV23@@Z(ptr long ptr ptr) msvcp120.?_Makeloc at _Locimp@locale at std@@CAPEAV123 at AEBV_Locinfo@3 at HPEAV123@PEBV23@@Z
 @ cdecl -arch=win32 ?_Makeushloc at _Locimp@locale at std@@CAXABV_Locinfo at 3@HPAV123 at PBV23@@Z(ptr long ptr ptr) msvcp120.?_Makeushloc at _Locimp@locale at std@@CAXABV_Locinfo at 3@HPAV123 at PBV23@@Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 458e6de..c01d187 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14809,6 +14809,22 @@ MSVCP_bool __cdecl tr2_sys__Current_set_wchar(WCHAR const* path)
     return SetCurrentDirectoryW(path) != 0;
 }
 
+/* ?_Make_dir at sys@tr2 at std@@YAHPB_W at Z */
+/* ?_Make_dir at sys@tr2 at std@@YAHPEB_W at Z */
+int __cdecl tr2_sys__Make_dir_wchar(WCHAR const* path)
+{
+    TRACE("(%s)\n", debugstr_w(path));
+
+    if(!CreateDirectoryW(path, NULL)) {
+        if(GetLastError() == ERROR_ALREADY_EXISTS)
+            return 0;
+        else
+            return -1;
+    }
+
+    return 1;
+}
+
 /* ??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