Nikolay Sivov : shell32/shlview: Try to use IShellDetails to respond on notifications if IShellFolder2 isn' t available.

Alexandre Julliard julliard at winehq.org
Tue Apr 27 16:59:32 CDT 2010


Module: wine
Branch: master
Commit: 7ea711964ba9619c24425f384c8e11ef33a599f5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7ea711964ba9619c24425f384c8e11ef33a599f5

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Apr 27 00:38:48 2010 +0400

shell32/shlview: Try to use IShellDetails to respond on notifications if IShellFolder2 isn't available.

---

 dlls/shell32/shlview.c |   51 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index b3d300a..d3322e4 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -1387,28 +1387,49 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
 
 	    if(lpdi->item.mask & LVIF_TEXT)	/* text requested */
 	    {
+	      static WCHAR emptyW[] = { 0 };
+	      SHELLDETAILS sd;
+	      HRESULT hr;
+
 	      if (This->pSF2Parent)
 	      {
-	        SHELLDETAILS sd;
-	        IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
-                if (lpnmh->code == LVN_GETDISPINFOA)
-                {
-                    /* shouldn't happen */
-                    NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
-                    StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
-                    TRACE("-- text=%s\n",lpdiA->item.pszText);
-                }
-                else /* LVN_GETDISPINFOW */
-                {
-                    StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
-                    TRACE("-- text=%s\n",debugstr_w(lpdi->item.pszText));
-                }
+	        hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
 	      }
 	      else
 	      {
-	        FIXME("no SF2\n");
+	        IShellDetails *details;
+
+	        hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
+	        if (hr == S_OK)
+	        {
+	          hr = IShellDetails_GetDetailsOf(details, pidl, lpdi->item.iSubItem, &sd);
+	          IShellDetails_Release(details);
+	        }
+	        else
+	          WARN("IShellFolder2/IShellDetails not supported\n");
+	      }
+
+	      if (hr != S_OK)
+	      {
+	          /* set to empty on failure */
+	          sd.str.uType = STRRET_WSTR;
+	          sd.str.u.pOleStr = emptyW;
 	      }
+
+              if (lpnmh->code == LVN_GETDISPINFOW)
+              {
+                  StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
+                  TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
+              }
+              else
+              {
+                  /* LVN_GETDISPINFOA - shouldn't happen */
+                  NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
+                  StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
+                  TRACE("-- text=%s\n", lpdiA->item.pszText);
+              }
 	    }
+
 	    if(lpdi->item.mask & LVIF_IMAGE)	/* image requested */
 	    {
 	      lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);




More information about the wine-cvs mailing list