Commit d101921b authored by Michael Jung's avatar Michael Jung Committed by Alexandre Julliard

Pass correct pointer to SHFree in case of failure in

UNIXFS_path_to_pidl. Return E_FAIL if we can't get the unix path in IPersistFolder3::InitializeEx. Return E_NOAGGREGATION if non-NULL pUnkOuter is given to the constructor.
parent 7f67b35a
...@@ -464,7 +464,7 @@ static BOOL UNIXFS_path_to_pidl(UnixFolder *pUnixFolder, const WCHAR *path, LPIT ...@@ -464,7 +464,7 @@ static BOOL UNIXFS_path_to_pidl(UnixFolder *pUnixFolder, const WCHAR *path, LPIT
if (pSlash) *pSlash = '/'; if (pSlash) *pSlash = '/';
if (!pNextPathElement) { if (!pNextPathElement) {
SHFree(pidl); SHFree(*ppidl);
return FALSE; return FALSE;
} }
pidl = ILGetNext(pidl); pidl = ILGetNext(pidl);
...@@ -824,7 +824,7 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_GetDisplayNameOf(IShellFolder2* i ...@@ -824,7 +824,7 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_GetDisplayNameOf(IShellFolder2* i
} }
} else { } else {
IShellFolder *pSubFolder; IShellFolder *pSubFolder;
USHORT emptyIDL = 0; SHITEMID emptyIDL = { 0, { 0 } };
hr = IShellFolder_BindToObject(iface, pidl, NULL, &IID_IShellFolder, (void**)&pSubFolder); hr = IShellFolder_BindToObject(iface, pidl, NULL, &IID_IShellFolder, (void**)&pSubFolder);
if (!SUCCEEDED(hr)) return hr; if (!SUCCEEDED(hr)) return hr;
...@@ -1221,15 +1221,23 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_InitializeEx(IPersistFolder3 *i ...@@ -1221,15 +1221,23 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_InitializeEx(IPersistFolder3 *i
return IPersistFolder3_Initialize(iface, pidlRoot); return IPersistFolder3_Initialize(iface, pidlRoot);
if (ppfti->csidl != -1) { if (ppfti->csidl != -1) {
if (SUCCEEDED(SHGetFolderPathW(0, ppfti->csidl, NULL, 0, wszTargetDosPath))) { if (FAILED(SHGetFolderPathW(0, ppfti->csidl, NULL, 0, wszTargetDosPath)) ||
UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath); !UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath))
{
return E_FAIL;
} }
} else if (*ppfti->szTargetParsingName) { } else if (*ppfti->szTargetParsingName) {
UNIXFS_get_unix_path(ppfti->szTargetParsingName, szTargetPath); if (!UNIXFS_get_unix_path(ppfti->szTargetParsingName, szTargetPath)) {
return E_FAIL;
}
} else if (ppfti->pidlTargetFolder) { } else if (ppfti->pidlTargetFolder) {
if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTargetDosPath)) { if (!SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTargetDosPath) ||
UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath); !UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath))
{
return E_FAIL;
} }
} else {
return E_FAIL;
} }
This->m_pszPath = SHAlloc(lstrlenA(szTargetPath)+1); This->m_pszPath = SHAlloc(lstrlenA(szTargetPath)+1);
...@@ -1237,8 +1245,8 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_InitializeEx(IPersistFolder3 *i ...@@ -1237,8 +1245,8 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_InitializeEx(IPersistFolder3 *i
return E_FAIL; return E_FAIL;
lstrcpyA(This->m_pszPath, szTargetPath); lstrcpyA(This->m_pszPath, szTargetPath);
This->m_pidlLocation = ILClone(pidlRoot); This->m_pidlLocation = ILClone(pidlRoot);
This->m_dwAttributes = (ppfti->dwAttributes == -1) ? ppfti->dwAttributes : This->m_dwAttributes = (ppfti->dwAttributes != -1) ? ppfti->dwAttributes :
SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR|SFGAO_CANRENAME|SFGAO_FILESYSTEM; (SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR|SFGAO_CANRENAME|SFGAO_FILESYSTEM);
return S_OK; return S_OK;
} }
...@@ -1532,6 +1540,11 @@ static HRESULT CreateUnixFolder(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, c ...@@ -1532,6 +1540,11 @@ static HRESULT CreateUnixFolder(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, c
{ {
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
UnixFolder *pUnixFolder = SHAlloc((ULONG)sizeof(UnixFolder)); UnixFolder *pUnixFolder = SHAlloc((ULONG)sizeof(UnixFolder));
if (pUnkOuter) {
FIXME("Aggregation not yet implemented!\n");
return CLASS_E_NOAGGREGATION;
}
if(pUnixFolder) { if(pUnixFolder) {
pUnixFolder->lpIShellFolder2Vtbl = &UnixFolder_IShellFolder2_Vtbl; pUnixFolder->lpIShellFolder2Vtbl = &UnixFolder_IShellFolder2_Vtbl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment