44 DWORD att = *pdwEffect & (SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK);
48 *pdwEffect &= ~(SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK) | att;
68 if (!pwszSrcPathsList)
71 PWCHAR pwszListPos = pwszSrcPathsList;
87 pwszListPos +=
lstrlenW(pwszListPos) + 1;
106 if (
_wcsicmp(szPath1, szPath2) == 0)
107 bRenameOnCollision =
TRUE;
113 fop.
pFrom = pwszSrcPathsList;
114 fop.
pTo = wszDstPath;
116 if (bRenameOnCollision)
123 ERR(
"SHFileOperationW failed\n");
176 swprintf(pwszTarget,
L"%s%s%s", wszLink, pwszBasePath, pwszExt);
178 swprintf(pwszTarget,
L"%s%s", pwszBasePath, pwszExt);
183 swprintf(pwszTarget,
L"%s%s (%u)%s", wszLink, pwszBasePath,
i, pwszExt);
185 swprintf(pwszTarget,
L"%s (%u)%s", pwszBasePath,
i, pwszExt);
208 *pdwEffect = dwEffect;
211 if (dwEffect & *pdwEffect) {
279 CComPtr<IFolderView> pfv;
285 hr = psfv->GetDragPoint(&ptDrag);
296 CComHeapPtr<POINT> apt;
297 if (!apt.Allocate(cidl))
306 pfv->GetItemPosition(apidl[
i], &apt[
i]);
307 apt[
i].x +=
pt.x - ptDrag.
x;
308 apt[
i].y +=
pt.y - ptDrag.
y;
311 pfv->SelectAndPositionItems(cidl, apidl, apt, SVSI_SELECT);
321 TRACE(
"(%p)->(DataObject=%p)\n",
this, pDataObject);
340#define D_NONE DROPEFFECT_NONE
341#define D_COPY DROPEFFECT_COPY
342#define D_MOVE DROPEFFECT_MOVE
343#define D_LINK DROPEFFECT_LINK
401 TRACE(
"(%p)\n",
this);
415 TRACE(
"(%p)\n",
this);
425 TRACE(
"(%p) object dropped, effect %u\n",
this, *pdwEffect);
432 DWORD dwAvailableEffects = *pdwEffect;
436 TRACE(
"pdwEffect: 0x%x, m_dwDefaultEffect: 0x%x, dwAvailableEffects: 0x%x\n", *pdwEffect,
m_dwDefaultEffect, dwAvailableEffects);
447 CComPtr<IShellFolderView> psfv;
457 CComPtr<IAsyncOperation> pAsyncOperation;
461 if (
SUCCEEDED(pAsyncOperation->GetAsyncMode(&fIsOpAsync)) && fIsOpAsync)
467 pAsyncOperation->StartOperation(
NULL);
473 data->pdwEffect = *pdwEffect;
478 return this->
_DoDrop(pDataObject, dwKeyState,
pt, pdwEffect);
502 TRACE(
"(%p) performing drop, effect %u\n",
this, *pdwEffect);
512 bool bLinking =
FALSE;
517 TRACE(
"Current drop effect flag %i\n", *pdwEffect);
527 TRACE(
"CFSTR_SHELLIDLIST\n");
530 ERR(
"CFSTR_SHELLIDLIST failed\n");
549 CComPtr<IShellFolder> psfDesktop;
550 CComPtr<IShellFolder> psfFrom =
NULL;
556 ERR(
"SHGetDesktopFolder failed\n");
567 psfFrom = psfDesktop;
574 ERR(
"no IShellFolder\n");
592 CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidlFull;
593 hr = SHILCombine(pidl, apidl[
i], &pidlFull);
600 BOOL UseParsing = (att & (SFGAO_FILESYSTEM | SFGAO_FOLDER)) == SFGAO_FILESYSTEM;
601 DWORD ShgdnFor = UseParsing ? SHGDN_FORPARSING : SHGDN_FOREDITING;
618 fSourceIsLink =
TRUE;
625 CComPtr<IPersistFile> ppf;
628 PWSTR pwszTargetFull;
639 CComPtr<IShellLinkW> pLink;
643 hr = pLink->SetIDList(pidlFull);
647 PWSTR pwszPath, pSep;
653 pLink->SetWorkingDirectory(pwszPath);
660 hr = ppf->Save(wszNewLnk, !fSourceIsLink);
689 wszTargetPath[
wcslen(wszTargetPath) + 1] =
'\0';
694 ERR(
"Error locking global\n");
698 ERR(
"Source file (just the first) = %s, target path = %s, bCopy: %d\n",
debugstr_w(pszSrcList),
debugstr_w(wszTargetPath), bCopy);
702 op.pFrom = pszSrcList;
703 op.pTo = wszTargetPath;
710 ERR(
"SHFileOperationW failed with 0x%x\n",
res);
716 ERR(
"Error calling GetData\n");
721 ERR(
"No viable drop format\n");
731 CComPtr<IDataObject> pDataObject;
736 CComPtr<IAsyncOperation> pAsyncOperation;
740 pAsyncOperation->EndOperation(
hr,
NULL,
data->pdwEffect);
753 return ShellObjectCreatorInit<CFSDropTarget>(sPathTarget,
riid, ppvOut);
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID *ppvOut)
static void SHELL_StripIllegalFsNameCharacters(_Inout_ LPWSTR Buf)
static HRESULT SHELL_LimitDropEffectToItemAttributes(_In_ IDataObject *pDataObject, _Inout_ PDWORD pdwEffect)
static void GetDefaultCopyMoveEffect()
#define shell32_hInstance
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void shell(int argc, const char *argv[])
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
STDMETHOD() Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
CComPtr< IUnknown > m_site
STDMETHOD() DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
HRESULT Initialize(LPWSTR PathTarget)
STDMETHOD() GetSite(REFIID riid, void **ppvSite) override
static DWORD WINAPI _DoDropThreadProc(LPVOID lpParameter)
HRESULT _CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST *apidl, BOOL bCopy)
BOOL _QueryDrop(DWORD dwKeyState, LPDWORD pdwEffect)
HRESULT _GetEffectFromMenu(IDataObject *pDataObject, POINTL pt, DWORD *pdwEffect, DWORD dwAvailableEffects)
STDMETHOD() DragLeave() override
HRESULT _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
BOOL _GetUniqueFileName(LPCWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut)
STDMETHOD() DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
STDMETHOD() SetSite(IUnknown *pUnkSite) override
HRESULT _RepositionItems(IShellFolderView *psfv, IDataObject *pDataObject, POINTL pt)
#define HeapFree(x, y, z)
#define FAILED_UNEXPECTEDLY(hr)
static void cleanup(void)
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
HRESULT WINAPI IShellLink_ConstructFromPath(WCHAR *path, REFIID riid, LPVOID *ppv)
HRESULT Shell_DisplayNameOf(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_ LPWSTR pszBuf, _In_ UINT cchBuf)
DWORD SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
void WINAPI SHFree(LPVOID pv)
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
LPVOID WINAPI SHAlloc(SIZE_T len)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
#define InitFormatEtc(fe, cf, med)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
HRESULT QueryGetData([in, unique] FORMATETC *pformatetc)
const DWORD DROPEFFECT_NONE
const DWORD DROPEFFECT_LINK
const DWORD DROPEFFECT_COPY
const DWORD DROPEFFECT_MOVE
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
const GUID IID_IDataObject
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST *pidl, const CIDA *cida)
HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN sigdnName, PWSTR *ppszName)
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define KeyStateToDropEffect(kst)
#define FOF_RENAMEONCOLLISION
#define FOF_NOCONFIRMMKDIR
HRESULT SH_GetApidlFromDataObject(IDataObject *pDataObject, PIDLIST_ABSOLUTE *ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl)
EXTERN_C HRESULT WINAPI SHGetAttributesFromDataObject(IDataObject *pDataObject, DWORD dwAttributeMask, DWORD *pdwAttributes, UINT *pcItems)
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
#define CFSTR_SHELLIDLIST
struct _DROPFILES * LPDROPFILES
ITEMIDLIST UNALIGNED * LPITEMIDLIST
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
#define INVALID_FILETITLE_CHARACTERSW
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
LPWSTR WINAPI CharNextW(_In_ LPCWSTR)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define MAKEINTRESOURCEW(i)
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define IID_PPV_ARG(Itype, ppType)