5 * Copyright 1997 Marcus Meissner
6 * Copyright 1998, 1999, 2002 Juergen Schmied
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/port.h"
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
45 #include "enumidlist.h"
47 #include "undocshell.h"
48 #include "shell32_main.h"
51 #include "shellfolder.h"
52 #include "wine/debug.h"
56 WINE_DEFAULT_DEBUG_CHANNEL (shell);
58 /***********************************************************************
59 * IShellFolder implementation
65 IShellFolder2Vtbl *lpvtblShellFolder;
66 IPersistFolder3Vtbl *lpvtblPersistFolder3;
67 IDropTargetVtbl *lpvtblDropTarget;
68 ISFHelperVtbl *lpvtblSFHelper;
70 IUnknown *pUnkOuter; /* used for aggregation */
74 /* both paths are parsible from the desktop */
75 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
77 LPITEMIDLIST pidlRoot; /* absolute pidl */
79 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
81 UINT cfShellIDList; /* clipboardformat for IDropTarget */
82 BOOL fAcceptFmt; /* flag for pending Drop */
85 static struct IUnknownVtbl unkvt;
86 static struct IShellFolder2Vtbl sfvt;
87 static struct IPersistFolder3Vtbl vt_FSFldr_PersistFolder3; /* IPersistFolder3 for a FS_Folder */
88 static struct IDropTargetVtbl dtvt;
89 static struct ISFHelperVtbl shvt;
91 #define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder)))
92 #define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset);
94 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3)))
95 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
97 #define _IPersistFolder3_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3)))
98 #define _ICOM_THIS_From_IPersistFolder3(class, name) class* This = (class*)(((char*)name)-_IPersistFolder3_Offset);
100 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
101 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
103 #define _ISFHelper_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblSFHelper)))
104 #define _ICOM_THIS_From_ISFHelper(class, name) class* This = (class*)(((char*)name)-_ISFHelper_Offset);
107 converts This to a interface pointer
109 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
110 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder)
111 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder)
112 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder3)
113 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder3)
114 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpvtblPersistFolder3)
115 #define _IPersistFolder3_(This) (IPersistFolder3*)&(This->lpvtblPersistFolder3)
116 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget)
117 #define _ISFHelper_(This) (ISFHelper*)&(This->lpvtblSFHelper)
119 /**************************************************************************
120 * registers clipboardformat once
122 static void SF_RegisterClipFmt (IGenericSFImpl * This)
124 TRACE ("(%p)\n", This);
126 if (!This->cfShellIDList) {
127 This->cfShellIDList = RegisterClipboardFormatA (CFSTR_SHELLIDLIST);
131 /**************************************************************************
132 * we need a separate IUnknown to handle aggregation
135 static HRESULT WINAPI IUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppvObj)
137 IGenericSFImpl *This = (IGenericSFImpl *)iface;
139 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
143 if (IsEqualIID (riid, &IID_IUnknown))
144 *ppvObj = _IUnknown_ (This);
145 else if (IsEqualIID (riid, &IID_IShellFolder))
146 *ppvObj = _IShellFolder_ (This);
147 else if (IsEqualIID (riid, &IID_IShellFolder2))
148 *ppvObj = _IShellFolder_ (This);
149 else if (IsEqualIID (riid, &IID_IPersist))
150 *ppvObj = _IPersist_ (This);
151 else if (IsEqualIID (riid, &IID_IPersistFolder))
152 *ppvObj = _IPersistFolder_ (This);
153 else if (IsEqualIID (riid, &IID_IPersistFolder2))
154 *ppvObj = _IPersistFolder2_ (This);
155 else if (IsEqualIID (riid, &IID_IPersistFolder3))
156 *ppvObj = _IPersistFolder3_ (This);
157 else if (IsEqualIID (riid, &IID_ISFHelper))
158 *ppvObj = _ISFHelper_ (This);
159 else if (IsEqualIID (riid, &IID_IDropTarget)) {
160 *ppvObj = _IDropTarget_ (This);
161 SF_RegisterClipFmt (This);
165 IUnknown_AddRef ((IUnknown *) (*ppvObj));
166 TRACE ("-- Interface = %p\n", *ppvObj);
169 TRACE ("-- Interface: E_NOINTERFACE\n");
170 return E_NOINTERFACE;
173 static ULONG WINAPI IUnknown_fnAddRef (IUnknown * iface)
175 IGenericSFImpl *This = (IGenericSFImpl *)iface;
177 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
179 return ++(This->ref);
182 static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
184 IGenericSFImpl *This = (IGenericSFImpl *)iface;
186 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
188 if (!--(This->ref)) {
189 TRACE ("-- destroying IShellFolder(%p)\n", This);
192 SHFree (This->pidlRoot);
193 if (This->sPathTarget)
194 SHFree (This->sPathTarget);
195 LocalFree ((HLOCAL) This);
201 static IUnknownVtbl unkvt =
203 IUnknown_fnQueryInterface,
208 static shvheader GenericSFHeader[] = {
209 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
210 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
211 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
212 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
213 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
216 #define GENERICSHELLVIEWCOLUMNS 5
218 /**************************************************************************
219 * IFSFolder_Constructor
222 * creating undocumented ShellFS_Folder as part of an aggregation
223 * {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
226 HRESULT WINAPI IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
230 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
232 if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
233 return CLASS_E_NOAGGREGATION;
234 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
236 return E_OUTOFMEMORY;
240 sf->lpvtblShellFolder = &sfvt;
241 sf->lpvtblPersistFolder3 = &vt_FSFldr_PersistFolder3;
242 sf->lpvtblDropTarget = &dtvt;
243 sf->lpvtblSFHelper = &shvt;
244 sf->pclsid = (CLSID *) & CLSID_ShellFSFolder;
245 sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_ (sf);
247 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
248 IUnknown_Release (_IUnknown_ (sf));
249 return E_NOINTERFACE;
252 TRACE ("--%p\n", *ppv);
256 /**************************************************************************
257 * IShellFolder_fnQueryInterface
260 * REFIID riid [in ] Requested InterfaceID
261 * LPVOID* ppvObject [out] Interface* to hold the result
263 static HRESULT WINAPI IShellFolder_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
265 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
267 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
269 return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
272 /**************************************************************************
273 * IShellFolder_AddRef
276 static ULONG WINAPI IShellFolder_fnAddRef (IShellFolder2 * iface)
278 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
280 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
282 return IUnknown_AddRef (This->pUnkOuter);
285 /**************************************************************************
286 * IShellFolder_fnRelease
288 static ULONG WINAPI IShellFolder_fnRelease (IShellFolder2 * iface)
290 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
292 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
294 return IUnknown_Release (This->pUnkOuter);
297 /**************************************************************************
298 * IShellFolder_ParseDisplayName {SHELL32}
300 * Parse a display name.
303 * hwndOwner [in] Parent window for any message's
304 * pbc [in] optional FileSystemBindData context
305 * lpszDisplayName [in] Unicode displayname.
306 * pchEaten [out] (unicode) characters processed
307 * ppidl [out] complex pidl to item
308 * pdwAttributes [out] items attributes
311 * Every folder tries to parse only its own (the leftmost) pidl and creates a
312 * subfolder to evaluate the remaining parts.
313 * Now we can parse into namespaces implemented by shell extensions
315 * Behaviour on win98: lpszDisplayName=NULL -> crash
316 * lpszDisplayName="" -> returns mycoputer-pidl
319 * pdwAttributes is not set
320 * pchEaten is not set like in windows
322 static HRESULT WINAPI
323 IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
326 LPOLESTR lpszDisplayName,
327 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
329 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
331 HRESULT hr = E_INVALIDARG;
332 LPCWSTR szNext = NULL;
333 WCHAR szElement[MAX_PATH];
334 CHAR szPath[MAX_PATH];
335 LPITEMIDLIST pidlTemp = NULL;
338 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
339 This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
341 if (!lpszDisplayName || !ppidl)
345 *pchEaten = 0; /* strange but like the original */
347 if (*lpszDisplayName) {
348 /* get the next element */
349 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
351 /* build the full pathname to the element */
352 lstrcpyA(szPath, This->sPathTarget);
353 PathAddBackslashA(szPath);
354 len = lstrlenA(szPath);
355 WideCharToMultiByte(CP_ACP, 0, szElement, -1, szPath + len, MAX_PATH - len, NULL, NULL);
358 hr = _ILCreateFromPathA(szPath, &pidlTemp);
361 if (szNext && *szNext) {
362 /* try to analyse the next element */
363 hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
365 /* it's the last element */
366 if (pdwAttributes && *pdwAttributes) {
367 hr = SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
378 TRACE ("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl ? *ppidl : 0, hr);
383 /**************************************************************************
384 * IShellFolder_fnEnumObjects
386 * HWND hwndOwner, //[in ] Parent Window
387 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
388 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
390 static HRESULT WINAPI
391 IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
393 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
395 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
397 *ppEnumIDList = IEnumIDList_Constructor();
399 CreateFolderEnumList(*ppEnumIDList, This->sPathTarget, dwFlags);
401 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
403 return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
406 /**************************************************************************
407 * IShellFolder_fnBindToObject
409 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
410 * LPBC pbc, //[in ] optional FileSystemBindData context
411 * REFIID riid, //[in ] Initial Interface
412 * LPVOID* ppvObject //[out] Interface*
414 static HRESULT WINAPI
415 IShellFolder_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, LPVOID * ppvOut)
417 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
419 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbc, shdebugstr_guid (riid), ppvOut);
421 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
424 /**************************************************************************
425 * IShellFolder_fnBindToStorage
427 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
428 * LPBC pbc, //[in ] reserved
429 * REFIID riid, //[in ] Initial storage interface
430 * LPVOID* ppvObject //[out] Interface* returned
432 static HRESULT WINAPI
433 IShellFolder_fnBindToStorage (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
435 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
437 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
443 /**************************************************************************
444 * IShellFolder_fnCompareIDs
447 static HRESULT WINAPI
448 IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
450 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
454 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
455 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
456 TRACE ("-- %i\n", nReturn);
460 /**************************************************************************
461 * IShellFolder_fnCreateViewObject
463 static HRESULT WINAPI
464 IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
466 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
468 LPSHELLVIEW pShellView;
469 HRESULT hr = E_INVALIDARG;
471 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
476 if (IsEqualIID (riid, &IID_IDropTarget)) {
477 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, ppvOut);
478 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
479 FIXME ("IContextMenu not implemented\n");
481 } else if (IsEqualIID (riid, &IID_IShellView)) {
482 pShellView = IShellView_Constructor ((IShellFolder *) iface);
484 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
485 IShellView_Release (pShellView);
489 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
493 /**************************************************************************
494 * IShellFolder_fnGetAttributesOf
497 * UINT cidl, //[in ] num elements in pidl array
498 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
499 * ULONG* rgfInOut) //[out] result array
502 static HRESULT WINAPI
503 IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
505 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
509 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
511 if ((!cidl) || (!apidl) || (!rgfInOut))
517 while (cidl > 0 && *apidl) {
519 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
524 TRACE ("-- result=0x%08lx\n", *rgfInOut);
529 /**************************************************************************
530 * IShellFolder_fnGetUIObjectOf
533 * HWND hwndOwner, //[in ] Parent window for any output
534 * UINT cidl, //[in ] array size
535 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
536 * REFIID riid, //[in ] Requested Interface
537 * UINT* prgfInOut, //[ ] reserved
538 * LPVOID* ppvObject) //[out] Resulting Interface
541 * This function gets asked to return "view objects" for one or more (multiple select)
543 * The viewobject typically is an COM object with one of the following interfaces:
544 * IExtractIcon,IDataObject,IContextMenu
545 * In order to support icon positions in the default Listview your DataObject
546 * must implement the SetData method (in addition to GetData :) - the shell passes
547 * a barely documented "Icon positions" structure to SetData when the drag starts,
548 * and GetData's it if the drop is in another explorer window that needs the positions.
550 static HRESULT WINAPI
551 IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
553 UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
555 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
558 IUnknown *pObj = NULL;
559 HRESULT hr = E_INVALIDARG;
561 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
562 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
567 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
568 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
570 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
571 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
573 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
574 pidl = ILCombine (This->pidlRoot, apidl[0]);
575 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
578 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
579 pidl = ILCombine (This->pidlRoot, apidl[0]);
580 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
583 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
584 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
585 } else if ((IsEqualIID(riid,&IID_IShellLinkW) || IsEqualIID(riid,&IID_IShellLinkA))
587 pidl = ILCombine (This->pidlRoot, apidl[0]);
588 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
594 if (SUCCEEDED(hr) && !pObj)
599 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
603 void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
605 /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
606 if (!(dwFlags & SHGDN_FORPARSING) &&
607 ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
610 DWORD dwDataSize = sizeof (DWORD);
611 BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
613 if (!RegCreateKeyExA (HKEY_CURRENT_USER,
614 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
615 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
616 if (!RegQueryValueExA (hKey, "HideFileExt", 0, 0, (LPBYTE) & dwData, &dwDataSize))
623 LPSTR ext = PathFindExtensionA(szPath);
627 char classname[MAX_PATH];
628 LONG classlen = MAX_PATH;
630 if (!RegQueryValueA(HKEY_CLASSES_ROOT, ext, classname, &classlen))
631 if (!RegOpenKeyA(HKEY_CLASSES_ROOT, classname, &hkey)) {
632 if (!RegQueryValueExA(hkey, "NeverShowExt", 0, NULL, NULL, NULL))
640 if (doHide && szPath[0] != '.')
641 PathRemoveExtensionA (szPath);
645 /**************************************************************************
646 * IShellFolder_fnGetDisplayNameOf
647 * Retrieves the display name for the specified file object or subfolder
650 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
651 * DWORD dwFlags, //[in ] SHGNO formatting flags
652 * LPSTRRET lpName) //[out] Returned display name
655 * if the name is in the pidl the ret value should be a STRRET_OFFSET
658 static HRESULT WINAPI
659 IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
661 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
663 CHAR szPath[MAX_PATH];
669 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
672 if (!pidl || !strRet)
675 bSimplePidl = _ILIsPidlSimple (pidl);
677 /* take names of special folders only if its only this folder */
678 if (_ILIsSpecialFolder (pidl)) {
680 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
682 FIXME ("special pidl\n");
685 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sPathTarget) {
686 lstrcpyA (szPath, This->sPathTarget); /* get path to root */
687 PathAddBackslashA (szPath);
688 len = lstrlenA (szPath);
690 _ILSimpleGetText (pidl, szPath + len, MAX_PATH - len); /* append my own path */
692 if (!_ILIsFolder(pidl))
693 SHELL_FS_ProcessDisplayFilename(szPath, dwFlags);
696 if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */
697 PathAddBackslashA (szPath);
698 len = lstrlenA (szPath);
701 (SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len)))
702 return E_OUTOFMEMORY;
704 strRet->uType = STRRET_CSTR;
705 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
707 TRACE ("-- (%p)->(%s)\n", This, szPath);
711 /**************************************************************************
712 * IShellFolder_fnSetNameOf
713 * Changes the name of a file object or subfolder, possibly changing its item
714 * identifier in the process.
717 * HWND hwndOwner, //[in ] Owner window for output
718 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
719 * LPCOLESTR lpszName, //[in ] the items new display name
720 * DWORD dwFlags, //[in ] SHGNO formatting flags
721 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
723 static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
724 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
726 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
727 char szSrc[MAX_PATH],
730 BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
732 TRACE ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
734 /* build source path */
735 if (dwFlags & SHGDN_INFOLDER) {
736 strcpy (szSrc, This->sPathTarget);
737 PathAddBackslashA (szSrc);
738 len = strlen (szSrc);
739 _ILSimpleGetText (pidl, szSrc + len, MAX_PATH - len);
741 /* FIXME: Can this work with a simple PIDL? */
742 SHGetPathFromIDListA (pidl, szSrc);
745 /* build destination path */
746 strcpy (szDest, This->sPathTarget);
747 PathAddBackslashA (szDest);
748 len = strlen (szDest);
749 WideCharToMultiByte (CP_ACP, 0, lpName, -1, szDest + len, MAX_PATH - len, NULL, NULL);
750 szDest[MAX_PATH - 1] = 0;
751 TRACE ("src=%s dest=%s\n", szSrc, szDest);
752 if (MoveFileA (szSrc, szDest)) {
756 hr = _ILCreateFromPathA(szDest, pPidlOut);
758 SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest);
766 static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
768 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
769 FIXME ("(%p)\n", This);
772 static HRESULT WINAPI IShellFolder_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
774 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
775 FIXME ("(%p)\n", This);
778 static HRESULT WINAPI
779 IShellFolder_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
781 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
783 TRACE ("(%p)\n", This);
792 static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
794 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
796 TRACE ("(%p)\n", This);
798 if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
801 *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
805 static HRESULT WINAPI
806 IShellFolder_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
808 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
809 FIXME ("(%p)\n", This);
813 static HRESULT WINAPI
814 IShellFolder_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
816 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
819 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
821 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
825 /* the header titles */
826 psd->fmt = GenericSFHeader[iColumn].fmt;
827 psd->cxChar = GenericSFHeader[iColumn].cxChar;
828 psd->str.uType = STRRET_CSTR;
829 LoadStringA (shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
832 /* the data from the pidl */
835 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
838 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
841 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
844 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
846 case 4: /* attributes */
847 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
851 psd->str.uType = STRRET_CSTR;
856 static HRESULT WINAPI IShellFolder_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
858 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
859 FIXME ("(%p)\n", This);
863 static IShellFolder2Vtbl sfvt =
865 IShellFolder_fnQueryInterface,
866 IShellFolder_fnAddRef,
867 IShellFolder_fnRelease,
868 IShellFolder_fnParseDisplayName,
869 IShellFolder_fnEnumObjects,
870 IShellFolder_fnBindToObject,
871 IShellFolder_fnBindToStorage,
872 IShellFolder_fnCompareIDs,
873 IShellFolder_fnCreateViewObject,
874 IShellFolder_fnGetAttributesOf,
875 IShellFolder_fnGetUIObjectOf,
876 IShellFolder_fnGetDisplayNameOf,
877 IShellFolder_fnSetNameOf,
879 IShellFolder_fnGetDefaultSearchGUID,
880 IShellFolder_fnEnumSearches,
881 IShellFolder_fnGetDefaultColumn,
882 IShellFolder_fnGetDefaultColumnState,
883 IShellFolder_fnGetDetailsEx,
884 IShellFolder_fnGetDetailsOf,
885 IShellFolder_fnMapColumnToSCID
888 /****************************************************************************
889 * ISFHelper for IShellFolder implementation
892 static HRESULT WINAPI ISFHelper_fnQueryInterface (ISFHelper * iface, REFIID riid, LPVOID * ppvObj)
894 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
896 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
898 return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
901 static ULONG WINAPI ISFHelper_fnAddRef (ISFHelper * iface)
903 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
905 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
907 return IUnknown_AddRef (This->pUnkOuter);
910 static ULONG WINAPI ISFHelper_fnRelease (ISFHelper * iface)
912 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
914 TRACE ("(%p)\n", This);
916 return IUnknown_Release (This->pUnkOuter);
919 /****************************************************************************
920 * ISFHelper_fnAddFolder
922 * creates a unique folder name
925 static HRESULT WINAPI ISFHelper_fnGetUniqueName (ISFHelper * iface, LPSTR lpName, UINT uLen)
927 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface)
930 char szText[MAX_PATH];
931 char *szNewFolder = "New Folder";
933 TRACE ("(%p)(%s %u)\n", This, lpName, uLen);
935 if (uLen < strlen (szNewFolder) + 4)
938 strcpy (lpName, szNewFolder);
940 hr = IShellFolder_fnEnumObjects (_IShellFolder2_ (This), 0,
941 SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum);
947 next:IEnumIDList_Reset (penum);
948 while (S_OK == IEnumIDList_Next (penum, 1, &pidl, &dwFetched) && dwFetched) {
949 _ILSimpleGetText (pidl, szText, MAX_PATH);
950 if (0 == strcasecmp (szText, lpName)) {
951 sprintf (lpName, "%s %d", szNewFolder, i++);
960 IEnumIDList_Release (penum);
965 /****************************************************************************
966 * ISFHelper_fnAddFolder
971 static HRESULT WINAPI ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCSTR lpName, LPITEMIDLIST * ppidlOut)
973 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface)
974 char lpstrNewDir[MAX_PATH];
976 HRESULT hres = E_FAIL;
978 TRACE ("(%p)(%s %p)\n", This, lpName, ppidlOut);
980 strcpy (lpstrNewDir, This->sPathTarget);
981 PathAppendA(lpstrNewDir, lpName);
983 bRes = CreateDirectoryA (lpstrNewDir, NULL);
985 SHChangeNotify (SHCNE_MKDIR, SHCNF_PATHA, lpstrNewDir, NULL);
990 hres = _ILCreateFromPathA(lpstrNewDir, ppidlOut);
992 char lpstrText[128 + MAX_PATH];
993 char lpstrTempText[128];
994 char lpstrCaption[256];
996 /* Cannot Create folder because of permissions */
997 LoadStringA (shell32_hInstance, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof (lpstrTempText));
998 LoadStringA (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, lpstrCaption, sizeof (lpstrCaption));
999 sprintf (lpstrText, lpstrTempText, lpstrNewDir);
1000 MessageBoxA (hwnd, lpstrText, lpstrCaption, MB_OK | MB_ICONEXCLAMATION);
1006 /****************************************************************************
1007 * ISFHelper_fnDeleteItems
1009 * deletes items in folder
1011 static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
1013 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface)
1015 char szPath[MAX_PATH];
1016 BOOL bConfirm = TRUE;
1018 TRACE ("(%p)(%u %p)\n", This, cidl, apidl);
1020 /* deleting multiple items so give a slightly different warning */
1024 snprintf (tmp, sizeof (tmp), "%d", cidl);
1025 if (!SHELL_ConfirmDialog(ASK_DELETE_MULTIPLE_ITEM, tmp))
1030 for (i = 0; i < cidl; i++) {
1031 strcpy (szPath, This->sPathTarget);
1032 PathAddBackslashA (szPath);
1033 _ILSimpleGetText (apidl[i], szPath + strlen (szPath), MAX_PATH);
1035 if (_ILIsFolder (apidl[i])) {
1038 TRACE ("delete %s\n", szPath);
1039 if (!SHELL_DeleteDirectoryA (szPath, bConfirm)) {
1040 TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm);
1043 pidl = ILCombine (This->pidlRoot, apidl[i]);
1044 SHChangeNotify (SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL);
1046 } else if (_ILIsValue (apidl[i])) {
1049 TRACE ("delete %s\n", szPath);
1050 if (!SHELL_DeleteFileA (szPath, bConfirm)) {
1051 TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm);
1054 pidl = ILCombine (This->pidlRoot, apidl[i]);
1055 SHChangeNotify (SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL);
1063 /****************************************************************************
1064 * ISFHelper_fnCopyItems
1066 * copies items to this folder
1068 static HRESULT WINAPI
1069 ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, LPCITEMIDLIST * apidl)
1072 IPersistFolder2 *ppf2 = NULL;
1073 char szSrcPath[MAX_PATH],
1074 szDstPath[MAX_PATH];
1076 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
1078 TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);
1080 IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2, (LPVOID *) & ppf2);
1084 if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2, &pidl))) {
1085 for (i = 0; i < cidl; i++) {
1086 SHGetPathFromIDListA (pidl, szSrcPath);
1087 PathAddBackslashA (szSrcPath);
1088 _ILSimpleGetText (apidl[i], szSrcPath + strlen (szSrcPath), MAX_PATH);
1090 strcpy (szDstPath, This->sPathTarget);
1091 PathAddBackslashA (szDstPath);
1092 _ILSimpleGetText (apidl[i], szDstPath + strlen (szDstPath), MAX_PATH);
1093 MESSAGE ("would copy %s to %s\n", szSrcPath, szDstPath);
1097 IPersistFolder2_Release (ppf2);
1102 static ISFHelperVtbl shvt =
1104 ISFHelper_fnQueryInterface,
1106 ISFHelper_fnRelease,
1107 ISFHelper_fnGetUniqueName,
1108 ISFHelper_fnAddFolder,
1109 ISFHelper_fnDeleteItems,
1110 ISFHelper_fnCopyItems
1113 /************************************************************************
1114 * IFSFldr_PersistFolder3_QueryInterface
1117 static HRESULT WINAPI IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3 * iface, REFIID iid, LPVOID * ppvObj)
1119 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1121 TRACE ("(%p)\n", This);
1123 return IUnknown_QueryInterface (This->pUnkOuter, iid, ppvObj);
1126 /************************************************************************
1127 * IFSFldr_PersistFolder3_AddRef
1130 static ULONG WINAPI IFSFldr_PersistFolder3_AddRef (IPersistFolder3 * iface)
1132 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1134 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
1136 return IUnknown_AddRef (This->pUnkOuter);
1139 /************************************************************************
1140 * IFSFldr_PersistFolder3_Release
1143 static ULONG WINAPI IFSFldr_PersistFolder3_Release (IPersistFolder3 * iface)
1145 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1147 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
1149 return IUnknown_Release (This->pUnkOuter);
1152 /************************************************************************
1153 * IFSFldr_PersistFolder3_GetClassID
1155 static HRESULT WINAPI IFSFldr_PersistFolder3_GetClassID (IPersistFolder3 * iface, CLSID * lpClassId)
1157 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1159 TRACE ("(%p)\n", This);
1163 *lpClassId = *This->pclsid;
1168 /************************************************************************
1169 * IFSFldr_PersistFolder3_Initialize
1172 * sPathTarget is not set. Don't know how to handle in a non rooted environment.
1174 static HRESULT WINAPI IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl)
1176 char sTemp[MAX_PATH];
1178 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1180 TRACE ("(%p)->(%p)\n", This, pidl);
1183 SHFree (This->pidlRoot); /* free the old pidl */
1184 This->pidlRoot = ILClone (pidl); /* set my pidl */
1186 if (This->sPathTarget)
1187 SHFree (This->sPathTarget);
1190 if (SHGetPathFromIDListA (pidl, sTemp)) {
1191 This->sPathTarget = SHAlloc (strlen (sTemp) + 1);
1192 strcpy (This->sPathTarget, sTemp);
1195 TRACE ("--(%p)->(%s)\n", This, This->sPathTarget);
1199 /**************************************************************************
1200 * IFSFldr_PersistFolder3_GetCurFolder
1202 static HRESULT WINAPI IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3 * iface, LPITEMIDLIST * pidl)
1204 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1206 TRACE ("(%p)->(%p)\n", This, pidl);
1208 if (!pidl) return E_POINTER;
1209 *pidl = ILClone (This->pidlRoot);
1213 /**************************************************************************
1214 * IFSFldr_PersistFolder3_InitializeEx
1216 * FIXME: errorhandling
1218 static HRESULT WINAPI
1219 IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
1220 IBindCtx * pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO * ppfti)
1222 char sTemp[MAX_PATH];
1224 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1226 TRACE ("(%p)->(%p,%p,%p)\n", This, pbc, pidlRoot, ppfti);
1228 TRACE ("--%p %s %s 0x%08lx 0x%08x\n",
1229 ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
1230 debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes, ppfti->csidl);
1233 if (ppfti && ppfti->pidlTargetFolder)
1234 pdump (ppfti->pidlTargetFolder);
1237 __SHFreeAndNil (&This->pidlRoot); /* free the old */
1238 if (This->sPathTarget)
1239 __SHFreeAndNil (&This->sPathTarget);
1242 * Root path and pidl
1244 This->pidlRoot = ILClone (pidlRoot);
1247 * the target folder is spezified in csidl OR pidlTargetFolder OR szTargetParsingName
1250 if (ppfti->csidl != -1) {
1251 if (SHGetSpecialFolderPathA (0, sTemp, ppfti->csidl, ppfti->csidl & CSIDL_FLAG_CREATE)) {
1252 __SHCloneStrA (&This->sPathTarget, sTemp);
1254 } else if (ppfti->szTargetParsingName[0]) {
1255 __SHCloneStrWtoA (&This->sPathTarget, ppfti->szTargetParsingName);
1256 } else if (ppfti->pidlTargetFolder) {
1257 if (SHGetPathFromIDListA (ppfti->pidlTargetFolder, sTemp)) {
1258 __SHCloneStrA (&This->sPathTarget, sTemp);
1263 TRACE ("--(%p)->(target=%s)\n", This, debugstr_a (This->sPathTarget));
1264 pdump (This->pidlRoot);
1265 return (This->sPathTarget) ? S_OK : E_FAIL;
1268 static HRESULT WINAPI
1269 IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3 * iface, PERSIST_FOLDER_TARGET_INFO * ppfti)
1271 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1272 FIXME ("(%p)->(%p)\n", This, ppfti);
1273 ZeroMemory (ppfti, sizeof (ppfti));
1277 static IPersistFolder3Vtbl vt_FSFldr_PersistFolder3 =
1279 IFSFldr_PersistFolder3_QueryInterface,
1280 IFSFldr_PersistFolder3_AddRef,
1281 IFSFldr_PersistFolder3_Release,
1282 IFSFldr_PersistFolder3_GetClassID,
1283 IFSFldr_PersistFolder3_Initialize,
1284 IFSFldr_PersistFolder3_fnGetCurFolder,
1285 IFSFldr_PersistFolder3_InitializeEx,
1286 IFSFldr_PersistFolder3_GetFolderTargetInfo
1289 /****************************************************************************
1290 * ISFDropTarget implementation
1292 static BOOL ISFDropTarget_QueryDrop (IDropTarget * iface, DWORD dwKeyState, LPDWORD pdwEffect)
1294 DWORD dwEffect = *pdwEffect;
1296 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1298 *pdwEffect = DROPEFFECT_NONE;
1300 if (This->fAcceptFmt) { /* Does our interpretation of the keystate ... */
1301 *pdwEffect = KeyStateToDropEffect (dwKeyState);
1303 /* ... matches the desired effect ? */
1304 if (dwEffect & *pdwEffect) {
1311 static HRESULT WINAPI ISFDropTarget_QueryInterface (IDropTarget * iface, REFIID riid, LPVOID * ppvObj)
1313 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1315 TRACE ("(%p)\n", This);
1317 return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
1320 static ULONG WINAPI ISFDropTarget_AddRef (IDropTarget * iface)
1322 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1324 TRACE ("(%p)\n", This);
1326 return IUnknown_AddRef (This->pUnkOuter);
1329 static ULONG WINAPI ISFDropTarget_Release (IDropTarget * iface)
1331 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1333 TRACE ("(%p)\n", This);
1335 return IUnknown_Release (This->pUnkOuter);
1338 static HRESULT WINAPI
1339 ISFDropTarget_DragEnter (IDropTarget * iface, IDataObject * pDataObject, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
1343 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1345 TRACE ("(%p)->(DataObject=%p)\n", This, pDataObject);
1347 InitFormatEtc (fmt, This->cfShellIDList, TYMED_HGLOBAL);
1349 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData (pDataObject, &fmt)) ? TRUE : FALSE;
1351 ISFDropTarget_QueryDrop (iface, dwKeyState, pdwEffect);
1356 static HRESULT WINAPI ISFDropTarget_DragOver (IDropTarget * iface, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
1358 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1360 TRACE ("(%p)\n", This);
1363 return E_INVALIDARG;
1365 ISFDropTarget_QueryDrop (iface, dwKeyState, pdwEffect);
1370 static HRESULT WINAPI ISFDropTarget_DragLeave (IDropTarget * iface)
1372 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1374 TRACE ("(%p)\n", This);
1376 This->fAcceptFmt = FALSE;
1381 static HRESULT WINAPI
1382 ISFDropTarget_Drop (IDropTarget * iface, IDataObject * pDataObject, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
1384 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1386 FIXME ("(%p) object dropped\n", This);
1391 static struct IDropTargetVtbl dtvt = {
1392 ISFDropTarget_QueryInterface,
1393 ISFDropTarget_AddRef,
1394 ISFDropTarget_Release,
1395 ISFDropTarget_DragEnter,
1396 ISFDropTarget_DragOver,
1397 ISFDropTarget_DragLeave,