- fix a bug in ShellView_DoContextMenu which made shell extensions crash on click

- pass the pidl of the parent folder to IShellExtInit function.
- shell extension dont run yet due SHGetPathFromIDList[A/W] cant return right information

svn path=/trunk/; revision=29977
This commit is contained in:
Johannes Anderwald 2007-10-30 12:05:24 +00:00
parent 11f4785469
commit fa7efa7843
2 changed files with 10 additions and 12 deletions

View file

@ -948,7 +948,6 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
HMENU hMenu;
BOOL fExplore = FALSE;
HWND hwndTree = 0;
LPCONTEXTMENU pContextMenu = NULL;
CMINVOKECOMMANDINFO cmi;
TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
@ -1011,7 +1010,7 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
cmi.cbSize = sizeof(cmi);
cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */
cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
IContextMenu_InvokeCommand(pContextMenu, &cmi);
IContextMenu_InvokeCommand(This->pCM, &cmi);
}
}
DestroyMenu(hMenu);

View file

@ -62,7 +62,7 @@ typedef struct
} ItemCmImpl;
UINT
SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj);
SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj, LPITEMIDLIST pidlFolder);
static const IContextMenu2Vtbl cmvt;
@ -310,7 +310,7 @@ SH_LoadContextMenuHandlers(ItemCmImpl *This, IDataObject * pDataObj, HMENU hMenu
UINT idCmdLast = 0xFFF0;
static WCHAR szAny[] = { '*',0};
SH_EnumerateDynamicContextHandlerForKey(szAny, This, pDataObj);
SH_EnumerateDynamicContextHandlerForKey(szAny, This, pDataObj, This->pidl);
for (i = 0; i < This->cidl; i++)
{
@ -324,7 +324,7 @@ SH_LoadContextMenuHandlers(ItemCmImpl *This, IDataObject * pDataObj, HMENU hMenu
if (hr == S_OK)
{
memcpy(&buffer[6], pwszCLSID, 38 * sizeof(WCHAR));
SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj);
SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj, This->pidl);
}
}
@ -333,7 +333,7 @@ SH_LoadContextMenuHandlers(ItemCmImpl *This, IDataObject * pDataObj, HMENU hMenu
ebuf[0] = L'.';
buffer[0] = L'\0';
if (MultiByteToWideChar(CP_ACP, 0, ebuf, -1, buffer, 111))
SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj);
SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj, This->pidl);
}
}
@ -778,7 +778,7 @@ static const IContextMenu2Vtbl cmvt =
};
HRESULT
SH_LoadDynamicContextMenuHandler(HKEY hKey, const CLSID * szClass, IContextMenu** ppv, IDataObject * pDataObj)
SH_LoadDynamicContextMenuHandler(HKEY hKey, const CLSID * szClass, IContextMenu** ppv, IDataObject * pDataObj, LPITEMIDLIST pidlFolder)
{
HRESULT hr;
IContextMenu * cmobj;
@ -800,8 +800,7 @@ SH_LoadDynamicContextMenuHandler(HKEY hKey, const CLSID * szClass, IContextMenu*
cmobj->lpVtbl->Release(cmobj);
return FALSE;
}
hr = shext->lpVtbl->Initialize(shext, NULL, pDataObj, hKey);
hr = shext->lpVtbl->Initialize(shext, pidlFolder, pDataObj, hKey);
if (hr != S_OK)
{
TRACE("Failed to initialize shell extension\n");
@ -817,7 +816,7 @@ SH_LoadDynamicContextMenuHandler(HKEY hKey, const CLSID * szClass, IContextMenu*
}
UINT
SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj)
SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj, LPITEMIDLIST pidlFolder)
{
HKEY hKey;
WCHAR szKey[MAX_PATH] = {0};
@ -861,7 +860,7 @@ SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *Th
TRACE("hResult %x szKey %s name %s\n",hResult, debugstr_w(szKey), debugstr_w(szName));
if (hResult == S_OK)
{
hResult = SH_LoadDynamicContextMenuHandler(hKey, &clsid, &cmobj, pDataObj);
hResult = SH_LoadDynamicContextMenuHandler(hKey, &clsid, &cmobj, pDataObj, pidlFolder);
}
if (hResult == S_OK)
{