shell32: Use the paste_pidls() helper function for the CFSTR_SHELLIDLISTW format too.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
91b0340170
commit
9bc7d41080
|
@ -1182,15 +1182,15 @@ static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL DoPaste(ContextMenu *This)
|
static HRESULT DoPaste(ContextMenu *This)
|
||||||
{
|
{
|
||||||
BOOL bSuccess = TRUE;
|
|
||||||
IDataObject * pda;
|
IDataObject * pda;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if(SUCCEEDED(OleGetClipboard(&pda)))
|
hr = OleGetClipboard(&pda);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
STGMEDIUM medium;
|
STGMEDIUM medium;
|
||||||
FORMATETC formatetc;
|
FORMATETC formatetc;
|
||||||
|
@ -1207,65 +1207,26 @@ static BOOL DoPaste(ContextMenu *This)
|
||||||
{
|
{
|
||||||
LPITEMIDLIST * apidl;
|
LPITEMIDLIST * apidl;
|
||||||
LPITEMIDLIST pidl;
|
LPITEMIDLIST pidl;
|
||||||
IShellFolder *psfFrom = NULL, *psfDesktop;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
LPIDA lpcida = GlobalLock(medium.u.hGlobal);
|
LPIDA lpcida = GlobalLock(medium.u.hGlobal);
|
||||||
TRACE("cida=%p\n", lpcida);
|
TRACE("cida=%p\n", lpcida);
|
||||||
|
if(lpcida)
|
||||||
|
{
|
||||||
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
||||||
|
if (apidl)
|
||||||
for (i = 0; bSuccess && i < lpcida->cidl; i++) {
|
|
||||||
ITEMIDLIST *apidl_dir = NULL;
|
|
||||||
ITEMIDLIST *apidl_item;
|
|
||||||
|
|
||||||
psfFrom = NULL;
|
|
||||||
/* bind to the source shellfolder */
|
|
||||||
SHGetDesktopFolder(&psfDesktop);
|
|
||||||
if(psfDesktop)
|
|
||||||
{
|
{
|
||||||
apidl_dir = ILClone(apidl[i]);
|
hr = paste_pidls(This, apidl, lpcida->cidl);
|
||||||
ILRemoveLastID(apidl_dir);
|
|
||||||
apidl_item = ILFindLastID(apidl[i]);
|
|
||||||
IShellFolder_BindToObject(psfDesktop, apidl_dir, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom);
|
|
||||||
IShellFolder_Release(psfDesktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (psfFrom)
|
|
||||||
{
|
|
||||||
/* get source and destination shellfolder */
|
|
||||||
ISFHelper *psfhlpdst, *psfhlpsrc;
|
|
||||||
IShellFolder_QueryInterface(This->parent, &IID_ISFHelper, (void**)&psfhlpdst);
|
|
||||||
IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (void**)&psfhlpsrc);
|
|
||||||
|
|
||||||
/* do the copy/move */
|
|
||||||
if (psfhlpdst && psfhlpsrc)
|
|
||||||
{
|
|
||||||
HRESULT hr = ISFHelper_CopyItems(psfhlpdst, psfFrom, 1, (LPCITEMIDLIST*)&apidl_item);
|
|
||||||
if (FAILED(hr))
|
|
||||||
bSuccess = FALSE;
|
|
||||||
/* FIXME handle move
|
|
||||||
ISFHelper_DeleteItems(psfhlpsrc, 1, &apidl_item);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
|
||||||
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
|
||||||
IShellFolder_Release(psfFrom);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bSuccess = FALSE;
|
|
||||||
SHFree(apidl_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ILFreeaPidl(apidl, lpcida->cidl);
|
_ILFreeaPidl(apidl, lpcida->cidl);
|
||||||
SHFree(pidl);
|
SHFree(pidl);
|
||||||
GlobalUnlock(medium.u.hGlobal);
|
|
||||||
|
|
||||||
/* release the medium*/
|
|
||||||
ReleaseStgMedium(&medium);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
bSuccess = FALSE;
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
GlobalUnlock(medium.u.hGlobal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
ReleaseStgMedium(&medium);
|
||||||
|
}
|
||||||
|
|
||||||
if(FAILED(format_hr))
|
if(FAILED(format_hr))
|
||||||
{
|
{
|
||||||
|
@ -1298,20 +1259,17 @@ static BOOL DoPaste(ContextMenu *This)
|
||||||
else
|
else
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
ReleaseStgMedium(&medium);
|
ReleaseStgMedium(&medium);
|
||||||
bSuccess = SUCCEEDED(hr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(format_hr))
|
if (FAILED(format_hr))
|
||||||
{
|
{
|
||||||
ERR("there are no supported and retrievable clipboard formats\n");
|
ERR("there are no supported and retrievable clipboard formats\n");
|
||||||
bSuccess = FALSE;
|
hr = format_hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IDataObject_Release(pda);
|
IDataObject_Release(pda);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
bSuccess = FALSE;
|
|
||||||
#if 0
|
#if 0
|
||||||
HGLOBAL hMem;
|
HGLOBAL hMem;
|
||||||
|
|
||||||
|
@ -1336,7 +1294,7 @@ static BOOL DoPaste(ContextMenu *This)
|
||||||
}
|
}
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
#endif
|
#endif
|
||||||
return bSuccess;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BackgroundMenu_InvokeCommand(
|
static HRESULT WINAPI BackgroundMenu_InvokeCommand(
|
||||||
|
|
Loading…
Reference in New Issue