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"
30 #define NONAMELESSUNION
31 #define NONAMELESSSTRUCT
40 #include "undocshell.h"
41 #include "shell32_main.h"
44 #include "shellfolder.h"
45 #include "wine/debug.h"
49 WINE_DEFAULT_DEBUG_CHANNEL (shell);
51 /***********************************************************************
52 * IShellFolder implementation
56 ICOM_VFIELD (IUnknown);
58 ICOM_VTABLE (IShellFolder2) * lpvtblShellFolder;
59 ICOM_VTABLE (IPersistFolder3) * lpvtblPersistFolder3;
60 ICOM_VTABLE (IDropTarget) * lpvtblDropTarget;
61 ICOM_VTABLE (ISFHelper) * lpvtblSFHelper;
63 IUnknown *pUnkOuter; /* used for aggregation */
67 /* both paths are parsible from the desktop */
68 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
70 LPITEMIDLIST pidlRoot; /* absolute pidl */
72 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
74 UINT cfShellIDList; /* clipboardformat for IDropTarget */
75 BOOL fAcceptFmt; /* flag for pending Drop */
78 static struct ICOM_VTABLE (IUnknown) unkvt;
79 static struct ICOM_VTABLE (IShellFolder2) sfvt;
80 static struct ICOM_VTABLE (IPersistFolder3) vt_FSFldr_PersistFolder3; /* IPersistFolder3 for a FS_Folder */
81 static struct ICOM_VTABLE (IDropTarget) dtvt;
82 static struct ICOM_VTABLE (ISFHelper) shvt;
84 #define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder)))
85 #define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset);
87 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3)))
88 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
90 #define _IPersistFolder3_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3)))
91 #define _ICOM_THIS_From_IPersistFolder3(class, name) class* This = (class*)(((char*)name)-_IPersistFolder3_Offset);
93 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
94 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
96 #define _ISFHelper_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblSFHelper)))
97 #define _ICOM_THIS_From_ISFHelper(class, name) class* This = (class*)(((char*)name)-_ISFHelper_Offset);
100 converts This to a interface pointer
102 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
103 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder)
104 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder)
105 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder3)
106 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder3)
107 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpvtblPersistFolder3)
108 #define _IPersistFolder3_(This) (IPersistFolder3*)&(This->lpvtblPersistFolder3)
109 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget)
110 #define _ISFHelper_(This) (ISFHelper*)&(This->lpvtblSFHelper)
112 /**************************************************************************
113 * registers clipboardformat once
115 static void SF_RegisterClipFmt (IGenericSFImpl * This)
117 TRACE ("(%p)\n", This);
119 if (!This->cfShellIDList) {
120 This->cfShellIDList = RegisterClipboardFormatA (CFSTR_SHELLIDLIST);
124 /**************************************************************************
125 * we need a separate IUnknown to handle aggregation
128 static HRESULT WINAPI IUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppvObj)
130 ICOM_THIS (IGenericSFImpl, iface);
132 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
136 if (IsEqualIID (riid, &IID_IUnknown))
137 *ppvObj = _IUnknown_ (This);
138 else if (IsEqualIID (riid, &IID_IShellFolder))
139 *ppvObj = _IShellFolder_ (This);
140 else if (IsEqualIID (riid, &IID_IShellFolder2))
141 *ppvObj = _IShellFolder_ (This);
142 else if (IsEqualIID (riid, &IID_IPersist))
143 *ppvObj = _IPersist_ (This);
144 else if (IsEqualIID (riid, &IID_IPersistFolder))
145 *ppvObj = _IPersistFolder_ (This);
146 else if (IsEqualIID (riid, &IID_IPersistFolder2))
147 *ppvObj = _IPersistFolder2_ (This);
148 else if (IsEqualIID (riid, &IID_IPersistFolder3))
149 *ppvObj = _IPersistFolder3_ (This);
150 else if (IsEqualIID (riid, &IID_ISFHelper))
151 *ppvObj = _ISFHelper_ (This);
152 else if (IsEqualIID (riid, &IID_IDropTarget)) {
153 *ppvObj = _IDropTarget_ (This);
154 SF_RegisterClipFmt (This);
158 IUnknown_AddRef ((IUnknown *) (*ppvObj));
159 TRACE ("-- Interface = %p\n", *ppvObj);
162 TRACE ("-- Interface: E_NOINTERFACE\n");
163 return E_NOINTERFACE;
166 static ULONG WINAPI IUnknown_fnAddRef (IUnknown * iface)
168 ICOM_THIS (IGenericSFImpl, iface);
170 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
172 return ++(This->ref);
175 static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
177 ICOM_THIS (IGenericSFImpl, iface);
179 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
181 if (!--(This->ref)) {
182 TRACE ("-- destroying IShellFolder(%p)\n", This);
185 SHFree (This->pidlRoot);
186 if (This->sPathTarget)
187 SHFree (This->sPathTarget);
188 LocalFree ((HLOCAL) This);
194 static ICOM_VTABLE (IUnknown) unkvt =
196 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IUnknown_fnQueryInterface,
201 static shvheader GenericSFHeader[] = {
202 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
203 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
204 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
205 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
206 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
209 #define GENERICSHELLVIEWCOLUMNS 5
211 /**************************************************************************
212 * IFSFolder_Constructor
215 * creating undocumented ShellFS_Folder as part of an aggregation
216 * {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
219 HRESULT WINAPI IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
223 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
225 if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
226 return CLASS_E_NOAGGREGATION;
227 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
229 return E_OUTOFMEMORY;
232 ICOM_VTBL (sf) = &unkvt;
233 sf->lpvtblShellFolder = &sfvt;
234 sf->lpvtblPersistFolder3 = &vt_FSFldr_PersistFolder3;
235 sf->lpvtblDropTarget = &dtvt;
236 sf->lpvtblSFHelper = &shvt;
237 sf->pclsid = (CLSID *) & CLSID_ShellFSFolder;
238 sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_ (sf);
240 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
241 IUnknown_Release (_IUnknown_ (sf));
242 return E_NOINTERFACE;
245 TRACE ("--%p\n", *ppv);
249 /**************************************************************************
250 * IShellFolder_fnQueryInterface
253 * REFIID riid [in ] Requested InterfaceID
254 * LPVOID* ppvObject [out] Interface* to hold the result
256 static HRESULT WINAPI IShellFolder_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
258 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
260 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
262 return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
265 /**************************************************************************
266 * IShellFolder_AddRef
269 static ULONG WINAPI IShellFolder_fnAddRef (IShellFolder2 * iface)
271 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
273 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
275 return IUnknown_AddRef (This->pUnkOuter);
278 /**************************************************************************
279 * IShellFolder_fnRelease
281 static ULONG WINAPI IShellFolder_fnRelease (IShellFolder2 * iface)
283 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
285 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
287 return IUnknown_Release (This->pUnkOuter);
290 /**************************************************************************
291 * IShellFolder_fnParseDisplayName
293 * HWND hwndOwner, //[in ] Parent window for any message's
294 * LPBC pbc, //[in ] reserved
295 * LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
296 * ULONG* pchEaten, //[out] (unicode) characters processed
297 * LPITEMIDLIST* ppidl, //[out] complex pidl to item
298 * ULONG* pdwAttributes //[out] items attributes
301 * every folder tries to parse only its own (the leftmost) pidl and creates a
302 * subfolder to evaluate the remaining parts
303 * now we can parse into namespaces implemented by shell extensions
305 * behaviour on win98: lpszDisplayName=NULL -> chrash
306 * lpszDisplayName="" -> returns mycoputer-pidl
309 * pdwAttributes: not set
310 * pchEaten: not set like in windows
312 static HRESULT WINAPI
313 IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
316 LPOLESTR lpszDisplayName,
317 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
319 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
321 HRESULT hr = E_OUTOFMEMORY;
322 LPCWSTR szNext = NULL;
323 WCHAR szElement[MAX_PATH];
324 CHAR szTempA[MAX_PATH],
326 LPITEMIDLIST pidlTemp = NULL;
328 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
329 This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
331 if (!lpszDisplayName || !ppidl)
335 *pchEaten = 0; /* strange but like the original */
337 if (*lpszDisplayName) {
338 /* get the next element */
339 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
341 /* build the full pathname to the element */
342 WideCharToMultiByte (CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL);
343 lstrcpyA (szPath, This->sPathTarget);
344 PathAddBackslashA (szPath);
345 lstrcatA (szPath, szTempA);
348 pidlTemp = SHSimpleIDListFromPathA (szPath);
351 if (szNext && *szNext) {
352 /* try to analyse the next element */
353 hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
355 /* it's the last element */
356 if (pdwAttributes && *pdwAttributes) {
357 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
369 TRACE ("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl ? *ppidl : 0, hr);
374 /**************************************************************************
375 * IShellFolder_fnEnumObjects
377 * HWND hwndOwner, //[in ] Parent Window
378 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
379 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
381 static HRESULT WINAPI
382 IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
384 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
386 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
388 *ppEnumIDList = IEnumIDList_Constructor (This->sPathTarget, dwFlags, EIDL_FILE);
390 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
392 return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
395 /**************************************************************************
396 * IShellFolder_fnBindToObject
398 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
399 * LPBC pbc, //[in ] reserved
400 * REFIID riid, //[in ] Initial Interface
401 * LPVOID* ppvObject //[out] Interface*
403 static HRESULT WINAPI
404 IShellFolder_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
406 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
408 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
410 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
413 /**************************************************************************
414 * IShellFolder_fnBindToStorage
416 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
417 * LPBC pbc, //[in ] reserved
418 * REFIID riid, //[in ] Initial storage interface
419 * LPVOID* ppvObject //[out] Interface* returned
421 static HRESULT WINAPI
422 IShellFolder_fnBindToStorage (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
424 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
426 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
432 /**************************************************************************
433 * IShellFolder_fnCompareIDs
436 static HRESULT WINAPI
437 IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
439 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
443 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
444 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
445 TRACE ("-- %i\n", nReturn);
449 /**************************************************************************
450 * IShellFolder_fnCreateViewObject
452 static HRESULT WINAPI
453 IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
455 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
457 LPSHELLVIEW pShellView;
458 HRESULT hr = E_INVALIDARG;
460 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
465 if (IsEqualIID (riid, &IID_IDropTarget)) {
466 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, ppvOut);
467 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
468 FIXME ("IContextMenu not implemented\n");
470 } else if (IsEqualIID (riid, &IID_IShellView)) {
471 pShellView = IShellView_Constructor ((IShellFolder *) iface);
473 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
474 IShellView_Release (pShellView);
478 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
482 /**************************************************************************
483 * IShellFolder_fnGetAttributesOf
486 * UINT cidl, //[in ] num elements in pidl array
487 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
488 * ULONG* rgfInOut) //[out] result array
491 static HRESULT WINAPI
492 IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
494 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
498 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
500 if ((!cidl) || (!apidl) || (!rgfInOut))
503 while (cidl > 0 && *apidl) {
505 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
510 TRACE ("-- result=0x%08lx\n", *rgfInOut);
515 /**************************************************************************
516 * IShellFolder_fnGetUIObjectOf
519 * HWND hwndOwner, //[in ] Parent window for any output
520 * UINT cidl, //[in ] array size
521 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
522 * REFIID riid, //[in ] Requested Interface
523 * UINT* prgfInOut, //[ ] reserved
524 * LPVOID* ppvObject) //[out] Resulting Interface
527 * This function gets asked to return "view objects" for one or more (multiple select)
529 * The viewobject typically is an COM object with one of the following interfaces:
530 * IExtractIcon,IDataObject,IContextMenu
531 * In order to support icon positions in the default Listview your DataObject
532 * must implement the SetData method (in addition to GetData :) - the shell passes
533 * a barely documented "Icon positions" structure to SetData when the drag starts,
534 * and GetData's it if the drop is in another explorer window that needs the positions.
536 static HRESULT WINAPI
537 IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
539 UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
541 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
544 IUnknown *pObj = NULL;
545 HRESULT hr = E_INVALIDARG;
547 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
548 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
553 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
554 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
556 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
557 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
559 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
560 pidl = ILCombine (This->pidlRoot, apidl[0]);
561 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
564 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
565 pidl = ILCombine (This->pidlRoot, apidl[0]);
566 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
569 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
570 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
580 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
584 /**************************************************************************
585 * IShellFolder_fnGetDisplayNameOf
586 * Retrieves the display name for the specified file object or subfolder
589 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
590 * DWORD dwFlags, //[in ] SHGNO formatting flags
591 * LPSTRRET lpName) //[out] Returned display name
594 * if the name is in the pidl the ret value should be a STRRET_OFFSET
597 static HRESULT WINAPI
598 IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
600 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
602 CHAR szPath[MAX_PATH] = "";
606 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
609 if (!pidl || !strRet)
612 bSimplePidl = _ILIsPidlSimple (pidl);
614 /* take names of special folders only if its only this folder */
615 if (_ILIsSpecialFolder (pidl)) {
617 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
619 FIXME ("special pidl\n");
622 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sPathTarget) {
623 lstrcpyA (szPath, This->sPathTarget); /* get path to root */
624 PathAddBackslashA (szPath);
625 len = lstrlenA (szPath);
627 _ILSimpleGetText (pidl, szPath + len, MAX_PATH - len); /* append my own path */
629 /* MSDN also mentions SHGDN_FOREDITING, which isn't defined in wine */
630 if (!_ILIsFolder (pidl) && !(dwFlags & SHGDN_FORPARSING) &&
631 ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
634 DWORD dwDataSize = sizeof (DWORD);
635 BOOL doHide = 0; /* The default value is FALSE (win98 at least) */
637 /* XXX should it do this only for known file types? -- that would make it even slower! */
638 /* XXX That's what the prompt says!! */
639 if (!RegCreateKeyExA (HKEY_CURRENT_USER,
640 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
641 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
642 if (!RegQueryValueExA (hKey, "HideFileExt", 0, 0, (LPBYTE) & dwData, &dwDataSize))
646 if (doHide && szPath[0] != '.')
647 PathRemoveExtensionA (szPath);
651 if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */
652 PathAddBackslashA (szPath);
653 len = lstrlenA (szPath);
656 (SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len)))
657 return E_OUTOFMEMORY;
659 strRet->uType = STRRET_CSTR;
660 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
662 TRACE ("-- (%p)->(%s)\n", This, szPath);
666 /**************************************************************************
667 * IShellFolder_fnSetNameOf
668 * Changes the name of a file object or subfolder, possibly changing its item
669 * identifier in the process.
672 * HWND hwndOwner, //[in ] Owner window for output
673 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
674 * LPCOLESTR lpszName, //[in ] the items new display name
675 * DWORD dwFlags, //[in ] SHGNO formatting flags
676 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
678 static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
679 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
681 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
682 char szSrc[MAX_PATH],
685 BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
687 TRACE ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
689 /* build source path */
690 if (dwFlags & SHGDN_INFOLDER) {
691 strcpy (szSrc, This->sPathTarget);
692 PathAddBackslashA (szSrc);
693 len = strlen (szSrc);
694 _ILSimpleGetText (pidl, szSrc + len, MAX_PATH - len);
696 SHGetPathFromIDListA (pidl, szSrc);
699 /* build destination path */
700 strcpy (szDest, This->sPathTarget);
701 PathAddBackslashA (szDest);
702 len = strlen (szDest);
703 WideCharToMultiByte (CP_ACP, 0, lpName, -1, szDest + len, MAX_PATH - len, NULL, NULL);
704 szDest[MAX_PATH - 1] = 0;
705 TRACE ("src=%s dest=%s\n", szSrc, szDest);
706 if (MoveFileA (szSrc, szDest)) {
708 *pPidlOut = SHSimpleIDListFromPathA (szDest);
709 SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest);
715 static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
717 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
718 FIXME ("(%p)\n", This);
721 static HRESULT WINAPI IShellFolder_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
723 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
724 FIXME ("(%p)\n", This);
727 static HRESULT WINAPI
728 IShellFolder_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
730 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
732 TRACE ("(%p)\n", This);
741 static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
743 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
745 TRACE ("(%p)\n", This);
747 if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
750 *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
754 static HRESULT WINAPI
755 IShellFolder_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
757 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
758 FIXME ("(%p)\n", This);
762 static HRESULT WINAPI
763 IShellFolder_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
765 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
768 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
770 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
774 /* the header titles */
775 psd->fmt = GenericSFHeader[iColumn].fmt;
776 psd->cxChar = GenericSFHeader[iColumn].cxChar;
777 psd->str.uType = STRRET_CSTR;
778 LoadStringA (shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
781 /* the data from the pidl */
784 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
787 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
790 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
793 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
795 case 4: /* attributes */
796 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
800 psd->str.uType = STRRET_CSTR;
805 static HRESULT WINAPI IShellFolder_fnMapNameToSCID (IShellFolder2 * iface, LPCWSTR pwszName, SHCOLUMNID * pscid)
807 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
808 FIXME ("(%p)\n", This);
812 static ICOM_VTABLE (IShellFolder2) sfvt =
814 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
815 IShellFolder_fnQueryInterface,
816 IShellFolder_fnAddRef,
817 IShellFolder_fnRelease,
818 IShellFolder_fnParseDisplayName,
819 IShellFolder_fnEnumObjects,
820 IShellFolder_fnBindToObject,
821 IShellFolder_fnBindToStorage,
822 IShellFolder_fnCompareIDs,
823 IShellFolder_fnCreateViewObject,
824 IShellFolder_fnGetAttributesOf,
825 IShellFolder_fnGetUIObjectOf,
826 IShellFolder_fnGetDisplayNameOf,
827 IShellFolder_fnSetNameOf,
829 IShellFolder_fnGetDefaultSearchGUID,
830 IShellFolder_fnEnumSearches,
831 IShellFolder_fnGetDefaultColumn,
832 IShellFolder_fnGetDefaultColumnState,
833 IShellFolder_fnGetDetailsEx,
834 IShellFolder_fnGetDetailsOf,
835 IShellFolder_fnMapNameToSCID
838 /****************************************************************************
839 * ISFHelper for IShellFolder implementation
842 static HRESULT WINAPI ISFHelper_fnQueryInterface (ISFHelper * iface, REFIID riid, LPVOID * ppvObj)
844 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
846 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
848 return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
851 static ULONG WINAPI ISFHelper_fnAddRef (ISFHelper * iface)
853 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
855 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
857 return IUnknown_AddRef (This->pUnkOuter);
860 static ULONG WINAPI ISFHelper_fnRelease (ISFHelper * iface)
862 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
864 TRACE ("(%p)\n", This);
866 return IUnknown_Release (This->pUnkOuter);
869 /****************************************************************************
870 * ISFHelper_fnAddFolder
872 * creates a unique folder name
875 static HRESULT WINAPI ISFHelper_fnGetUniqueName (ISFHelper * iface, LPSTR lpName, UINT uLen)
877 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface)
880 char szText[MAX_PATH];
881 char *szNewFolder = "New Folder";
883 TRACE ("(%p)(%s %u)\n", This, lpName, uLen);
885 if (uLen < strlen (szNewFolder) + 4)
888 strcpy (lpName, szNewFolder);
890 hr = IShellFolder_fnEnumObjects (_IShellFolder2_ (This), 0,
891 SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum);
897 next:IEnumIDList_Reset (penum);
898 while (S_OK == IEnumIDList_Next (penum, 1, &pidl, &dwFetched) && dwFetched) {
899 _ILSimpleGetText (pidl, szText, MAX_PATH);
900 if (0 == strcasecmp (szText, lpName)) {
901 sprintf (lpName, "%s %d", szNewFolder, i++);
910 IEnumIDList_Release (penum);
915 /****************************************************************************
916 * ISFHelper_fnAddFolder
921 static HRESULT WINAPI ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCSTR lpName, LPITEMIDLIST * ppidlOut)
923 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface)
924 char lpstrNewDir[MAX_PATH];
926 HRESULT hres = E_FAIL;
928 TRACE ("(%p)(%s %p)\n", This, lpName, ppidlOut);
930 strcpy (lpstrNewDir, This->sPathTarget);
931 PathAddBackslashA (lpstrNewDir);
932 strcat (lpstrNewDir, lpName);
934 bRes = CreateDirectoryA (lpstrNewDir, NULL);
940 pidlitem = SHSimpleIDListFromPathA (lpstrNewDir);
942 pidl = ILCombine (This->pidlRoot, pidlitem);
943 SHChangeNotify (SHCNE_MKDIR, SHCNF_IDLIST, pidl, NULL);
947 *ppidlOut = pidlitem;
950 char lpstrText[128 + MAX_PATH];
951 char lpstrTempText[128];
952 char lpstrCaption[256];
954 /* Cannot Create folder because of permissions */
955 LoadStringA (shell32_hInstance, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof (lpstrTempText));
956 LoadStringA (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, lpstrCaption, sizeof (lpstrCaption));
957 sprintf (lpstrText, lpstrTempText, lpstrNewDir);
958 MessageBoxA (hwnd, lpstrText, lpstrCaption, MB_OK | MB_ICONEXCLAMATION);
964 /****************************************************************************
965 * ISFHelper_fnDeleteItems
967 * deletes items in folder
969 static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
971 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface)
973 char szPath[MAX_PATH];
974 BOOL bConfirm = TRUE;
976 TRACE ("(%p)(%u %p)\n", This, cidl, apidl);
978 /* deleting multiple items so give a slightly different warning */
982 snprintf (tmp, sizeof (tmp), "%d", cidl);
983 if (!SHELL_ConfirmDialog(ASK_DELETE_MULTIPLE_ITEM, tmp))
988 for (i = 0; i < cidl; i++) {
989 strcpy (szPath, This->sPathTarget);
990 PathAddBackslashA (szPath);
991 _ILSimpleGetText (apidl[i], szPath + strlen (szPath), MAX_PATH);
993 if (_ILIsFolder (apidl[i])) {
996 TRACE ("delete %s\n", szPath);
997 if (!SHELL_DeleteDirectoryA (szPath, bConfirm)) {
998 TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm);
1001 pidl = ILCombine (This->pidlRoot, apidl[i]);
1002 SHChangeNotify (SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL);
1004 } else if (_ILIsValue (apidl[i])) {
1007 TRACE ("delete %s\n", szPath);
1008 if (!SHELL_DeleteFileA (szPath, bConfirm)) {
1009 TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm);
1012 pidl = ILCombine (This->pidlRoot, apidl[i]);
1013 SHChangeNotify (SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL);
1021 /****************************************************************************
1022 * ISFHelper_fnCopyItems
1024 * copies items to this folder
1026 static HRESULT WINAPI
1027 ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, LPCITEMIDLIST * apidl)
1030 IPersistFolder2 *ppf2 = NULL;
1031 char szSrcPath[MAX_PATH],
1032 szDstPath[MAX_PATH];
1034 _ICOM_THIS_From_ISFHelper (IGenericSFImpl, iface);
1036 TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);
1038 IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2, (LPVOID *) & ppf2);
1042 if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2, &pidl))) {
1043 for (i = 0; i < cidl; i++) {
1044 SHGetPathFromIDListA (pidl, szSrcPath);
1045 PathAddBackslashA (szSrcPath);
1046 _ILSimpleGetText (apidl[i], szSrcPath + strlen (szSrcPath), MAX_PATH);
1048 strcpy (szDstPath, This->sPathTarget);
1049 PathAddBackslashA (szDstPath);
1050 _ILSimpleGetText (apidl[i], szDstPath + strlen (szDstPath), MAX_PATH);
1051 MESSAGE ("would copy %s to %s\n", szSrcPath, szDstPath);
1055 IPersistFolder2_Release (ppf2);
1060 static ICOM_VTABLE (ISFHelper) shvt =
1062 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1063 ISFHelper_fnQueryInterface,
1065 ISFHelper_fnRelease,
1066 ISFHelper_fnGetUniqueName,
1067 ISFHelper_fnAddFolder,
1068 ISFHelper_fnDeleteItems,
1069 ISFHelper_fnCopyItems
1072 /************************************************************************
1073 * IFSFldr_PersistFolder3_QueryInterface
1076 static HRESULT WINAPI IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3 * iface, REFIID iid, LPVOID * ppvObj)
1078 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1080 TRACE ("(%p)\n", This);
1082 return IUnknown_QueryInterface (This->pUnkOuter, iid, ppvObj);
1085 /************************************************************************
1086 * IFSFldr_PersistFolder3_AddRef
1089 static ULONG WINAPI IFSFldr_PersistFolder3_AddRef (IPersistFolder3 * iface)
1091 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1093 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
1095 return IUnknown_AddRef (This->pUnkOuter);
1098 /************************************************************************
1099 * IFSFldr_PersistFolder3_Release
1102 static ULONG WINAPI IFSFldr_PersistFolder3_Release (IPersistFolder3 * iface)
1104 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1106 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
1108 return IUnknown_Release (This->pUnkOuter);
1111 /************************************************************************
1112 * IFSFldr_PersistFolder3_GetClassID
1114 static HRESULT WINAPI IFSFldr_PersistFolder3_GetClassID (IPersistFolder3 * iface, CLSID * lpClassId)
1116 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1118 TRACE ("(%p)\n", This);
1122 *lpClassId = *This->pclsid;
1127 /************************************************************************
1128 * IFSFldr_PersistFolder3_Initialize
1131 * sPathTarget is not set. Don't know how to handle in a non rooted environment.
1133 static HRESULT WINAPI IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl)
1135 char sTemp[MAX_PATH];
1137 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1139 TRACE ("(%p)->(%p)\n", This, pidl);
1142 SHFree (This->pidlRoot); /* free the old pidl */
1143 This->pidlRoot = ILClone (pidl); /* set my pidl */
1145 if (This->sPathTarget)
1146 SHFree (This->sPathTarget);
1149 if (SHGetPathFromIDListA (pidl, sTemp)) {
1150 This->sPathTarget = SHAlloc (strlen (sTemp) + 1);
1151 strcpy (This->sPathTarget, sTemp);
1154 TRACE ("--(%p)->(%s)\n", This, This->sPathTarget);
1158 /**************************************************************************
1159 * IFSFldr_PersistFolder3_GetCurFolder
1161 static HRESULT WINAPI IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3 * iface, LPITEMIDLIST * pidl)
1163 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1165 TRACE ("(%p)->(%p)\n", This, pidl);
1167 if (!pidl) return E_POINTER;
1168 *pidl = ILClone (This->pidlRoot);
1172 /**************************************************************************
1173 * IFSFldr_PersistFolder3_InitializeEx
1175 * FIXME: errorhandling
1177 static HRESULT WINAPI
1178 IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
1179 IBindCtx * pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO * ppfti)
1181 char sTemp[MAX_PATH];
1183 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1185 TRACE ("(%p)->(%p,%p,%p)\n", This, pbc, pidlRoot, ppfti);
1187 TRACE ("--%p %s %s 0x%08lx 0x%08x\n",
1188 ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
1189 debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes, ppfti->csidl);
1192 if (ppfti && ppfti->pidlTargetFolder)
1193 pdump (ppfti->pidlTargetFolder);
1196 __SHFreeAndNil (&This->pidlRoot); /* free the old */
1197 if (This->sPathTarget)
1198 __SHFreeAndNil (&This->sPathTarget);
1201 * Root path and pidl
1203 This->pidlRoot = ILClone (pidlRoot);
1206 * the target folder is spezified in csidl OR pidlTargetFolder OR szTargetParsingName
1209 if (ppfti->csidl != -1) {
1210 if (SHGetSpecialFolderPathA (0, sTemp, ppfti->csidl, ppfti->csidl & CSIDL_FLAG_CREATE)) {
1211 __SHCloneStrA (&This->sPathTarget, sTemp);
1213 } else if (ppfti->szTargetParsingName[0]) {
1214 __SHCloneStrWtoA (&This->sPathTarget, ppfti->szTargetParsingName);
1215 } else if (ppfti->pidlTargetFolder) {
1216 if (SHGetPathFromIDListA (ppfti->pidlTargetFolder, sTemp)) {
1217 __SHCloneStrA (&This->sPathTarget, sTemp);
1222 TRACE ("--(%p)->(target=%s)\n", This, debugstr_a (This->sPathTarget));
1223 pdump (This->pidlRoot);
1224 return (This->sPathTarget) ? S_OK : E_FAIL;
1227 static HRESULT WINAPI
1228 IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3 * iface, PERSIST_FOLDER_TARGET_INFO * ppfti)
1230 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl, iface);
1231 FIXME ("(%p)->(%p)\n", This, ppfti);
1232 ZeroMemory (ppfti, sizeof (ppfti));
1236 static ICOM_VTABLE (IPersistFolder3) vt_FSFldr_PersistFolder3 =
1238 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1239 IFSFldr_PersistFolder3_QueryInterface,
1240 IFSFldr_PersistFolder3_AddRef,
1241 IFSFldr_PersistFolder3_Release,
1242 IFSFldr_PersistFolder3_GetClassID,
1243 IFSFldr_PersistFolder3_Initialize,
1244 IFSFldr_PersistFolder3_fnGetCurFolder,
1245 IFSFldr_PersistFolder3_InitializeEx,
1246 IFSFldr_PersistFolder3_GetFolderTargetInfo
1249 /****************************************************************************
1250 * ISFDropTarget implementation
1252 static BOOL ISFDropTarget_QueryDrop (IDropTarget * iface, DWORD dwKeyState, LPDWORD pdwEffect)
1254 DWORD dwEffect = *pdwEffect;
1256 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1258 *pdwEffect = DROPEFFECT_NONE;
1260 if (This->fAcceptFmt) { /* Does our interpretation of the keystate ... */
1261 *pdwEffect = KeyStateToDropEffect (dwKeyState);
1263 /* ... matches the desired effect ? */
1264 if (dwEffect & *pdwEffect) {
1271 static HRESULT WINAPI ISFDropTarget_QueryInterface (IDropTarget * iface, REFIID riid, LPVOID * ppvObj)
1273 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1275 TRACE ("(%p)\n", This);
1277 return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
1280 static ULONG WINAPI ISFDropTarget_AddRef (IDropTarget * iface)
1282 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1284 TRACE ("(%p)\n", This);
1286 return IUnknown_AddRef (This->pUnkOuter);
1289 static ULONG WINAPI ISFDropTarget_Release (IDropTarget * iface)
1291 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1293 TRACE ("(%p)\n", This);
1295 return IUnknown_Release (This->pUnkOuter);
1298 static HRESULT WINAPI
1299 ISFDropTarget_DragEnter (IDropTarget * iface, IDataObject * pDataObject, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
1303 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1305 TRACE ("(%p)->(DataObject=%p)\n", This, pDataObject);
1307 InitFormatEtc (fmt, This->cfShellIDList, TYMED_HGLOBAL);
1309 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData (pDataObject, &fmt)) ? TRUE : FALSE;
1311 ISFDropTarget_QueryDrop (iface, dwKeyState, pdwEffect);
1316 static HRESULT WINAPI ISFDropTarget_DragOver (IDropTarget * iface, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
1318 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1320 TRACE ("(%p)\n", This);
1323 return E_INVALIDARG;
1325 ISFDropTarget_QueryDrop (iface, dwKeyState, pdwEffect);
1330 static HRESULT WINAPI ISFDropTarget_DragLeave (IDropTarget * iface)
1332 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1334 TRACE ("(%p)\n", This);
1336 This->fAcceptFmt = FALSE;
1341 static HRESULT WINAPI
1342 ISFDropTarget_Drop (IDropTarget * iface, IDataObject * pDataObject, DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
1344 _ICOM_THIS_From_IDropTarget (IGenericSFImpl, iface);
1346 FIXME ("(%p) object dropped\n", This);
1351 static struct ICOM_VTABLE (IDropTarget) dtvt = {
1352 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1353 ISFDropTarget_QueryInterface,
1354 ISFDropTarget_AddRef,
1355 ISFDropTarget_Release,
1356 ISFDropTarget_DragEnter,
1357 ISFDropTarget_DragOver,
1358 ISFDropTarget_DragLeave,