From ee77fc3b4ec9152698fbb6c0e4784c6e28dddea7 Mon Sep 17 00:00:00 2001 From: YongHao Hu Date: Mon, 10 Aug 2015 14:44:53 +0800 Subject: [PATCH] msvcp110: Add tr2_sys__Current_get_wchar implementation and test. --- dlls/msvcp110/msvcp110.spec | 4 ++-- dlls/msvcp120/msvcp120.spec | 4 ++-- dlls/msvcp120/tests/msvcp120.c | 15 +++++++++++++++ dlls/msvcp120_app/msvcp120_app.spec | 4 ++-- dlls/msvcp90/ios.c | 11 +++++++++++ 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index a2456811bbb..02d80f930d9 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1169,8 +1169,8 @@ @ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADPAD@Z(ptr) tr2_sys__Current_get @ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADPEAD@Z(ptr) tr2_sys__Current_get -@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WPA_W@Z -@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WPEA_W@Z +@ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WPA_W@Z(ptr) tr2_sys__Current_get_wchar +@ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WPEA_W@Z(ptr) tr2_sys__Current_get_wchar @ cdecl -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPBD@Z(str) tr2_sys__Current_set @ cdecl -arch=win64 ?_Current_set@sys@tr2@std@@YA_NPEBD@Z(str) tr2_sys__Current_set @ stub -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPB_W@Z diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index a0357de7a31..d4312680420 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1134,8 +1134,8 @@ @ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z(ptr) tr2_sys__Current_get @ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z(ptr) tr2_sys__Current_get -@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z -@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z +@ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z(ptr) tr2_sys__Current_get_wchar +@ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z(ptr) tr2_sys__Current_get_wchar @ cdecl -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPBD@Z(str) tr2_sys__Current_set @ cdecl -arch=win64 ?_Current_set@sys@tr2@std@@YA_NPEBD@Z(str) tr2_sys__Current_set @ stub -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPB_W@Z diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 9fca0c23e87..a81c9283e8a 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -77,6 +77,7 @@ static ULONGLONG(__cdecl *p_tr2_sys__File_size_wchar)(WCHAR const*); static int (__cdecl *p_tr2_sys__Equivalent)(char const*, char const*); static int (__cdecl *p_tr2_sys__Equivalent_wchar)(WCHAR const*, WCHAR const*); static char* (__cdecl *p_tr2_sys__Current_get)(char *); +static WCHAR* (__cdecl *p_tr2_sys__Current_get_wchar)(WCHAR *); 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*); @@ -123,6 +124,8 @@ static BOOL init(void) "?_Equivalent@sys@tr2@std@@YAHPEB_W0@Z"); SET(p_tr2_sys__Current_get, "?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z"); + SET(p_tr2_sys__Current_get_wchar, + "?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z"); SET(p_tr2_sys__Current_set, "?_Current_set@sys@tr2@std@@YA_NPEBD@Z"); SET(p_tr2_sys__Make_dir, @@ -150,6 +153,8 @@ static BOOL init(void) "?_Equivalent@sys@tr2@std@@YAHPB_W0@Z"); SET(p_tr2_sys__Current_get, "?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z"); + SET(p_tr2_sys__Current_get_wchar, + "?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z"); SET(p_tr2_sys__Current_set, "?_Current_set@sys@tr2@std@@YA_NPBD@Z"); SET(p_tr2_sys__Make_dir, @@ -478,6 +483,8 @@ static void test_tr2_sys__Current_get(void) { char temp_path[MAX_PATH], current_path[MAX_PATH], origin_path[MAX_PATH]; char *temp; + WCHAR temp_path_wchar[MAX_PATH], current_path_wchar[MAX_PATH]; + WCHAR *temp_wchar; memset(origin_path, 0, MAX_PATH); GetCurrentDirectoryA(MAX_PATH, origin_path); memset(temp_path, 0, MAX_PATH); @@ -490,6 +497,14 @@ static void test_tr2_sys__Current_get(void) temp[strlen(temp)] = '\\'; ok(!strcmp(temp_path, current_path), "test_tr2_sys__Current_get(): expect: %s, got %s\n", temp_path, current_path); + GetTempPathW(MAX_PATH, temp_path_wchar); + ok(SetCurrentDirectoryW(temp_path_wchar), "SetCurrentDirectoryW to temp_path_wchar failed\n"); + memset(current_path_wchar, 0, MAX_PATH); + temp_wchar = p_tr2_sys__Current_get_wchar(current_path_wchar); + ok(temp_wchar == current_path_wchar, "p_tr2_sys__Current_get_wchar returned different buffer\n"); + temp_wchar[wcslen(temp_wchar)] = '\\'; + ok(!wcscmp(temp_path_wchar, current_path_wchar), "test_tr2_sys__Current_get(): expect: %s, got %s\n", wine_dbgstr_w(temp_path_wchar), wine_dbgstr_w(current_path_wchar)); + ok(SetCurrentDirectoryA(origin_path), "SetCurrentDirectoryA to origin_path failed\n"); memset(current_path, 0, MAX_PATH); temp = p_tr2_sys__Current_get(current_path); diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index 515ca2bff48..286b97863ca 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1134,8 +1134,8 @@ @ stub -arch=win64 ?_Copy_file@sys@tr2@std@@YAHPEB_W0_N@Z @ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPADAAY0BAE@D@Z @ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPEADAEAY0BAE@D@Z -@ stub -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z -@ stub -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z +@ cdecl -arch=win32 ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z +@ cdecl -arch=win64 ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z(ptr) msvcp120.?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z @ cdecl -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPBD@Z(str) msvcp120.?_Current_set@sys@tr2@std@@YA_NPBD@Z @ cdecl -arch=win64 ?_Current_set@sys@tr2@std@@YA_NPEBD@Z(str) msvcp120.?_Current_set@sys@tr2@std@@YA_NPEBD@Z @ stub -arch=win32 ?_Current_set@sys@tr2@std@@YA_NPB_W@Z diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index af3f5699c77..905697278a4 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -14790,6 +14790,17 @@ int __cdecl tr2_sys__Equivalent_wchar(WCHAR const* path1, WCHAR const* path2) ); } +/* ?_Current_get@sys@tr2@std@@YAPA_WAAY0BAE@_W@Z */ +/* ?_Current_get@sys@tr2@std@@YAPEA_WAEAY0BAE@_W@Z */ +WCHAR* __cdecl tr2_sys__Current_get_wchar(WCHAR *current_path) +{ + TRACE("(%s)\n", debugstr_w(current_path)); + + if(!GetCurrentDirectoryW(MAX_PATH, current_path)) + return NULL; + return current_path; +} + /* ??1_Winit@std@@QAE@XZ */ /* ??1_Winit@std@@QAE@XZ */ DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)