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"
38 #include "wine/obj_base.h"
39 #include "wine/obj_dragdrop.h"
40 #include "wine/obj_shellfolder.h"
41 #include "undocshell.h"
42 #include "shell32_main.h"
45 #include "shellfolder.h"
46 #include "wine/debug.h"
50 WINE_DEFAULT_DEBUG_CHANNEL (shell
);
52 /***********************************************************************
53 * IShellFolder implementation
57 ICOM_VFIELD (IUnknown
);
59 ICOM_VTABLE (IShellFolder2
) * lpvtblShellFolder
;
60 ICOM_VTABLE (IPersistFolder3
) * lpvtblPersistFolder3
;
61 ICOM_VTABLE (IDropTarget
) * lpvtblDropTarget
;
62 ICOM_VTABLE (ISFHelper
) * lpvtblSFHelper
;
64 IUnknown
*pUnkOuter
; /* used for aggregation */
68 /* both paths are parsible from the desktop */
69 LPSTR sPathTarget
; /* complete path to target used for enumeration and ChangeNotify */
71 LPITEMIDLIST pidlRoot
; /* absolute pidl */
73 int dwAttributes
; /* attributes returned by GetAttributesOf FIXME: use it */
75 UINT cfShellIDList
; /* clipboardformat for IDropTarget */
76 BOOL fAcceptFmt
; /* flag for pending Drop */
79 static struct ICOM_VTABLE (IUnknown
) unkvt
;
80 static struct ICOM_VTABLE (IShellFolder2
) sfvt
;
81 static struct ICOM_VTABLE (IPersistFolder3
) vt_FSFldr_PersistFolder3
; /* IPersistFolder3 for a FS_Folder */
82 static struct ICOM_VTABLE (IDropTarget
) dtvt
;
83 static struct ICOM_VTABLE (ISFHelper
) shvt
;
85 #define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder)))
86 #define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset);
88 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3)))
89 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
91 #define _IPersistFolder3_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder3)))
92 #define _ICOM_THIS_From_IPersistFolder3(class, name) class* This = (class*)(((char*)name)-_IPersistFolder3_Offset);
94 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
95 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
97 #define _ISFHelper_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblSFHelper)))
98 #define _ICOM_THIS_From_ISFHelper(class, name) class* This = (class*)(((char*)name)-_ISFHelper_Offset);
101 converts This to a interface pointer
103 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
104 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder)
105 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder)
106 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder3)
107 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder3)
108 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpvtblPersistFolder3)
109 #define _IPersistFolder3_(This) (IPersistFolder3*)&(This->lpvtblPersistFolder3)
110 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget)
111 #define _ISFHelper_(This) (ISFHelper*)&(This->lpvtblSFHelper)
113 /**************************************************************************
114 * registers clipboardformat once
116 static void SF_RegisterClipFmt (IGenericSFImpl
* This
)
118 TRACE ("(%p)\n", This
);
120 if (!This
->cfShellIDList
) {
121 This
->cfShellIDList
= RegisterClipboardFormatA (CFSTR_SHELLIDLIST
);
125 /**************************************************************************
126 * we need a separate IUnknown to handle aggregation
129 static HRESULT WINAPI
IUnknown_fnQueryInterface (IUnknown
* iface
, REFIID riid
, LPVOID
* ppvObj
)
131 ICOM_THIS (IGenericSFImpl
, iface
);
133 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
137 if (IsEqualIID (riid
, &IID_IUnknown
))
138 *ppvObj
= _IUnknown_ (This
);
139 else if (IsEqualIID (riid
, &IID_IShellFolder
))
140 *ppvObj
= _IShellFolder_ (This
);
141 else if (IsEqualIID (riid
, &IID_IShellFolder2
))
142 *ppvObj
= _IShellFolder_ (This
);
143 else if (IsEqualIID (riid
, &IID_IPersist
))
144 *ppvObj
= _IPersist_ (This
);
145 else if (IsEqualIID (riid
, &IID_IPersistFolder
))
146 *ppvObj
= _IPersistFolder_ (This
);
147 else if (IsEqualIID (riid
, &IID_IPersistFolder2
))
148 *ppvObj
= _IPersistFolder2_ (This
);
149 else if (IsEqualIID (riid
, &IID_IPersistFolder3
))
150 *ppvObj
= _IPersistFolder3_ (This
);
151 else if (IsEqualIID (riid
, &IID_ISFHelper
))
152 *ppvObj
= _ISFHelper_ (This
);
153 else if (IsEqualIID (riid
, &IID_IDropTarget
)) {
154 *ppvObj
= _IDropTarget_ (This
);
155 SF_RegisterClipFmt (This
);
159 IUnknown_AddRef ((IUnknown
*) (*ppvObj
));
160 TRACE ("-- Interface = %p\n", *ppvObj
);
163 TRACE ("-- Interface: E_NOINTERFACE\n");
164 return E_NOINTERFACE
;
167 static ULONG WINAPI
IUnknown_fnAddRef (IUnknown
* iface
)
169 ICOM_THIS (IGenericSFImpl
, iface
);
171 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
173 return ++(This
->ref
);
176 static ULONG WINAPI
IUnknown_fnRelease (IUnknown
* iface
)
178 ICOM_THIS (IGenericSFImpl
, iface
);
180 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
182 if (!--(This
->ref
)) {
183 TRACE ("-- destroying IShellFolder(%p)\n", This
);
186 SHFree (This
->pidlRoot
);
187 if (This
->sPathTarget
)
188 SHFree (This
->sPathTarget
);
189 LocalFree ((HLOCAL
) This
);
195 static ICOM_VTABLE (IUnknown
) unkvt
=
197 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE IUnknown_fnQueryInterface
,
202 static shvheader GenericSFHeader
[] = {
203 {IDS_SHV_COLUMN1
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 15},
204 {IDS_SHV_COLUMN2
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
205 {IDS_SHV_COLUMN3
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
206 {IDS_SHV_COLUMN4
, SHCOLSTATE_TYPE_DATE
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 12},
207 {IDS_SHV_COLUMN5
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 5}
210 #define GENERICSHELLVIEWCOLUMNS 5
212 /**************************************************************************
213 * IFSFolder_Constructor
216 * creating undocumented ShellFS_Folder as part of an aggregation
217 * {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
220 HRESULT WINAPI
IFSFolder_Constructor (IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
224 TRACE ("unkOut=%p %s\n", pUnkOuter
, shdebugstr_guid (riid
));
226 if (pUnkOuter
&& !IsEqualIID (riid
, &IID_IUnknown
))
227 return CLASS_E_NOAGGREGATION
;
228 sf
= (IGenericSFImpl
*) LocalAlloc (GMEM_ZEROINIT
, sizeof (IGenericSFImpl
));
230 return E_OUTOFMEMORY
;
233 ICOM_VTBL (sf
) = &unkvt
;
234 sf
->lpvtblShellFolder
= &sfvt
;
235 sf
->lpvtblPersistFolder3
= &vt_FSFldr_PersistFolder3
;
236 sf
->lpvtblDropTarget
= &dtvt
;
237 sf
->lpvtblSFHelper
= &shvt
;
238 sf
->pclsid
= (CLSID
*) & CLSID_ShellFSFolder
;
239 sf
->pUnkOuter
= pUnkOuter
? pUnkOuter
: _IUnknown_ (sf
);
241 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf
), riid
, ppv
))) {
242 IUnknown_Release (_IUnknown_ (sf
));
243 return E_NOINTERFACE
;
246 TRACE ("--%p\n", *ppv
);
250 /**************************************************************************
251 * IShellFolder_fnQueryInterface
254 * REFIID riid [in ] Requested InterfaceID
255 * LPVOID* ppvObject [out] Interface* to hold the result
257 static HRESULT WINAPI
IShellFolder_fnQueryInterface (IShellFolder2
* iface
, REFIID riid
, LPVOID
* ppvObj
)
259 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
261 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
263 return IUnknown_QueryInterface (This
->pUnkOuter
, riid
, ppvObj
);
266 /**************************************************************************
267 * IShellFolder_AddRef
270 static ULONG WINAPI
IShellFolder_fnAddRef (IShellFolder2
* iface
)
272 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
274 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
276 return IUnknown_AddRef (This
->pUnkOuter
);
279 /**************************************************************************
280 * IShellFolder_fnRelease
282 static ULONG WINAPI
IShellFolder_fnRelease (IShellFolder2
* iface
)
284 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
286 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
288 return IUnknown_Release (This
->pUnkOuter
);
291 /**************************************************************************
292 * IShellFolder_fnParseDisplayName
294 * HWND hwndOwner, //[in ] Parent window for any message's
295 * LPBC pbc, //[in ] reserved
296 * LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
297 * ULONG* pchEaten, //[out] (unicode) characters processed
298 * LPITEMIDLIST* ppidl, //[out] complex pidl to item
299 * ULONG* pdwAttributes //[out] items attributes
302 * every folder tries to parse only its own (the leftmost) pidl and creates a
303 * subfolder to evaluate the remaining parts
304 * now we can parse into namespaces implemented by shell extensions
306 * behaviour on win98: lpszDisplayName=NULL -> chrash
307 * lpszDisplayName="" -> returns mycoputer-pidl
310 * pdwAttributes: not set
311 * pchEaten: not set like in windows
313 static HRESULT WINAPI
314 IShellFolder_fnParseDisplayName (IShellFolder2
* iface
,
317 LPOLESTR lpszDisplayName
,
318 DWORD
* pchEaten
, LPITEMIDLIST
* ppidl
, DWORD
* pdwAttributes
)
320 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
322 HRESULT hr
= E_OUTOFMEMORY
;
323 LPCWSTR szNext
= NULL
;
324 WCHAR szElement
[MAX_PATH
];
325 CHAR szTempA
[MAX_PATH
],
327 LPITEMIDLIST pidlTemp
= NULL
;
329 TRACE ("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
330 This
, hwndOwner
, pbcReserved
, lpszDisplayName
, debugstr_w (lpszDisplayName
), pchEaten
, ppidl
, pdwAttributes
);
332 if (!lpszDisplayName
|| !ppidl
)
336 *pchEaten
= 0; /* strange but like the original */
338 if (*lpszDisplayName
) {
339 /* get the next element */
340 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
342 /* build the full pathname to the element */
343 WideCharToMultiByte (CP_ACP
, 0, szElement
, -1, szTempA
, MAX_PATH
, NULL
, NULL
);
344 lstrcpyA (szPath
, This
->sPathTarget
);
345 PathAddBackslashA (szPath
);
346 lstrcatA (szPath
, szTempA
);
349 pidlTemp
= SHSimpleIDListFromPathA (szPath
);
352 if (szNext
&& *szNext
) {
353 /* try to analyse the next element */
354 hr
= SHELL32_ParseNextElement (hwndOwner
, iface
, &pidlTemp
, (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
356 /* it's the last element */
357 if (pdwAttributes
&& *pdwAttributes
) {
358 SHELL32_GetItemAttributes (_IShellFolder_ (This
), pidlTemp
, pdwAttributes
);
370 TRACE ("(%p)->(-- pidl=%p ret=0x%08lx)\n", This
, ppidl
? *ppidl
: 0, hr
);
375 /**************************************************************************
376 * IShellFolder_fnEnumObjects
378 * HWND hwndOwner, //[in ] Parent Window
379 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
380 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
382 static HRESULT WINAPI
383 IShellFolder_fnEnumObjects (IShellFolder2
* iface
, HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
* ppEnumIDList
)
385 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
387 TRACE ("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n", This
, hwndOwner
, dwFlags
, ppEnumIDList
);
389 *ppEnumIDList
= IEnumIDList_Constructor (This
->sPathTarget
, dwFlags
, EIDL_FILE
);
391 TRACE ("-- (%p)->(new ID List: %p)\n", This
, *ppEnumIDList
);
393 return *ppEnumIDList
? S_OK
: E_OUTOFMEMORY
;
396 /**************************************************************************
397 * IShellFolder_fnBindToObject
399 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
400 * LPBC pbc, //[in ] reserved
401 * REFIID riid, //[in ] Initial Interface
402 * LPVOID* ppvObject //[out] Interface*
404 static HRESULT WINAPI
405 IShellFolder_fnBindToObject (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
407 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
409 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
411 return SHELL32_BindToChild (This
->pidlRoot
, This
->sPathTarget
, pidl
, riid
, ppvOut
);
414 /**************************************************************************
415 * IShellFolder_fnBindToStorage
417 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
418 * LPBC pbc, //[in ] reserved
419 * REFIID riid, //[in ] Initial storage interface
420 * LPVOID* ppvObject //[out] Interface* returned
422 static HRESULT WINAPI
423 IShellFolder_fnBindToStorage (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
425 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
427 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
433 /**************************************************************************
434 * IShellFolder_fnCompareIDs
437 static HRESULT WINAPI
438 IShellFolder_fnCompareIDs (IShellFolder2
* iface
, LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
440 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
444 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This
, lParam
, pidl1
, pidl2
);
445 nReturn
= SHELL32_CompareIDs (_IShellFolder_ (This
), lParam
, pidl1
, pidl2
);
446 TRACE ("-- %i\n", nReturn
);
450 /**************************************************************************
451 * IShellFolder_fnCreateViewObject
453 static HRESULT WINAPI
454 IShellFolder_fnCreateViewObject (IShellFolder2
* iface
, HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
456 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
458 LPSHELLVIEW pShellView
;
459 HRESULT hr
= E_INVALIDARG
;
461 TRACE ("(%p)->(hwnd=0x%x,%s,%p)\n", This
, hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
466 if (IsEqualIID (riid
, &IID_IDropTarget
)) {
467 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
, ppvOut
);
468 } else if (IsEqualIID (riid
, &IID_IContextMenu
)) {
469 FIXME ("IContextMenu not implemented\n");
471 } else if (IsEqualIID (riid
, &IID_IShellView
)) {
472 pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
474 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
475 IShellView_Release (pShellView
);
479 TRACE ("-- (%p)->(interface=%p)\n", This
, ppvOut
);
483 /**************************************************************************
484 * IShellFolder_fnGetAttributesOf
487 * UINT cidl, //[in ] num elements in pidl array
488 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
489 * ULONG* rgfInOut) //[out] result array
492 static HRESULT WINAPI
493 IShellFolder_fnGetAttributesOf (IShellFolder2
* iface
, UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
495 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
499 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This
, cidl
, apidl
, *rgfInOut
);
501 if ((!cidl
) || (!apidl
) || (!rgfInOut
))
504 while (cidl
> 0 && *apidl
) {
506 SHELL32_GetItemAttributes (_IShellFolder_ (This
), *apidl
, rgfInOut
);
511 TRACE ("-- result=0x%08lx\n", *rgfInOut
);
516 /**************************************************************************
517 * IShellFolder_fnGetUIObjectOf
520 * HWND hwndOwner, //[in ] Parent window for any output
521 * UINT cidl, //[in ] array size
522 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
523 * REFIID riid, //[in ] Requested Interface
524 * UINT* prgfInOut, //[ ] reserved
525 * LPVOID* ppvObject) //[out] Resulting Interface
528 * This function gets asked to return "view objects" for one or more (multiple select)
530 * The viewobject typically is an COM object with one of the following interfaces:
531 * IExtractIcon,IDataObject,IContextMenu
532 * In order to support icon positions in the default Listview your DataObject
533 * must implement the SetData method (in addition to GetData :) - the shell passes
534 * a barely documented "Icon positions" structure to SetData when the drag starts,
535 * and GetData's it if the drop is in another explorer window that needs the positions.
537 static HRESULT WINAPI
538 IShellFolder_fnGetUIObjectOf (IShellFolder2
* iface
,
540 UINT cidl
, LPCITEMIDLIST
* apidl
, REFIID riid
, UINT
* prgfInOut
, LPVOID
* ppvOut
)
542 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
545 IUnknown
*pObj
= NULL
;
546 HRESULT hr
= E_INVALIDARG
;
548 TRACE ("(%p)->(0x%04x,%u,apidl=%p,%s,%p,%p)\n",
549 This
, hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
554 if (IsEqualIID (riid
, &IID_IContextMenu
) && (cidl
>= 1)) {
555 pObj
= (LPUNKNOWN
) ISvItemCm_Constructor ((IShellFolder
*) iface
, This
->pidlRoot
, apidl
, cidl
);
557 } else if (IsEqualIID (riid
, &IID_IDataObject
) && (cidl
>= 1)) {
558 pObj
= (LPUNKNOWN
) IDataObject_Constructor (hwndOwner
, This
->pidlRoot
, apidl
, cidl
);
560 } else if (IsEqualIID (riid
, &IID_IExtractIconA
) && (cidl
== 1)) {
561 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
562 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
565 } else if (IsEqualIID (riid
, &IID_IDropTarget
) && (cidl
>= 1)) {
566 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
, (LPVOID
*) & pObj
);
576 TRACE ("(%p)->hr=0x%08lx\n", This
, hr
);
580 /**************************************************************************
581 * IShellFolder_fnGetDisplayNameOf
582 * Retrieves the display name for the specified file object or subfolder
585 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
586 * DWORD dwFlags, //[in ] SHGNO formatting flags
587 * LPSTRRET lpName) //[out] Returned display name
590 * if the name is in the pidl the ret value should be a STRRET_OFFSET
593 static HRESULT WINAPI
594 IShellFolder_fnGetDisplayNameOf (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
596 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
598 CHAR szPath
[MAX_PATH
] = "";
602 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This
, pidl
, dwFlags
, strRet
);
605 if (!pidl
|| !strRet
)
608 bSimplePidl
= _ILIsPidlSimple (pidl
);
610 /* take names of special folders only if its only this folder */
611 if (_ILIsSpecialFolder (pidl
)) {
613 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
); /* append my own path */
615 FIXME ("special pidl\n");
618 if (!(dwFlags
& SHGDN_INFOLDER
) && (dwFlags
& SHGDN_FORPARSING
) && This
->sPathTarget
) {
619 lstrcpyA (szPath
, This
->sPathTarget
); /* get path to root */
620 PathAddBackslashA (szPath
);
621 len
= lstrlenA (szPath
);
623 _ILSimpleGetText (pidl
, szPath
+ len
, MAX_PATH
- len
); /* append my own path */
625 /* MSDN also mentions SHGDN_FOREDITING, which isn't defined in wine */
626 if (!_ILIsFolder (pidl
) && !(dwFlags
& SHGDN_FORPARSING
) &&
627 ((dwFlags
& SHGDN_INFOLDER
) || (dwFlags
== SHGDN_NORMAL
))) {
630 DWORD dwDataSize
= sizeof (DWORD
);
631 BOOL doHide
= 0; /* The default value is FALSE (win98 at least) */
633 /* XXX should it do this only for known file types? -- that would make it even slower! */
634 /* XXX That's what the prompt says!! */
635 if (!RegCreateKeyExA (HKEY_CURRENT_USER
,
636 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
637 0, 0, 0, KEY_ALL_ACCESS
, 0, &hKey
, 0)) {
638 if (!RegQueryValueExA (hKey
, "HideFileExt", 0, 0, (LPBYTE
) & dwData
, &dwDataSize
))
642 if (doHide
&& szPath
[0] != '.')
643 PathRemoveExtensionA (szPath
);
647 if ((dwFlags
& SHGDN_FORPARSING
) && !bSimplePidl
) { /* go deeper if needed */
648 PathAddBackslashA (szPath
);
649 len
= lstrlenA (szPath
);
652 (SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
| SHGDN_INFOLDER
, szPath
+ len
, MAX_PATH
- len
)))
653 return E_OUTOFMEMORY
;
655 strRet
->uType
= STRRET_CSTR
;
656 lstrcpynA (strRet
->u
.cStr
, szPath
, MAX_PATH
);
658 TRACE ("-- (%p)->(%s)\n", This
, szPath
);
662 /**************************************************************************
663 * IShellFolder_fnSetNameOf
664 * Changes the name of a file object or subfolder, possibly changing its item
665 * identifier in the process.
668 * HWND hwndOwner, //[in ] Owner window for output
669 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
670 * LPCOLESTR lpszName, //[in ] the items new display name
671 * DWORD dwFlags, //[in ] SHGNO formatting flags
672 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
674 static HRESULT WINAPI
IShellFolder_fnSetNameOf (IShellFolder2
* iface
, HWND hwndOwner
, LPCITEMIDLIST pidl
, /*simple pidl */
675 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
677 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
678 char szSrc
[MAX_PATH
],
681 BOOL bIsFolder
= _ILIsFolder (ILFindLastID (pidl
));
683 TRACE ("(%p)->(%u,pidl=%p,%s,%lu,%p)\n", This
, hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
685 /* build source path */
686 if (dwFlags
& SHGDN_INFOLDER
) {
687 strcpy (szSrc
, This
->sPathTarget
);
688 PathAddBackslashA (szSrc
);
689 len
= strlen (szSrc
);
690 _ILSimpleGetText (pidl
, szSrc
+ len
, MAX_PATH
- len
);
692 SHGetPathFromIDListA (pidl
, szSrc
);
695 /* build destination path */
696 strcpy (szDest
, This
->sPathTarget
);
697 PathAddBackslashA (szDest
);
698 len
= strlen (szDest
);
699 WideCharToMultiByte (CP_ACP
, 0, lpName
, -1, szDest
+ len
, MAX_PATH
- len
, NULL
, NULL
);
700 szDest
[MAX_PATH
- 1] = 0;
701 TRACE ("src=%s dest=%s\n", szSrc
, szDest
);
702 if (MoveFileA (szSrc
, szDest
)) {
704 *pPidlOut
= SHSimpleIDListFromPathA (szDest
);
705 SHChangeNotifyA (bIsFolder
? SHCNE_RENAMEFOLDER
: SHCNE_RENAMEITEM
, SHCNF_PATHA
, szSrc
, szDest
);
711 static HRESULT WINAPI
IShellFolder_fnGetDefaultSearchGUID (IShellFolder2
* iface
, GUID
* pguid
)
713 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
714 FIXME ("(%p)\n", This
);
717 static HRESULT WINAPI
IShellFolder_fnEnumSearches (IShellFolder2
* iface
, IEnumExtraSearch
** ppenum
)
719 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
720 FIXME ("(%p)\n", This
);
723 static HRESULT WINAPI
724 IShellFolder_fnGetDefaultColumn (IShellFolder2
* iface
, DWORD dwRes
, ULONG
* pSort
, ULONG
* pDisplay
)
726 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
728 TRACE ("(%p)\n", This
);
737 static HRESULT WINAPI
IShellFolder_fnGetDefaultColumnState (IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
739 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
741 TRACE ("(%p)\n", This
);
743 if (!pcsFlags
|| iColumn
>= GENERICSHELLVIEWCOLUMNS
)
746 *pcsFlags
= GenericSFHeader
[iColumn
].pcsFlags
;
750 static HRESULT WINAPI
751 IShellFolder_fnGetDetailsEx (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
753 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
754 FIXME ("(%p)\n", This
);
758 static HRESULT WINAPI
759 IShellFolder_fnGetDetailsOf (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
761 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
764 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
766 if (!psd
|| iColumn
>= GENERICSHELLVIEWCOLUMNS
)
770 /* the header titles */
771 psd
->fmt
= GenericSFHeader
[iColumn
].fmt
;
772 psd
->cxChar
= GenericSFHeader
[iColumn
].cxChar
;
773 psd
->str
.uType
= STRRET_CSTR
;
774 LoadStringA (shell32_hInstance
, GenericSFHeader
[iColumn
].colnameid
, psd
->str
.u
.cStr
, MAX_PATH
);
777 /* the data from the pidl */
780 hr
= IShellFolder_GetDisplayNameOf (iface
, pidl
, SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
783 _ILGetFileSize (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
786 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
789 _ILGetFileDate (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
791 case 4: /* attributes */
792 _ILGetFileAttributes (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
796 psd
->str
.uType
= STRRET_CSTR
;
801 static HRESULT WINAPI
IShellFolder_fnMapNameToSCID (IShellFolder2
* iface
, LPCWSTR pwszName
, SHCOLUMNID
* pscid
)
803 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
804 FIXME ("(%p)\n", This
);
808 static ICOM_VTABLE (IShellFolder2
) sfvt
=
810 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
811 IShellFolder_fnQueryInterface
,
812 IShellFolder_fnAddRef
,
813 IShellFolder_fnRelease
,
814 IShellFolder_fnParseDisplayName
,
815 IShellFolder_fnEnumObjects
,
816 IShellFolder_fnBindToObject
,
817 IShellFolder_fnBindToStorage
,
818 IShellFolder_fnCompareIDs
,
819 IShellFolder_fnCreateViewObject
,
820 IShellFolder_fnGetAttributesOf
,
821 IShellFolder_fnGetUIObjectOf
,
822 IShellFolder_fnGetDisplayNameOf
,
823 IShellFolder_fnSetNameOf
,
825 IShellFolder_fnGetDefaultSearchGUID
,
826 IShellFolder_fnEnumSearches
,
827 IShellFolder_fnGetDefaultColumn
,
828 IShellFolder_fnGetDefaultColumnState
,
829 IShellFolder_fnGetDetailsEx
,
830 IShellFolder_fnGetDetailsOf
,
831 IShellFolder_fnMapNameToSCID
834 /****************************************************************************
835 * ISFHelper for IShellFolder implementation
838 static HRESULT WINAPI
ISFHelper_fnQueryInterface (ISFHelper
* iface
, REFIID riid
, LPVOID
* ppvObj
)
840 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
842 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
844 return IUnknown_QueryInterface (This
->pUnkOuter
, riid
, ppvObj
);
847 static ULONG WINAPI
ISFHelper_fnAddRef (ISFHelper
* iface
)
849 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
851 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
853 return IUnknown_AddRef (This
->pUnkOuter
);
856 static ULONG WINAPI
ISFHelper_fnRelease (ISFHelper
* iface
)
858 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
860 TRACE ("(%p)\n", This
);
862 return IUnknown_Release (This
->pUnkOuter
);
865 /****************************************************************************
866 * ISFHelper_fnAddFolder
868 * creates a unique folder name
871 static HRESULT WINAPI
ISFHelper_fnGetUniqueName (ISFHelper
* iface
, LPSTR lpName
, UINT uLen
)
873 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
)
876 char szText
[MAX_PATH
];
877 char *szNewFolder
= "New Folder";
879 TRACE ("(%p)(%s %u)\n", This
, lpName
, uLen
);
881 if (uLen
< strlen (szNewFolder
) + 4)
884 strcpy (lpName
, szNewFolder
);
886 hr
= IShellFolder_fnEnumObjects (_IShellFolder2_ (This
), 0,
887 SHCONTF_FOLDERS
| SHCONTF_NONFOLDERS
| SHCONTF_INCLUDEHIDDEN
, &penum
);
893 next
:IEnumIDList_Reset (penum
);
894 while (S_OK
== IEnumIDList_Next (penum
, 1, &pidl
, &dwFetched
) && dwFetched
) {
895 _ILSimpleGetText (pidl
, szText
, MAX_PATH
);
896 if (0 == strcasecmp (szText
, lpName
)) {
897 sprintf (lpName
, "%s %d", szNewFolder
, i
++);
906 IEnumIDList_Release (penum
);
911 /****************************************************************************
912 * ISFHelper_fnAddFolder
917 static HRESULT WINAPI
ISFHelper_fnAddFolder (ISFHelper
* iface
, HWND hwnd
, LPCSTR lpName
, LPITEMIDLIST
* ppidlOut
)
919 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
)
920 char lpstrNewDir
[MAX_PATH
];
922 HRESULT hres
= E_FAIL
;
924 TRACE ("(%p)(%s %p)\n", This
, lpName
, ppidlOut
);
926 strcpy (lpstrNewDir
, This
->sPathTarget
);
927 PathAddBackslashA (lpstrNewDir
);
928 strcat (lpstrNewDir
, lpName
);
930 bRes
= CreateDirectoryA (lpstrNewDir
, NULL
);
936 pidlitem
= SHSimpleIDListFromPathA (lpstrNewDir
);
938 pidl
= ILCombine (This
->pidlRoot
, pidlitem
);
939 SHChangeNotifyA (SHCNE_MKDIR
, SHCNF_IDLIST
, pidl
, NULL
);
943 *ppidlOut
= pidlitem
;
946 char lpstrText
[128 + MAX_PATH
];
947 char lpstrTempText
[128];
948 char lpstrCaption
[256];
950 /* Cannot Create folder because of permissions */
951 LoadStringA (shell32_hInstance
, IDS_CREATEFOLDER_DENIED
, lpstrTempText
, sizeof (lpstrTempText
));
952 LoadStringA (shell32_hInstance
, IDS_CREATEFOLDER_CAPTION
, lpstrCaption
, sizeof (lpstrCaption
));
953 sprintf (lpstrText
, lpstrTempText
, lpstrNewDir
);
954 MessageBoxA (hwnd
, lpstrText
, lpstrCaption
, MB_OK
| MB_ICONEXCLAMATION
);
960 /****************************************************************************
961 * ISFHelper_fnDeleteItems
963 * deletes items in folder
965 static HRESULT WINAPI
ISFHelper_fnDeleteItems (ISFHelper
* iface
, UINT cidl
, LPCITEMIDLIST
* apidl
)
967 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
)
969 char szPath
[MAX_PATH
];
970 BOOL bConfirm
= TRUE
;
972 TRACE ("(%p)(%u %p)\n", This
, cidl
, apidl
);
974 /* deleting multiple items so give a slightly different warning */
978 snprintf (tmp
, sizeof (tmp
), "%d", cidl
);
979 if (!SHELL_WarnItemDelete (ASK_DELETE_MULTIPLE_ITEM
, tmp
))
984 for (i
= 0; i
< cidl
; i
++) {
985 strcpy (szPath
, This
->sPathTarget
);
986 PathAddBackslashA (szPath
);
987 _ILSimpleGetText (apidl
[i
], szPath
+ strlen (szPath
), MAX_PATH
);
989 if (_ILIsFolder (apidl
[i
])) {
992 TRACE ("delete %s\n", szPath
);
993 if (!SHELL_DeleteDirectoryA (szPath
, bConfirm
)) {
994 TRACE ("delete %s failed, bConfirm=%d\n", szPath
, bConfirm
);
997 pidl
= ILCombine (This
->pidlRoot
, apidl
[i
]);
998 SHChangeNotifyA (SHCNE_RMDIR
, SHCNF_IDLIST
, pidl
, NULL
);
1000 } else if (_ILIsValue (apidl
[i
])) {
1003 TRACE ("delete %s\n", szPath
);
1004 if (!SHELL_DeleteFileA (szPath
, bConfirm
)) {
1005 TRACE ("delete %s failed, bConfirm=%d\n", szPath
, bConfirm
);
1008 pidl
= ILCombine (This
->pidlRoot
, apidl
[i
]);
1009 SHChangeNotifyA (SHCNE_DELETE
, SHCNF_IDLIST
, pidl
, NULL
);
1017 /****************************************************************************
1018 * ISFHelper_fnCopyItems
1020 * copies items to this folder
1022 static HRESULT WINAPI
1023 ISFHelper_fnCopyItems (ISFHelper
* iface
, IShellFolder
* pSFFrom
, UINT cidl
, LPCITEMIDLIST
* apidl
)
1026 IPersistFolder2
*ppf2
= NULL
;
1027 char szSrcPath
[MAX_PATH
],
1028 szDstPath
[MAX_PATH
];
1030 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
1032 TRACE ("(%p)->(%p,%u,%p)\n", This
, pSFFrom
, cidl
, apidl
);
1034 IShellFolder_QueryInterface (pSFFrom
, &IID_IPersistFolder2
, (LPVOID
*) & ppf2
);
1038 if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2
, &pidl
))) {
1039 for (i
= 0; i
< cidl
; i
++) {
1040 SHGetPathFromIDListA (pidl
, szSrcPath
);
1041 PathAddBackslashA (szSrcPath
);
1042 _ILSimpleGetText (apidl
[i
], szSrcPath
+ strlen (szSrcPath
), MAX_PATH
);
1044 strcpy (szDstPath
, This
->sPathTarget
);
1045 PathAddBackslashA (szDstPath
);
1046 _ILSimpleGetText (apidl
[i
], szDstPath
+ strlen (szDstPath
), MAX_PATH
);
1047 MESSAGE ("would copy %s to %s\n", szSrcPath
, szDstPath
);
1051 IPersistFolder2_Release (ppf2
);
1056 static ICOM_VTABLE (ISFHelper
) shvt
=
1058 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1059 ISFHelper_fnQueryInterface
,
1061 ISFHelper_fnRelease
,
1062 ISFHelper_fnGetUniqueName
,
1063 ISFHelper_fnAddFolder
,
1064 ISFHelper_fnDeleteItems
,
1065 ISFHelper_fnCopyItems
1068 /************************************************************************
1069 * IFSFldr_PersistFolder3_QueryInterface
1072 static HRESULT WINAPI
IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3
* iface
, REFIID iid
, LPVOID
* ppvObj
)
1074 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1076 TRACE ("(%p)\n", This
);
1078 return IUnknown_QueryInterface (This
->pUnkOuter
, iid
, ppvObj
);
1081 /************************************************************************
1082 * IFSFldr_PersistFolder3_AddRef
1085 static ULONG WINAPI
IFSFldr_PersistFolder3_AddRef (IPersistFolder3
* iface
)
1087 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1089 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
1091 return IUnknown_AddRef (This
->pUnkOuter
);
1094 /************************************************************************
1095 * IFSFldr_PersistFolder3_Release
1098 static ULONG WINAPI
IFSFldr_PersistFolder3_Release (IPersistFolder3
* iface
)
1100 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1102 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
1104 return IUnknown_Release (This
->pUnkOuter
);
1107 /************************************************************************
1108 * IFSFldr_PersistFolder3_GetClassID
1110 static HRESULT WINAPI
IFSFldr_PersistFolder3_GetClassID (IPersistFolder3
* iface
, CLSID
* lpClassId
)
1112 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1114 TRACE ("(%p)\n", This
);
1118 *lpClassId
= *This
->pclsid
;
1123 /************************************************************************
1124 * IFSFldr_PersistFolder3_Initialize
1127 * sPathTarget is not set. Don't know how to handle in a non rooted environment.
1129 static HRESULT WINAPI
IFSFldr_PersistFolder3_Initialize (IPersistFolder3
* iface
, LPCITEMIDLIST pidl
)
1131 char sTemp
[MAX_PATH
];
1133 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1135 TRACE ("(%p)->(%p)\n", This
, pidl
);
1138 SHFree (This
->pidlRoot
); /* free the old pidl */
1139 This
->pidlRoot
= ILClone (pidl
); /* set my pidl */
1141 if (This
->sPathTarget
)
1142 SHFree (This
->sPathTarget
);
1145 if (SHGetPathFromIDListA (pidl
, sTemp
)) {
1146 This
->sPathTarget
= SHAlloc (strlen (sTemp
) + 1);
1147 strcpy (This
->sPathTarget
, sTemp
);
1150 TRACE ("--(%p)->(%s)\n", This
, This
->sPathTarget
);
1154 /**************************************************************************
1155 * IFSFldr_PersistFolder3_GetCurFolder
1157 static HRESULT WINAPI
IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3
* iface
, LPITEMIDLIST
* pidl
)
1159 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1161 TRACE ("(%p)->(%p)\n", This
, pidl
);
1163 if (!pidl
) return E_POINTER
;
1164 *pidl
= ILClone (This
->pidlRoot
);
1168 /**************************************************************************
1169 * IFSFldr_PersistFolder3_InitializeEx
1171 * FIXME: errorhandling
1173 static HRESULT WINAPI
1174 IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3
* iface
,
1175 IBindCtx
* pbc
, LPCITEMIDLIST pidlRoot
, const PERSIST_FOLDER_TARGET_INFO
* ppfti
)
1177 char sTemp
[MAX_PATH
];
1179 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1181 TRACE ("(%p)->(%p,%p,%p)\n", This
, pbc
, pidlRoot
, ppfti
);
1183 TRACE ("--%p %s %s 0x%08lx 0x%08x\n",
1184 ppfti
->pidlTargetFolder
, debugstr_w (ppfti
->szTargetParsingName
),
1185 debugstr_w (ppfti
->szNetworkProvider
), ppfti
->dwAttributes
, ppfti
->csidl
);
1188 if (ppfti
&& ppfti
->pidlTargetFolder
)
1189 pdump (ppfti
->pidlTargetFolder
);
1192 __SHFreeAndNil (&This
->pidlRoot
); /* free the old */
1193 if (This
->sPathTarget
)
1194 __SHFreeAndNil (&This
->sPathTarget
);
1197 * Root path and pidl
1199 This
->pidlRoot
= ILClone (pidlRoot
);
1202 * the target folder is spezified in csidl OR pidlTargetFolder OR szTargetParsingName
1205 if (ppfti
->csidl
!= -1) {
1206 if (SHGetSpecialFolderPathA (0, sTemp
, ppfti
->csidl
, ppfti
->csidl
& CSIDL_FLAG_CREATE
)) {
1207 __SHCloneStrA (&This
->sPathTarget
, sTemp
);
1209 } else if (ppfti
->szTargetParsingName
[0]) {
1210 __SHCloneStrWtoA (&This
->sPathTarget
, ppfti
->szTargetParsingName
);
1211 } else if (ppfti
->pidlTargetFolder
) {
1212 if (SHGetPathFromIDListA (ppfti
->pidlTargetFolder
, sTemp
)) {
1213 __SHCloneStrA (&This
->sPathTarget
, sTemp
);
1218 TRACE ("--(%p)->(target=%s)\n", This
, debugstr_a (This
->sPathTarget
));
1219 pdump (This
->pidlRoot
);
1220 return (This
->sPathTarget
) ? S_OK
: E_FAIL
;
1223 static HRESULT WINAPI
1224 IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3
* iface
, PERSIST_FOLDER_TARGET_INFO
* ppfti
)
1226 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1227 FIXME ("(%p)->(%p)\n", This
, ppfti
);
1228 ZeroMemory (ppfti
, sizeof (ppfti
));
1232 static ICOM_VTABLE (IPersistFolder3
) vt_FSFldr_PersistFolder3
=
1234 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1235 IFSFldr_PersistFolder3_QueryInterface
,
1236 IFSFldr_PersistFolder3_AddRef
,
1237 IFSFldr_PersistFolder3_Release
,
1238 IFSFldr_PersistFolder3_GetClassID
,
1239 IFSFldr_PersistFolder3_Initialize
,
1240 IFSFldr_PersistFolder3_fnGetCurFolder
,
1241 IFSFldr_PersistFolder3_InitializeEx
,
1242 IFSFldr_PersistFolder3_GetFolderTargetInfo
1245 /****************************************************************************
1246 * ISFDropTarget implementation
1248 static BOOL
ISFDropTarget_QueryDrop (IDropTarget
* iface
, DWORD dwKeyState
, LPDWORD pdwEffect
)
1250 DWORD dwEffect
= *pdwEffect
;
1252 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1254 *pdwEffect
= DROPEFFECT_NONE
;
1256 if (This
->fAcceptFmt
) { /* Does our interpretation of the keystate ... */
1257 *pdwEffect
= KeyStateToDropEffect (dwKeyState
);
1259 /* ... matches the desired effect ? */
1260 if (dwEffect
& *pdwEffect
) {
1267 static HRESULT WINAPI
ISFDropTarget_QueryInterface (IDropTarget
* iface
, REFIID riid
, LPVOID
* ppvObj
)
1269 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1271 TRACE ("(%p)\n", This
);
1273 return IUnknown_QueryInterface (This
->pUnkOuter
, riid
, ppvObj
);
1276 static ULONG WINAPI
ISFDropTarget_AddRef (IDropTarget
* iface
)
1278 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1280 TRACE ("(%p)\n", This
);
1282 return IUnknown_AddRef (This
->pUnkOuter
);
1285 static ULONG WINAPI
ISFDropTarget_Release (IDropTarget
* iface
)
1287 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1289 TRACE ("(%p)\n", This
);
1291 return IUnknown_Release (This
->pUnkOuter
);
1294 static HRESULT WINAPI
1295 ISFDropTarget_DragEnter (IDropTarget
* iface
, IDataObject
* pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
* pdwEffect
)
1299 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1301 TRACE ("(%p)->(DataObject=%p)\n", This
, pDataObject
);
1303 InitFormatEtc (fmt
, This
->cfShellIDList
, TYMED_HGLOBAL
);
1305 This
->fAcceptFmt
= (S_OK
== IDataObject_QueryGetData (pDataObject
, &fmt
)) ? TRUE
: FALSE
;
1307 ISFDropTarget_QueryDrop (iface
, dwKeyState
, pdwEffect
);
1312 static HRESULT WINAPI
ISFDropTarget_DragOver (IDropTarget
* iface
, DWORD dwKeyState
, POINTL pt
, DWORD
* pdwEffect
)
1314 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1316 TRACE ("(%p)\n", This
);
1319 return E_INVALIDARG
;
1321 ISFDropTarget_QueryDrop (iface
, dwKeyState
, pdwEffect
);
1326 static HRESULT WINAPI
ISFDropTarget_DragLeave (IDropTarget
* iface
)
1328 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1330 TRACE ("(%p)\n", This
);
1332 This
->fAcceptFmt
= FALSE
;
1337 static HRESULT WINAPI
1338 ISFDropTarget_Drop (IDropTarget
* iface
, IDataObject
* pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
* pdwEffect
)
1340 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1342 FIXME ("(%p) object dropped\n", This
);
1347 static struct ICOM_VTABLE (IDropTarget
) dtvt
= {
1348 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1349 ISFDropTarget_QueryInterface
,
1350 ISFDropTarget_AddRef
,
1351 ISFDropTarget_Release
,
1352 ISFDropTarget_DragEnter
,
1353 ISFDropTarget_DragOver
,
1354 ISFDropTarget_DragLeave
,