mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[0.4.9][SHELL32] Copy without FILE_ATTRIBUTE_READONLY from a CDROM CORE-18089 (#4386)
That problem in the shell was unhidden when we switched from our own to the MS-PL CDFS-driver in 0.4.8-dev-164-gec6b3ecbe4
because our own old CDFS driver erroneously never reported any CD file being read-only. Fix picked from 0.4.15-dev-4348-g513d0a6d2d
While backporting the fix, I decided to port back also some EOL-whitespace-stripping in that file.
This commit is contained in:
parent
2986b27f7d
commit
275c4442bb
1 changed files with 36 additions and 13 deletions
|
@ -711,6 +711,21 @@ static DWORD SHNotifyMoveFileW(FILE_OPERATION *op, LPCWSTR src, LPCWSTR dest, BO
|
|||
return GetLastError();
|
||||
}
|
||||
|
||||
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]
|
||||
*
|
||||
|
@ -751,6 +766,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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue