From: YongHao Hu Subject: [PATCH 11/16] msvcp110: Add tr2_sys__Link implementation and test.(resend) Message-Id: <55D36BA7.7030205@gmail.com> Date: Wed, 19 Aug 2015 01:30:15 +0800 --- dlls/msvcp110/msvcp110.spec | 4 +- dlls/msvcp120/msvcp120.spec | 4 +- dlls/msvcp120/tests/msvcp120.c | 95 +++++++++++++++++++++++++++++++++++++ dlls/msvcp120_app/msvcp120_app.spec | 4 +- dlls/msvcp90/ios.c | 12 +++++ 5 files changed, 113 insertions(+), 6 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 1ed4aa5..1d40668 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1570,8 +1570,8 @@ @ stub -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z @ stub -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z @ stub -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z -@ stub -arch=win32 ?_Link@sys@tr2@std@@YAHPBD0@Z -@ stub -arch=win64 ?_Link@sys@tr2@std@@YAHPEBD0@Z +@ cdecl -arch=win32 ?_Link@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Link +@ cdecl -arch=win64 ?_Link@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Link @ stub -arch=win32 ?_Link@sys@tr2@std@@YAHPB_W0@Z @ stub -arch=win64 ?_Link@sys@tr2@std@@YAHPEB_W0@Z @ cdecl -arch=win32 ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z(ptr ptr long) locale__Locimp__Locimp_Addfac diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 225006a..ba2fb52 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1531,8 +1531,8 @@ @ stub -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z @ stub -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z @ stub -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z -@ stub -arch=win32 ?_Link@sys@tr2@std@@YAHPBD0@Z -@ stub -arch=win64 ?_Link@sys@tr2@std@@YAHPEBD0@Z +@ cdecl -arch=win32 ?_Link@sys@tr2@std@@YAHPBD0@Z(str str) tr2_sys__Link +@ cdecl -arch=win64 ?_Link@sys@tr2@std@@YAHPEBD0@Z(str str) tr2_sys__Link @ stub -arch=win32 ?_Link@sys@tr2@std@@YAHPB_W0@Z @ stub -arch=win64 ?_Link@sys@tr2@std@@YAHPEB_W0@Z @ cdecl -arch=win32 ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z(ptr ptr long) locale__Locimp__Locimp_Addfac diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 092239f..063abe1 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -97,6 +97,7 @@ static void (__cdecl *p_tr2_sys__Last_write_time_set)(char const*, __int64); static void* (__cdecl *p_tr2_sys__Open_dir)(char*, char const*, int *, enum file_type*); 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 HMODULE msvcp; #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) @@ -175,6 +176,8 @@ static BOOL init(void) "?_Read_dir@sys@tr2@std@@YAPEADAEAY0BAE@DPEAXAEAW4file_type@123@@Z"); SET(p_tr2_sys__Close_dir, "?_Close_dir@sys@tr2@std@@YAXPEAX@Z"); + SET(p_tr2_sys__Link, + "?_Link@sys@tr2@std@@YAHPEBD0@Z"); } else { SET(p_tr2_sys__File_size, "?_File_size@sys@tr2@std@@YA_KPBD@Z"); @@ -226,6 +229,8 @@ static BOOL init(void) "?_Read_dir@sys@tr2@std@@YAPADAAY0BAE@DPAXAAW4file_type@123@@Z"); SET(p_tr2_sys__Close_dir, "?_Close_dir@sys@tr2@std@@YAXPAX@Z"); + SET(p_tr2_sys__Link, + "?_Link@sys@tr2@std@@YAHPBD0@Z"); } msvcr = GetModuleHandleA("msvcr120.dll"); @@ -1041,6 +1046,95 @@ static void test_tr2_sys__dir_operation(void) ok(RemoveDirectoryA("tr2_test_dir"), "expect tr2_test_dir to exist\n"); } +static void test_tr2_sys__Link(void) +{ + int ret, i; + HANDLE file, h1, h2; + BY_HANDLE_FILE_INFORMATION info1, info2; + char temp_path[MAX_PATH], current_path[MAX_PATH]; + LARGE_INTEGER file_size; + struct { + char const *existing_path; + char const *new_path; + MSVCP_bool fail_if_exists; + int last_error; + MSVCP_bool is_todo; + } tests[] = { + { "f1", "f1_link", TRUE, ERROR_SUCCESS, FALSE }, + { "f1", "tr2_test_dir\\f1_link", TRUE, ERROR_SUCCESS, FALSE }, + { "tr2_test_dir\\f1_link", "tr2_test_dir\\f1_link_link", TRUE, ERROR_SUCCESS, FALSE }, + { "tr2_test_dir", "dir_link", TRUE, ERROR_ACCESS_DENIED, FALSE }, + { NULL, "NULL_link", TRUE, ERROR_INVALID_PARAMETER, TRUE }, + { "f1", NULL, TRUE, ERROR_INVALID_PARAMETER, TRUE }, + { "not_exist", "not_exist_link", TRUE, ERROR_FILE_NOT_FOUND, FALSE }, + { "f1", "not_exist_dir\\f1_link", TRUE, ERROR_PATH_NOT_FOUND, FALSE } + }; + + memset(current_path, 0, MAX_PATH); + GetCurrentDirectoryA(MAX_PATH, current_path); + memset(temp_path, 0, MAX_PATH); + GetTempPathA(MAX_PATH, temp_path); + ok(SetCurrentDirectoryA(temp_path), "SetCurrentDirectoryA to temp_path failed\n"); + + 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