Author: akhaldi Date: Tue May 12 10:57:24 2015 New Revision: 67683
URL: http://svn.reactos.org/svn/reactos?rev=67683&view=rev Log: [SHELL32] Don't provide the format option when the volume is read only. By Barrett Karish. CORE-9530
Modified: trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp
Modified: trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefaultC... ============================================================================== --- trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp [iso-8859-1] Tue May 12 10:57:24 2015 @@ -13,6 +13,9 @@ */
#include "precomp.h" + +/* FIXME: ntifs.h */ +#define FILE_READ_ONLY_VOLUME 0x00080000
WINE_DEFAULT_DEBUG_CHANNEL(dmenu);
@@ -880,11 +883,20 @@
if (_ILIsDrive(m_apidl[0])) { - /* The 'Format' option must be always available, - * thus it is not registered as a static shell extension */ - _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); - _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0x7ABC, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED); - bAddSep = TRUE; + char szDrive[8] = {0}; + DWORD dwFlags; + + _ILGetDrive(m_apidl[0], szDrive, sizeof(szDrive)); + if (GetVolumeInformationA(szDrive, NULL, 0, NULL, NULL, &dwFlags, NULL, 0)) + { + /* Disable format if read only */ + if (!(dwFlags & FILE_READ_ONLY_VOLUME)) + { + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0x7ABC, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED); + bAddSep = TRUE; + } + } }
BOOL bClipboardData = (HasClipboardData() && (rfg & SFGAO_FILESYSTEM));