[PATCH 3/3 v3] kernel32: Correct ReplaceFileW behaviour

Alexandre Julliard julliard at winehq.org
Tue Sep 4 08:03:55 CDT 2018


Brock York <twunknown at gmail.com> writes:

> @@ -1788,6 +1789,14 @@ BOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileNa
>          goto fail;
>      }
>  
> +    /* Replacement should fail if replaced is READ_ONLY */
> +    fattribs = GetFileAttributesW(lpReplacedFileName);
> +    if (fattribs & FILE_ATTRIBUTE_READONLY)
> +    {
> +        error = ERROR_ACCESS_DENIED;
> +        goto fail;
> +    }

It would be better to retrieve the attributes from the handle we have
already opened, with something like GetFileInformationByHandle().

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list