[PATCH] msvcp140: Add a dedicated _Equivalent method that allows for directories.

Piotr Caban piotr.caban at gmail.com
Mon Oct 21 05:48:20 CDT 2019


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



More information about the wine-devel mailing list