https://git.reactos.org/?p=reactos.git;a=commitdiff;h=513d0a6d2d4652671c9b7…
commit 513d0a6d2d4652671c9b7c92c495edce6d9491a4
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Thu Mar 10 23:00:32 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sat Apr 9 01:21:57 2022 +0200
[SHELL32] Copy without FILE_ATTRIBUTE_READONLY from a CDROM
CORE-18089
---
dll/win32/shell32/shlfileop.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/dll/win32/shell32/shlfileop.cpp b/dll/win32/shell32/shlfileop.cpp
index fbd06a767b8..351ee1e4c5c 100644
--- a/dll/win32/shell32/shlfileop.cpp
+++ b/dll/win32/shell32/shlfileop.cpp
@@ -755,6 +755,21 @@ static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src,
LPCWSTR dest, BO
#endif
}
+static BOOL SHIsCdRom(LPCWSTR path)
+{
+ WCHAR tmp[] = { L"A:\\" };
+
+ if (!path || !path[0])
+ return FALSE;
+
+ if (path[1] != UNICODE_NULL && path[1] != ':')
+ return FALSE;
+
+ tmp[0] = path[0];
+
+ return GetDriveTypeW(tmp) == DRIVE_CDROM;
+}
+
/************************************************************************
* SHNotifyCopyFile [internal]
*
@@ -795,6 +810,14 @@ static DWORD SHNotifyCopyFileW(FILE_OPERATION *op, LPCWSTR src,
LPCWSTR dest, BO
ret = CopyFileExW(src, dest, SHCopyProgressRoutine, op, &op->bCancelled,
bFailIfExists);
if (ret)
{
+ // We are copying from a CD-ROM volume, which is readonly
+ if (SHIsCdRom(src))
+ {
+ attribs = GetFileAttributesW(dest);
+ attribs &= ~FILE_ATTRIBUTE_READONLY;
+ SetFileAttributesW(dest, attribs);
+ }
+
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHW, dest, NULL);
return ERROR_SUCCESS;
}