shell32 (part2): Make sure the bind context is forwarded in ShellFolder_ParseDisplayName

Rolf Kalbermatter rolf.kalbermatter at citengineering.com
Thu Sep 11 14:00:57 CDT 2003


Changelog
  - dlls/shell32/shfldr.h
  - dlls/shell32/shlfolder.c
    Modify helper function to accept also a bind context to pass through

  - dlls/shell32/shfldr_desktop.c
  - dlls/shell32/shfldr_fs.c
  - dlls/shell32/shfldr_mycomp.c
    Pass through the bind context parameter

License: X11/LGPL

Rolf Kalbermatter

===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr.h,v
retrieving revision 1.2
diff -u -r1.2 shfldr.h
--- dlls/shell32/shfldr.h	2 Sep 2003 01:01:06 -0000	1.2
+++ dlls/shell32/shfldr.h	11 Sep 2003 18:03:20 -0000
@@ -32,8 +32,8 @@
 #define GET_SHGDN_RELATION(dwFlags)    ((DWORD)dwFlags & (DWORD)0x000000FF)
 
 LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut);
-HRESULT SHELL32_ParseNextElement (HWND hwndOwner, IShellFolder2 * psf, LPITEMIDLIST * pidlInOut, LPOLESTR szNext,
-				  DWORD * pEaten, DWORD * pdwAttributes);
+HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
+				  LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes);
 HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes);
 HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCITEMIDLIST pidlChild, REFCLSID clsid, REFIID iid,
 				LPVOID * ppvOut);
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfolder.c,v
retrieving revision 1.83
diff -u -r1.83 shlfolder.c
--- dlls/shell32/shlfolder.c	9 Sep 2003 19:39:31 -0000	1.83
+++ dlls/shell32/shlfolder.c	11 Sep 2003 18:03:22 -0000
@@ -105,8 +105,7 @@
     return pszTail;
 }
 
-HRESULT SHELL32_ParseNextElement (HWND hwndOwner,
-				  IShellFolder2 * psf,
+HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc,
 				  LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes)
 {
     HRESULT hr = E_OUTOFMEMORY;
@@ -114,13 +113,13 @@
       pidlTemp = NULL;
     IShellFolder *psfChild;
 
-    TRACE ("(%p, %p, %s)\n", psf, pidlInOut ? *pidlInOut : NULL, debugstr_w (szNext));
+    TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlInOut ? *pidlInOut : NULL, debugstr_w (szNext));
 
     /* get the shellfolder for the child pidl and let it analyse further */
-    hr = IShellFolder_BindToObject (psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID *) & psfChild);
+    hr = IShellFolder_BindToObject (psf, *pidlInOut, pbc, &IID_IShellFolder, (LPVOID *) & psfChild);
 
     if (SUCCEEDED (hr)) {
-	hr = IShellFolder_ParseDisplayName (psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes);
+	hr = IShellFolder_ParseDisplayName (psfChild, hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
 	IShellFolder_Release (psfChild);
 
 	pidlTemp = ILCombine (*pidlInOut, pidlOut);
@@ -390,7 +389,7 @@
 }
 
 /***********************************************************************
- *  SHELL32_GetItemAttributes
+ *  SHELL32_CompareIDs
  */
 HRESULT SHELL32_CompareIDs (IShellFolder * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
 {
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_desktop.c,v
retrieving revision 1.12
diff -u -r1.12 shfldr_desktop.c
--- dlls/shell32/shfldr_desktop.c	9 Sep 2003 19:39:31 -0000	1.12
+++ dlls/shell32/shfldr_desktop.c	11 Sep 2003 18:03:21 -0000
@@ -189,7 +189,7 @@
 */
 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
 						      HWND hwndOwner,
-						      LPBC pbcReserved,
+						      LPBC pbc,
 						      LPOLESTR lpszDisplayName,
 						      DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
 {
@@ -198,13 +198,19 @@
     WCHAR szElement[MAX_PATH];
     LPCWSTR szNext = NULL;
     LPITEMIDLIST pidlTemp = NULL;
-    HRESULT hr = E_OUTOFMEMORY;
+    HRESULT hr = E_INVALIDARG;
+    char szPath[MAX_PATH];
+    DWORD len;
     CLSID clsid;
 
     TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
-	   This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
+	   This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
+
+    if (!lpszDisplayName || !ppidl)
+	return E_INVALIDARG;
 
     *ppidl = 0;
+
     if (pchEaten)
 	*pchEaten = 0;		/* strange but like the original */
 
@@ -217,21 +223,24 @@
 	/* it's a filesystem path with a drive. Let MyComputer parse it */
 	pidlTemp = _ILCreateMyComputer ();
 	szNext = lpszDisplayName;
+    } else if (PathIsUNCW(lpszDisplayName)) {
+	pidlTemp = _ILCreateNetwork();
+	szNext = lpszDisplayName;
     } else {
 	/* it's a filesystem path on the desktop. Let a FSFolder parse it */
-	WCHAR szCompletePath[MAX_PATH];
 
-	/* build a complete path to create a simpel pidl */
-	MultiByteToWideChar (CP_ACP, 0, This->sPathTarget, -1, szCompletePath, MAX_PATH);
-	PathAddBackslashW (szCompletePath);
-	lstrcatW (szCompletePath, lpszDisplayName);
-	pidlTemp = SHSimpleIDListFromPathW (lpszDisplayName);
+	/* build a complete path to create a simple pidl */
+	lstrcpyA(szPath, This->sPathTarget);
+	PathAddBackslashA(szPath);
+	len = lstrlenA(szPath);
+	WideCharToMultiByte(CP_ACP, 0, lpszDisplayName, -1, szPath + len, MAX_PATH - len, NULL, NULL);
+	pidlTemp = _ILCreateFromPathA(szPath);
 	szNext = lpszDisplayName;
     }
 
     if (pidlTemp) {
 	if (szNext && *szNext) {
-	    hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
+	    hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
 	} else {
 	    hr = S_OK;
 	    if (pdwAttributes && *pdwAttributes) {
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_fs.c,v
retrieving revision 1.14
diff -u -r1.14 shfldr_fs.c
--- dlls/shell32/shfldr_fs.c	9 Sep 2003 19:39:31 -0000	1.14
+++ dlls/shell32/shfldr_fs.c	11 Sep 2003 18:03:21 -0000
@@ -319,7 +319,7 @@
 static HRESULT WINAPI
 IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
 				 HWND hwndOwner,
-				 LPBC pbcReserved,
+				 LPBC pbc,
 				 LPOLESTR lpszDisplayName,
 				 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
 {
@@ -333,7 +333,7 @@
     DWORD len;
 
     TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
-	   This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
+	   This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
 
     if (!lpszDisplayName || !ppidl)
 	return E_INVALIDARG;
@@ -356,7 +356,7 @@
 	if (pidlTemp) {
 	    if (szNext && *szNext) {
 		/* try to analyse the next element */
-		hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
+		hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
 	    } else {
 		/* it's the last element */
 		if (pdwAttributes && *pdwAttributes) {
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_mycomp.c,v
retrieving revision 1.9
diff -u -r1.9 shfldr_mycomp.c
--- dlls/shell32/shfldr_mycomp.c	5 Sep 2003 23:08:31 -0000	1.9
+++ dlls/shell32/shfldr_mycomp.c	11 Sep 2003 18:03:22 -0000
@@ -189,7 +189,7 @@
 static HRESULT WINAPI
 ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface,
 				   HWND hwndOwner,
-				   LPBC pbcReserved,
+				   LPBC pbc,
 				   LPOLESTR lpszDisplayName,
 				   DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
 {
@@ -202,7 +202,7 @@
     LPITEMIDLIST pidlTemp;
 
     TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
-	   This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
+	   This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
 
     *ppidl = 0;
     if (pchEaten)
@@ -215,7 +215,7 @@
 	pidlTemp = _ILCreateDrive (szTempA);
 
 	if (szNext && *szNext) {
-	    hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
+	    hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
 	} else {
 	    if (pdwAttributes && *pdwAttributes) {
 		SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);





More information about the wine-patches mailing list