YongHao Hu : msvcp110: Add tr2_sys__Make_dir implementation and test.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 15 08:49:10 CDT 2015


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

Author: YongHao Hu <christopherwuy at gmail.com>
Date:   Sat Jun 13 00:31:30 2015 +0800

msvcp110: Add tr2_sys__Make_dir implementation and test.

---

 dlls/msvcp110/msvcp110.spec         |  4 ++--
 dlls/msvcp120/msvcp120.spec         |  4 ++--
 dlls/msvcp120/tests/msvcp120.c      | 29 +++++++++++++++++++++++++++++
 dlls/msvcp120_app/msvcp120_app.spec |  4 ++--
 dlls/msvcp90/ios.c                  | 16 ++++++++++++++++
 5 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index a06d260..dcf47db 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1617,8 +1617,8 @@
 @ stub -arch=win64 ?_MP_Mul at std@@YAXQEA_K_K1 at Z
 @ stub -arch=win32 ?_MP_Rem at std@@YAXQA_K_K at Z
 @ stub -arch=win64 ?_MP_Rem at std@@YAXQEA_K_K at Z
-@ stub -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPBD at Z
-@ stub -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEBD 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 ?_Makeloc at _Locimp@locale at std@@CAPAV123 at ABV_Locinfo@3 at HPAV123@PBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeloc
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 275d7ab..acfd380 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1578,8 +1578,8 @@
 @ stub -arch=win64 ?_MP_Mul at std@@YAXQEA_K_K1 at Z
 @ stub -arch=win32 ?_MP_Rem at std@@YAXQA_K_K at Z
 @ stub -arch=win64 ?_MP_Rem at std@@YAXQEA_K_K at Z
-@ stub -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPBD at Z
-@ stub -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEBD 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 ?_Makeloc at _Locimp@locale at std@@CAPAV123 at ABV_Locinfo@3 at HPAV123@PBV23@@Z(ptr long ptr ptr) locale__Locimp__Makeloc
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 5953fbe..90c317b 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -64,6 +64,7 @@ static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*);
 static int (__cdecl *p_tr2_sys__Equivalent)(char const*, char const*);
 static char* (__cdecl *p_tr2_sys__Current_get)(char *);
 static MSVCP_bool (__cdecl *p_tr2_sys__Current_set)(char const*);
+static int (__cdecl *p_tr2_sys__Make_dir)(char const*);
 
 static HMODULE msvcp;
 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -100,6 +101,8 @@ static BOOL init(void)
                 "?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z");
         SET(p_tr2_sys__Current_set,
                 "?_Current_set at sys@tr2 at std@@YA_NPEBD at Z");
+        SET(p_tr2_sys__Make_dir,
+                "?_Make_dir at sys@tr2 at std@@YAHPEBD at Z");
     } else {
         SET(p_tr2_sys__File_size,
                 "?_File_size at sys@tr2 at std@@YA_KPBD at Z");
@@ -109,6 +112,8 @@ static BOOL init(void)
                 "?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z");
         SET(p_tr2_sys__Current_set,
                 "?_Current_set at sys@tr2 at std@@YA_NPBD at Z");
+        SET(p_tr2_sys__Make_dir,
+                "?_Make_dir at sys@tr2 at std@@YAHPBD at Z");
     }
 
     msvcr = GetModuleHandleA("msvcr120.dll");
@@ -469,6 +474,29 @@ static void test_tr2_sys__Current_set(void)
     ok(!strcmp(origin_path, current_path), "test_tr2_sys__Current_get(): expect: %s, got %s\n", origin_path, current_path);
 }
 
+static void test_tr2_sys__Make_dir(void)
+{
+    int ret, i;
+    struct {
+        char const *path;
+        int val;
+    } tests[] = {
+        { "tr2_test_dir", 1 },
+        { "tr2_test_dir", 0 },
+        { NULL, -1 },
+        { "??invalid_name>>", -1 }
+    };
+
+    for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+        errno = 0xdeadbeef;
+        ret = p_tr2_sys__Make_dir(tests[i].path);
+        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);
+    }
+
+    ok(RemoveDirectoryA("tr2_test_dir"), "Expected tr2_test_dir to exist\n");
+}
+
 START_TEST(msvcp120)
 {
     if(!init()) return;
@@ -482,5 +510,6 @@ START_TEST(msvcp120)
     test_tr2_sys__Equivalent();
     test_tr2_sys__Current_get();
     test_tr2_sys__Current_set();
+    test_tr2_sys__Make_dir();
     FreeLibrary(msvcp);
 }
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 596eee5..9fb9ba2 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1578,8 +1578,8 @@
 @ stub -arch=win64 ?_MP_Mul at std@@YAXQEA_K_K1 at Z
 @ stub -arch=win32 ?_MP_Rem at std@@YAXQA_K_K at Z
 @ stub -arch=win64 ?_MP_Rem at std@@YAXQEA_K_K at Z
-@ stub -arch=win32 ?_Make_dir at sys@tr2 at std@@YAHPBD at Z
-@ stub -arch=win64 ?_Make_dir at sys@tr2 at std@@YAHPEBD 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 ?_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
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index e78c46b..49e841e 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14260,6 +14260,22 @@ MSVCP_bool __cdecl tr2_sys__Current_set(char const* path)
     return SetCurrentDirectoryA(path) != 0;
 }
 
+/* ?_Make_dir at sys@tr2 at std@@YAHPBD at Z */
+/* ?_Make_dir at sys@tr2 at std@@YAHPEBD at Z */
+int __cdecl tr2_sys__Make_dir(char const* path)
+{
+    TRACE("(%p)\n", path);
+
+    if(!CreateDirectoryA(path, NULL)) {
+        if(GetLastError() == ERROR_ALREADY_EXISTS)
+            return 0;
+        else
+            return -1;
+    }
+
+    return 1;
+}
+
 /* ??0strstream at std@@QAE at PADHH@Z */
 /* ??0strstream at std@@QEAA at PEAD_JH@Z */
 #if STREAMSIZE_BITS == 64




More information about the wine-cvs mailing list