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
;
176 ULONG refCount
= InterlockedIncrement(&This
->ref
);
178 TRACE ("(%p)->(count=%lu)\n", This
, refCount
- 1);
183 static ULONG WINAPI
IUnknown_fnRelease (IUnknown
* iface
)
185 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
186 ULONG refCount
= InterlockedDecrement(&This
->ref
);
188 TRACE ("(%p)->(count=%lu)\n", This
, refCount
+ 1);
191 TRACE ("-- destroying IShellFolder(%p)\n", This
);
194 SHFree (This
->pidlRoot
);
195 if (This
->sPathTarget
)
196 SHFree (This
->sPathTarget
);
197 LocalFree ((HLOCAL
) This
);
202 static IUnknownVtbl unkvt
=
204 IUnknown_fnQueryInterface
,
209 static shvheader GenericSFHeader
[] = {
210 {IDS_SHV_COLUMN1
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 15},
211 {IDS_SHV_COLUMN2
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
212 {IDS_SHV_COLUMN3
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
213 {IDS_SHV_COLUMN4
, SHCOLSTATE_TYPE_DATE
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 12},
214 {IDS_SHV_COLUMN5
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 5}
217 #define GENERICSHELLVIEWCOLUMNS 5
219 /**************************************************************************
220 * IFSFolder_Constructor
223 * creating undocumented ShellFS_Folder as part of an aggregation
224 * {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
227 HRESULT WINAPI
IFSFolder_Constructor (IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
231 TRACE ("unkOut=%p %s\n", pUnkOuter
, shdebugstr_guid (riid
));
233 if (pUnkOuter
&& !IsEqualIID (riid
, &IID_IUnknown
))
234 return CLASS_E_NOAGGREGATION
;
235 sf
= (IGenericSFImpl
*) LocalAlloc (GMEM_ZEROINIT
, sizeof (IGenericSFImpl
));
237 return E_OUTOFMEMORY
;
241 sf
->lpvtblShellFolder
= &sfvt
;
242 sf
->lpvtblPersistFolder3
= &vt_FSFldr_PersistFolder3
;
243 sf
->lpvtblDropTarget
= &dtvt
;
244 sf
->lpvtblSFHelper
= &shvt
;
245 sf
->pclsid
= (CLSID
*) & CLSID_ShellFSFolder
;
246 sf
->pUnkOuter
= pUnkOuter
? pUnkOuter
: _IUnknown_ (sf
);
248 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf
), riid
, ppv
))) {
249 IUnknown_Release (_IUnknown_ (sf
));
250 return E_NOINTERFACE
;
253 TRACE ("--%p\n", *ppv
);
257 /**************************************************************************
258 * IShellFolder_fnQueryInterface
261 * REFIID riid [in ] Requested InterfaceID
262 * LPVOID* ppvObject [out] Interface* to hold the result
264 static HRESULT WINAPI
IShellFolder_fnQueryInterface (IShellFolder2
* iface
, REFIID riid
, LPVOID
* ppvObj
)
266 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
268 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
270 return IUnknown_QueryInterface (This
->pUnkOuter
, riid
, ppvObj
);
273 /**************************************************************************
274 * IShellFolder_AddRef
277 static ULONG WINAPI
IShellFolder_fnAddRef (IShellFolder2
* iface
)
279 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
281 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
283 return IUnknown_AddRef (This
->pUnkOuter
);
286 /**************************************************************************
287 * IShellFolder_fnRelease
289 static ULONG WINAPI
IShellFolder_fnRelease (IShellFolder2
* iface
)
291 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
293 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
295 return IUnknown_Release (This
->pUnkOuter
);
298 /**************************************************************************
299 * IShellFolder_ParseDisplayName {SHELL32}
301 * Parse a display name.
304 * hwndOwner [in] Parent window for any message's
305 * pbc [in] optional FileSystemBindData context
306 * lpszDisplayName [in] Unicode displayname.
307 * pchEaten [out] (unicode) characters processed
308 * ppidl [out] complex pidl to item
309 * pdwAttributes [out] items attributes
312 * Every folder tries to parse only its own (the leftmost) pidl and creates a
313 * subfolder to evaluate the remaining parts.
314 * Now we can parse into namespaces implemented by shell extensions
316 * Behaviour on win98: lpszDisplayName=NULL -> crash
317 * lpszDisplayName="" -> returns mycoputer-pidl
320 * pdwAttributes is not set
321 * pchEaten is not set like in windows
323 static HRESULT WINAPI
324 IShellFolder_fnParseDisplayName (IShellFolder2
* iface
,
327 LPOLESTR lpszDisplayName
,
328 DWORD
* pchEaten
, LPITEMIDLIST
* ppidl
, DWORD
* pdwAttributes
)
330 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
332 HRESULT hr
= E_INVALIDARG
;
333 LPCWSTR szNext
= NULL
;
334 WCHAR szElement
[MAX_PATH
];
335 CHAR szPath
[MAX_PATH
];
336 LPITEMIDLIST pidlTemp
= NULL
;
339 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
340 This
, hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
), pchEaten
, ppidl
, pdwAttributes
);
342 if (!lpszDisplayName
|| !ppidl
)
346 *pchEaten
= 0; /* strange but like the original */
348 if (*lpszDisplayName
) {
349 /* get the next element */
350 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
352 /* build the full pathname to the element */
353 lstrcpyA(szPath
, This
->sPathTarget
);
354 PathAddBackslashA(szPath
);
355 len
= lstrlenA(szPath
);
356 WideCharToMultiByte(CP_ACP
, 0, szElement
, -1, szPath
+ len
, MAX_PATH
- len
, NULL
, NULL
);
359 hr
= _ILCreateFromPathA(szPath
, &pidlTemp
);
362 if (szNext
&& *szNext
) {
363 /* try to analyse the next element */
364 hr
= SHELL32_ParseNextElement (iface
, hwndOwner
, pbc
, &pidlTemp
, (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
366 /* it's the last element */
367 if (pdwAttributes
&& *pdwAttributes
) {
368 hr
= SHELL32_GetItemAttributes (_IShellFolder_ (This
), pidlTemp
, pdwAttributes
);
379 TRACE ("(%p)->(-- pidl=%p ret=0x%08lx)\n", This
, ppidl
? *ppidl
: 0, hr
);
384 /**************************************************************************
385 * IShellFolder_fnEnumObjects
387 * HWND hwndOwner, //[in ] Parent Window
388 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
389 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
391 static HRESULT WINAPI
392 IShellFolder_fnEnumObjects (IShellFolder2
* iface
, HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
* ppEnumIDList
)
394 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
396 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This
, hwndOwner
, dwFlags
, ppEnumIDList
);
398 *ppEnumIDList
= IEnumIDList_Constructor();
400 CreateFolderEnumList(*ppEnumIDList
, This
->sPathTarget
, dwFlags
);
402 TRACE ("-- (%p)->(new ID List: %p)\n", This
, *ppEnumIDList
);
404 return *ppEnumIDList
? S_OK
: E_OUTOFMEMORY
;
407 /**************************************************************************
408 * IShellFolder_fnBindToObject
410 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
411 * LPBC pbc, //[in ] optional FileSystemBindData context
412 * REFIID riid, //[in ] Initial Interface
413 * LPVOID* ppvObject //[out] Interface*
415 static HRESULT WINAPI
416 IShellFolder_fnBindToObject (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, LPBC pbc
, REFIID riid
, LPVOID
* ppvOut
)
418 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
420 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This
, pidl
, pbc
, shdebugstr_guid (riid
), ppvOut
);
422 return SHELL32_BindToChild (This
->pidlRoot
, This
->sPathTarget
, pidl
, riid
, ppvOut
);
425 /**************************************************************************
426 * IShellFolder_fnBindToStorage
428 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
429 * LPBC pbc, //[in ] reserved
430 * REFIID riid, //[in ] Initial storage interface
431 * LPVOID* ppvObject //[out] Interface* returned
433 static HRESULT WINAPI
434 IShellFolder_fnBindToStorage (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
436 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
438 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
444 /**************************************************************************
445 * IShellFolder_fnCompareIDs
448 static HRESULT WINAPI
449 IShellFolder_fnCompareIDs (IShellFolder2
* iface
, LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
451 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
455 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This
, lParam
, pidl1
, pidl2
);
456 nReturn
= SHELL32_CompareIDs (_IShellFolder_ (This
), lParam
, pidl1
, pidl2
);
457 TRACE ("-- %i\n", nReturn
);
461 /**************************************************************************
462 * IShellFolder_fnCreateViewObject
464 static HRESULT WINAPI
465 IShellFolder_fnCreateViewObject (IShellFolder2
* iface
, HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
467 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
469 LPSHELLVIEW pShellView
;
470 HRESULT hr
= E_INVALIDARG
;
472 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This
, hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
477 if (IsEqualIID (riid
, &IID_IDropTarget
)) {
478 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
, ppvOut
);
479 } else if (IsEqualIID (riid
, &IID_IContextMenu
)) {
480 FIXME ("IContextMenu not implemented\n");
482 } else if (IsEqualIID (riid
, &IID_IShellView
)) {
483 pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
485 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
486 IShellView_Release (pShellView
);
490 TRACE ("-- (%p)->(interface=%p)\n", This
, ppvOut
);
494 /**************************************************************************
495 * IShellFolder_fnGetAttributesOf
498 * UINT cidl, //[in ] num elements in pidl array
499 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
500 * ULONG* rgfInOut) //[out] result array
503 static HRESULT WINAPI
504 IShellFolder_fnGetAttributesOf (IShellFolder2
* iface
, UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
506 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
510 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This
, cidl
, apidl
, *rgfInOut
);
512 if ((!cidl
) || (!apidl
) || (!rgfInOut
))
518 while (cidl
> 0 && *apidl
) {
520 SHELL32_GetItemAttributes (_IShellFolder_ (This
), *apidl
, rgfInOut
);
525 TRACE ("-- result=0x%08lx\n", *rgfInOut
);
530 /**************************************************************************
531 * IShellFolder_fnGetUIObjectOf
534 * HWND hwndOwner, //[in ] Parent window for any output
535 * UINT cidl, //[in ] array size
536 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
537 * REFIID riid, //[in ] Requested Interface
538 * UINT* prgfInOut, //[ ] reserved
539 * LPVOID* ppvObject) //[out] Resulting Interface
542 * This function gets asked to return "view objects" for one or more (multiple select)
544 * The viewobject typically is an COM object with one of the following interfaces:
545 * IExtractIcon,IDataObject,IContextMenu
546 * In order to support icon positions in the default Listview your DataObject
547 * must implement the SetData method (in addition to GetData :) - the shell passes
548 * a barely documented "Icon positions" structure to SetData when the drag starts,
549 * and GetData's it if the drop is in another explorer window that needs the positions.
551 static HRESULT WINAPI
552 IShellFolder_fnGetUIObjectOf (IShellFolder2
* iface
,
554 UINT cidl
, LPCITEMIDLIST
* apidl
, REFIID riid
, UINT
* prgfInOut
, LPVOID
* ppvOut
)
556 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
559 IUnknown
*pObj
= NULL
;
560 HRESULT hr
= E_INVALIDARG
;
562 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
563 This
, hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
568 if (IsEqualIID (riid
, &IID_IContextMenu
) && (cidl
>= 1)) {
569 pObj
= (LPUNKNOWN
) ISvItemCm_Constructor ((IShellFolder
*) iface
, This
->pidlRoot
, apidl
, cidl
);
571 } else if (IsEqualIID (riid
, &IID_IDataObject
) && (cidl
>= 1)) {
572 pObj
= (LPUNKNOWN
) IDataObject_Constructor (hwndOwner
, This
->pidlRoot
, apidl
, cidl
);
574 } else if (IsEqualIID (riid
, &IID_IExtractIconA
) && (cidl
== 1)) {
575 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
576 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
579 } else if (IsEqualIID (riid
, &IID_IExtractIconW
) && (cidl
== 1)) {
580 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
581 pObj
= (LPUNKNOWN
) IExtractIconW_Constructor (pidl
);
584 } else if (IsEqualIID (riid
, &IID_IDropTarget
) && (cidl
>= 1)) {
585 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
, (LPVOID
*) & pObj
);
586 } else if ((IsEqualIID(riid
,&IID_IShellLinkW
) || IsEqualIID(riid
,&IID_IShellLinkA
))
588 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
589 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*)&pObj
);
595 if (SUCCEEDED(hr
) && !pObj
)
600 TRACE ("(%p)->hr=0x%08lx\n", This
, hr
);
604 void SHELL_FS_ProcessDisplayFilename(LPSTR szPath
, DWORD dwFlags
)
606 /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
607 if (!(dwFlags
& SHGDN_FORPARSING
) &&
608 ((dwFlags
& SHGDN_INFOLDER
) || (dwFlags
== SHGDN_NORMAL
))) {
611 DWORD dwDataSize
= sizeof (DWORD
);
612 BOOL doHide
= FALSE
; /* The default value is FALSE (win98 at least) */
614 if (!RegCreateKeyExA (HKEY_CURRENT_USER
,
615 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
616 0, 0, 0, KEY_ALL_ACCESS
, 0, &hKey
, 0)) {
617 if (!RegQueryValueExA (hKey
, "HideFileExt", 0, 0, (LPBYTE
) & dwData
, &dwDataSize
))
624 LPSTR ext
= PathFindExtensionA(szPath
);
628 char classname
[MAX_PATH
];
629 LONG classlen
= MAX_PATH
;
631 if (!RegQueryValueA(HKEY_CLASSES_ROOT
, ext
, classname
, &classlen
))
632 if (!RegOpenKeyA(HKEY_CLASSES_ROOT
, classname
, &hkey
)) {
633 if (!RegQueryValueExA(hkey
, "NeverShowExt", 0, NULL
, NULL
, NULL
))
641 if (doHide
&& szPath
[0] != '.')
642 PathRemoveExtensionA (szPath
);
646 /**************************************************************************
647 * IShellFolder_fnGetDisplayNameOf
648 * Retrieves the display name for the specified file object or subfolder
651 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
652 * DWORD dwFlags, //[in ] SHGNO formatting flags
653 * LPSTRRET lpName) //[out] Returned display name
656 * if the name is in the pidl the ret value should be a STRRET_OFFSET
659 static HRESULT WINAPI
660 IShellFolder_fnGetDisplayNameOf (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
662 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
664 CHAR szPath
[MAX_PATH
];
670 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This
, pidl
, dwFlags
, strRet
);
673 if (!pidl
|| !strRet
)
676 bSimplePidl
= _ILIsPidlSimple (pidl
);
678 /* take names of special folders only if its only this folder */
679 if (_ILIsSpecialFolder (pidl
)) {
681 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
); /* append my own path */
683 FIXME ("special pidl\n");
686 if (!(dwFlags
& SHGDN_INFOLDER
) && (dwFlags
& SHGDN_FORPARSING
) && This
->sPathTarget
) {
687 lstrcpyA (szPath
, This
->sPathTarget
); /* get path to root */
688 PathAddBackslashA (szPath
);
689 len
= lstrlenA (szPath
);
691 _ILSimpleGetText (pidl
, szPath
+ len
, MAX_PATH
- len
); /* append my own path */
693 if (!_ILIsFolder(pidl
))
694 SHELL_FS_ProcessDisplayFilename(szPath
, dwFlags
);
697 if ((dwFlags
& SHGDN_FORPARSING
) && !bSimplePidl
) { /* go deeper if needed */
698 PathAddBackslashA (szPath
);
699 len
= lstrlenA (szPath
);
702 (SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
| SHGDN_INFOLDER
, szPath
+ len
, MAX_PATH
- len
)))
703 return E_OUTOFMEMORY
;
705 strRet
->uType
= STRRET_CSTR
;
706 lstrcpynA (strRet
->u
.cStr
, szPath
, MAX_PATH
);
708 TRACE ("-- (%p)->(%s)\n", This
, szPath
);
712 /**************************************************************************
713 * IShellFolder_fnSetNameOf
714 * Changes the name of a file object or subfolder, possibly changing its item
715 * identifier in the process.
718 * HWND hwndOwner, //[in ] Owner window for output
719 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
720 * LPCOLESTR lpszName, //[in ] the items new display name
721 * DWORD dwFlags, //[in ] SHGNO formatting flags
722 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
724 static HRESULT WINAPI
IShellFolder_fnSetNameOf (IShellFolder2
* iface
, HWND hwndOwner
, LPCITEMIDLIST pidl
, /*simple pidl */
725 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
727 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
728 char szSrc
[MAX_PATH
],
731 BOOL bIsFolder
= _ILIsFolder (ILFindLastID (pidl
));
733 TRACE ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This
, hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
735 /* build source path */
736 if (dwFlags
& SHGDN_INFOLDER
) {
737 strcpy (szSrc
, This
->sPathTarget
);
738 PathAddBackslashA (szSrc
);
739 len
= strlen (szSrc
);
740 _ILSimpleGetText (pidl
, szSrc
+ len
, MAX_PATH
- len
);
742 /* FIXME: Can this work with a simple PIDL? */
743 SHGetPathFromIDListA (pidl
, szSrc
);
746 /* build destination path */
747 strcpy (szDest
, This
->sPathTarget
);
748 PathAddBackslashA (szDest
);
749 len
= strlen (szDest
);
750 WideCharToMultiByte (CP_ACP
, 0, lpName
, -1, szDest
+ len
, MAX_PATH
- len
, NULL
, NULL
);
751 szDest
[MAX_PATH
- 1] = 0;
752 TRACE ("src=%s dest=%s\n", szSrc
, szDest
);
753 if (MoveFileA (szSrc
, szDest
)) {
757 hr
= _ILCreateFromPathA(szDest
, pPidlOut
);
759 SHChangeNotify (bIsFolder
? SHCNE_RENAMEFOLDER
: SHCNE_RENAMEITEM
, SHCNF_PATHA
, szSrc
, szDest
);
767 static HRESULT WINAPI
IShellFolder_fnGetDefaultSearchGUID (IShellFolder2
* iface
, GUID
* pguid
)
769 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
770 FIXME ("(%p)\n", This
);
773 static HRESULT WINAPI
IShellFolder_fnEnumSearches (IShellFolder2
* iface
, IEnumExtraSearch
** ppenum
)
775 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
776 FIXME ("(%p)\n", This
);
779 static HRESULT WINAPI
780 IShellFolder_fnGetDefaultColumn (IShellFolder2
* iface
, DWORD dwRes
, ULONG
* pSort
, ULONG
* pDisplay
)
782 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
784 TRACE ("(%p)\n", This
);
793 static HRESULT WINAPI
IShellFolder_fnGetDefaultColumnState (IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
795 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
797 TRACE ("(%p)\n", This
);
799 if (!pcsFlags
|| iColumn
>= GENERICSHELLVIEWCOLUMNS
)
802 *pcsFlags
= GenericSFHeader
[iColumn
].pcsFlags
;
806 static HRESULT WINAPI
807 IShellFolder_fnGetDetailsEx (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
809 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
810 FIXME ("(%p)\n", This
);
814 static HRESULT WINAPI
815 IShellFolder_fnGetDetailsOf (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
817 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
820 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
822 if (!psd
|| iColumn
>= GENERICSHELLVIEWCOLUMNS
)
826 /* the header titles */
827 psd
->fmt
= GenericSFHeader
[iColumn
].fmt
;
828 psd
->cxChar
= GenericSFHeader
[iColumn
].cxChar
;
829 psd
->str
.uType
= STRRET_CSTR
;
830 LoadStringA (shell32_hInstance
, GenericSFHeader
[iColumn
].colnameid
, psd
->str
.u
.cStr
, MAX_PATH
);
833 /* the data from the pidl */
836 hr
= IShellFolder_GetDisplayNameOf (iface
, pidl
, SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
839 _ILGetFileSize (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
842 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
845 _ILGetFileDate (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
847 case 4: /* attributes */
848 _ILGetFileAttributes (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
852 psd
->str
.uType
= STRRET_CSTR
;
857 static HRESULT WINAPI
IShellFolder_fnMapColumnToSCID (IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
859 _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl
, iface
)
860 FIXME ("(%p)\n", This
);
864 static IShellFolder2Vtbl sfvt
=
866 IShellFolder_fnQueryInterface
,
867 IShellFolder_fnAddRef
,
868 IShellFolder_fnRelease
,
869 IShellFolder_fnParseDisplayName
,
870 IShellFolder_fnEnumObjects
,
871 IShellFolder_fnBindToObject
,
872 IShellFolder_fnBindToStorage
,
873 IShellFolder_fnCompareIDs
,
874 IShellFolder_fnCreateViewObject
,
875 IShellFolder_fnGetAttributesOf
,
876 IShellFolder_fnGetUIObjectOf
,
877 IShellFolder_fnGetDisplayNameOf
,
878 IShellFolder_fnSetNameOf
,
880 IShellFolder_fnGetDefaultSearchGUID
,
881 IShellFolder_fnEnumSearches
,
882 IShellFolder_fnGetDefaultColumn
,
883 IShellFolder_fnGetDefaultColumnState
,
884 IShellFolder_fnGetDetailsEx
,
885 IShellFolder_fnGetDetailsOf
,
886 IShellFolder_fnMapColumnToSCID
889 /****************************************************************************
890 * ISFHelper for IShellFolder implementation
893 static HRESULT WINAPI
ISFHelper_fnQueryInterface (ISFHelper
* iface
, REFIID riid
, LPVOID
* ppvObj
)
895 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
897 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
899 return IUnknown_QueryInterface (This
->pUnkOuter
, riid
, ppvObj
);
902 static ULONG WINAPI
ISFHelper_fnAddRef (ISFHelper
* iface
)
904 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
906 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
908 return IUnknown_AddRef (This
->pUnkOuter
);
911 static ULONG WINAPI
ISFHelper_fnRelease (ISFHelper
* iface
)
913 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
915 TRACE ("(%p)\n", This
);
917 return IUnknown_Release (This
->pUnkOuter
);
920 /****************************************************************************
921 * ISFHelper_fnAddFolder
923 * creates a unique folder name
926 static HRESULT WINAPI
ISFHelper_fnGetUniqueName (ISFHelper
* iface
, LPSTR lpName
, UINT uLen
)
928 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
)
931 char szText
[MAX_PATH
];
932 char *szNewFolder
= "New Folder";
934 TRACE ("(%p)(%s %u)\n", This
, lpName
, uLen
);
936 if (uLen
< strlen (szNewFolder
) + 4)
939 strcpy (lpName
, szNewFolder
);
941 hr
= IShellFolder_fnEnumObjects (_IShellFolder2_ (This
), 0,
942 SHCONTF_FOLDERS
| SHCONTF_NONFOLDERS
| SHCONTF_INCLUDEHIDDEN
, &penum
);
948 next
:IEnumIDList_Reset (penum
);
949 while (S_OK
== IEnumIDList_Next (penum
, 1, &pidl
, &dwFetched
) && dwFetched
) {
950 _ILSimpleGetText (pidl
, szText
, MAX_PATH
);
951 if (0 == strcasecmp (szText
, lpName
)) {
952 sprintf (lpName
, "%s %d", szNewFolder
, i
++);
961 IEnumIDList_Release (penum
);
966 /****************************************************************************
967 * ISFHelper_fnAddFolder
972 static HRESULT WINAPI
ISFHelper_fnAddFolder (ISFHelper
* iface
, HWND hwnd
, LPCSTR lpName
, LPITEMIDLIST
* ppidlOut
)
974 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
)
975 char lpstrNewDir
[MAX_PATH
];
977 HRESULT hres
= E_FAIL
;
979 TRACE ("(%p)(%s %p)\n", This
, lpName
, ppidlOut
);
981 strcpy (lpstrNewDir
, This
->sPathTarget
);
982 PathAppendA(lpstrNewDir
, lpName
);
984 bRes
= CreateDirectoryA (lpstrNewDir
, NULL
);
986 SHChangeNotify (SHCNE_MKDIR
, SHCNF_PATHA
, lpstrNewDir
, NULL
);
991 hres
= _ILCreateFromPathA(lpstrNewDir
, ppidlOut
);
993 char lpstrText
[128 + MAX_PATH
];
994 char lpstrTempText
[128];
995 char lpstrCaption
[256];
997 /* Cannot Create folder because of permissions */
998 LoadStringA (shell32_hInstance
, IDS_CREATEFOLDER_DENIED
, lpstrTempText
, sizeof (lpstrTempText
));
999 LoadStringA (shell32_hInstance
, IDS_CREATEFOLDER_CAPTION
, lpstrCaption
, sizeof (lpstrCaption
));
1000 sprintf (lpstrText
, lpstrTempText
, lpstrNewDir
);
1001 MessageBoxA (hwnd
, lpstrText
, lpstrCaption
, MB_OK
| MB_ICONEXCLAMATION
);
1007 /****************************************************************************
1008 * ISFHelper_fnDeleteItems
1010 * deletes items in folder
1012 static HRESULT WINAPI
ISFHelper_fnDeleteItems (ISFHelper
* iface
, UINT cidl
, LPCITEMIDLIST
* apidl
)
1014 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
)
1016 char szPath
[MAX_PATH
];
1017 BOOL bConfirm
= TRUE
;
1019 TRACE ("(%p)(%u %p)\n", This
, cidl
, apidl
);
1021 /* deleting multiple items so give a slightly different warning */
1025 snprintf (tmp
, sizeof (tmp
), "%d", cidl
);
1026 if (!SHELL_ConfirmDialog(ASK_DELETE_MULTIPLE_ITEM
, tmp
))
1031 for (i
= 0; i
< cidl
; i
++) {
1032 strcpy (szPath
, This
->sPathTarget
);
1033 PathAddBackslashA (szPath
);
1034 _ILSimpleGetText (apidl
[i
], szPath
+ strlen (szPath
), MAX_PATH
);
1036 if (_ILIsFolder (apidl
[i
])) {
1039 TRACE ("delete %s\n", szPath
);
1040 if (!SHELL_DeleteDirectoryA (szPath
, bConfirm
)) {
1041 TRACE ("delete %s failed, bConfirm=%d\n", szPath
, bConfirm
);
1044 pidl
= ILCombine (This
->pidlRoot
, apidl
[i
]);
1045 SHChangeNotify (SHCNE_RMDIR
, SHCNF_IDLIST
, pidl
, NULL
);
1047 } else if (_ILIsValue (apidl
[i
])) {
1050 TRACE ("delete %s\n", szPath
);
1051 if (!SHELL_DeleteFileA (szPath
, bConfirm
)) {
1052 TRACE ("delete %s failed, bConfirm=%d\n", szPath
, bConfirm
);
1055 pidl
= ILCombine (This
->pidlRoot
, apidl
[i
]);
1056 SHChangeNotify (SHCNE_DELETE
, SHCNF_IDLIST
, pidl
, NULL
);
1064 /****************************************************************************
1065 * ISFHelper_fnCopyItems
1067 * copies items to this folder
1069 static HRESULT WINAPI
1070 ISFHelper_fnCopyItems (ISFHelper
* iface
, IShellFolder
* pSFFrom
, UINT cidl
, LPCITEMIDLIST
* apidl
)
1073 IPersistFolder2
*ppf2
= NULL
;
1074 char szSrcPath
[MAX_PATH
],
1075 szDstPath
[MAX_PATH
];
1077 _ICOM_THIS_From_ISFHelper (IGenericSFImpl
, iface
);
1079 TRACE ("(%p)->(%p,%u,%p)\n", This
, pSFFrom
, cidl
, apidl
);
1081 IShellFolder_QueryInterface (pSFFrom
, &IID_IPersistFolder2
, (LPVOID
*) & ppf2
);
1085 if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2
, &pidl
))) {
1086 for (i
= 0; i
< cidl
; i
++) {
1087 SHGetPathFromIDListA (pidl
, szSrcPath
);
1088 PathAddBackslashA (szSrcPath
);
1089 _ILSimpleGetText (apidl
[i
], szSrcPath
+ strlen (szSrcPath
), MAX_PATH
);
1091 strcpy (szDstPath
, This
->sPathTarget
);
1092 PathAddBackslashA (szDstPath
);
1093 _ILSimpleGetText (apidl
[i
], szDstPath
+ strlen (szDstPath
), MAX_PATH
);
1094 MESSAGE ("would copy %s to %s\n", szSrcPath
, szDstPath
);
1098 IPersistFolder2_Release (ppf2
);
1103 static ISFHelperVtbl shvt
=
1105 ISFHelper_fnQueryInterface
,
1107 ISFHelper_fnRelease
,
1108 ISFHelper_fnGetUniqueName
,
1109 ISFHelper_fnAddFolder
,
1110 ISFHelper_fnDeleteItems
,
1111 ISFHelper_fnCopyItems
1114 /************************************************************************
1115 * IFSFldr_PersistFolder3_QueryInterface
1118 static HRESULT WINAPI
IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3
* iface
, REFIID iid
, LPVOID
* ppvObj
)
1120 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1122 TRACE ("(%p)\n", This
);
1124 return IUnknown_QueryInterface (This
->pUnkOuter
, iid
, ppvObj
);
1127 /************************************************************************
1128 * IFSFldr_PersistFolder3_AddRef
1131 static ULONG WINAPI
IFSFldr_PersistFolder3_AddRef (IPersistFolder3
* iface
)
1133 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1135 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
1137 return IUnknown_AddRef (This
->pUnkOuter
);
1140 /************************************************************************
1141 * IFSFldr_PersistFolder3_Release
1144 static ULONG WINAPI
IFSFldr_PersistFolder3_Release (IPersistFolder3
* iface
)
1146 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1148 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
1150 return IUnknown_Release (This
->pUnkOuter
);
1153 /************************************************************************
1154 * IFSFldr_PersistFolder3_GetClassID
1156 static HRESULT WINAPI
IFSFldr_PersistFolder3_GetClassID (IPersistFolder3
* iface
, CLSID
* lpClassId
)
1158 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1160 TRACE ("(%p)\n", This
);
1164 *lpClassId
= *This
->pclsid
;
1169 /************************************************************************
1170 * IFSFldr_PersistFolder3_Initialize
1173 * sPathTarget is not set. Don't know how to handle in a non rooted environment.
1175 static HRESULT WINAPI
IFSFldr_PersistFolder3_Initialize (IPersistFolder3
* iface
, LPCITEMIDLIST pidl
)
1177 char sTemp
[MAX_PATH
];
1179 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1181 TRACE ("(%p)->(%p)\n", This
, pidl
);
1184 SHFree (This
->pidlRoot
); /* free the old pidl */
1185 This
->pidlRoot
= ILClone (pidl
); /* set my pidl */
1187 if (This
->sPathTarget
)
1188 SHFree (This
->sPathTarget
);
1191 if (SHGetPathFromIDListA (pidl
, sTemp
)) {
1192 This
->sPathTarget
= SHAlloc (strlen (sTemp
) + 1);
1193 strcpy (This
->sPathTarget
, sTemp
);
1196 TRACE ("--(%p)->(%s)\n", This
, This
->sPathTarget
);
1200 /**************************************************************************
1201 * IFSFldr_PersistFolder3_GetCurFolder
1203 static HRESULT WINAPI
IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3
* iface
, LPITEMIDLIST
* pidl
)
1205 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1207 TRACE ("(%p)->(%p)\n", This
, pidl
);
1209 if (!pidl
) return E_POINTER
;
1210 *pidl
= ILClone (This
->pidlRoot
);
1214 /**************************************************************************
1215 * IFSFldr_PersistFolder3_InitializeEx
1217 * FIXME: errorhandling
1219 static HRESULT WINAPI
1220 IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3
* iface
,
1221 IBindCtx
* pbc
, LPCITEMIDLIST pidlRoot
, const PERSIST_FOLDER_TARGET_INFO
* ppfti
)
1223 char sTemp
[MAX_PATH
];
1225 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1227 TRACE ("(%p)->(%p,%p,%p)\n", This
, pbc
, pidlRoot
, ppfti
);
1229 TRACE ("--%p %s %s 0x%08lx 0x%08x\n",
1230 ppfti
->pidlTargetFolder
, debugstr_w (ppfti
->szTargetParsingName
),
1231 debugstr_w (ppfti
->szNetworkProvider
), ppfti
->dwAttributes
, ppfti
->csidl
);
1234 if (ppfti
&& ppfti
->pidlTargetFolder
)
1235 pdump (ppfti
->pidlTargetFolder
);
1238 __SHFreeAndNil (&This
->pidlRoot
); /* free the old */
1239 if (This
->sPathTarget
)
1240 __SHFreeAndNil (&This
->sPathTarget
);
1243 * Root path and pidl
1245 This
->pidlRoot
= ILClone (pidlRoot
);
1248 * the target folder is spezified in csidl OR pidlTargetFolder OR szTargetParsingName
1251 if (ppfti
->csidl
!= -1) {
1252 if (SHGetSpecialFolderPathA (0, sTemp
, ppfti
->csidl
, ppfti
->csidl
& CSIDL_FLAG_CREATE
)) {
1253 __SHCloneStrA (&This
->sPathTarget
, sTemp
);
1255 } else if (ppfti
->szTargetParsingName
[0]) {
1256 __SHCloneStrWtoA (&This
->sPathTarget
, ppfti
->szTargetParsingName
);
1257 } else if (ppfti
->pidlTargetFolder
) {
1258 if (SHGetPathFromIDListA (ppfti
->pidlTargetFolder
, sTemp
)) {
1259 __SHCloneStrA (&This
->sPathTarget
, sTemp
);
1264 TRACE ("--(%p)->(target=%s)\n", This
, debugstr_a (This
->sPathTarget
));
1265 pdump (This
->pidlRoot
);
1266 return (This
->sPathTarget
) ? S_OK
: E_FAIL
;
1269 static HRESULT WINAPI
1270 IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3
* iface
, PERSIST_FOLDER_TARGET_INFO
* ppfti
)
1272 _ICOM_THIS_From_IPersistFolder3 (IGenericSFImpl
, iface
);
1273 FIXME ("(%p)->(%p)\n", This
, ppfti
);
1274 ZeroMemory (ppfti
, sizeof (ppfti
));
1278 static IPersistFolder3Vtbl vt_FSFldr_PersistFolder3
=
1280 IFSFldr_PersistFolder3_QueryInterface
,
1281 IFSFldr_PersistFolder3_AddRef
,
1282 IFSFldr_PersistFolder3_Release
,
1283 IFSFldr_PersistFolder3_GetClassID
,
1284 IFSFldr_PersistFolder3_Initialize
,
1285 IFSFldr_PersistFolder3_fnGetCurFolder
,
1286 IFSFldr_PersistFolder3_InitializeEx
,
1287 IFSFldr_PersistFolder3_GetFolderTargetInfo
1290 /****************************************************************************
1291 * ISFDropTarget implementation
1293 static BOOL
ISFDropTarget_QueryDrop (IDropTarget
* iface
, DWORD dwKeyState
, LPDWORD pdwEffect
)
1295 DWORD dwEffect
= *pdwEffect
;
1297 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1299 *pdwEffect
= DROPEFFECT_NONE
;
1301 if (This
->fAcceptFmt
) { /* Does our interpretation of the keystate ... */
1302 *pdwEffect
= KeyStateToDropEffect (dwKeyState
);
1304 /* ... matches the desired effect ? */
1305 if (dwEffect
& *pdwEffect
) {
1312 static HRESULT WINAPI
ISFDropTarget_QueryInterface (IDropTarget
* iface
, REFIID riid
, LPVOID
* ppvObj
)
1314 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1316 TRACE ("(%p)\n", This
);
1318 return IUnknown_QueryInterface (This
->pUnkOuter
, riid
, ppvObj
);
1321 static ULONG WINAPI
ISFDropTarget_AddRef (IDropTarget
* iface
)
1323 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1325 TRACE ("(%p)\n", This
);
1327 return IUnknown_AddRef (This
->pUnkOuter
);
1330 static ULONG WINAPI
ISFDropTarget_Release (IDropTarget
* iface
)
1332 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1334 TRACE ("(%p)\n", This
);
1336 return IUnknown_Release (This
->pUnkOuter
);
1339 static HRESULT WINAPI
1340 ISFDropTarget_DragEnter (IDropTarget
* iface
, IDataObject
* pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
* pdwEffect
)
1344 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1346 TRACE ("(%p)->(DataObject=%p)\n", This
, pDataObject
);
1348 InitFormatEtc (fmt
, This
->cfShellIDList
, TYMED_HGLOBAL
);
1350 This
->fAcceptFmt
= (S_OK
== IDataObject_QueryGetData (pDataObject
, &fmt
)) ? TRUE
: FALSE
;
1352 ISFDropTarget_QueryDrop (iface
, dwKeyState
, pdwEffect
);
1357 static HRESULT WINAPI
ISFDropTarget_DragOver (IDropTarget
* iface
, DWORD dwKeyState
, POINTL pt
, DWORD
* pdwEffect
)
1359 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1361 TRACE ("(%p)\n", This
);
1364 return E_INVALIDARG
;
1366 ISFDropTarget_QueryDrop (iface
, dwKeyState
, pdwEffect
);
1371 static HRESULT WINAPI
ISFDropTarget_DragLeave (IDropTarget
* iface
)
1373 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1375 TRACE ("(%p)\n", This
);
1377 This
->fAcceptFmt
= FALSE
;
1382 static HRESULT WINAPI
1383 ISFDropTarget_Drop (IDropTarget
* iface
, IDataObject
* pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
* pdwEffect
)
1385 _ICOM_THIS_From_IDropTarget (IGenericSFImpl
, iface
);
1387 FIXME ("(%p) object dropped\n", This
);
1392 static struct IDropTargetVtbl dtvt
= {
1393 ISFDropTarget_QueryInterface
,
1394 ISFDropTarget_AddRef
,
1395 ISFDropTarget_Release
,
1396 ISFDropTarget_DragEnter
,
1397 ISFDropTarget_DragOver
,
1398 ISFDropTarget_DragLeave
,