Author: janderwald
Date: Thu Nov 1 16:33:18 2007
New Revision: 30037
URL:
http://svn.reactos.org/svn/reactos?rev=30037&view=rev
Log:
- dont show Open With shell extension when a selected item is a folder or a shortcut
- add the "explore" verb only if folder has a subfolder
- always add open verb
Modified:
trunk/reactos/dll/win32/shell32/she_ocmenu.c
trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/she_ocmenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/she_ocme…
==============================================================================
--- trunk/reactos/dll/win32/shell32/she_ocmenu.c (original)
+++ trunk/reactos/dll/win32/shell32/she_ocmenu.c Thu Nov 1 16:33:18 2007
@@ -23,7 +23,7 @@
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
-//#define YDEBUG
+#define YDEBUG
#include "winerror.h"
#include "wine/debug.h"
@@ -588,6 +588,7 @@
LPCITEMIDLIST pidl;
WCHAR szPath[MAX_PATH];
LPWSTR szPtr;
+ static const WCHAR szShortCut[] = { '.','l','n','k',
0 };
fmt.cfFormat = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);
fmt.ptd = NULL;
@@ -619,11 +620,18 @@
ERR("no mem\n");
return E_OUTOFMEMORY;
}
+ if (_ILIsFolder(pidl_child))
+ {
+ TRACE("pidl is a folder\n");
+ SHFree(pidl);
+ return E_FAIL;
+ }
+
if (!SHGetPathFromIDListW(pidl, szPath))
{
SHFree(pidl);
ERR("SHGetPathFromIDListW failed\n");
- return FALSE;
+ return E_FAIL;
}
SHFree(pidl);
@@ -632,6 +640,12 @@
szPtr = wcschr(szPath, '.');
if (szPtr)
{
+ if (!_wcsicmp(szPtr, szShortCut))
+ {
+ TRACE("pidl is a shortcut\n");
+ return E_FAIL;
+ }
+
SHEOW_LoadItemFromHKCU(This, szPtr);
SHEOW_LoadItemFromHKCR(This, szPtr);
}
Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original)
+++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Thu Nov 1 16:33:18 2007
@@ -382,19 +382,18 @@
_InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING,
"&Select", MFS_ENABLED);
TRACE("rfg %x\n", This->rfg);
- if (This->rfg & SFGAO_BROWSABLE)
+
+ if (This->rfg & SFGAO_HASSUBFOLDER)
{
- if(This->bAllValues)
- {
- _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING,
"&Open", MFS_ENABLED);
- _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING,
"&Explore", MFS_ENABLED);
- }
- else
- {
- _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING,
"&Explore", MFS_ENABLED);
- _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING,
"&Open", MFS_ENABLED);
- }
+ /* FIXME
+ * check if folder hasnt already been extended
+ * use reduce verb then
+ */
+
+ _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING,
"&Explore", MFS_ENABLED);
}
+
+ _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING,
"&Open", MFS_ENABLED);
SetMenuDefaultItem(hmenu, 0, MF_BYPOSITION);
@@ -669,7 +668,7 @@
HRESULT
DoShellExtensions(ItemCmImpl *This, LPCMINVOKECOMMANDINFO lpcmi)
{
- HRESULT hResult;
+ HRESULT hResult = NOERROR;
UINT i;
TRACE("DoShellExtensions %p verb %x count %u\n",This,
LOWORD(lpcmi->lpVerb), This->ecount);
@@ -679,9 +678,12 @@
hResult = cmenu->lpVtbl->InvokeCommand(cmenu, lpcmi);
if (SUCCEEDED(hResult))
- return hResult;
- }
- return NOERROR;
+ {
+ break;
+ }
+ }
+ TRACE("DoShellExtensions result %x\n", hResult);
+ return hResult;
}
@@ -873,7 +875,7 @@
cmobj->lpVtbl->Release(cmobj);
return FALSE;
}
- hr = shext->lpVtbl->Initialize(shext, pidlFolder, pDataObj, hKey);
+ hr = shext->lpVtbl->Initialize(shext, NULL, pDataObj, hKey);
if (hr != S_OK)
{
TRACE("Failed to initialize shell extension\n");