YongHao Hu : msvcp110: Add tr2_sys__Current_get implementation and test.

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


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

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

msvcp110: Add tr2_sys__Current_get 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                  | 11 +++++++++++
 5 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index c388eaf..13d790e 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1167,8 +1167,8 @@
 @ stub -arch=win64 ?_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
-@ stub -arch=win32 ?_Current_get at sys@tr2 at std@@YAPADPAD at Z
-@ stub -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEADPEAD at Z
+@ 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
 @ stub -arch=win32 ?_Current_get at sys@tr2 at std@@YAPA_WPA_W at Z
 @ stub -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEA_WPEA_W at Z
 @ stub -arch=win32 ?_Current_set at sys@tr2 at std@@YA_NPBD at Z
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index c74e6ca..9547473 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1132,8 +1132,8 @@
 @ stub -arch=win64 ?_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
-@ stub -arch=win32 ?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z
-@ stub -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z
+@ 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
 @ stub -arch=win32 ?_Current_get at sys@tr2 at std@@YAPA_WAAY0BAE at _W@Z
 @ stub -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEA_WAEAY0BAE at _W@Z
 @ stub -arch=win32 ?_Current_set at sys@tr2 at std@@YA_NPBD at Z
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index defa934..6760a13 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -61,6 +61,7 @@ static void (CDECL *p__Do_call)(void *this);
 /* filesystem */
 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 HMODULE msvcp;
 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -93,11 +94,15 @@ static BOOL init(void)
                 "?_File_size at sys@tr2 at std@@YA_KPEBD at Z");
         SET(p_tr2_sys__Equivalent,
                 "?_Equivalent at sys@tr2 at std@@YAHPEBD0 at Z");
+        SET(p_tr2_sys__Current_get,
+                "?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z");
     } else {
         SET(p_tr2_sys__File_size,
                 "?_File_size at sys@tr2 at std@@YA_KPBD at Z");
         SET(p_tr2_sys__Equivalent,
                 "?_Equivalent at sys@tr2 at std@@YAHPBD0 at Z");
+        SET(p_tr2_sys__Current_get,
+                "?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z");
     }
 
     msvcr = GetModuleHandleA("msvcr120.dll");
@@ -395,6 +400,29 @@ static void test_tr2_sys__Equivalent(void)
     ok(SetCurrentDirectoryA(current_path), "SetCurrentDirectoryA failed\n");
 }
 
+static void test_tr2_sys__Current_get(void)
+{
+    char temp_path[MAX_PATH], current_path[MAX_PATH], origin_path[MAX_PATH];
+    char *temp;
+    memset(origin_path, 0, MAX_PATH);
+    GetCurrentDirectoryA(MAX_PATH, origin_path);
+    memset(temp_path, 0, MAX_PATH);
+    GetTempPathA(MAX_PATH, temp_path);
+
+    ok(SetCurrentDirectoryA(temp_path), "SetCurrentDirectoryA to temp_path failed\n");
+    memset(current_path, 0, MAX_PATH);
+    temp = p_tr2_sys__Current_get(current_path);
+    ok(temp == current_path, "p_tr2_sys__Current_get returned different buffer\n");
+    temp[strlen(temp)] = '\\';
+    ok(!strcmp(temp_path, current_path), "test_tr2_sys__Current_get(): expect: %s, got %s\n", temp_path, current_path);
+
+    ok(SetCurrentDirectoryA(origin_path), "SetCurrentDirectoryA to origin_path failed\n");
+    memset(current_path, 0, MAX_PATH);
+    temp = p_tr2_sys__Current_get(current_path);
+    ok(temp == current_path, "p_tr2_sys__Current_get returned different buffer\n");
+    ok(!strcmp(origin_path, current_path), "test_tr2_sys__Current_get(): expect: %s, got %s\n", origin_path, current_path);
+}
+
 START_TEST(msvcp120)
 {
     if(!init()) return;
@@ -406,5 +434,6 @@ START_TEST(msvcp120)
 
     test_tr2_sys__File_size();
     test_tr2_sys__Equivalent();
+    test_tr2_sys__Current_get();
     FreeLibrary(msvcp);
 }
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index fdbda65..11e208a 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1132,8 +1132,8 @@
 @ stub -arch=win64 ?_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
-@ stub -arch=win32 ?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z
-@ stub -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@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
 @ stub -arch=win32 ?_Current_get at sys@tr2 at std@@YAPA_WAAY0BAE at _W@Z
 @ stub -arch=win64 ?_Current_get at sys@tr2 at std@@YAPEA_WAEAY0BAE at _W@Z
 @ stub -arch=win32 ?_Current_set at sys@tr2 at std@@YA_NPBD at Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index d68e26a..e11d8c4 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14241,6 +14241,17 @@ int __cdecl tr2_sys__Equivalent(char const* path1, char const* path2)
             );
 }
 
+/* ?_Current_get at sys@tr2 at std@@YAPADAAY0BAE at D@Z */
+/* ?_Current_get at sys@tr2 at std@@YAPEADAEAY0BAE at D@Z */
+char* __cdecl tr2_sys__Current_get(char *current_path)
+{
+    TRACE("(%p)\n", current_path);
+
+    if(!GetCurrentDirectoryA(MAX_PATH, current_path))
+        return NULL;
+    return current_path;
+}
+
 /* ??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