mirror of
https://github.com/reactos/reactos.git
synced 2024-11-04 22:00:55 +00:00
[SHELL32] CD-ROM drive shouldn't be renamed (#5461)
- Add _ILGetDriveType helper function. - Use _ILGetDrive and GetDriveType functions to determine the drive type. - If it was a CD-ROM drive, then remove SFGAO_CANRENAME flag. CORE-18272
This commit is contained in:
parent
ca62121b4d
commit
62eaad1811
1 changed files with 21 additions and 0 deletions
|
@ -55,6 +55,17 @@ static int iDriveTypeIds[7] = { IDS_DRIVE_FIXED, /* DRIVE_UNKNOWN */
|
||||||
IDS_DRIVE_FIXED /* DRIVE_RAMDISK*/
|
IDS_DRIVE_FIXED /* DRIVE_RAMDISK*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOL _ILGetDriveType(LPCITEMIDLIST pidl)
|
||||||
|
{
|
||||||
|
char szDrive[8];
|
||||||
|
if (!_ILGetDrive(pidl, szDrive, _countof(szDrive)))
|
||||||
|
{
|
||||||
|
ERR("pidl %p is not a drive\n", pidl);
|
||||||
|
return DRIVE_UNKNOWN;
|
||||||
|
}
|
||||||
|
return ::GetDriveTypeA(szDrive);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* IShellFolder implementation
|
* IShellFolder implementation
|
||||||
*/
|
*/
|
||||||
|
@ -660,7 +671,12 @@ HRESULT WINAPI CDrivesFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLEST
|
||||||
if (pdwAttributes && *pdwAttributes)
|
if (pdwAttributes && *pdwAttributes)
|
||||||
{
|
{
|
||||||
if (_ILIsDrive(pidlTemp))
|
if (_ILIsDrive(pidlTemp))
|
||||||
|
{
|
||||||
*pdwAttributes &= dwDriveAttributes;
|
*pdwAttributes &= dwDriveAttributes;
|
||||||
|
|
||||||
|
if (_ILGetDriveType(pidlTemp) == DRIVE_CDROM)
|
||||||
|
*pdwAttributes &= ~SFGAO_CANRENAME; // CD-ROM drive cannot rename
|
||||||
|
}
|
||||||
else if (_ILIsSpecialFolder(pidlTemp))
|
else if (_ILIsSpecialFolder(pidlTemp))
|
||||||
m_regFolder->GetAttributesOf(1, &pidlTemp, pdwAttributes);
|
m_regFolder->GetAttributesOf(1, &pidlTemp, pdwAttributes);
|
||||||
else
|
else
|
||||||
|
@ -877,7 +893,12 @@ HRESULT WINAPI CDrivesFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY a
|
||||||
for (UINT i = 0; i < cidl; ++i)
|
for (UINT i = 0; i < cidl; ++i)
|
||||||
{
|
{
|
||||||
if (_ILIsDrive(apidl[i]))
|
if (_ILIsDrive(apidl[i]))
|
||||||
|
{
|
||||||
*rgfInOut &= dwDriveAttributes;
|
*rgfInOut &= dwDriveAttributes;
|
||||||
|
|
||||||
|
if (_ILGetDriveType(apidl[i]) == DRIVE_CDROM)
|
||||||
|
*rgfInOut &= ~SFGAO_CANRENAME; // CD-ROM drive cannot rename
|
||||||
|
}
|
||||||
else if (_ILIsControlPanel(apidl[i]))
|
else if (_ILIsControlPanel(apidl[i]))
|
||||||
*rgfInOut &= dwControlPanelAttributes;
|
*rgfInOut &= dwControlPanelAttributes;
|
||||||
else if (_ILIsSpecialFolder(*apidl))
|
else if (_ILIsSpecialFolder(*apidl))
|
||||||
|
|
Loading…
Reference in a new issue