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.
This commit is contained in:
parent
7f67b35a0d
commit
d101921b54
|
@ -464,7 +464,7 @@ static BOOL UNIXFS_path_to_pidl(UnixFolder *pUnixFolder, const WCHAR *path, LPIT
|
|||
if (pSlash) *pSlash = '/';
|
||||
|
||||
if (!pNextPathElement) {
|
||||
SHFree(pidl);
|
||||
SHFree(*ppidl);
|
||||
return FALSE;
|
||||
}
|
||||
pidl = ILGetNext(pidl);
|
||||
|
@ -824,7 +824,7 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_GetDisplayNameOf(IShellFolder2* i
|
|||
}
|
||||
} else {
|
||||
IShellFolder *pSubFolder;
|
||||
USHORT emptyIDL = 0;
|
||||
SHITEMID emptyIDL = { 0, { 0 } };
|
||||
|
||||
hr = IShellFolder_BindToObject(iface, pidl, NULL, &IID_IShellFolder, (void**)&pSubFolder);
|
||||
if (!SUCCEEDED(hr)) return hr;
|
||||
|
@ -1221,15 +1221,23 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_InitializeEx(IPersistFolder3 *i
|
|||
return IPersistFolder3_Initialize(iface, pidlRoot);
|
||||
|
||||
if (ppfti->csidl != -1) {
|
||||
if (SUCCEEDED(SHGetFolderPathW(0, ppfti->csidl, NULL, 0, wszTargetDosPath))) {
|
||||
UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath);
|
||||
if (FAILED(SHGetFolderPathW(0, ppfti->csidl, NULL, 0, wszTargetDosPath)) ||
|
||||
!UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
} else if (*ppfti->szTargetParsingName) {
|
||||
UNIXFS_get_unix_path(ppfti->szTargetParsingName, szTargetPath);
|
||||
} else if (ppfti->pidlTargetFolder) {
|
||||
if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTargetDosPath)) {
|
||||
UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath);
|
||||
if (!UNIXFS_get_unix_path(ppfti->szTargetParsingName, szTargetPath)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
} else if (ppfti->pidlTargetFolder) {
|
||||
if (!SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTargetDosPath) ||
|
||||
!UNIXFS_get_unix_path(wszTargetDosPath, szTargetPath))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
} else {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
This->m_pszPath = SHAlloc(lstrlenA(szTargetPath)+1);
|
||||
|
@ -1237,8 +1245,8 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_InitializeEx(IPersistFolder3 *i
|
|||
return E_FAIL;
|
||||
lstrcpyA(This->m_pszPath, szTargetPath);
|
||||
This->m_pidlLocation = ILClone(pidlRoot);
|
||||
This->m_dwAttributes = (ppfti->dwAttributes == -1) ? ppfti->dwAttributes :
|
||||
SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR|SFGAO_CANRENAME|SFGAO_FILESYSTEM;
|
||||
This->m_dwAttributes = (ppfti->dwAttributes != -1) ? ppfti->dwAttributes :
|
||||
(SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR|SFGAO_CANRENAME|SFGAO_FILESYSTEM);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1532,6 +1540,11 @@ static HRESULT CreateUnixFolder(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, c
|
|||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
UnixFolder *pUnixFolder = SHAlloc((ULONG)sizeof(UnixFolder));
|
||||
|
||||
if (pUnkOuter) {
|
||||
FIXME("Aggregation not yet implemented!\n");
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
}
|
||||
|
||||
if(pUnixFolder) {
|
||||
pUnixFolder->lpIShellFolder2Vtbl = &UnixFolder_IShellFolder2_Vtbl;
|
||||
|
|
Loading…
Reference in New Issue