From 2407c138487db2c9fac8db0634fe67f07d92a125 Mon Sep 17 00:00:00 2001 From: Rolf Kalbermatter Date: Mon, 15 Sep 2003 22:16:41 +0000 Subject: [PATCH] Make sure the bind context is forwarded in ShellFolder_ParseDisplayName. --- dlls/shell32/shfldr.h | 4 ++-- dlls/shell32/shfldr_desktop.c | 29 +++++++++++++++++++---------- dlls/shell32/shfldr_fs.c | 6 +++--- dlls/shell32/shfldr_mycomp.c | 6 +++--- dlls/shell32/shlfolder.c | 11 +++++------ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/dlls/shell32/shfldr.h b/dlls/shell32/shfldr.h index 7c7ed5693e6..56bb6e3d885 100644 --- a/dlls/shell32/shfldr.h +++ b/dlls/shell32/shfldr.h @@ -32,8 +32,8 @@ typedef struct { #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); diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index efafc9bfeb5..85012a132c5 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -189,7 +189,7 @@ static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface) */ 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 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, 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 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, /* 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) { diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index 8ba9072687c..4d28f9b8126 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -319,7 +319,7 @@ static ULONG WINAPI IShellFolder_fnRelease (IShellFolder2 * iface) 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 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, 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 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, 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) { diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index 157c48893d2..2c12200c8bd 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -189,7 +189,7 @@ static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface) 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 @@ ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface, 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 @@ ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface, 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); diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 0d2c325f199..46e9328cbec 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -105,8 +105,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) 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 @@ HRESULT SHELL32_ParseNextElement (HWND hwndOwner, 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 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO } /*********************************************************************** - * SHELL32_GetItemAttributes + * SHELL32_CompareIDs */ HRESULT SHELL32_CompareIDs (IShellFolder * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) {