shell32: Use ParseURL to detect URLs.

This commit is contained in:
Andrew Eikum 2010-06-28 12:06:24 -05:00 committed by Alexandre Julliard
parent ff08a68668
commit da31fc06a4
1 changed files with 4 additions and 6 deletions

View File

@ -152,6 +152,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
WCHAR szElement[MAX_PATH]; WCHAR szElement[MAX_PATH];
LPCWSTR szNext = NULL; LPCWSTR szNext = NULL;
LPITEMIDLIST pidlTemp = NULL; LPITEMIDLIST pidlTemp = NULL;
PARSEDURLW urldata;
HRESULT hr = S_OK; HRESULT hr = S_OK;
CLSID clsid; CLSID clsid;
@ -167,6 +168,8 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
if (pchEaten) if (pchEaten)
*pchEaten = 0; /* strange but like the original */ *pchEaten = 0; /* strange but like the original */
urldata.cbSize = sizeof(urldata);
if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
{ {
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH); szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
@ -193,13 +196,8 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
*ppidl = pidlTemp; *ppidl = pidlTemp;
return S_OK; return S_OK;
} }
else if (strchrW(lpszDisplayName,':')) else if (SUCCEEDED(ParseURLW(lpszDisplayName, &urldata)))
{ {
PARSEDURLW urldata;
urldata.cbSize = sizeof(urldata);
ParseURLW(lpszDisplayName,&urldata);
if (urldata.nScheme == URL_SCHEME_SHELL) /* handle shell: urls */ if (urldata.nScheme == URL_SCHEME_SHELL) /* handle shell: urls */
{ {
TRACE ("-- shell url: %s\n", debugstr_w(urldata.pszSuffix)); TRACE ("-- shell url: %s\n", debugstr_w(urldata.pszSuffix));