- 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; HMENU hMenu;
BOOL fExplore = FALSE; BOOL fExplore = FALSE;
HWND hwndTree = 0; HWND hwndTree = 0;
LPCONTEXTMENU pContextMenu = NULL;
CMINVOKECOMMANDINFO cmi; CMINVOKECOMMANDINFO cmi;
TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault); 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.cbSize = sizeof(cmi);
cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */ cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */
cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
IContextMenu_InvokeCommand(pContextMenu, &cmi); IContextMenu_InvokeCommand(This->pCM, &cmi);
} }
} }
DestroyMenu(hMenu); DestroyMenu(hMenu);

View file

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