From d6dcc253bf907e4e92f24821eb960e528c2f5485 Mon Sep 17 00:00:00 2001 From: YongHao Hu Date: Fri, 19 Feb 2016 00:46:51 +0800 Subject: [PATCH] msvcp110: Add tr2_sys__Symlink implementation and test. Signed-off-by: YongHao Hu Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp110/msvcp110.spec | 4 +- dlls/msvcp120/msvcp120.spec | 4 +- dlls/msvcp120/tests/msvcp120.c | 65 +++++++++++++++++++++++++++++ dlls/msvcp120_app/msvcp120_app.spec | 4 +- dlls/msvcp90/ios.c | 13 ++++++ 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 1df4c55177c..3d899245c5c 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1771,8 +1771,8 @@ @ cdecl -arch=arm ?_Swap_all@_Container_base12@std@@QAAXAAU12@@Z(ptr ptr) _Container_base12__Swap_all @ thiscall -arch=i386 ?_Swap_all@_Container_base12@std@@QAEXAAU12@@Z(ptr ptr) _Container_base12__Swap_all @ cdecl -arch=win64 ?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z(ptr ptr) _Container_base12__Swap_all -@ stub -arch=win32 ?_Symlink@sys@tr2@std@@YAHPBD0@Z -@ stub -arch=win64 ?_Symlink@sys@tr2@std@@YAHPEBD0@Z +@ cdecl -arch=win32 ?_Symlink@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Symlink +@ cdecl -arch=win64 ?_Symlink@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Symlink @ stub -arch=win32 ?_Symlink@sys@tr2@std@@YAHPB_W0@Z @ stub -arch=win64 ?_Symlink@sys@tr2@std@@YAHPEB_W0@Z @ extern ?_Sync@ios_base@std@@0_NA ios_base_Sync diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 626ead806b0..1bb487e7eaf 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1732,8 +1732,8 @@ @ cdecl -arch=arm ?_Swap_all@_Container_base12@std@@QAAXAAU12@@Z(ptr ptr) _Container_base12__Swap_all @ thiscall -arch=i386 ?_Swap_all@_Container_base12@std@@QAEXAAU12@@Z(ptr ptr) _Container_base12__Swap_all @ cdecl -arch=win64 ?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z(ptr ptr) _Container_base12__Swap_all -@ stub -arch=win32 ?_Symlink@sys@tr2@std@@YAHPBD0@Z -@ stub -arch=win64 ?_Symlink@sys@tr2@std@@YAHPEBD0@Z +@ cdecl -arch=win32 ?_Symlink@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Symlink +@ cdecl -arch=win64 ?_Symlink@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Symlink @ stub -arch=win32 ?_Symlink@sys@tr2@std@@YAHPB_W0@Z @ stub -arch=win64 ?_Symlink@sys@tr2@std@@YAHPEB_W0@Z @ extern ?_Sync@ios_base@std@@0_NA ios_base_Sync diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 1aaa251db8b..f884d0c87b3 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -133,6 +133,7 @@ static void* (__cdecl *p_tr2_sys__Open_dir)(char*, char const*, int *, enum file static char* (__cdecl *p_tr2_sys__Read_dir)(char*, void*, enum file_type*); static void (__cdecl *p_tr2_sys__Close_dir)(void*); static int (__cdecl *p_tr2_sys__Link)(char const*, char const*); +static int (__cdecl *p_tr2_sys__Symlink)(char const*, char const*); /* thrd */ typedef struct @@ -268,6 +269,8 @@ static BOOL init(void) "?_Close_dir@sys@tr2@std@@YAXPEAX@Z"); SET(p_tr2_sys__Link, "?_Link@sys@tr2@std@@YAHPEBD0@Z"); + SET(p_tr2_sys__Symlink, + "?_Symlink@sys@tr2@std@@YAHPEBD0@Z"); SET(p__Thrd_current, "_Thrd_current"); } else { @@ -323,6 +326,8 @@ static BOOL init(void) "?_Close_dir@sys@tr2@std@@YAXPAX@Z"); SET(p_tr2_sys__Link, "?_Link@sys@tr2@std@@YAHPBD0@Z"); + SET(p_tr2_sys__Symlink, + "?_Symlink@sys@tr2@std@@YAHPBD0@Z"); #ifdef __i386__ SET(p_i386_Thrd_current, "_Thrd_current"); @@ -1396,6 +1401,65 @@ static void test_tr2_sys__Link(void) ok(SetCurrentDirectoryA(current_path), "SetCurrentDirectoryA failed\n"); } +static void test_tr2_sys__Symlink(void) +{ + int ret, i; + HANDLE file; + LARGE_INTEGER file_size; + struct { + char const *existing_path; + char const *new_path; + int last_error; + MSVCP_bool is_todo; + } tests[] = { + { "f1", "f1_link", ERROR_SUCCESS, FALSE }, + { "f1", "tr2_test_dir\\f1_link", ERROR_SUCCESS, FALSE }, + { "tr2_test_dir\\f1_link", "tr2_test_dir\\f1_link_link", ERROR_SUCCESS, FALSE }, + { "tr2_test_dir", "dir_link", ERROR_SUCCESS, FALSE }, + { NULL, "NULL_link", ERROR_INVALID_PARAMETER, FALSE }, + { "f1", NULL, ERROR_INVALID_PARAMETER, FALSE }, + { "not_exist", "not_exist_link", ERROR_SUCCESS, FALSE }, + { "f1", "not_exist_dir\\f1_link", ERROR_PATH_NOT_FOUND, TRUE } + }; + + ret = p_tr2_sys__Make_dir("tr2_test_dir"); + ok(ret == 1, "test_tr2_sys__Make_dir(): expect 1 got %d\n", ret); + file = CreateFileA("f1", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n"); + file_size.QuadPart = 7; + ok(SetFilePointerEx(file, file_size, NULL, FILE_BEGIN), "SetFilePointerEx failed\n"); + ok(SetEndOfFile(file), "SetEndOfFile failed\n"); + CloseHandle(file); + + for(i=0; i