[SHELL32]

- Fix SH_ParseGuidDisplayName which was completely broken when I committed it.
- Use GUIDFromStringW instead of SHCLSIDFromStringW in _ILCreateGuidFromStrW. The latter needs the string to terminate right after the guid.

svn path=/trunk/; revision=69369
This commit is contained in:
Giannis Adamopoulos 2015-09-27 10:52:10 +00:00
parent 88e5d9fb36
commit 466e9a0571
4 changed files with 19 additions and 14 deletions

View file

@ -66,7 +66,7 @@ HRESULT SHELL32_SetNameOfGuidItem(PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD
HRESULT SHELL32_GetDetailsOfGuidItem(IShellFolder2* psf, PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd); HRESULT SHELL32_GetDetailsOfGuidItem(IShellFolder2* psf, PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
HRESULT SH_ParseGuidDisplayName(IShellFolder * pFolder, HRESULT SH_ParseGuidDisplayName(IShellFolder2 * pFolder,
HWND hwndOwner, HWND hwndOwner,
LPBC pbc, LPBC pbc,
LPOLESTR lpszDisplayName, LPOLESTR lpszDisplayName,

View file

@ -682,7 +682,7 @@ HRESULT SHELL32_CompareIDs(IShellFolder * iface, LPARAM lParam, LPCITEMIDLIST pi
return nReturn; return nReturn;
} }
HRESULT SH_ParseGuidDisplayName(IShellFolder * pFolder, HRESULT SH_ParseGuidDisplayName(IShellFolder2 * pFolder,
HWND hwndOwner, HWND hwndOwner,
LPBC pbc, LPBC pbc,
LPOLESTR lpszDisplayName, LPOLESTR lpszDisplayName,
@ -701,17 +701,14 @@ HRESULT SH_ParseGuidDisplayName(IShellFolder * pFolder,
*pchEaten = 0; *pchEaten = 0;
UINT cch = wcslen(lpszDisplayName); UINT cch = wcslen(lpszDisplayName);
if (cch < 40) if (cch < 39 || lpszDisplayName[0] != L':' || lpszDisplayName[1] != L':')
return E_FAIL;
if (lpszDisplayName[0] != L':' || lpszDisplayName[1] != L':' || lpszDisplayName[2] != L'{' || lpszDisplayName[40] != L'}')
return E_FAIL; return E_FAIL;
pidl = _ILCreateGuidFromStrW(lpszDisplayName + 2); pidl = _ILCreateGuidFromStrW(lpszDisplayName + 2);
if (pidl == NULL) if (pidl == NULL)
return E_FAIL; return E_FAIL;
if (cch < 42) if (cch < 41)
{ {
*ppidl = pidl; *ppidl = pidl;
if (pdwAttributes && *pdwAttributes) if (pdwAttributes && *pdwAttributes)
@ -721,15 +718,12 @@ HRESULT SH_ParseGuidDisplayName(IShellFolder * pFolder,
} }
else else
{ {
IShellFolder* psf; HRESULT hr = SHELL32_ParseNextElement(pFolder, hwndOwner, pbc, &pidl, lpszDisplayName + 41, pchEaten, pdwAttributes);
LPITEMIDLIST pidlChild; if (SUCCEEDED(hr))
HRESULT hres;
hres = SHELL32_BindToGuidItem(NULL, pidl, NULL, IID_PPV_ARG(IShellFolder, &psf));
if (SUCCEEDED(hres))
{ {
return psf->ParseDisplayName(hwndOwner, pbc, lpszDisplayName + 42, pchEaten, &pidlChild, pdwAttributes); *ppidl = pidl;
} }
return hr;
} }
return S_OK; return S_OK;

View file

@ -1654,6 +1654,7 @@ LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid)
return pidlOut; return pidlOut;
} }
#ifndef __REACTOS__
LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID) LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID)
{ {
IID iid; IID iid;
@ -1665,12 +1666,17 @@ LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID)
} }
return _ILCreateGuid(PT_GUID, &iid); return _ILCreateGuid(PT_GUID, &iid);
} }
#endif
LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID) LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID)
{ {
IID iid; IID iid;
#ifndef __REACTOS__
if (FAILED(SHCLSIDFromStringW(szGUID, &iid))) if (FAILED(SHCLSIDFromStringW(szGUID, &iid)))
#else
if (!GUIDFromStringW(szGUID, &iid))
#endif
{ {
ERR("%s is not a GUID\n", debugstr_w(szGUID)); ERR("%s is not a GUID\n", debugstr_w(szGUID));
return NULL; return NULL;

View file

@ -550,6 +550,11 @@ INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateD
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv); HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv);
BOOL WINAPI GUIDFromStringW(
_In_ PCWSTR psz,
_Out_ LPGUID pguid
);
static inline ULONG static inline ULONG
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
{ {