Brock York twunknown@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().