Author: janderwald Date: Tue Oct 30 15:05:24 2007 New Revision: 29977
URL: http://svn.reactos.org/svn/reactos?rev=29977&view=rev Log: - 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
Modified: trunk/reactos/dll/win32/shell32/shlview.c trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/shlview.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlview.c... ============================================================================== --- trunk/reactos/dll/win32/shell32/shlview.c (original) +++ trunk/reactos/dll/win32/shell32/shlview.c Tue Oct 30 15:05:24 2007 @@ -948,7 +948,6 @@ 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 @@ 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);
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 Tue Oct 30 15:05:24 2007 @@ -62,7 +62,7 @@ } 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 @@ 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 @@ 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 @@ 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,12 +778,12 @@ };
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; IShellExtInit *shext; - + TRACE("SH_LoadDynamicContextMenuHandler entered with %s\n",wine_dbgstr_guid(szClass));
hr = SHCoCreateInstance(NULL, szClass, NULL, &IID_IContextMenu, (void**)&cmobj); @@ -800,8 +800,7 @@ 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 @@ }
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 @@ 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) {