From f3b6c6ac0415010fa22d7d0440cb46f507328407 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Tue, 11 Jul 2017 12:30:16 +0200 Subject: [PATCH] msvcp140: Implement _Current_get. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Dösinger Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- 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 2d511682d01..10bad33f5cb 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 f5559805a01..7f1aae382a8 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@details@Concurrency@@YAXPAU_Threadpool_chore@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 e3ba6487087..9d62454ac67 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@sys@tr2@std@@YA_NPB_W@Z */ /* ?_Current_set@sys@tr2@std@@YA_NPEB_W@Z */ MSVCP_bool __cdecl tr2_sys__Current_set_wchar(WCHAR const* path) -- 2.11.4.GIT