From: YongHao Hu Subject: [PATCH 08/12] msvcp110: Add tr2_sys__Symlink implementation and test.(resend) Message-Id: <55ED9DAA.9060204@gmail.com> Date: Mon, 7 Sep 2015 22:22:34 +0800 --- dlls/msvcp110/msvcp110.spec | 4 +-- dlls/msvcp120/msvcp120.spec | 4 +-- dlls/msvcp120/tests/msvcp120.c | 68 +++++++++++++++++++++++++++++++++++++ dlls/msvcp120_app/msvcp120_app.spec | 4 +-- dlls/msvcp90/ios.c | 10 ++++++ 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 1d40668..e46dea0 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 ba2fb52..298cd24 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 063abe1..5ab4c8d 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -98,6 +98,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*); static HMODULE msvcp; #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) @@ -178,6 +179,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"); } else { SET(p_tr2_sys__File_size, "?_File_size@sys@tr2@std@@YA_KPBD@Z"); @@ -231,6 +234,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"); } msvcr = GetModuleHandleA("msvcr120.dll"); @@ -1135,6 +1140,68 @@ static void test_tr2_sys__Link(void) ok(SetCurrentDirectoryA(current_path), "SetCurrentDirectoryA failed\n"); } +static void test_tr2_sys__Symlink(void) +{ + int ret, i, delete_flag; + 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, TRUE }, + { "f1", NULL, ERROR_INVALID_PARAMETER, TRUE }, + { "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); + + delete_flag = 1; + for(i=0; i