Author: janderwald Date: Fri Nov 14 13:48:46 2008 New Revision: 37363
URL: http://svn.reactos.org/svn/reactos?rev=37363&view=rev Log: - Create IDataObject from the selected pidl - Check if drop target is the desktop - fixes bug 3763
Modified: trunk/reactos/dll/win32/shell32/shv_def_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/shv_def_cmenu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_def_c... ============================================================================== --- trunk/reactos/dll/win32/shell32/shv_def_cmenu.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shv_def_cmenu.c [iso-8859-1] Fri Nov 14 13:48:46 2008 @@ -1054,9 +1054,19 @@ return E_FAIL; }
- IShellFolder_Release(psfDesktop); - - if (FAILED(IShellFolder_BindToObject(This->dcm.psf, This->dcm.apidl[0], NULL, &IID_IShellFolder, (LPVOID*)&psfTarget))) + if (This->dcm.cidl) + { + IShellFolder_Release(psfDesktop); + hr = IShellFolder_BindToObject(This->dcm.psf, This->dcm.apidl[0], NULL, &IID_IShellFolder, (LPVOID*)&psfTarget); + } + else + { + /* target folder is desktop because cidl is zero */ + psfTarget = psfDesktop; + hr = S_OK; + } + + if (FAILED(hr)) { ERR("no IShellFolder\n");
@@ -1309,8 +1319,15 @@ { LPSHELLBROWSER lpSB; LPSHELLVIEW lpSV; - LPDATAOBJECT lpDo; + LPDATAOBJECT pDataObj; HRESULT hr; + + if (SUCCEEDED(SHCreateDataObject(iface->dcm.pidlFolder, iface->dcm.cidl, iface->dcm.apidl, NULL, &IID_IDataObject, (void**)&pDataObj))) + { + hr = OleSetClipboard(pDataObj); + IDataObject_Release(pDataObj); + return hr; + }
lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); if (!lpSB) @@ -1326,19 +1343,19 @@ return hr; }
- hr = IShellView_GetItemObject(lpSV, SVGIO_SELECTION, &IID_IDataObject, (LPVOID*)&lpDo); + hr = IShellView_GetItemObject(lpSV, SVGIO_SELECTION, &IID_IDataObject, (LPVOID*)&pDataObj); if (FAILED(hr)) { TRACE("failed to get item object\n"); return hr; }
- hr = OleSetClipboard(lpDo); + hr = OleSetClipboard(pDataObj); if (FAILED(hr)) { WARN("OleSetClipboard failed"); } - IDataObject_Release(lpDo); + IDataObject_Release(pDataObj); IShellView_Release(lpSV); return S_OK; }