Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/msvcp120/tests/msvcp120.c | 3 +++ dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp140/tests/msvcp140.c | 2 +- dlls/msvcp90/ios.c | 35 ++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 8f7b75aab4..d484cdd7ed 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -1230,6 +1230,7 @@ static void test_tr2_sys__Equivalent(void) char temp_path[MAX_PATH], current_path[MAX_PATH]; WCHAR testW[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','1',0}; WCHAR testW2[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','2',0}; + WCHAR test_dirW[] = {'t','r','2','_','t','e','s','t','_','d','i','r',0}; struct { char const *path1; char const *path2; @@ -1273,6 +1274,8 @@ static void test_tr2_sys__Equivalent(void) ok(val == 1, "tr2_sys__Equivalent(): expect: 1, got %d\n", val); val = p_tr2_sys__Equivalent_wchar(testW, testW2); ok(val == 0, "tr2_sys__Equivalent(): expect: 0, got %d\n", val); + val = p_tr2_sys__Equivalent_wchar(test_dirW, test_dirW); + ok(val == -1, "tr2_sys__Equivalent(): expect: -1, got %d\n", val);
ok(DeleteFileA("tr2_test_dir/f1"), "expect tr2_test_dir/f1 to exist\n"); ok(DeleteFileA("tr2_test_dir/f2"), "expect tr2_test_dir/f2 to exist\n"); diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index a5b2bd40b2..70caad8dba 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 -@ cdecl _Equivalent(wstr wstr) tr2_sys__Equivalent_wchar +@ cdecl _Equivalent(wstr wstr) _Equivalent @ 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 04406240e0..f4a0943c2c 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -1400,7 +1400,7 @@ static void test_Equivalent(void) { f1W, NULL, 0 }, { f1W, wine_test_dirW, 0 }, { wine_test_dirW, f1W, 0 }, - { wine_test_dirW, wine_test_dirW, -1 }, + { wine_test_dirW, wine_test_dirW, 1 }, { f1W_subdir, f2W, 0 }, { f1W, f1W, 1 }, { not_existW, f1W, 0 }, diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 84174e4f95..383a487ec7 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -15647,6 +15647,41 @@ int __cdecl tr2_sys__Equivalent_wchar(WCHAR const* path1, WCHAR const* path2) ); }
+/* _Equivalent, msvcp140 version */ +int __cdecl _Equivalent(WCHAR const* path1, WCHAR const* path2) +{ + HANDLE h1, h2; + int ret; + BY_HANDLE_FILE_INFORMATION info1, info2; + TRACE("(%s %s)\n", debugstr_w(path1), debugstr_w(path2)); + + h1 = CreateFileW(path1, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); + h2 = CreateFileW(path2, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); + if(h1 == INVALID_HANDLE_VALUE) { + if(h2 == INVALID_HANDLE_VALUE) { + return -1; + }else { + CloseHandle(h2); + return 0; + } + }else if(h2 == INVALID_HANDLE_VALUE) { + CloseHandle(h1); + return 0; + } + + ret = GetFileInformationByHandle(h1, &info1) && GetFileInformationByHandle(h2, &info2); + CloseHandle(h1); + CloseHandle(h2); + if(!ret) + return -1; + return (info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber + && info1.nFileIndexHigh == info2.nFileIndexHigh + && info1.nFileIndexLow == info2.nFileIndexLow + ); +} + /* ?_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)
Hi Sven,
On 10/18/19 10:07 PM, Sven Baars wrote:
--- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -1400,7 +1400,7 @@ static void test_Equivalent(void) { f1W, NULL, 0 }, { f1W, wine_test_dirW, 0 }, { wine_test_dirW, f1W, 0 },
{ wine_test_dirW, wine_test_dirW, -1 },
{ wine_test_dirW, wine_test_dirW, 1 },
This change breaks the tests on some versions of msvcp140. Please mark the old behavior as broken.
+/* _Equivalent, msvcp140 version */ +int __cdecl _Equivalent(WCHAR const* path1, WCHAR const* path2) +{
- HANDLE h1, h2;
- int ret;
- BY_HANDLE_FILE_INFORMATION info1, info2;
- TRACE("(%s %s)\n", debugstr_w(path1), debugstr_w(path2));
- h1 = CreateFileW(path1, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
- h2 = CreateFileW(path2, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
- if(h1 == INVALID_HANDLE_VALUE) {
if(h2 == INVALID_HANDLE_VALUE) {
return -1;
}else {
CloseHandle(h2);
return 0;
}
- }else if(h2 == INVALID_HANDLE_VALUE) {
CloseHandle(h1);
return 0;
- }
- ret = GetFileInformationByHandle(h1, &info1) && GetFileInformationByHandle(h2, &info2);
- CloseHandle(h1);
- CloseHandle(h2);
- if(!ret)
return -1;
- return (info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber
&& info1.nFileIndexHigh == info2.nFileIndexHigh
&& info1.nFileIndexLow == info2.nFileIndexLow
);
+}
Please add a helper function instead of duplicating the implementation.
Thanks, Piotr
Hi Piotr,
On 21-10-19 12:48, Piotr Caban wrote:
Hi Sven,
- { wine_test_dirW, wine_test_dirW, -1 }, + { wine_test_dirW, wine_test_dirW, 1 },
This change breaks the tests on some versions of msvcp140. Please mark the old behavior as broken.
That explains why the test was there in the first place. The tests I did, as well as the tests on the test bot were actually failing. Thanks for the information.
Please add a helper function instead of duplicating the implementation.
I just duplicated what was done in the rest of the file. I'll also use the helper for the other implementations in that case.
Thanks, Sven