Fix an IE crash and make the "Create Folder" functionality in Favorites work

Dmitry Timoshkov dmitry at baikal.ru
Thu Jan 8 07:58:06 CST 2004


Hello,

this patch fixes a crash in IE (Favorites->Organize Favorites->Create Folder)
and brings that functionality to life.

The crash was caused by the fact that LPSHELLVIEW was left uninitialized after
the IShellBrowser_QueryActiveShellView() call, hWndSV was left uninitialized
as well. DoNewFolder copes with LPSHELLVIEW being NULL on its own.

I didn't reindent the ISVBgCm_fnInvokeCommand() function body to keep
the patch small, although it's in a big mess.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Fix an IE crash and make the "Create Folder" functionality in Favorites
    work.

--- cvs/hq/wine/dlls/shell32/shv_bg_cmenu.c	2003-09-14 18:57:00.000000000 +0900
+++ wine/dlls/shell32/shv_bg_cmenu.c	2004-01-08 21:45:05.000000000 +0800
@@ -307,6 +307,7 @@ static BOOL DoPaste(
 #endif
 	return bSuccess;
 }
+
 /**************************************************************************
 * ISVBgCm_fnInvokeCommand()
 */
@@ -317,8 +318,8 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCo
 	ICOM_THIS(BgCmImpl, iface);
 
 	LPSHELLBROWSER	lpSB;
-	LPSHELLVIEW	lpSV;
-	HWND	hWndSV;
+	LPSHELLVIEW lpSV = NULL;
+	HWND hWndSV = 0;
 
 	TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd);
 
@@ -331,15 +332,13 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCo
 	  }
 	}
 
-	if(lpSV)
-	{
 	  if(HIWORD(lpcmi->lpVerb))
 	  {
 	    TRACE("%s\n",lpcmi->lpVerb);
 
 	    if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA))
 	    {
-	      if(lpSV) DoNewFolder(iface, lpSV);
+                DoNewFolder(iface, lpSV);
 	    }
 	    else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA))
 	    {
@@ -371,8 +370,9 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCo
 	    }
 	  }
 
+        if (lpSV)
 	  IShellView_Release(lpSV);	/* QueryActiveShellView does AddRef*/
-	}
+
 	return NOERROR;
 }
 






More information about the wine-patches mailing list