shell32: Create the PIDLs even if IFileSystemBindData::GetFindData returns an error.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a5a333572c
commit
429154a97d
|
@ -300,10 +300,11 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
|
||||||
{
|
{
|
||||||
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
||||||
|
|
||||||
HRESULT hr = E_INVALIDARG;
|
HRESULT hr = S_OK;
|
||||||
LPCWSTR szNext = NULL;
|
LPCWSTR szNext = NULL;
|
||||||
WCHAR szElement[MAX_PATH];
|
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
|
WIN32_FIND_DATAW find_data = { 0 };
|
||||||
|
IFileSystemBindData *fsbd = NULL;
|
||||||
LPITEMIDLIST pidlTemp = NULL;
|
LPITEMIDLIST pidlTemp = NULL;
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
|
||||||
|
@ -317,31 +318,55 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
|
||||||
if (pchEaten)
|
if (pchEaten)
|
||||||
*pchEaten = 0; /* strange but like the original */
|
*pchEaten = 0; /* strange but like the original */
|
||||||
|
|
||||||
pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName);
|
if (pbc)
|
||||||
if (!pidlTemp && *lpszDisplayName)
|
|
||||||
{
|
{
|
||||||
/* get the next element */
|
static WCHAR dataW[] = {'F','i','l','e',' ','S','y','s','t','e','m',' ',
|
||||||
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
|
'B','i','n','d',' ','D','a','t','a',0 };
|
||||||
|
IUnknown *unk;
|
||||||
|
|
||||||
|
/* see if the caller bound File System Bind Data */
|
||||||
|
if (SUCCEEDED( IBindCtx_GetObjectParam( pbc, dataW, &unk )))
|
||||||
|
{
|
||||||
|
IUnknown_QueryInterface( unk, &IID_IFileSystemBindData, (void**)&fsbd );
|
||||||
|
IUnknown_Release( unk );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*lpszDisplayName)
|
||||||
|
{
|
||||||
/* build the full pathname to the element */
|
/* build the full pathname to the element */
|
||||||
lstrcpynW(szPath, This->sPathTarget, MAX_PATH - 1);
|
lstrcpynW(szPath, This->sPathTarget, MAX_PATH - 1);
|
||||||
PathAddBackslashW(szPath);
|
PathAddBackslashW(szPath);
|
||||||
len = lstrlenW(szPath);
|
len = lstrlenW(szPath);
|
||||||
lstrcpynW(szPath + len, szElement, MAX_PATH - len);
|
/* get the next element */
|
||||||
|
szNext = GetNextElementW( lpszDisplayName, szPath + len, MAX_PATH - len );
|
||||||
|
|
||||||
/* get the pidl */
|
if (szNext && *szNext)
|
||||||
|
{
|
||||||
hr = _ILCreateFromPathW( szPath, &pidlTemp );
|
hr = _ILCreateFromPathW( szPath, &pidlTemp );
|
||||||
|
if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) && fsbd)
|
||||||
if (SUCCEEDED(hr)) {
|
{
|
||||||
if (szNext && *szNext) {
|
find_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
/* try to analyse the next element */
|
strcpyW( find_data.cFileName, szPath + len );
|
||||||
hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc,
|
pidlTemp = _ILCreateFromFindDataW( &find_data );
|
||||||
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
|
|
||||||
} else {
|
|
||||||
/* it's the last element */
|
|
||||||
if (pdwAttributes && *pdwAttributes)
|
|
||||||
hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
|
|
||||||
}
|
}
|
||||||
|
if (pidlTemp) /* try to analyse the next element */
|
||||||
|
hr = SHELL32_ParseNextElement( iface, hwndOwner, pbc, &pidlTemp,
|
||||||
|
(WCHAR *)szNext, pchEaten, pdwAttributes );
|
||||||
|
}
|
||||||
|
else /* it's the last element */
|
||||||
|
{
|
||||||
|
if (fsbd)
|
||||||
|
{
|
||||||
|
if (FAILED( IFileSystemBindData_GetFindData( fsbd, &find_data )))
|
||||||
|
find_data.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
|
||||||
|
strcpyW( find_data.cFileName, szPath + len );
|
||||||
|
pidlTemp = _ILCreateFromFindDataW( &find_data );
|
||||||
|
}
|
||||||
|
else hr = _ILCreateFromPathW(szPath, &pidlTemp);
|
||||||
|
|
||||||
|
if (pidlTemp && pdwAttributes && *pdwAttributes)
|
||||||
|
hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +377,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
|
||||||
|
|
||||||
TRACE ("(%p)->(-- pidl=%p ret=0x%08x)\n", This, *ppidl, hr);
|
TRACE ("(%p)->(-- pidl=%p ret=0x%08x)\n", This, *ppidl, hr);
|
||||||
|
|
||||||
|
if (fsbd) IFileSystemBindData_Release( fsbd );
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue