YongHao Hu : msvcp110: Add tr2_sys__Remove_dir implementation and test.

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


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

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

msvcp110: Add tr2_sys__Remove_dir implementation and test.

---

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

diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index dcf47db..9ba3224 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1718,8 +1718,8 @@
 @ stub -arch=arm ?_Release at _Pad@std@@QAAXXZ
 @ stub -arch=i386 ?_Release at _Pad@std@@QAEXXZ
 @ stub -arch=win64 ?_Release at _Pad@std@@QEAAXXZ
-@ stub -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z
-@ stub -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z
+@ cdecl -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z(str) tr2_sys__Remove_dir
+@ cdecl -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z(str) tr2_sys__Remove_dir
 @ stub -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPB_W at Z
 @ stub -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z
 @ stub -arch=win32 ?_Rename at sys@tr2 at std@@YAHPBD0 at Z
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index acfd380..488bb01 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1679,8 +1679,8 @@
 @ stub -arch=arm ?_Release at _Pad@std@@QAAXXZ
 @ stub -arch=i386 ?_Release at _Pad@std@@QAEXXZ
 @ stub -arch=win64 ?_Release at _Pad@std@@QEAAXXZ
-@ stub -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z
-@ stub -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z
+@ cdecl -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z(str) tr2_sys__Remove_dir
+@ cdecl -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z(str) tr2_sys__Remove_dir
 @ stub -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPB_W at Z
 @ stub -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z
 @ stub -arch=win32 ?_Rename at sys@tr2 at std@@YAHPBD0 at Z
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 90c317b..e97aa55 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -65,6 +65,7 @@ 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 MSVCP_bool (__cdecl *p_tr2_sys__Remove_dir)(char const*);
 
 static HMODULE msvcp;
 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -103,6 +104,8 @@ static BOOL init(void)
                 "?_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");
+        SET(p_tr2_sys__Remove_dir,
+                "?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z");
     } else {
         SET(p_tr2_sys__File_size,
                 "?_File_size at sys@tr2 at std@@YA_KPBD at Z");
@@ -114,6 +117,8 @@ static BOOL init(void)
                 "?_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");
+        SET(p_tr2_sys__Remove_dir,
+                "?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z");
     }
 
     msvcr = GetModuleHandleA("msvcr120.dll");
@@ -497,6 +502,30 @@ static void test_tr2_sys__Make_dir(void)
     ok(RemoveDirectoryA("tr2_test_dir"), "Expected tr2_test_dir to exist\n");
 }
 
+static void test_tr2_sys__Remove_dir(void)
+{
+    MSVCP_bool ret;
+    int i;
+    struct {
+        char const *path;
+        MSVCP_bool val;
+    } tests[] = {
+        { "tr2_test_dir", TRUE  },
+        { "tr2_test_dir", FALSE },
+        { NULL, FALSE },
+        { "??invalid_name>>", FALSE }
+    };
+
+    ok(p_tr2_sys__Make_dir("tr2_test_dir"), "tr2_sys__Make_dir() failed\n");
+
+    for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+        errno = 0xdeadbeef;
+        ret = p_tr2_sys__Remove_dir(tests[i].path);
+        ok(ret == tests[i].val, "test_tr2_sys__Remove_dir(): test %d expect: %d, got %d\n", i+1, tests[i].val, ret);
+        ok(errno == 0xdeadbeef, "test_tr2_sys__Remove_dir(): test %d errno expect 0xdeadbeef, got %d\n", i+1, errno);
+    }
+}
+
 START_TEST(msvcp120)
 {
     if(!init()) return;
@@ -511,5 +540,6 @@ START_TEST(msvcp120)
     test_tr2_sys__Current_get();
     test_tr2_sys__Current_set();
     test_tr2_sys__Make_dir();
+    test_tr2_sys__Remove_dir();
     FreeLibrary(msvcp);
 }
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 9fb9ba2..3633567 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1679,8 +1679,8 @@
 @ stub -arch=arm ?_Release at _Pad@std@@QAAXXZ
 @ stub -arch=i386 ?_Release at _Pad@std@@QAEXXZ
 @ stub -arch=win64 ?_Release at _Pad@std@@QEAAXXZ
-@ stub -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z
-@ stub -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z
+@ cdecl -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z(str) msvcp120.?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z
+@ cdecl -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z(str) msvcp120.?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z
 @ stub -arch=win32 ?_Remove_dir at sys@tr2 at std@@YA_NPB_W at Z
 @ stub -arch=win64 ?_Remove_dir at sys@tr2 at std@@YA_NPEB_W at Z
 @ stub -arch=win32 ?_Rename at sys@tr2 at std@@YAHPBD0 at Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 49e841e..218c6c7 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14276,6 +14276,14 @@ int __cdecl tr2_sys__Make_dir(char const* path)
     return 1;
 }
 
+/* ?_Remove_dir at sys@tr2 at std@@YA_NPBD at Z */
+/* ?_Remove_dir at sys@tr2 at std@@YA_NPEBD at Z */
+MSVCP_bool __cdecl tr2_sys__Remove_dir(char const* path)
+{
+    TRACE("(%p)\n", path);
+    return RemoveDirectoryA(path) != 0;
+}
+
 /* ??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