=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: msvcp140: Implement _Current_get.

Alexandre Julliard julliard at winehq.org
Tue Jul 11 15:59:32 CDT 2017


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Jul 11 12:30:16 2017 +0200

msvcp140: Implement _Current_get.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcp140/msvcp140.spec    |  2 +-
 dlls/msvcp140/tests/msvcp140.c | 28 ++++++++++++++++++++++++++++
 dlls/msvcp90/ios.c             | 10 ++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec
index 2d51168..10bad33 100644
--- a/dlls/msvcp140/msvcp140.spec
+++ b/dlls/msvcp140/msvcp140.spec
@@ -3634,7 +3634,7 @@
 @ cdecl _Cnd_wait(ptr ptr)
 @ stub _Copy_file
 @ stub _Cosh
-@ stub _Current_get
+@ cdecl _Current_get(ptr)
 @ stub _Current_set
 @ extern _Denorm _Denorm
 @ cdecl _Dtest(ptr) _Dtest
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c
index f555980..7f1aae3 100644
--- a/dlls/msvcp140/tests/msvcp140.c
+++ b/dlls/msvcp140/tests/msvcp140.c
@@ -152,6 +152,7 @@ static int (__cdecl *p__Schedule_chore)(_Threadpool_chore*);
 static int (__cdecl *p__Reschedule_chore)(const _Threadpool_chore*);
 static void (__cdecl *p__Release_chore)(_Threadpool_chore*);
 
+static MSVCP_bool (__cdecl *p_Current_get)(WCHAR *);
 static ULONGLONG (__cdecl *p_File_size)(WCHAR const *);
 static int (__cdecl *p_To_byte)(const WCHAR *src, char *dst);
 static int (__cdecl *p_To_wide)(const char *src, WCHAR *dst);
@@ -217,6 +218,7 @@ static BOOL init(void)
         SET(p__Release_chore, "?_Release_chore at details@Concurrency@@YAXPAU_Threadpool_chore at 12@@Z");
     }
 
+    SET(p_Current_get, "_Current_get");
     SET(p_File_size, "_File_size");
     SET(p_To_byte, "_To_byte");
     SET(p_To_wide, "_To_wide");
@@ -618,6 +620,31 @@ static void test_File_size(void)
     ok(SetCurrentDirectoryW(origin_path), "SetCurrentDirectoryW to origin_path failed\n");
 }
 
+static void test_Current_get(void)
+{
+    WCHAR temp_path[MAX_PATH], current_path[MAX_PATH], origin_path[MAX_PATH];
+    BOOL ret;
+    memset(origin_path, 0, sizeof(origin_path));
+    GetCurrentDirectoryW(MAX_PATH, origin_path);
+    memset(temp_path, 0, sizeof(temp_path));
+    GetTempPathW(MAX_PATH, temp_path);
+
+    ok(SetCurrentDirectoryW(temp_path), "SetCurrentDirectoryW to temp_path failed\n");
+    memset(current_path, 0, sizeof(current_path));
+    ret = p_Current_get(current_path);
+    ok(ret == TRUE, "p_Current_get returned %u\n", ret);
+    current_path[wcslen(current_path)] = '\\';
+    ok(!wcscmp(temp_path, current_path), "p_Current_get(): expect: %s, got %s\n",
+            wine_dbgstr_w(temp_path), wine_dbgstr_w(current_path));
+
+    ok(SetCurrentDirectoryW(origin_path), "SetCurrentDirectoryW to origin_path failed\n");
+    memset(current_path, 0, sizeof(current_path));
+    ret = p_Current_get(current_path);
+    ok(ret == TRUE, "p_Current_get returned %u\n", ret);
+    ok(!wcscmp(origin_path, current_path), "p_Current_get(): expect: %s, got %s\n",
+            wine_dbgstr_w(origin_path), wine_dbgstr_w(current_path));
+}
+
 START_TEST(msvcp140)
 {
     if(!init()) return;
@@ -630,5 +657,6 @@ START_TEST(msvcp140)
     test_to_byte();
     test_to_wide();
     test_File_size();
+    test_Current_get();
     FreeLibrary(msvcp);
 }
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index e3ba648..9d62454 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -15530,6 +15530,16 @@ WCHAR* __cdecl tr2_sys__Current_get_wchar(WCHAR *current_path)
     return current_path;
 }
 
+/* _Current_get, msvcp140 version */
+BOOL __cdecl _Current_get(WCHAR *current_path)
+{
+    TRACE("(%s)\n", debugstr_w(current_path));
+
+    if(!GetCurrentDirectoryW(MAX_PATH, current_path))
+        return FALSE;
+    return TRUE;
+}
+
 /* ?_Current_set at sys@tr2 at std@@YA_NPB_W at Z */
 /* ?_Current_set at sys@tr2 at std@@YA_NPEB_W at Z */
 MSVCP_bool __cdecl tr2_sys__Current_set_wchar(WCHAR const* path)




More information about the wine-cvs mailing list