https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9cca5bf4b04fc5c7c9012…
commit 9cca5bf4b04fc5c7c90129d99780475a53603394
Author: Whindmar Saksit <whindsaks(a)proton.me>
AuthorDate: Thu Oct 31 14:12:34 2024 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Oct 31 14:12:34 2024 +0100
[SHELL32] No new menu and working properties in Drives and NetHood background menu
(#7430)
- No "New" menu in My Computer background menu.
- Add "Properties" in NetHood background menu.
---
dll/win32/shell32/folders/CDrivesFolder.cpp | 17 ++--------------
dll/win32/shell32/folders/CNetFolder.cpp | 31 +++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/dll/win32/shell32/folders/CDrivesFolder.cpp
b/dll/win32/shell32/folders/CDrivesFolder.cpp
index 83f3d684e98..fd41debc914 100644
--- a/dll/win32/shell32/folders/CDrivesFolder.cpp
+++ b/dll/win32/shell32/folders/CDrivesFolder.cpp
@@ -915,20 +915,7 @@ HRESULT WINAPI CDrivesFolder::CreateViewObject(HWND hwndOwner, REFIID
riid, LPVO
}
else if (IsEqualIID(riid, IID_IContextMenu))
{
- HKEY hKeys[16];
- UINT cKeys = 0;
- AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
-
- DEFCONTEXTMENU dcm;
- dcm.hwnd = hwndOwner;
- dcm.pcmcb = this;
- dcm.pidlFolder = pidlRoot;
- dcm.psf = this;
- dcm.cidl = 0;
- dcm.apidl = NULL;
- dcm.cKeys = cKeys;
- dcm.aKeys = hKeys;
- dcm.punkAssociationInfo = NULL;
+ DEFCONTEXTMENU dcm = { hwndOwner, this, pidlRoot, this };
hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
}
else if (IsEqualIID(riid, IID_IShellView))
@@ -1364,7 +1351,7 @@ HRESULT WINAPI CDrivesFolder::CallBack(IShellFolder *psf, HWND
hwndOwner, IDataO
// "System" properties
return SHELL_ExecuteControlPanelCPL(hwndOwner, L"sysdm.cpl") ? S_OK
: E_FAIL;
}
- else if (uMsg == DFM_MERGECONTEXTMENU)
+ else if (uMsg == DFM_MERGECONTEXTMENU) // TODO: DFM_MERGECONTEXTMENU_BOTTOM
{
QCMINFO *pqcminfo = (QCMINFO *)lParam;
HMENU hpopup = CreatePopupMenu();
diff --git a/dll/win32/shell32/folders/CNetFolder.cpp
b/dll/win32/shell32/folders/CNetFolder.cpp
index a96e9e1d493..e557e791dc9 100644
--- a/dll/win32/shell32/folders/CNetFolder.cpp
+++ b/dll/win32/shell32/folders/CNetFolder.cpp
@@ -207,6 +207,33 @@ BOOL CNetFolderEnum::CreateMyCompEnumList(DWORD dwFlags)
return bRet;
}
+/**************************************************************************
+ * CNetFolder background context menu
+ */
+static HRESULT CALLBACK CNetFolderBackgroundMenuCB(IShellFolder *psf, HWND hwnd,
IDataObject *pdtobj,
+ UINT uMsg, WPARAM wParam, LPARAM
lParam)
+{
+ enum { IDC_PROPERTIES };
+ if (uMsg == DFM_INVOKECOMMAND && wParam == IDC_PROPERTIES)
+ {
+ return SHELL_ExecuteControlPanelCPL(hwnd, L"ncpa.cpl") ? S_OK :
E_FAIL;
+ }
+ else if (uMsg == DFM_MERGECONTEXTMENU) // TODO: DFM_MERGECONTEXTMENU_BOTTOM
+ {
+ QCMINFO *pqcminfo = (QCMINFO*)lParam;
+ HMENU hpopup = CreatePopupMenu();
+ _InsertMenuItemW(hpopup, 0, TRUE, IDC_PROPERTIES, MFT_STRING,
MAKEINTRESOURCEW(IDS_PROPERTIES), MFS_ENABLED);
+ pqcminfo->idCmdFirst = Shell_MergeMenus(pqcminfo->hmenu, hpopup,
pqcminfo->indexMenu, pqcminfo->idCmdFirst, pqcminfo->idCmdLast,
MM_ADDSEPARATOR);
+ DestroyMenu(hpopup);
+ return S_OK;
+ }
+ return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
+}
+
+/**************************************************************************
+ * CNetFolder
+ */
+
CNetFolder::CNetFolder()
{
pidlRoot = NULL;
@@ -330,8 +357,8 @@ HRESULT WINAPI CNetFolder::CreateViewObject(HWND hwndOwner, REFIID
riid, LPVOID
}
else if (IsEqualIID(riid, IID_IContextMenu))
{
- WARN("IContextMenu not implemented\n");
- hr = E_NOTIMPL;
+ hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, 0, NULL, this,
CNetFolderBackgroundMenuCB,
+ 0, NULL, (IContextMenu**)ppvOut);
}
else if (IsEqualIID(riid, IID_IShellView))
{