mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 20:47:21 +00:00
[0.4.13][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
4d65489387
commit
37c0bd4cac
1 changed files with 36 additions and 13 deletions
|
@ -713,6 +713,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]
|
||||
*
|
||||
|
@ -753,6 +768,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…
Add table
Add a link
Reference in a new issue