ReactOS  0.4.14-dev-838-g99f979d
CFSDropTarget.cpp
Go to the documentation of this file.
1 
2 /*
3  * file system folder drop target
4  *
5  * Copyright 1997 Marcus Meissner
6  * Copyright 1998, 1999, 2002 Juergen Schmied
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22 
23 #include <precomp.h>
24 
26 
27 /****************************************************************************
28  * BuildPathsList
29  *
30  * Builds a list of paths like the one used in SHFileOperation from a table of
31  * PIDLs relative to the given base folder
32  */
33 static WCHAR* BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls)
34 {
35  WCHAR *pwszPathsList = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) * cidl + 1);
36  WCHAR *pwszListPos = pwszPathsList;
37 
38  for (int i = 0; i < cidl; i++)
39  {
40  FileStructW* pDataW = _ILGetFileStructW(pidls[i]);
41  if (!pDataW)
42  {
43  ERR("Got garbage pidl\n");
44  continue;
45  }
46 
47  PathCombineW(pwszListPos, wszBasePath, pDataW->wszName);
48  pwszListPos += wcslen(pwszListPos) + 1;
49  }
50  *pwszListPos = 0;
51  return pwszPathsList;
52 }
53 
54 /****************************************************************************
55  * CFSDropTarget::_CopyItems
56  *
57  * copies items to this folder
58  */
60  LPCITEMIDLIST * apidl, BOOL bCopy)
61 {
62  LPWSTR pszSrcList;
63  HRESULT hr;
64  WCHAR wszTargetPath[MAX_PATH + 1];
65 
66  wcscpy(wszTargetPath, m_sPathTarget);
67  //Double NULL terminate.
68  wszTargetPath[wcslen(wszTargetPath) + 1] = '\0';
69 
70  TRACE ("(%p)->(%p,%u,%p)\n", this, pSFFrom, cidl, apidl);
71 
72  STRRET strretFrom;
73  hr = pSFFrom->GetDisplayNameOf(NULL, SHGDN_FORPARSING, &strretFrom);
75  return hr;
76 
77  pszSrcList = BuildPathsList(strretFrom.pOleStr, cidl, apidl);
78  ERR("Source file (just the first) = %s, target path = %s, bCopy: %d\n", debugstr_w(pszSrcList), debugstr_w(m_sPathTarget), bCopy);
79  CoTaskMemFree(strretFrom.pOleStr);
80  if (!pszSrcList)
81  return E_OUTOFMEMORY;
82 
83  SHFILEOPSTRUCTW op = {0};
84  op.pFrom = pszSrcList;
85  op.pTo = wszTargetPath;
86  op.hwnd = m_hwndSite;
87  op.wFunc = bCopy ? FO_COPY : FO_MOVE;
89 
90  int res = SHFileOperationW(&op);
91 
92  HeapFree(GetProcessHeap(), 0, pszSrcList);
93 
94  if (res)
95  return E_FAIL;
96  else
97  return S_OK;
98 }
99 
101  m_cfShellIDList(0),
102  m_fAcceptFmt(FALSE),
103  m_sPathTarget(NULL),
104  m_hwndSite(NULL),
105  m_grfKeyState(0)
106 {
107 }
108 
110 {
111  if (!PathTarget)
112  return E_UNEXPECTED;
113 
115  if (!m_cfShellIDList)
116  return E_FAIL;
117 
118  m_sPathTarget = (WCHAR *)SHAlloc((wcslen(PathTarget) + 1) * sizeof(WCHAR));
119  if (!m_sPathTarget)
120  return E_OUTOFMEMORY;
121 
122  wcscpy(m_sPathTarget, PathTarget);
123 
124  return S_OK;
125 }
126 
128 {
130 }
131 
132 BOOL
133 CFSDropTarget::_GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut)
134 {
135  WCHAR wszLink[40];
136 
137  if (!bShortcut)
138  {
139  if (!LoadStringW(shell32_hInstance, IDS_LNK_FILE, wszLink, _countof(wszLink)))
140  wszLink[0] = L'\0';
141  }
142 
143  if (!bShortcut)
144  swprintf(pwszTarget, L"%s%s%s", wszLink, pwszBasePath, pwszExt);
145  else
146  swprintf(pwszTarget, L"%s%s", pwszBasePath, pwszExt);
147 
148  for (UINT i = 2; PathFileExistsW(pwszTarget); ++i)
149  {
150  if (!bShortcut)
151  swprintf(pwszTarget, L"%s%s (%u)%s", wszLink, pwszBasePath, i, pwszExt);
152  else
153  swprintf(pwszTarget, L"%s (%u)%s", pwszBasePath, i, pwszExt);
154  }
155 
156  return TRUE;
157 }
158 
159 /****************************************************************************
160  * IDropTarget implementation
161  */
163 {
164  /* TODO Windows does different drop effects if dragging across drives.
165  i.e., it will copy instead of move if the directories are on different disks. */
166 
167  DWORD dwEffect = m_dwDefaultEffect;
168 
169  *pdwEffect = DROPEFFECT_NONE;
170 
171  if (m_fAcceptFmt) { /* Does our interpretation of the keystate ... */
172  *pdwEffect = KeyStateToDropEffect (dwKeyState);
173 
174  if (*pdwEffect == DROPEFFECT_NONE)
175  *pdwEffect = dwEffect;
176 
177  /* ... matches the desired effect ? */
178  if (dwEffect & *pdwEffect) {
179  return TRUE;
180  }
181  }
182  return FALSE;
183 }
184 
185 HRESULT CFSDropTarget::_GetEffectFromMenu(IDataObject *pDataObject, POINTL pt, DWORD *pdwEffect, DWORD dwAvailableEffects)
186 {
188  if (!hmenu)
189  return E_OUTOFMEMORY;
190 
192 
193  if ((dwAvailableEffects & DROPEFFECT_COPY) == 0)
195  else if ((dwAvailableEffects & DROPEFFECT_MOVE) == 0)
197  else if ((dwAvailableEffects & DROPEFFECT_LINK) == 0)
199 
200  if ((*pdwEffect & DROPEFFECT_COPY))
202  else if ((*pdwEffect & DROPEFFECT_MOVE))
204  else if ((*pdwEffect & DROPEFFECT_LINK))
206 
207  /* FIXME: We need to support shell extensions here */
208 
209  /* We shouldn't use the site window here because the menu should work even when we don't have a site */
210  HWND hwndDummy = CreateWindowEx(0,
211  WC_STATIC,
212  NULL,
214  pt.x,
215  pt.y,
216  1,
217  1,
218  NULL,
219  NULL,
220  NULL,
221  NULL);
222 
223  UINT uCommand = TrackPopupMenu(hpopupmenu,
225  pt.x, pt.y, 0, hwndDummy, NULL);
226 
227  DestroyWindow(hwndDummy);
228 
229  if (uCommand == 0)
230  return S_FALSE;
231  else if (uCommand == IDM_COPYHERE)
232  *pdwEffect = DROPEFFECT_COPY;
233  else if (uCommand == IDM_MOVEHERE)
234  *pdwEffect = DROPEFFECT_MOVE;
235  else if (uCommand == IDM_LINKHERE)
236  *pdwEffect = DROPEFFECT_LINK;
237 
238  return S_OK;
239 }
240 
242 {
243  CComPtr<IFolderView> pfv;
244  POINT ptDrag;
245  HRESULT hr = psfv->QueryInterface(IID_PPV_ARG(IFolderView, &pfv));
246  if (FAILED_UNEXPECTEDLY(hr))
247  return hr;
248 
249  hr = psfv->GetDragPoint(&ptDrag);
250  if (FAILED_UNEXPECTEDLY(hr))
251  return hr;
252 
253  PIDLIST_ABSOLUTE pidlFolder;
254  PUITEMID_CHILD *apidl;
255  UINT cidl;
256  hr = SH_GetApidlFromDataObject(pdtobj, &pidlFolder, &apidl, &cidl);
257  if (FAILED_UNEXPECTEDLY(hr))
258  return hr;
259 
260  CComHeapPtr<POINT> apt;
261  if (!apt.Allocate(cidl))
262  {
263  SHFree(pidlFolder);
264  _ILFreeaPidl(apidl, cidl);
265  return E_OUTOFMEMORY;
266  }
267 
268  for (UINT i = 0; i<cidl; i++)
269  {
270  pfv->GetItemPosition(apidl[i], &apt[i]);
271  apt[i].x += pt.x - ptDrag.x;
272  apt[i].y += pt.y - ptDrag.y;
273  }
274 
275  pfv->SelectAndPositionItems(cidl, apidl, apt, SVSI_SELECT);
276 
277  SHFree(pidlFolder);
278  _ILFreeaPidl(apidl, cidl);
279  return S_OK;
280 }
281 
283  DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
284 {
285  TRACE("(%p)->(DataObject=%p)\n", this, pDataObject);
286 
287  if (*pdwEffect == DROPEFFECT_NONE)
288  return S_OK;
289 
290  FORMATETC fmt;
291  FORMATETC fmt2;
293 
294  InitFormatEtc (fmt, m_cfShellIDList, TYMED_HGLOBAL);
295  InitFormatEtc (fmt2, CF_HDROP, TYMED_HGLOBAL);
296 
297  if (SUCCEEDED(pDataObject->QueryGetData(&fmt)))
298  m_fAcceptFmt = TRUE;
299  else if (SUCCEEDED(pDataObject->QueryGetData(&fmt2)))
300  m_fAcceptFmt = TRUE;
301 
302  m_grfKeyState = dwKeyState;
303 
304 #define D_NONE DROPEFFECT_NONE
305 #define D_COPY DROPEFFECT_COPY
306 #define D_MOVE DROPEFFECT_MOVE
307 #define D_LINK DROPEFFECT_LINK
308  m_dwDefaultEffect = *pdwEffect;
309  switch (*pdwEffect & (D_COPY | D_MOVE | D_LINK))
310  {
311  case D_COPY | D_MOVE:
312  if (dwKeyState & MK_CONTROL)
314  else
316  break;
317  case D_COPY | D_MOVE | D_LINK:
318  if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
320  else if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == MK_CONTROL)
322  else
324  break;
325  case D_COPY | D_LINK:
326  if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
328  else
330  break;
331  case D_MOVE | D_LINK:
332  if ((dwKeyState & (MK_SHIFT | MK_CONTROL)) == (MK_SHIFT | MK_CONTROL))
334  else
336  break;
337  }
338 
339  STGMEDIUM medium;
340  if (SUCCEEDED(pDataObject->GetData(&fmt2, &medium)))
341  {
342  WCHAR wstrFirstFile[MAX_PATH];
343  if (DragQueryFileW((HDROP)medium.hGlobal, 0, wstrFirstFile, _countof(wstrFirstFile)))
344  {
345  /* Check if the drive letter is different */
346  if (wstrFirstFile[0] != m_sPathTarget[0])
347  {
349  }
350  }
351  ReleaseStgMedium(&medium);
352  }
353 
354  if (!m_fAcceptFmt)
355  *pdwEffect = DROPEFFECT_NONE;
356  else
357  *pdwEffect = m_dwDefaultEffect;
358 
359  return S_OK;
360 }
361 
363  DWORD *pdwEffect)
364 {
365  TRACE("(%p)\n", this);
366 
367  if (!pdwEffect)
368  return E_INVALIDARG;
369 
370  m_grfKeyState = dwKeyState;
371 
372  _QueryDrop(dwKeyState, pdwEffect);
373 
374  return S_OK;
375 }
376 
378 {
379  TRACE("(%p)\n", this);
380 
382 
383  return S_OK;
384 }
385 
387  DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
388 {
389  TRACE("(%p) object dropped, effect %u\n", this, *pdwEffect);
390 
391  if (!pdwEffect)
392  return E_INVALIDARG;
393 
395 
396  DWORD dwAvailableEffects = *pdwEffect;
397 
398  _QueryDrop(dwKeyState, pdwEffect);
399 
400  TRACE("pdwEffect: 0x%x, m_dwDefaultEffect: 0x%x, dwAvailableEffects: 0x%x\n", *pdwEffect, m_dwDefaultEffect, dwAvailableEffects);
401 
403  {
404  HRESULT hr = _GetEffectFromMenu(pDataObject, pt, pdwEffect, dwAvailableEffects);
405  if (FAILED_UNEXPECTEDLY(hr) || hr == S_FALSE)
406  return hr;
407  }
408 
409  if (*pdwEffect == DROPEFFECT_MOVE && m_site)
410  {
411  CComPtr<IShellFolderView> psfv;
412  HRESULT hr = IUnknown_QueryService(m_site, SID_IFolderView, IID_PPV_ARG(IShellFolderView, &psfv));
413  if (SUCCEEDED(hr) && psfv->IsDropOnSource(this) == S_OK)
414  {
415  _RepositionItems(psfv, pDataObject, pt);
416  return S_OK;
417  }
418  }
419 
420  BOOL fIsOpAsync = FALSE;
421  CComPtr<IAsyncOperation> pAsyncOperation;
422 
423  if (SUCCEEDED(pDataObject->QueryInterface(IID_PPV_ARG(IAsyncOperation, &pAsyncOperation))))
424  {
425  if (SUCCEEDED(pAsyncOperation->GetAsyncMode(&fIsOpAsync)) && fIsOpAsync)
426  {
427  _DoDropData *data = static_cast<_DoDropData*>(HeapAlloc(GetProcessHeap(), 0, sizeof(_DoDropData)));
428  data->This = this;
429  // Need to maintain this class in case the window is closed or the class exists temporarily (when dropping onto a folder).
430  pDataObject->AddRef();
431  pAsyncOperation->StartOperation(NULL);
433  this->AddRef();
434  data->dwKeyState = dwKeyState;
435  data->pt = pt;
436  // Need to dereference as pdweffect gets freed.
437  data->pdwEffect = *pdwEffect;
439  return S_OK;
440  }
441  }
442  return this->_DoDrop(pDataObject, dwKeyState, pt, pdwEffect);
443 }
444 
445 HRESULT
446 WINAPI
448 {
449  m_site = pUnkSite;
450  return S_OK;
451 }
452 
453 HRESULT
454 WINAPI
456 {
457  if (!m_site)
458  return E_FAIL;
459 
460  return m_site->QueryInterface(riid, ppvSite);
461 }
462 
464  DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
465 {
466  TRACE("(%p) performing drop, effect %u\n", this, *pdwEffect);
467  FORMATETC fmt;
468  FORMATETC fmt2;
469  STGMEDIUM medium;
470 
471  InitFormatEtc (fmt, m_cfShellIDList, TYMED_HGLOBAL);
472  InitFormatEtc (fmt2, CF_HDROP, TYMED_HGLOBAL);
473 
474  HRESULT hr;
475  bool bCopy = TRUE;
476  bool bLinking = FALSE;
477 
478  /* Figure out what drop operation we're doing */
479  if (pdwEffect)
480  {
481  TRACE("Current drop effect flag %i\n", *pdwEffect);
482  if ((*pdwEffect & DROPEFFECT_MOVE) == DROPEFFECT_MOVE)
483  bCopy = FALSE;
484  if ((*pdwEffect & DROPEFFECT_LINK) == DROPEFFECT_LINK)
485  bLinking = TRUE;
486  }
487 
488  if (SUCCEEDED(pDataObject->QueryGetData(&fmt)))
489  {
490  hr = pDataObject->GetData(&fmt, &medium);
491  TRACE("CFSTR_SHELLIDLIST.\n");
492 
493  /* lock the handle */
494  LPIDA lpcida = (LPIDA)GlobalLock(medium.hGlobal);
495  if (!lpcida)
496  {
497  ReleaseStgMedium(&medium);
498  return E_FAIL;
499  }
500 
501  /* convert the data into pidl */
502  LPITEMIDLIST pidl;
503  LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
504  if (!apidl)
505  {
506  ReleaseStgMedium(&medium);
507  return E_FAIL;
508  }
509 
510  CComPtr<IShellFolder> psfDesktop;
511  CComPtr<IShellFolder> psfFrom = NULL;
512 
513  /* Grab the desktop shell folder */
514  hr = SHGetDesktopFolder(&psfDesktop);
515  if (FAILED(hr))
516  {
517  ERR("SHGetDesktopFolder failed\n");
518  SHFree(pidl);
519  _ILFreeaPidl(apidl, lpcida->cidl);
520  ReleaseStgMedium(&medium);
521  return E_FAIL;
522  }
523 
524  /* Find source folder, this is where the clipboard data was copied from */
525  if (_ILIsDesktop(pidl))
526  {
527  /* use desktop shell folder */
528  psfFrom = psfDesktop;
529  }
530  else
531  {
532  hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfFrom));
533  if (FAILED(hr))
534  {
535  ERR("no IShellFolder\n");
536  SHFree(pidl);
537  _ILFreeaPidl(apidl, lpcida->cidl);
538  ReleaseStgMedium(&medium);
539  return E_FAIL;
540  }
541  }
542 
543  if (bLinking)
544  {
545  WCHAR wszTargetPath[MAX_PATH];
546  WCHAR wszPath[MAX_PATH];
547  WCHAR wszTarget[MAX_PATH];
548 
549  wcscpy(wszTargetPath, m_sPathTarget);
550 
551  TRACE("target path = %s", debugstr_w(wszTargetPath));
552 
553  /* We need to create a link for each pidl in the copied items, so step through the pidls from the clipboard */
554  for (UINT i = 0; i < lpcida->cidl; i++)
555  {
556  //Find out which file we're copying
557  STRRET strFile;
558  hr = psfFrom->GetDisplayNameOf(apidl[i], SHGDN_FORPARSING, &strFile);
559  if (FAILED(hr))
560  {
561  ERR("Error source obtaining path");
562  break;
563  }
564 
565  hr = StrRetToBufW(&strFile, apidl[i], wszPath, _countof(wszPath));
566  if (FAILED(hr))
567  {
568  ERR("Error putting source path into buffer");
569  break;
570  }
571  TRACE("source path = %s", debugstr_w(wszPath));
572 
573  // Creating a buffer to hold the combined path
574  WCHAR buffer_1[MAX_PATH] = L"";
575  WCHAR *lpStr1;
576  lpStr1 = buffer_1;
577 
578  LPWSTR pwszFileName = PathFindFileNameW(wszPath);
579  LPWSTR pwszExt = PathFindExtensionW(wszPath);
580  LPWSTR placementPath = PathCombineW(lpStr1, m_sPathTarget, pwszFileName);
581  CComPtr<IPersistFile> ppf;
582 
583  //Check to see if it's already a link.
584  if (!wcsicmp(pwszExt, L".lnk"))
585  {
586  //It's a link so, we create a new one which copies the old.
587  if(!_GetUniqueFileName(placementPath, pwszExt, wszTarget, TRUE))
588  {
589  ERR("Error getting unique file name");
590  hr = E_FAIL;
591  break;
592  }
594  if (FAILED(hr)) {
595  ERR("Error constructing link from file");
596  break;
597  }
598 
599  hr = ppf->Save(wszTarget, FALSE);
600  if (FAILED(hr))
601  break;
603  }
604  else
605  {
606  //It's not a link, so build a new link using the creator class and fill it in.
607  //Create a file name for the link
608  if (!_GetUniqueFileName(placementPath, L".lnk", wszTarget, TRUE))
609  {
610  ERR("Error creating unique file name");
611  hr = E_FAIL;
612  break;
613  }
614 
615  CComPtr<IShellLinkW> pLink;
616  hr = CShellLink::_CreatorClass::CreateInstance(NULL, IID_PPV_ARG(IShellLinkW, &pLink));
617  if (FAILED(hr)) {
618  ERR("Error instantiating IShellLinkW");
619  break;
620  }
621 
622  WCHAR szDirPath[MAX_PATH], *pwszFile;
623  GetFullPathName(wszPath, MAX_PATH, szDirPath, &pwszFile);
624  if (pwszFile) pwszFile[0] = 0;
625 
626  hr = pLink->SetPath(wszPath);
627  if(FAILED(hr))
628  break;
629 
630  hr = pLink->SetWorkingDirectory(szDirPath);
631  if(FAILED(hr))
632  break;
633 
634  hr = pLink->QueryInterface(IID_PPV_ARG(IPersistFile, &ppf));
635  if(FAILED(hr))
636  break;
637 
638  hr = ppf->Save(wszTarget, TRUE);
639  if (FAILED(hr))
640  break;
642  }
643  }
644  }
645  else
646  {
647  hr = _CopyItems(psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl, bCopy);
648  }
649 
650  SHFree(pidl);
651  _ILFreeaPidl(apidl, lpcida->cidl);
652  ReleaseStgMedium(&medium);
653  }
654  else if (SUCCEEDED(pDataObject->QueryGetData(&fmt2)))
655  {
656  FORMATETC fmt2;
657  InitFormatEtc (fmt2, CF_HDROP, TYMED_HGLOBAL);
658  if (SUCCEEDED(pDataObject->GetData(&fmt2, &medium)) /* && SUCCEEDED(pDataObject->GetData(&fmt2, &medium))*/)
659  {
660  WCHAR wszTargetPath[MAX_PATH + 1];
661  LPWSTR pszSrcList;
662 
663  wcscpy(wszTargetPath, m_sPathTarget);
664  //Double NULL terminate.
665  wszTargetPath[wcslen(wszTargetPath) + 1] = '\0';
666 
667  LPDROPFILES lpdf = (LPDROPFILES) GlobalLock(medium.hGlobal);
668  if (!lpdf)
669  {
670  ERR("Error locking global\n");
671  return E_FAIL;
672  }
673  pszSrcList = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles);
674  ERR("Source file (just the first) = %s, target path = %s, bCopy: %d\n", debugstr_w(pszSrcList), debugstr_w(wszTargetPath), bCopy);
675 
677  ZeroMemory(&op, sizeof(op));
678  op.pFrom = pszSrcList;
679  op.pTo = wszTargetPath;
680  op.hwnd = m_hwndSite;
681  op.wFunc = bCopy ? FO_COPY : FO_MOVE;
683  hr = SHFileOperationW(&op);
684  return hr;
685  }
686  ERR("Error calling GetData\n");
687  hr = E_FAIL;
688  }
689  else
690  {
691  ERR("No viable drop format.\n");
692  hr = E_FAIL;
693  }
694  return hr;
695 }
696 
698 {
700  _DoDropData *data = static_cast<_DoDropData*>(lpParameter);
701  CComPtr<IDataObject> pDataObject;
703 
704  if (SUCCEEDED(hr))
705  {
706  CComPtr<IAsyncOperation> pAsyncOperation;
707  hr = data->This->_DoDrop(pDataObject, data->dwKeyState, data->pt, &data->pdwEffect);
708  if (SUCCEEDED(pDataObject->QueryInterface(IID_PPV_ARG(IAsyncOperation, &pAsyncOperation))))
709  {
710  pAsyncOperation->EndOperation(hr, NULL, data->pdwEffect);
711  }
712  }
713  //Release the CFSFolder and data object holds in the copying thread.
714  data->This->Release();
715  //Release the parameter from the heap.
717  CoUninitialize();
718  return 0;
719 }
720 
722 {
723  return ShellObjectCreatorInit<CFSDropTarget>(sPathTarget, riid, ppvOut);
724 }
virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
LPWSTR m_sPathTarget
Definition: CFSDropTarget.h:34
#define WS_DISABLED
Definition: pedump.c:621
struct _DROPFILES * LPDROPFILES
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define MK_SHIFT
Definition: winuser.h:2344
#define D_LINK
#define MF_BYCOMMAND
Definition: winuser.h:202
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define IDM_LINKHERE
Definition: shresdef.h:794
long y
Definition: polytest.cpp:48
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID *ppvOut)
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite)
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:477
CComPtr< IUnknown > m_site
Definition: CFSDropTarget.h:38
HRESULT hr
Definition: shlfolder.c:183
static HMENU hmenu
Definition: win.c:66
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
long x
Definition: polytest.cpp:48
#define InitFormatEtc(fe, cf, med)
Definition: editor.h:32
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define pt(x, y)
Definition: drawing.c:79
#define TPM_LEFTALIGN
Definition: winuser.h:2352
WINE_DEFAULT_DEBUG_CHANNEL(shell)
REFIID riid
Definition: precomp.h:44
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define FO_COPY
Definition: shellapi.h:134
#define TPM_RETURNCMD
Definition: winuser.h:2362
#define _countof(array)
Definition: fontsub.cpp:30
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
WCHAR wszName[1]
Definition: shlfolder.c:1555
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
Definition: shtypes.idl:68
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
const char * fmt
Definition: wsprintf.c:30
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2144
HRESULT _CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST *apidl, BOOL bCopy)
LPWSTR pOleStr
Definition: shtypes.idl:96
#define FOF_ALLOWUNDO
Definition: shellapi.h:144
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
#define ZeroMemory
Definition: winbase.h:1642
const GUID IID_IDataObject
#define SID_IFolderView
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1283
virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1914
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST *pidl, const CIDA *cida)
Definition: pidl.c:2659
static DWORD WINAPI _DoDropThreadProc(LPVOID lpParameter)
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
#define FO_MOVE
Definition: shellapi.h:133
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
#define IDM_DRAGFILE
Definition: shresdef.h:791
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
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
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define WC_STATIC
Definition: commctrl.h:4678
unsigned int BOOL
Definition: ntddk_ex.h:94
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
#define debugstr_w
Definition: kernel32.h:32
#define SS_LEFT
Definition: pedump.c:692
#define CreateWindowEx
Definition: winuser.h:5730
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT SH_GetApidlFromDataObject(IDataObject *pDataObject, PIDLIST_ABSOLUTE *ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl)
Definition: shlfolder.cpp:327
smooth NULL
Definition: ftsmooth.c:416
#define KeyStateToDropEffect(kst)
Definition: shell32_main.h:95
#define CF_HDROP
Definition: constants.h:410
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
HRESULT _GetEffectFromMenu(IDataObject *pDataObject, POINTL pt, DWORD *pdwEffect, DWORD dwAvailableEffects)
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
static HMENU hpopupmenu
Definition: msg.c:17319
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define MK_RBUTTON
Definition: winuser.h:2343
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
UINT m_cfShellIDList
Definition: CFSDropTarget.h:32
#define D_COPY
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define WS_OVERLAPPED
Definition: pedump.c:615
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define D_MOVE
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
BOOL _QueryDrop(DWORD dwKeyState, LPDWORD pdwEffect)
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
virtual HRESULT WINAPI DragLeave()
#define WINAPI
Definition: msvc.h:6
const DWORD DROPEFFECT_LINK
Definition: oleidl.idl:932
struct CIDA * LPIDA
UINT cidl
Definition: shlobj.h:499
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define TPM_NONOTIFY
Definition: winuser.h:2361
ULONG AddRef()
#define IDM_COPYHERE
Definition: shresdef.h:792
HRESULT _RepositionItems(IShellFolderView *psfv, IDataObject *pDataObject, POINTL pt)
HRESULT _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
DWORD m_dwDefaultEffect
Definition: CFSDropTarget.h:37
LPVOID lpParameter
Definition: kernel32.h:241
#define GetFullPathName
Definition: winbase.h:3655
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
BOOL _GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut)
#define IDS_LNK_FILE
Definition: shresdef.h:166
DWORD dwKeyState
Definition: CFSDropTarget.h:77
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2621
#define wcsicmp
Definition: string.h:1152
#define SHCNF_PATHW
Definition: shlobj.h:1763
HRESULT Initialize(LPWSTR PathTarget)
#define IDM_MOVEHERE
Definition: shresdef.h:793
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
Definition: marshal.c:2100
#define S_OK
Definition: intsafe.h:59
#define WS_BORDER
Definition: pedump.c:625
static WCHAR * BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls)
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2336
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT QueryGetData([in, unique] FORMATETC *pformatetc)
virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
unsigned int UINT
Definition: ndis.h:50
#define MK_CONTROL
Definition: winuser.h:2345
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define E_UNEXPECTED
Definition: winerror.h:2456
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
GLuint res
Definition: glext.h:9613
#define TPM_LEFTBUTTON
Definition: winuser.h:2354
uint32_t * LPDWORD
Definition: typedefs.h:57
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
DWORD m_grfKeyState
Definition: CFSDropTarget.h:36
UINT op
Definition: effect.c:223
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SHCNE_CREATE
Definition: shlobj.h:1729
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define FOF_NOCONFIRMMKDIR
Definition: shellapi.h:147
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
Definition: dsound.c:943
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: shlobj.h:498