diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index 245389e61ea..6a4eb14c04f 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3638,7 +3638,7 @@ @ cdecl _Current_set(wstr) tr2_sys__Current_set_wchar @ extern _Denorm _Denorm @ cdecl _Dtest(ptr) _Dtest -@ stub _Equivalent +@ cdecl _Equivalent(wstr wstr) tr2_sys__Equivalent_wchar @ cdecl _Exp(ptr double long) _Exp @ stub _FCosh @ extern _FDenorm _FDenorm diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index ac7154bec2f..229741a52d5 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -176,6 +176,7 @@ static void (__cdecl *p__Release_chore)(_Threadpool_chore*); static void (__cdecl *p_Close_dir)(void*); static MSVCP_bool (__cdecl *p_Current_get)(WCHAR *); static MSVCP_bool (__cdecl *p_Current_set)(WCHAR const *); +static int (__cdecl *p_Equivalent)(WCHAR const*, WCHAR const*); static ULONGLONG (__cdecl *p_File_size)(WCHAR const *); static __int64 (__cdecl *p_Last_write_time)(WCHAR const*); static void (__cdecl *p_Set_last_write_time)(WCHAR const*, __int64); @@ -267,6 +268,7 @@ static BOOL init(void) SET(p_Close_dir, "_Close_dir"); SET(p_Current_get, "_Current_get"); SET(p_Current_set, "_Current_set"); + SET(p_Equivalent, "_Equivalent"); SET(p_File_size, "_File_size"); SET(p_Last_write_time, "_Last_write_time"); SET(p_Set_last_write_time, "_Set_last_write_time"); @@ -1360,6 +1362,72 @@ static void test__Winerror_map(void) } } +static void test_Equivalent(void) +{ + int val, i; + HANDLE file; + WCHAR temp_path[MAX_PATH], current_path[MAX_PATH]; + static const WCHAR wine_test_dirW[] = + {'w','i','n','e','_','t','e','s','t','_','d','i','r',0}; + static const WCHAR f1W[] = + {'w','i','n','e','_','t','e','s','t','_','d','i','r','/','f','1',0}; + static const WCHAR f1W_backslash[] = + {'w','i','n','e','_','t','e','s','t','_','d','i','r','\\','f','1',0}; + static const WCHAR f1W_subdir[] = + {'w','i','n','e','_','t','e','s','t','_','d','i','r','/','.','/','f','1',0}; + static const WCHAR f1W_long[] = + {'w','i','n','e','_','t','e','s','t','_','d','i','r','/','.','.','/','w','i','n','e','_','t','e','s','t','_','d','i','r','/','f','1',0}; + static const WCHAR f2W[] = + {'w','i','n','e','_','t','e','s','t','_','d','i','r','/','f','2',0}; + static const WCHAR not_existW[] = + {'n','o','t','_','e','x','i','s','t','s','_','f','i','l','e',0}; + static const struct { + const WCHAR *path1; + const WCHAR *path2; + int equivalent; + } tests[] = { + { NULL, NULL, -1 }, + { NULL, f1W, 0 }, + { f1W, NULL, 0 }, + { f1W, wine_test_dirW, 0 }, + { wine_test_dirW, f1W, 0 }, + { wine_test_dirW, wine_test_dirW, -1 }, + { f1W_subdir, f2W, 0 }, + { f1W, f1W, 1 }, + { not_existW, f1W, 0 }, + { f1W_backslash, f1W_subdir, 1 }, + { not_existW, not_existW, -1 }, + { f1W, not_existW, 0 }, + { f1W_long, f1W, 1 } + }; + + memset(current_path, 0, MAX_PATH); + GetCurrentDirectoryW(MAX_PATH, current_path); + memset(temp_path, 0, MAX_PATH); + GetTempPathW(MAX_PATH, temp_path); + ok(SetCurrentDirectoryW(temp_path), "SetCurrentDirectoryW to temp_path failed\n"); + CreateDirectoryW(wine_test_dirW, NULL); + + file = CreateFileW(f1W, 0, 0, NULL, CREATE_ALWAYS, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n"); + CloseHandle(file); + file = CreateFileW(f2W, 0, 0, NULL, CREATE_ALWAYS, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n"); + CloseHandle(file); + + for(i=0; i