4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999 Juergen Schmied
7 * IShellFolder2 and related interfaces
14 #include "debugtools.h"
21 #include "wine/obj_base.h"
22 #include "wine/obj_dragdrop.h"
23 #include "wine/obj_shellfolder.h"
24 #include "wine/undocshell.h"
25 #include "shell32_main.h"
28 DEFAULT_DEBUG_CHANNEL(shell)
31 /***************************************************************************
32 * debughelper: print out the return adress
33 * helps especially to track down unbalanced AddRef/Release
38 #define _CALL_TRACE TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 ));
52 /***************************************************************************
53 * GetNextElement (internal function)
55 * gets a part of a string till the first backslash
58 * pszNext [IN] string to get the element from
59 * pszOut [IN] pointer to buffer whitch receives string
60 * dwOut [IN] length of pszOut
63 * LPSTR pointer to first, not yet parsed char
66 static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut)
67 { LPCWSTR pszTail = pszNext;
69 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut);
73 if(!pszNext || !*pszNext)
76 while(*pszTail && (*pszTail != (WCHAR)'\\'))
79 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1;
80 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy);
87 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail);
91 static HRESULT SHELL32_ParseNextElement(
94 LPITEMIDLIST * pidlInOut,
99 HRESULT hr = E_OUTOFMEMORY;
100 LPITEMIDLIST pidlOut, pidlTemp = NULL;
101 IShellFolder *psfChild;
103 TRACE("(%p, %p, %s)\n",psf, pidlInOut ? *pidlInOut : NULL, debugstr_w(szNext));
106 /* get the shellfolder for the child pidl and let it analyse further */
107 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
111 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes);
112 IShellFolder_Release(psfChild);
114 pidlTemp = ILCombine(*pidlInOut, pidlOut);
121 *pidlInOut = pidlTemp;
123 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr);
127 /***********************************************************************
128 * SHELL32_CoCreateInitSF
130 * creates a initialized shell folder
132 static HRESULT SHELL32_CoCreateInitSF (
133 LPITEMIDLIST pidlRoot,
134 LPITEMIDLIST pidlChild,
140 LPITEMIDLIST absPidl;
141 IShellFolder2 *pShellFolder;
142 IPersistFolder *pPersistFolder;
144 TRACE("%p %p\n", pidlRoot, pidlChild);
148 /* we have to ask first for IPersistFolder, some special folders are expecting this */
149 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder);
152 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder);
155 absPidl = ILCombine (pidlRoot, pidlChild);
156 hr = IPersistFolder_Initialize(pPersistFolder, absPidl);
157 IPersistFolder_Release(pPersistFolder);
159 *ppvOut = pShellFolder;
163 TRACE("-- ret=0x%08lx\n", hr);
167 static HRESULT SHELL32_GetDisplayNameOfChild(
174 LPITEMIDLIST pidlFirst, pidlNext;
175 IShellFolder2 * psfChild;
176 HRESULT hr = E_OUTOFMEMORY;
179 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen);
182 if ((pidlFirst = ILCloneFirst(pidl)))
184 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
187 pidlNext = ILGetNext(pidl);
189 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp);
192 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext);
195 IShellFolder_Release(psfChild);
200 TRACE("-- ret=0x%08lx %s\n", hr, szOut);
205 /***********************************************************************
206 * IShellFolder implementation
211 ICOM_VFIELD(IUnknown);
213 ICOM_VTABLE(IShellFolder2)* lpvtblShellFolder;;
214 ICOM_VTABLE(IPersistFolder)* lpvtblPersistFolder;
215 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget;
217 IUnknown *pUnkOuter; /* used for aggregation */
222 LPITEMIDLIST absPidl; /* complete pidl */
224 UINT cfShellIDList; /* clipboardformat for IDropTarget */
225 BOOL fAcceptFmt; /* flag for pending Drop */
228 static struct ICOM_VTABLE(IUnknown) unkvt;
229 static struct ICOM_VTABLE(IShellFolder2) sfvt;
230 static struct ICOM_VTABLE(IPersistFolder) psfvt;
231 static struct ICOM_VTABLE(IDropTarget) dtvt;
233 static IShellFolder * ISF_MyComputer_Constructor(void);
235 #define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder)))
236 #define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset);
238 #define _IPersistFolder_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder)))
239 #define _ICOM_THIS_From_IPersistFolder(class, name) class* This = (class*)(((char*)name)-_IPersistFolder_Offset);
241 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
242 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
245 converts This to a interface pointer
247 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
248 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder)
249 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder)
250 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder)
251 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder)
252 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget)
253 /**************************************************************************
254 * registers clipboardformat once
256 static void SF_RegisterClipFmt (IGenericSFImpl * This)
258 TRACE("(%p)\n", This);
260 if (!This->cfShellIDList)
262 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);
266 /**************************************************************************
267 * we need a seperate IUnknown to handle aggregation
270 static HRESULT WINAPI IUnknown_fnQueryInterface(
275 ICOM_THIS(IGenericSFImpl, iface);
278 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
282 if(IsEqualIID(riid, &IID_IUnknown)) *ppvObj = _IUnknown_(This);
283 else if(IsEqualIID(riid, &IID_IShellFolder)) *ppvObj = _IShellFolder_(This);
284 else if(IsEqualIID(riid, &IID_IShellFolder2)) *ppvObj = _IShellFolder_(This);
285 else if(IsEqualIID(riid, &IID_IPersist)) *ppvObj = _IPersist_(This);
286 else if(IsEqualIID(riid, &IID_IPersistFolder)) *ppvObj = _IPersistFolder_(This);
287 else if(IsEqualIID(riid, &IID_IDropTarget))
289 *ppvObj = _IDropTarget_(This);
290 SF_RegisterClipFmt(This);
295 IUnknown_AddRef((IUnknown*)(*ppvObj));
296 TRACE("-- Interface = %p\n", *ppvObj);
299 TRACE("-- Interface: E_NOINTERFACE\n");
300 return E_NOINTERFACE;
303 static ULONG WINAPI IUnknown_fnAddRef(IUnknown * iface)
305 ICOM_THIS(IGenericSFImpl, iface);
308 TRACE("(%p)->(count=%lu)\n",This,This->ref);
311 return ++(This->ref);
314 static ULONG WINAPI IUnknown_fnRelease(IUnknown * iface)
316 ICOM_THIS(IGenericSFImpl, iface);
319 TRACE("(%p)->(count=%lu)\n",This,This->ref);
324 TRACE("-- destroying IShellFolder(%p)\n",This);
326 if (pdesktopfolder == _IShellFolder_(This))
329 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This);
331 if(This->absPidl) SHFree(This->absPidl);
332 if(This->sMyPath) SHFree(This->sMyPath);
333 HeapFree(GetProcessHeap(),0,This);
339 static ICOM_VTABLE(IUnknown) unkvt =
341 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
342 IUnknown_fnQueryInterface,
347 static shvheader GenericSFHeader [] =
349 { IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15 },
350 { IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
351 { IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
352 { IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12 },
353 { IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5 }
355 #define GENERICSHELLVIEWCOLUMNS 5
357 /**************************************************************************
358 * IShellFolder_Constructor
361 * creating undocumented ShellFS_Folder as part of an aggregation
362 * {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
365 * when pUnkOuter = 0 then rrid = IID_IShellFolder is returned
367 HRESULT IFSFolder_Constructor(
368 IUnknown * pUnkOuter,
375 TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid));
377 if(pUnkOuter && ! IsEqualIID(riid, &IID_IUnknown))
379 hr = CLASS_E_NOAGGREGATION; /* forbidden by definition */
383 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
387 ICOM_VTBL(sf)=&unkvt;
388 sf->lpvtblShellFolder=&sfvt;
389 sf->lpvtblPersistFolder=&psfvt;
390 sf->lpvtblDropTarget=&dtvt;
391 sf->pclsid = (CLSID*)&CLSID_SFFile;
392 sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_(sf);
393 *ppv = _IUnknown_(sf);
404 /**************************************************************************
405 * IShellFolder_Constructor
408 * THIS points to the parent folder
411 IShellFolder * IShellFolder_Constructor(
412 IShellFolder2 * iface,
418 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
420 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
423 ICOM_VTBL(sf)=&unkvt;
424 sf->lpvtblShellFolder=&sfvt;
425 sf->lpvtblPersistFolder=&psfvt;
426 sf->lpvtblDropTarget=&dtvt;
427 sf->pclsid = (CLSID*)&CLSID_SFFile;
428 sf->pUnkOuter = _IUnknown_(sf);
430 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,This, pidl);
433 if(pidl && iface) /* do we have a pidl? */
437 sf->absPidl = ILCombine(This->absPidl, pidl); /* build a absolute pidl */
439 if (!_ILIsSpecialFolder(pidl)) /* only file system paths */
441 if(This->sMyPath) /* get the size of the parents path */
443 dwSize += strlen(This->sMyPath) ;
444 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(This->sMyPath));
447 dwSize += _ILSimpleGetText(pidl,NULL,0); /* add the size of our name*/
448 sf->sMyPath = SHAlloc(dwSize + 2); /* '\0' and backslash */
450 if(!sf->sMyPath) return NULL;
453 if(This->sMyPath) /* if the parent has a path, get it*/
455 strcpy(sf->sMyPath, This->sMyPath);
456 PathAddBackslashA (sf->sMyPath);
459 len = strlen(sf->sMyPath);
460 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize+2 - len);
463 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath));
469 return _IShellFolder_(sf);
472 /**************************************************************************
473 * IShellFolder_fnQueryInterface
476 * REFIID riid [in ] Requested InterfaceID
477 * LPVOID* ppvObject [out] Interface* to hold the result
479 static HRESULT WINAPI IShellFolder_fnQueryInterface(
480 IShellFolder2 * iface,
484 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
487 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
489 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj);
492 /**************************************************************************
493 * IShellFolder_AddRef
496 static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder2 * iface)
498 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
501 TRACE("(%p)->(count=%lu)\n",This,This->ref);
503 return IUnknown_AddRef(This->pUnkOuter);
506 /**************************************************************************
507 * IShellFolder_fnRelease
509 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface)
511 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
514 TRACE("(%p)->(count=%lu)\n",This,This->ref);
516 return IUnknown_Release(This->pUnkOuter);
519 /**************************************************************************
520 * IShellFolder_fnParseDisplayName
522 * HWND hwndOwner, //[in ] Parent window for any message's
523 * LPBC pbc, //[in ] reserved
524 * LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
525 * ULONG* pchEaten, //[out] (unicode) characters processed
526 * LPITEMIDLIST* ppidl, //[out] complex pidl to item
527 * ULONG* pdwAttributes //[out] items attributes
530 * every folder trys to parse only it's own (the leftmost) pidl and creates a
531 * subfolder to evaluate the remaining parts
532 * now we can parse into namespaces implemented by shell extensions
534 * behaviour on win98: lpszDisplayName=NULL -> chrash
535 * lpszDisplayName="" -> returns mycoputer-pidl
538 * pdwAttributes: not set
539 * pchEaten: not set like in windows
541 static HRESULT WINAPI IShellFolder_fnParseDisplayName(
542 IShellFolder2 * iface,
545 LPOLESTR lpszDisplayName,
548 DWORD *pdwAttributes)
550 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
552 HRESULT hr = E_OUTOFMEMORY;
554 WCHAR szElement[MAX_PATH];
555 CHAR szTempA[MAX_PATH], szPath[MAX_PATH];
556 LPITEMIDLIST pidlTemp=NULL;
558 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
559 This,hwndOwner,pbcReserved,lpszDisplayName,
560 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
562 if (!lpszDisplayName || !ppidl) return E_INVALIDARG;
564 if (pchEaten) *pchEaten = 0; /* strange but like the original */
566 if (*lpszDisplayName)
568 /* get the next element */
569 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);
571 /* build the full pathname to the element */
572 lstrcpynWtoA(szTempA, szElement, lstrlenW(szElement) + 1);
573 strcpy(szPath, This->sMyPath);
574 PathAddBackslashA(szPath);
575 strcat(szPath, szTempA);
578 pidlTemp = SHSimpleIDListFromPathA(szPath);
582 /* try to analyse the next element */
583 if (szNext && *szNext)
585 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
596 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr);
601 /**************************************************************************
602 * IShellFolder_fnEnumObjects
604 * HWND hwndOwner, //[in ] Parent Window
605 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
606 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
608 static HRESULT WINAPI IShellFolder_fnEnumObjects(
609 IShellFolder2 * iface,
612 LPENUMIDLIST* ppEnumIDList)
614 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
616 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
618 *ppEnumIDList = NULL;
619 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE);
621 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
623 if(!*ppEnumIDList) return E_OUTOFMEMORY;
628 /**************************************************************************
629 * IShellFolder_fnBindToObject
631 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
632 * LPBC pbc, //[in ] reserved
633 * REFIID riid, //[in ] Initial Interface
634 * LPVOID* ppvObject //[out] Interface*
636 static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl,
637 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
639 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
641 IShellFolder *pShellFolder, *pSubFolder;
642 IPersistFolder *pPersistFolder;
643 LPITEMIDLIST absPidl;
645 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,debugstr_guid(riid),ppvOut);
647 if(!pidl || !ppvOut) return E_INVALIDARG;
651 if ((iid=_ILGetGUIDPointer(pidl)))
653 /* we have to create a alien folder */
654 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder))
655 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder)))
657 absPidl = ILCombine (This->absPidl, pidl);
658 IPersistFolder_Initialize(pPersistFolder, absPidl);
659 IPersistFolder_Release(pPersistFolder);
669 LPITEMIDLIST pidltemp = ILCloneFirst(pidl);
670 pShellFolder = IShellFolder_Constructor(iface, pidltemp);
674 if (_ILIsPidlSimple(pidl))
676 *ppvOut = pShellFolder;
680 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder);
681 IShellFolder_Release(pShellFolder);
682 *ppvOut = pSubFolder;
685 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
690 /**************************************************************************
691 * IShellFolder_fnBindToStorage
693 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
694 * LPBC pbc, //[in ] reserved
695 * REFIID riid, //[in ] Initial storage interface
696 * LPVOID* ppvObject //[out] Interface* returned
698 static HRESULT WINAPI IShellFolder_fnBindToStorage(
699 IShellFolder2 * iface,
705 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
707 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",
708 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut);
714 /**************************************************************************
715 * IShellFolder_fnCompareIDs
718 * LPARAM lParam, //[in ] Column?
719 * LPCITEMIDLIST pidl1, //[in ] simple pidl
720 * LPCITEMIDLIST pidl2) //[in ] simple pidl
723 * Special case - If one of the items is a Path and the other is a File,
724 * always make the Path come before the File.
727 * use SCODE_CODE() on the return value to get the result
730 static HRESULT WINAPI IShellFolder_fnCompareIDs(
731 IShellFolder2 * iface,
736 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
738 CHAR szTemp1[MAX_PATH];
739 CHAR szTemp2[MAX_PATH];
742 HRESULT hr = E_OUTOFMEMORY;
743 LPCITEMIDLIST pidlTemp;
746 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2);
750 if (!pidl1 && !pidl2)
752 hr = ResultFromShort(0);
756 hr = ResultFromShort(-1);
760 hr = ResultFromShort(1);
765 pd1 = _ILGetDataPointer(pidl1);
766 pd2 = _ILGetDataPointer(pidl2);
768 /* compate the types. sort order is the PT_* constant */
769 pt1 = ( pd1 ? pd1->type: PT_DESKTOP);
770 pt2 = ( pd2 ? pd2->type: PT_DESKTOP);
774 hr = ResultFromShort(pt1-pt2);
776 else /* same type of pidl */
778 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH);
779 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH);
780 nReturn = strcasecmp(szTemp1, szTemp2);
782 if (nReturn == 0) /* first pidl different ? */
784 pidl1 = ILGetNext(pidl1);
786 if (pidl1 && pidl1->mkid.cb) /* go deeper? */
788 pidlTemp = ILCloneFirst(pidl1);
789 pidl2 = ILGetNext(pidl2);
791 hr = IShellFolder_BindToObject(iface, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf);
794 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2);
795 IShellFolder_Release(psf);
796 hr = ResultFromShort(nReturn);
802 hr = ResultFromShort(nReturn); /* two equal simple pidls */
807 hr = ResultFromShort(nReturn); /* two different simple pidls */
812 TRACE("-- res=0x%08lx\n", hr);
816 /**************************************************************************
817 * IShellFolder_fnCreateViewObject
819 static HRESULT WINAPI IShellFolder_fnCreateViewObject(
820 IShellFolder2 * iface,
825 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
827 LPSHELLVIEW pShellView;
828 HRESULT hr = E_INVALIDARG;
830 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut);
836 if(IsEqualIID(riid, &IID_IDropTarget))
838 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, ppvOut);
840 else if(IsEqualIID(riid, &IID_IContextMenu))
842 FIXME("IContextMenu not implemented\n");
845 else if(IsEqualIID(riid, &IID_IShellView))
847 pShellView = IShellView_Constructor((IShellFolder*)iface);
850 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
851 IShellView_Release(pShellView);
855 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
859 /**************************************************************************
860 * IShellFolder_fnGetAttributesOf
863 * UINT cidl, //[in ] num elements in pidl array
864 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
865 * ULONG* rgfInOut) //[out] result array
868 static HRESULT WINAPI IShellFolder_fnGetAttributesOf(
869 IShellFolder2 * iface,
871 LPCITEMIDLIST *apidl,
874 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
878 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);
880 if ( (!cidl) || (!apidl) || (!rgfInOut))
883 while (cidl > 0 && *apidl)
886 if (_ILIsFolder( *apidl))
888 *rgfInOut &= 0xe0000177;
891 else if (_ILIsValue( *apidl))
893 *rgfInOut &= 0x40000177;
902 TRACE("-- result=0x%08lx\n",*rgfInOut);
906 /**************************************************************************
907 * IShellFolder_fnGetUIObjectOf
910 * HWND hwndOwner, //[in ] Parent window for any output
911 * UINT cidl, //[in ] array size
912 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
913 * REFIID riid, //[in ] Requested Interface
914 * UINT* prgfInOut, //[ ] reserved
915 * LPVOID* ppvObject) //[out] Resulting Interface
918 * This function gets asked to return "view objects" for one or more (multiple select)
920 * The viewobject typically is an COM object with one of the following interfaces:
921 * IExtractIcon,IDataObject,IContextMenu
922 * In order to support icon positions in the default Listview your DataObject
923 * must implement the SetData method (in addition to GetData :) - the shell passes
924 * a barely documented "Icon positions" structure to SetData when the drag starts,
925 * and GetData's it if the drop is in another explorer window that needs the positions.
927 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf(
928 IShellFolder2 * iface,
931 LPCITEMIDLIST * apidl,
936 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
939 IUnknown* pObj = NULL;
940 HRESULT hr = E_INVALIDARG;
942 TRACE("(%p)->(%u,%u,apidl=%p,\n\tIID:%s,%p,%p)\n",
943 This,hwndOwner,cidl,apidl,debugstr_guid(riid),prgfInOut,ppvOut);
949 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1))
951 pObj = (LPUNKNOWN)IContextMenu_Constructor((IShellFolder*)iface, This->absPidl, apidl, cidl);
954 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1))
956 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl);
959 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1))
961 pidl = ILCombine(This->absPidl,apidl[0]);
962 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl );
966 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1))
968 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, (LPVOID*)&pObj);
980 TRACE("(%p)->hr=0x%08lx\n",This, hr);
984 /**************************************************************************
985 * IShellFolder_fnGetDisplayNameOf
986 * Retrieves the display name for the specified file object or subfolder
989 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
990 * DWORD dwFlags, //[in ] SHGNO formatting flags
991 * LPSTRRET lpName) //[out] Returned display name
994 * if the name is in the pidl the ret value should be a STRRET_OFFSET
996 #define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
997 #define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
999 static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf(
1000 IShellFolder2 * iface,
1005 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1007 CHAR szPath[MAX_PATH]= "";
1011 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
1014 if(!pidl || !strRet) return E_INVALIDARG;
1016 bSimplePidl = _ILIsPidlSimple(pidl);
1018 /* take names of special folders only if its only this folder */
1019 if (_ILIsSpecialFolder(pidl))
1023 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
1028 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath)
1030 strcpy (szPath, This->sMyPath); /* get path to root*/
1031 PathAddBackslashA(szPath);
1032 len = strlen(szPath);
1034 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len); /* append my own path */
1037 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl) /* go deeper if needed */
1039 PathAddBackslashA(szPath);
1040 len = strlen(szPath);
1042 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath + len, MAX_PATH - len)))
1043 return E_OUTOFMEMORY;
1045 strRet->uType = STRRET_CSTRA;
1046 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
1048 TRACE("-- (%p)->(%s)\n", This, szPath);
1052 /**************************************************************************
1053 * IShellFolder_fnSetNameOf
1054 * Changes the name of a file object or subfolder, possibly changing its item
1055 * identifier in the process.
1058 * HWND hwndOwner, //[in ] Owner window for output
1059 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
1060 * LPCOLESTR lpszName, //[in ] the items new display name
1061 * DWORD dwFlags, //[in ] SHGNO formatting flags
1062 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
1064 static HRESULT WINAPI IShellFolder_fnSetNameOf(
1065 IShellFolder2 * iface,
1067 LPCITEMIDLIST pidl, /*simple pidl*/
1070 LPITEMIDLIST *pPidlOut)
1072 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1074 FIXME("(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n",
1075 This,hwndOwner,pidl,debugstr_w(lpName),dw,pPidlOut);
1080 /**************************************************************************
1081 * IShellFolder_fnGetFolderPath
1083 static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder2 * iface, LPSTR lpszOut, DWORD dwOutSize)
1085 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1087 TRACE("(%p)->(%p %lu)\n",This, lpszOut, dwOutSize);
1089 if (!lpszOut) return FALSE;
1093 if (! This->sMyPath) return FALSE;
1095 lstrcpynA(lpszOut, This->sMyPath, dwOutSize);
1097 TRACE("-- (%p)->(return=%s)\n",This, lpszOut);
1101 static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID(
1102 IShellFolder2 * iface,
1105 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1106 FIXME("(%p)\n",This);
1109 static HRESULT WINAPI IShellFolder_fnEnumSearches(
1110 IShellFolder2 * iface,
1111 IEnumExtraSearch **ppenum)
1113 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1114 FIXME("(%p)\n",This);
1117 static HRESULT WINAPI IShellFolder_fnGetDefaultColumn(
1118 IShellFolder2 * iface,
1123 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1125 TRACE("(%p)\n",This);
1127 if (pSort) *pSort = 0;
1128 if (pDisplay) *pDisplay = 0;
1132 static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState(
1133 IShellFolder2 * iface,
1137 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1139 TRACE("(%p)\n",This);
1141 if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG;
1143 *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
1147 static HRESULT WINAPI IShellFolder_fnGetDetailsEx(
1148 IShellFolder2 * iface,
1150 const SHCOLUMNID *pscid,
1153 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1154 FIXME("(%p)\n",This);
1158 static HRESULT WINAPI IShellFolder_fnGetDetailsOf(
1159 IShellFolder2 * iface,
1164 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1165 HRESULT hr = E_FAIL;
1167 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd);
1169 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG;
1173 /* the header titles */
1174 psd->fmt = GenericSFHeader[iColumn].fmt;
1175 psd->cxChar = GenericSFHeader[iColumn].cxChar;
1176 psd->str.uType = STRRET_CSTRA;
1177 LoadStringA(shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
1182 /* the data from the pidl */
1186 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
1189 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
1192 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);
1195 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH);
1197 case 4: /* attributes */
1198 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH);
1202 psd->str.uType = STRRET_CSTRA;
1207 static HRESULT WINAPI IShellFolder_fnMapNameToSCID(
1208 IShellFolder2 * iface,
1212 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1213 FIXME("(%p)\n",This);
1217 static ICOM_VTABLE(IShellFolder2) sfvt =
1219 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1220 IShellFolder_fnQueryInterface,
1221 IShellFolder_fnAddRef,
1222 IShellFolder_fnRelease,
1223 IShellFolder_fnParseDisplayName,
1224 IShellFolder_fnEnumObjects,
1225 IShellFolder_fnBindToObject,
1226 IShellFolder_fnBindToStorage,
1227 IShellFolder_fnCompareIDs,
1228 IShellFolder_fnCreateViewObject,
1229 IShellFolder_fnGetAttributesOf,
1230 IShellFolder_fnGetUIObjectOf,
1231 IShellFolder_fnGetDisplayNameOf,
1232 IShellFolder_fnSetNameOf,
1235 IShellFolder_fnGetDefaultSearchGUID,
1236 IShellFolder_fnEnumSearches,
1237 IShellFolder_fnGetDefaultColumn,
1238 IShellFolder_fnGetDefaultColumnState,
1239 IShellFolder_fnGetDetailsEx,
1240 IShellFolder_fnGetDetailsOf,
1241 IShellFolder_fnMapNameToSCID
1243 /***********************************************************************
1244 * [Desktopfolder] IShellFolder implementation
1246 static struct ICOM_VTABLE(IShellFolder2) sfdvt;
1248 static shvheader DesktopSFHeader [] =
1250 { IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15 },
1251 { IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
1252 { IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
1253 { IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12 },
1254 { IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5 }
1256 #define DESKTOPSHELLVIEWCOLUMNS 5
1258 /**************************************************************************
1259 * ISF_Desktop_Constructor
1262 IShellFolder * ISF_Desktop_Constructor()
1264 IGenericSFImpl * sf;
1266 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
1268 ICOM_VTBL(sf)=&unkvt;
1269 sf->lpvtblShellFolder=&sfdvt;
1270 sf->absPidl=_ILCreateDesktop(); /* my qualified pidl */
1271 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl;
1276 return _IShellFolder_(sf);
1279 /**************************************************************************
1280 * ISF_Desktop_fnQueryInterface
1282 * NOTES supports not IPersist/IPersistFolder
1284 static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
1285 IShellFolder2 * iface,
1289 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1291 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
1295 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
1297 *ppvObj = _IUnknown_(This);
1299 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/
1301 *ppvObj = _IShellFolder_(This);
1303 else if(IsEqualIID(riid, &IID_IShellFolder2)) /*IShellFolder2*/
1305 *ppvObj = _IShellFolder_(This);
1310 IUnknown_AddRef((IUnknown*)(*ppvObj));
1311 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1314 TRACE("-- Interface: E_NOINTERFACE\n");
1315 return E_NOINTERFACE;
1318 /**************************************************************************
1319 * ISF_Desktop_fnParseDisplayName
1322 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
1325 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName(
1326 IShellFolder2 * iface,
1329 LPOLESTR lpszDisplayName,
1331 LPITEMIDLIST *ppidl,
1332 DWORD *pdwAttributes)
1334 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1336 LPCWSTR szNext=NULL;
1337 LPITEMIDLIST pidlTemp=NULL;
1338 HRESULT hr=E_OUTOFMEMORY;
1340 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
1341 This,hwndOwner,pbcReserved,lpszDisplayName,
1342 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
1345 if (pchEaten) *pchEaten = 0; /* strange but like the original */
1347 /* fixme no real parsing implemented */
1348 pidlTemp = _ILCreateMyComputer();
1349 szNext = lpszDisplayName;
1351 if (szNext && *szNext)
1353 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
1362 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);
1367 /**************************************************************************
1368 * ISF_Desktop_fnEnumObjects
1370 static HRESULT WINAPI ISF_Desktop_fnEnumObjects(
1371 IShellFolder2 * iface,
1374 LPENUMIDLIST* ppEnumIDList)
1376 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1378 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
1380 *ppEnumIDList = NULL;
1381 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
1383 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
1385 if(!*ppEnumIDList) return E_OUTOFMEMORY;
1390 /**************************************************************************
1391 * ISF_Desktop_fnBindToObject
1393 static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl,
1394 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
1396 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1398 IShellFolder *pShellFolder, *pSubFolder;
1400 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",
1401 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut);
1405 if ((clsid=_ILGetGUIDPointer(pidl)))
1407 if ( IsEqualIID(clsid, &CLSID_MyComputer))
1409 pShellFolder = ISF_MyComputer_Constructor();
1413 /* shell extension */
1414 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))
1416 return E_INVALIDARG;
1422 /* file system folder on the desktop */
1423 LPITEMIDLIST deskpidl, firstpidl, completepidl;
1424 IPersistFolder * ppf;
1427 SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, &deskpidl);
1428 firstpidl = ILCloneFirst(pidl);
1429 completepidl = ILCombine(deskpidl, firstpidl);
1431 pShellFolder = IShellFolder_Constructor(NULL, NULL);
1432 if (SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&ppf)))
1434 IPersistFolder_Initialize(ppf, completepidl);
1435 IPersistFolder_Release(ppf);
1437 ILFree(completepidl);
1442 if (_ILIsPidlSimple(pidl)) /* no sub folders */
1444 *ppvOut = pShellFolder;
1446 else /* go deeper */
1448 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder);
1449 IShellFolder_Release(pShellFolder);
1450 *ppvOut = pSubFolder;
1453 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
1458 /**************************************************************************
1459 * ISF_Desktop_fnCreateViewObject
1461 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder2 * iface,
1462 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
1464 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1466 LPSHELLVIEW pShellView;
1467 HRESULT hr = E_INVALIDARG;
1469 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut);
1475 if(IsEqualIID(riid, &IID_IDropTarget))
1477 FIXME("IDropTarget not implemented\n");
1480 else if(IsEqualIID(riid, &IID_IContextMenu))
1482 FIXME("IContextMenu not implemented\n");
1485 else if(IsEqualIID(riid, &IID_IShellView))
1487 pShellView = IShellView_Constructor((IShellFolder*)iface);
1490 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
1491 IShellView_Release(pShellView);
1495 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
1499 /**************************************************************************
1500 * ISF_Desktop_fnGetAttributesOf
1502 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
1504 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1510 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut);
1512 if ( (!cidl) || (!apidl) || (!rgfInOut))
1513 return E_INVALIDARG;
1515 while (cidl > 0 && *apidl)
1519 if ((clsid=_ILGetGUIDPointer(*apidl)))
1521 if (IsEqualIID(clsid, &CLSID_MyComputer))
1523 *rgfInOut &= 0xb0000154;
1526 else if (HCR_GetFolderAttributes(clsid, &attributes))
1528 *rgfInOut &= attributes;
1532 { /* some shell-extension */
1533 *rgfInOut &= 0xb0000154;
1536 else if (_ILIsFolder( *apidl))
1538 *rgfInOut &= 0xe0000177;
1541 else if (_ILIsValue( *apidl))
1543 *rgfInOut &= 0x40000177;
1552 TRACE("-- result=0x%08lx\n",*rgfInOut);
1557 /**************************************************************************
1558 * ISF_Desktop_fnGetDisplayNameOf
1561 * special case: pidl = null gives desktop-name back
1563 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf(
1564 IShellFolder2 * iface,
1569 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1571 CHAR szPath[MAX_PATH]= "";
1573 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
1576 if(!strRet) return E_INVALIDARG;
1580 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH);
1582 else if ( _ILIsPidlSimple(pidl) )
1584 _ILSimpleGetText(pidl, szPath, MAX_PATH);
1588 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH)))
1589 return E_OUTOFMEMORY;
1591 strRet->uType = STRRET_CSTRA;
1592 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
1595 TRACE("-- (%p)->(%s)\n", This, szPath);
1599 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(
1600 IShellFolder2 * iface,
1603 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1604 FIXME("(%p)\n",This);
1607 static HRESULT WINAPI ISF_Desktop_fnEnumSearches(
1608 IShellFolder2 * iface,
1609 IEnumExtraSearch **ppenum)
1611 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1612 FIXME("(%p)\n",This);
1615 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn(
1616 IShellFolder2 * iface,
1621 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1623 TRACE("(%p)\n",This);
1625 if (pSort) *pSort = 0;
1626 if (pDisplay) *pDisplay = 0;
1630 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState(
1631 IShellFolder2 * iface,
1635 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1637 TRACE("(%p)\n",This);
1639 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG;
1641 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
1645 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx(
1646 IShellFolder2 * iface,
1648 const SHCOLUMNID *pscid,
1651 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1652 FIXME("(%p)\n",This);
1656 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf(
1657 IShellFolder2 * iface,
1662 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1663 HRESULT hr = E_FAIL;;
1665 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd);
1667 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG;
1671 psd->fmt = DesktopSFHeader[iColumn].fmt;
1672 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
1673 psd->str.uType = STRRET_CSTRA;
1674 LoadStringA(shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
1679 /* the data from the pidl */
1683 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
1686 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
1689 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);
1692 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH);
1694 case 4: /* attributes */
1695 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH);
1699 psd->str.uType = STRRET_CSTRA;
1704 static HRESULT WINAPI ISF_Desktop_fnMapNameToSCID(
1705 IShellFolder2 * iface,
1709 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1710 FIXME("(%p)\n",This);
1714 static ICOM_VTABLE(IShellFolder2) sfdvt =
1716 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1717 ISF_Desktop_fnQueryInterface,
1718 IShellFolder_fnAddRef,
1719 IShellFolder_fnRelease,
1720 ISF_Desktop_fnParseDisplayName,
1721 ISF_Desktop_fnEnumObjects,
1722 ISF_Desktop_fnBindToObject,
1723 IShellFolder_fnBindToStorage,
1724 IShellFolder_fnCompareIDs,
1725 ISF_Desktop_fnCreateViewObject,
1726 ISF_Desktop_fnGetAttributesOf,
1727 IShellFolder_fnGetUIObjectOf,
1728 ISF_Desktop_fnGetDisplayNameOf,
1729 IShellFolder_fnSetNameOf,
1732 ISF_Desktop_fnGetDefaultSearchGUID,
1733 ISF_Desktop_fnEnumSearches,
1734 ISF_Desktop_fnGetDefaultColumn,
1735 ISF_Desktop_fnGetDefaultColumnState,
1736 ISF_Desktop_fnGetDetailsEx,
1737 ISF_Desktop_fnGetDetailsOf,
1738 ISF_Desktop_fnMapNameToSCID
1742 /***********************************************************************
1743 * IShellFolder [MyComputer] implementation
1746 static struct ICOM_VTABLE(IShellFolder2) sfmcvt;
1748 static shvheader MyComputerSFHeader [] =
1750 { IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15 },
1751 { IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
1752 { IDS_SHV_COLUMN6, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
1753 { IDS_SHV_COLUMN7, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
1755 #define MYCOMPUTERSHELLVIEWCOLUMNS 4
1757 /**************************************************************************
1758 * ISF_MyComputer_Constructor
1760 static IShellFolder * ISF_MyComputer_Constructor(void)
1762 IGenericSFImpl * sf;
1764 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
1767 ICOM_VTBL(sf)=&unkvt;
1768 sf->lpvtblShellFolder=&sfmcvt;
1769 sf->lpvtblPersistFolder = &psfvt;
1770 sf->pclsid = (CLSID*)&CLSID_SFMyComp;
1771 sf->absPidl=_ILCreateMyComputer(); /* my qualified pidl */
1772 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl;
1777 return _IShellFolder_(sf);
1780 /**************************************************************************
1781 * ISF_MyComputer_fnParseDisplayName
1783 static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName(
1784 IShellFolder2 * iface,
1787 LPOLESTR lpszDisplayName,
1789 LPITEMIDLIST *ppidl,
1790 DWORD *pdwAttributes)
1792 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1794 HRESULT hr = E_OUTOFMEMORY;
1795 LPCWSTR szNext=NULL;
1796 WCHAR szElement[MAX_PATH];
1797 CHAR szTempA[MAX_PATH];
1798 LPITEMIDLIST pidlTemp;
1800 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
1801 This,hwndOwner,pbcReserved,lpszDisplayName,
1802 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
1805 if (pchEaten) *pchEaten = 0; /* strange but like the original */
1807 if (PathIsRootW(lpszDisplayName))
1809 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);
1810 lstrcpynWtoA(szTempA, szElement, lstrlenW(szElement) + 1);
1811 pidlTemp = _ILCreateDrive(szTempA);
1813 if (szNext && *szNext)
1815 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
1824 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);
1829 /**************************************************************************
1830 * ISF_MyComputer_fnEnumObjects
1832 static HRESULT WINAPI ISF_MyComputer_fnEnumObjects(
1833 IShellFolder2 * iface,
1836 LPENUMIDLIST* ppEnumIDList)
1838 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1840 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
1842 *ppEnumIDList = NULL;
1843 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP);
1845 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
1847 if(!*ppEnumIDList) return E_OUTOFMEMORY;
1852 /**************************************************************************
1853 * ISF_MyComputer_fnBindToObject
1855 static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl,
1856 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
1858 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1860 IShellFolder *pShellFolder, *pSubFolder;
1861 LPITEMIDLIST pidltemp;
1863 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",
1864 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut);
1866 if(!pidl || !ppvOut) return E_INVALIDARG;
1870 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &CLSID_MyComputer))
1872 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))
1879 if (!_ILIsDrive(pidl)) return E_INVALIDARG;
1881 pidltemp = ILCloneFirst(pidl);
1882 pShellFolder = IShellFolder_Constructor(iface, pidltemp);
1886 if (_ILIsPidlSimple(pidl)) /* no sub folders */
1888 *ppvOut = pShellFolder;
1890 else /* go deeper */
1892 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder);
1893 IShellFolder_Release(pShellFolder);
1894 *ppvOut = pSubFolder;
1897 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
1902 /**************************************************************************
1903 * ISF_MyComputer_fnCreateViewObject
1905 static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder2 * iface,
1906 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
1908 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1910 LPSHELLVIEW pShellView;
1911 HRESULT hr = E_INVALIDARG;
1913 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut);
1919 if(IsEqualIID(riid, &IID_IDropTarget))
1921 FIXME("IDropTarget not implemented\n");
1924 else if(IsEqualIID(riid, &IID_IContextMenu))
1926 FIXME("IContextMenu not implemented\n");
1929 else if(IsEqualIID(riid, &IID_IShellView))
1931 pShellView = IShellView_Constructor((IShellFolder*)iface);
1934 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
1935 IShellView_Release(pShellView);
1939 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
1943 /**************************************************************************
1944 * ISF_MyComputer_fnGetAttributesOf
1946 static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
1948 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
1954 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);
1956 if ( (!cidl) || (!apidl) || (!rgfInOut))
1957 return E_INVALIDARG;
1959 *rgfInOut = 0xffffffff;
1961 while (cidl > 0 && *apidl)
1965 if (_ILIsDrive(*apidl))
1967 *rgfInOut &= 0xf0000144;
1970 else if ((clsid=_ILGetGUIDPointer(*apidl)))
1972 if (HCR_GetFolderAttributes(clsid, &attributes))
1974 *rgfInOut &= attributes;
1984 TRACE("-- result=0x%08lx\n",*rgfInOut);
1988 /**************************************************************************
1989 * ISF_MyComputer_fnGetDisplayNameOf
1992 * The desktopfolder creates only complete paths (SHGDN_FORPARSING).
1993 * SHGDN_INFOLDER makes no sense.
1995 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf(
1996 IShellFolder2 * iface,
2001 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2003 char szPath[MAX_PATH], szDrive[18];
2007 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
2010 if(!strRet) return E_INVALIDARG;
2012 szPath[0]=0x00; szDrive[0]=0x00;
2015 bSimplePidl = _ILIsPidlSimple(pidl);
2017 if (_ILIsSpecialFolder(pidl))
2019 /* take names of special folders only if its only this folder */
2022 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
2027 if (!_ILIsDrive(pidl))
2029 ERR("Wrong pidl type\n");
2030 return E_INVALIDARG;
2033 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
2035 /* long view "lw_name (C:)" */
2036 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING))
2038 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags;
2040 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0);
2041 strcat (szDrive," (");
2042 strncat (szDrive, szPath, 2);
2043 strcat (szDrive,")");
2044 strcpy (szPath, szDrive);
2048 if (!bSimplePidl) /* go deeper if needed */
2050 PathAddBackslashA(szPath);
2051 len = strlen(szPath);
2053 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len)))
2054 return E_OUTOFMEMORY;
2056 strRet->uType = STRRET_CSTRA;
2057 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
2060 TRACE("-- (%p)->(%s)\n", This, szPath);
2064 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID(
2065 IShellFolder2 * iface,
2068 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2069 FIXME("(%p)\n",This);
2072 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches(
2073 IShellFolder2 * iface,
2074 IEnumExtraSearch **ppenum)
2076 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2077 FIXME("(%p)\n",This);
2080 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn(
2081 IShellFolder2 * iface,
2086 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2088 TRACE("(%p)\n",This);
2090 if (pSort) *pSort = 0;
2091 if (pDisplay) *pDisplay = 0;
2095 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState(
2096 IShellFolder2 * iface,
2100 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2102 TRACE("(%p)\n",This);
2104 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG;
2106 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
2110 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx(
2111 IShellFolder2 * iface,
2113 const SHCOLUMNID *pscid,
2116 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2117 FIXME("(%p)\n",This);
2122 /* fixme: drive size >4GB is rolling over */
2123 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf(
2124 IShellFolder2 * iface,
2129 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2132 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd);
2134 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG;
2138 psd->fmt = MyComputerSFHeader[iColumn].fmt;
2139 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
2140 psd->str.uType = STRRET_CSTRA;
2141 LoadStringA(shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
2146 char szPath[MAX_PATH];
2147 ULARGE_INTEGER ulBytes;
2149 psd->str.u.cStr[0] = 0x00;
2150 psd->str.uType = STRRET_CSTRA;
2154 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
2157 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);
2159 case 2: /* total size */
2160 if (_ILIsDrive(pidl))
2162 _ILSimpleGetText(pidl, szPath, MAX_PATH);
2163 GetDiskFreeSpaceExA(szPath, NULL, &ulBytes, NULL);
2164 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH);
2167 case 3: /* free size */
2168 if (_ILIsDrive(pidl))
2170 _ILSimpleGetText(pidl, szPath, MAX_PATH);
2171 GetDiskFreeSpaceExA(szPath, &ulBytes, NULL, NULL);
2172 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH);
2181 static HRESULT WINAPI ISF_MyComputer_fnMapNameToSCID(
2182 IShellFolder2 * iface,
2186 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)
2187 FIXME("(%p)\n",This);
2191 static ICOM_VTABLE(IShellFolder2) sfmcvt =
2193 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2194 IShellFolder_fnQueryInterface,
2195 IShellFolder_fnAddRef,
2196 IShellFolder_fnRelease,
2197 ISF_MyComputer_fnParseDisplayName,
2198 ISF_MyComputer_fnEnumObjects,
2199 ISF_MyComputer_fnBindToObject,
2200 IShellFolder_fnBindToStorage,
2201 IShellFolder_fnCompareIDs,
2202 ISF_MyComputer_fnCreateViewObject,
2203 ISF_MyComputer_fnGetAttributesOf,
2204 IShellFolder_fnGetUIObjectOf,
2205 ISF_MyComputer_fnGetDisplayNameOf,
2206 IShellFolder_fnSetNameOf,
2209 ISF_MyComputer_fnGetDefaultSearchGUID,
2210 ISF_MyComputer_fnEnumSearches,
2211 ISF_MyComputer_fnGetDefaultColumn,
2212 ISF_MyComputer_fnGetDefaultColumnState,
2213 ISF_MyComputer_fnGetDetailsEx,
2214 ISF_MyComputer_fnGetDetailsOf,
2215 ISF_MyComputer_fnMapNameToSCID
2219 /************************************************************************
2220 * ISFPersistFolder_QueryInterface (IUnknown)
2223 static HRESULT WINAPI ISFPersistFolder_QueryInterface(
2224 IPersistFolder * iface,
2228 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
2230 TRACE("(%p)\n", This);
2232 return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvObj);
2235 /************************************************************************
2236 * ISFPersistFolder_AddRef (IUnknown)
2239 static ULONG WINAPI ISFPersistFolder_AddRef(
2240 IPersistFolder * iface)
2242 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
2244 TRACE("(%p)\n", This);
2246 return IUnknown_AddRef(This->pUnkOuter);
2249 /************************************************************************
2250 * ISFPersistFolder_Release (IUnknown)
2253 static ULONG WINAPI ISFPersistFolder_Release(
2254 IPersistFolder * iface)
2256 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
2258 TRACE("(%p)\n", This);
2260 return IUnknown_Release(This->pUnkOuter);
2263 /************************************************************************
2264 * ISFPersistFolder_GetClassID (IPersist)
2266 static HRESULT WINAPI ISFPersistFolder_GetClassID(
2267 IPersistFolder * iface,
2270 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
2272 TRACE("(%p)\n", This);
2274 if (!lpClassId) return E_POINTER;
2275 *lpClassId = *This->pclsid;
2280 /************************************************************************
2281 * ISFPersistFolder_Initialize (IPersistFolder)
2284 * sMyPath is not set. Don't know how to handle in a non rooted environment.
2286 static HRESULT WINAPI ISFPersistFolder_Initialize(
2287 IPersistFolder * iface,
2290 char sTemp[MAX_PATH];
2291 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
2293 TRACE("(%p)->(%p)\n", This, pidl);
2295 /* free the old stuff */
2298 SHFree(This->absPidl);
2299 This->absPidl = NULL;
2303 SHFree(This->sMyPath);
2304 This->sMyPath = NULL;
2308 This->absPidl = ILClone(pidl);
2311 if (SHGetPathFromIDListA(pidl, sTemp))
2313 This->sMyPath = SHAlloc(strlen(sTemp+1));
2314 strcpy(This->sMyPath, sTemp);
2317 TRACE("--(%p)->(%s)\n", This, This->sMyPath);
2322 static ICOM_VTABLE(IPersistFolder) psfvt =
2324 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2325 ISFPersistFolder_QueryInterface,
2326 ISFPersistFolder_AddRef,
2327 ISFPersistFolder_Release,
2328 ISFPersistFolder_GetClassID,
2329 ISFPersistFolder_Initialize
2332 /****************************************************************************
2333 * ISFDropTarget implementation
2335 static BOOL ISFDropTarget_QueryDrop(
2340 DWORD dwEffect = *pdwEffect;
2342 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2344 *pdwEffect = DROPEFFECT_NONE;
2346 if (This->fAcceptFmt)
2347 { /* Does our interpretation of the keystate ... */
2348 *pdwEffect = KeyStateToDropEffect(dwKeyState);
2350 /* ... matches the desired effect ? */
2351 if (dwEffect & *pdwEffect)
2359 static HRESULT WINAPI ISFDropTarget_QueryInterface(
2364 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2366 TRACE("(%p)\n", This);
2368 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj);
2371 static ULONG WINAPI ISFDropTarget_AddRef( IDropTarget *iface)
2373 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2375 TRACE("(%p)\n", This);
2377 return IUnknown_AddRef(This->pUnkOuter);
2380 static ULONG WINAPI ISFDropTarget_Release( IDropTarget *iface)
2382 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2384 TRACE("(%p)\n", This);
2386 return IUnknown_Release(This->pUnkOuter);
2389 static HRESULT WINAPI ISFDropTarget_DragEnter(
2391 IDataObject *pDataObject,
2398 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2400 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject);
2402 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL);
2404 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE;
2406 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);
2411 static HRESULT WINAPI ISFDropTarget_DragOver(
2417 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2419 TRACE("(%p)\n",This);
2421 if(!pdwEffect) return E_INVALIDARG;
2423 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);
2428 static HRESULT WINAPI ISFDropTarget_DragLeave(
2431 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2433 TRACE("(%p)\n",This);
2435 This->fAcceptFmt = FALSE;
2440 static HRESULT WINAPI ISFDropTarget_Drop(
2442 IDataObject* pDataObject,
2447 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2449 FIXME("(%p) object dropped\n",This);
2454 static struct ICOM_VTABLE(IDropTarget) dtvt =
2456 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2457 ISFDropTarget_QueryInterface,
2458 ISFDropTarget_AddRef,
2459 ISFDropTarget_Release,
2460 ISFDropTarget_DragEnter,
2461 ISFDropTarget_DragOver,
2462 ISFDropTarget_DragLeave,