https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d039653959aca40876ba9…
commit d039653959aca40876ba91c448f46ccb530d4749
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Thu Jul 15 22:46:20 2021 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Fri Jul 23 22:10:36 2021 +0200
[SHELL32] CDefView: Respect item attributes
---
dll/win32/shell32/CDefView.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp
index 50471196d31..608738f48e6 100644
--- a/dll/win32/shell32/CDefView.cpp
+++ b/dll/win32/shell32/CDefView.cpp
@@ -1587,6 +1587,26 @@ LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL
bUseSelection)
if (FAILED_UNEXPECTEDLY( hResult))
goto cleanup;
+ if (bUseSelection)
+ {
+ // FIXME: we should cache this....
+ SFGAOF rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE |
SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER;
+ hResult = m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &rfg);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return 0;
+
+ if (!(rfg & SFGAO_CANMOVE) && uCommand == FCIDM_SHVIEW_CUT)
+ return 0;
+ if (!(rfg & SFGAO_CANCOPY) && uCommand == FCIDM_SHVIEW_COPY)
+ return 0;
+ if (!(rfg & SFGAO_CANDELETE) && uCommand == FCIDM_SHVIEW_DELETE)
+ return 0;
+ if (!(rfg & SFGAO_CANRENAME) && uCommand == FCIDM_SHVIEW_RENAME)
+ return 0;
+ if (!(rfg & SFGAO_HASPROPSHEET) && uCommand ==
FCIDM_SHVIEW_PROPERTIES)
+ return 0;
+ }
+
InvokeContextMenuCommand(uCommand);
cleanup:
@@ -1819,6 +1839,9 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL &bHand
case FCIDM_SHVIEW_PROPERTIES:
case FCIDM_SHVIEW_COPYTO:
case FCIDM_SHVIEW_MOVETO:
+ if (SHRestricted(REST_NOVIEWCONTEXTMENU))
+ return 0;
+
return OnExplorerCommand(dwCmdID, TRUE);
case FCIDM_SHVIEW_INSERT: