4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999 Juergen Schmied
7 * IShellFolder with IDropTarget, IPersistFolder
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"
27 DEFAULT_DEBUG_CHANNEL(shell)
31 /***************************************************************************
32 * GetNextElement (internal function)
34 * gets a part of a string till the first backslash
37 * pszNext [IN] string to get the element from
38 * pszOut [IN] pointer to buffer whitch receives string
39 * dwOut [IN] length of pszOut
42 * LPSTR pointer to first, not yet parsed char
45 static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut)
46 { LPCWSTR pszTail = pszNext;
48 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut);
52 if(!pszNext || !*pszNext)
55 while(*pszTail && (*pszTail != (WCHAR)'\\'))
58 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1;
59 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy);
66 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail);
70 static HRESULT SHELL32_ParseNextElement(
73 LPITEMIDLIST * pidlInOut,
78 HRESULT hr = E_OUTOFMEMORY;
79 LPITEMIDLIST pidlOut, pidlTemp = NULL;
80 IShellFolder *psfChild;
82 TRACE("(%p %p %s)\n",psf, pidlInOut? *pidlInOut: NULL, debugstr_w(szNext));
85 /* get the shellfolder for the child pidl and let it analyse further */
86 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
90 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes);
91 IShellFolder_Release(psfChild);
93 pidlTemp = ILCombine(*pidlInOut, pidlOut);
100 *pidlInOut = pidlTemp;
102 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr);
106 /***********************************************************************
107 * SHELL32_CoCreateInitSF
109 * creates a initialized shell folder
111 static HRESULT SHELL32_CoCreateInitSF (
112 LPITEMIDLIST pidlRoot,
113 LPITEMIDLIST pidlChild,
119 LPITEMIDLIST absPidl;
120 IShellFolder *pShellFolder;
121 IPersistFolder *pPersistFolder;
123 TRACE("%p %p\n", pidlRoot, pidlChild);
127 /* we have to ask first for IPersistFolder, some special folders are expecting this */
128 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder);
131 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder);
134 absPidl = ILCombine (pidlRoot, pidlChild);
135 hr = IPersistFolder_Initialize(pPersistFolder, absPidl);
136 IPersistFolder_Release(pPersistFolder);
138 *ppvOut = pShellFolder;
142 TRACE("-- ret=0x%08lx\n", hr);
146 static HRESULT SHELL32_GetDisplayNameOfChild(
153 LPITEMIDLIST pidlFirst, pidlNext;
154 IShellFolder * psfChild;
155 HRESULT hr = E_OUTOFMEMORY;
158 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen);
161 if ((pidlFirst = ILCloneFirst(pidl)))
163 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
166 pidlNext = ILGetNext(pidl);
168 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp);
171 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext);
174 IShellFolder_Release(psfChild);
179 TRACE("-- ret=0x%08lx %s\n", hr, szOut);
184 /***********************************************************************
185 * IShellFolder implementation
190 ICOM_VTABLE(IShellFolder)* lpvtbl;
193 ICOM_VTABLE(IPersistFolder)* lpvtblPersistFolder;
194 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget;
199 LPITEMIDLIST absPidl; /* complete pidl */
201 UINT cfShellIDList; /* clipboardformat for IDropTarget */
202 BOOL fAcceptFmt; /* flag for pending Drop */
205 static struct ICOM_VTABLE(IShellFolder) sfvt;
206 static struct ICOM_VTABLE(IPersistFolder) psfvt;
207 static struct ICOM_VTABLE(IDropTarget) dtvt;
209 static IShellFolder * ISF_MyComputer_Constructor(void);
211 #define _IPersistFolder_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder)))
212 #define _ICOM_THIS_From_IPersistFolder(class, name) class* This = (class*)(((char*)name)-_IPersistFolder_Offset);
214 static struct ICOM_VTABLE(IDropTarget) dtvt;
215 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
216 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
218 /**************************************************************************
219 * registers clipboardformat once
221 static void SF_RegisterClipFmt (IShellFolder * iface)
223 ICOM_THIS(IGenericSFImpl, iface);
225 TRACE("(%p)\n", This);
227 if (!This->cfShellIDList)
229 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);
233 /**************************************************************************
234 * IShellFolder_Constructor
238 static IShellFolder * IShellFolder_Constructor(
243 IGenericSFImpl * sfParent = (IGenericSFImpl*) psf;
246 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
250 sf->lpvtblPersistFolder=&psfvt;
251 sf->lpvtblDropTarget=&dtvt;
252 sf->pclsid = (CLSID*)&CLSID_SFFile;
254 sf->fAcceptFmt=FALSE;
256 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,sfParent, pidl);
259 if(pidl) /* do we have a pidl? */
263 sf->absPidl = ILCombine(sfParent->absPidl, pidl); /* build a absolute pidl */
265 if (!_ILIsSpecialFolder(pidl)) /* only file system paths */
267 if(sfParent->sMyPath) /* get the size of the parents path */
269 dwSize += strlen(sfParent->sMyPath) ;
270 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(sfParent->sMyPath));
273 dwSize += _ILSimpleGetText(pidl,NULL,0); /* add the size of our name*/
274 sf->sMyPath = SHAlloc(dwSize + 2); /* '\0' and backslash */
276 if(!sf->sMyPath) return NULL;
279 if(sfParent->sMyPath) /* if the parent has a path, get it*/
281 strcpy(sf->sMyPath, sfParent->sMyPath);
282 PathAddBackslashA (sf->sMyPath);
285 len = strlen(sf->sMyPath);
286 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize - len + 1);
289 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath));
295 return (IShellFolder *)sf;
297 /**************************************************************************
298 * IShellFolder_fnQueryInterface
301 * REFIID riid [in ] Requested InterfaceID
302 * LPVOID* ppvObject [out] Interface* to hold the result
304 static HRESULT WINAPI IShellFolder_fnQueryInterface(
305 IShellFolder * iface,
309 ICOM_THIS(IGenericSFImpl, iface);
312 WINE_StringFromCLSID((LPCLSID)riid,xriid);
313 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
317 if(IsEqualIID(riid, &IID_IUnknown))
320 else if(IsEqualIID(riid, &IID_IShellFolder))
322 *ppvObj = (IShellFolder*)This;
324 else if(IsEqualIID(riid, &IID_IPersist))
326 *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder);
328 else if(IsEqualIID(riid, &IID_IPersistFolder))
330 *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder);
332 else if(IsEqualIID(riid, &IID_IDropTarget))
334 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget);
335 SF_RegisterClipFmt((IShellFolder*)This);
340 IUnknown_AddRef((IUnknown*)(*ppvObj));
341 TRACE("-- Interface = %p\n", *ppvObj);
344 TRACE("-- Interface: E_NOINTERFACE\n");
345 return E_NOINTERFACE;
348 /**************************************************************************
349 * IShellFolder_AddRef
352 static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder * iface)
354 ICOM_THIS(IGenericSFImpl, iface);
357 TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 ));
359 TRACE("(%p)->(count=%lu)\n",This,This->ref);
362 return ++(This->ref);
365 /**************************************************************************
366 * IShellFolder_fnRelease
368 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder * iface)
370 ICOM_THIS(IGenericSFImpl, iface);
373 TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 ));
375 TRACE("(%p)->(count=%lu)\n",This,This->ref);
379 { TRACE("-- destroying IShellFolder(%p)\n",This);
381 if (pdesktopfolder == iface)
382 { pdesktopfolder=NULL;
383 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This);
386 { SHFree(This->absPidl);
389 { SHFree(This->sMyPath);
392 HeapFree(GetProcessHeap(),0,This);
398 /**************************************************************************
399 * IShellFolder_fnParseDisplayName
401 * HWND hwndOwner, //[in ] Parent window for any message's
402 * LPBC pbc, //[in ] reserved
403 * LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
404 * ULONG* pchEaten, //[out] (unicode) characters processed
405 * LPITEMIDLIST* ppidl, //[out] complex pidl to item
406 * ULONG* pdwAttributes //[out] items attributes
409 * every folder trys to parse only it's own (the leftmost) pidl and creates a
410 * subfolder to evaluate the remaining parts
411 * now we can parse into namespaces implemented by shell extensions
413 * behaviour on win98: lpszDisplayName=NULL -> chrash
414 * lpszDisplayName="" -> returns mycoputer-pidl
417 * pdwAttributes: not set
418 * pchEaten: not set like in windows
420 static HRESULT WINAPI IShellFolder_fnParseDisplayName(
421 IShellFolder * iface,
424 LPOLESTR lpszDisplayName,
427 DWORD *pdwAttributes)
429 ICOM_THIS(IGenericSFImpl, iface);
431 HRESULT hr = E_OUTOFMEMORY;
433 WCHAR szElement[MAX_PATH];
434 CHAR szTempA[MAX_PATH], szPath[MAX_PATH];
435 LPITEMIDLIST pidlTemp=NULL;
437 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
438 This,hwndOwner,pbcReserved,lpszDisplayName,
439 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
441 if (pchEaten) *pchEaten = 0; /* strange but like the original */
443 if (*lpszDisplayName)
445 /* get the next element */
446 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);
448 /* build the full pathname to the element */
449 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1);
450 strcpy(szPath, This->sMyPath);
451 PathAddBackslashA(szPath);
452 strcat(szPath, szTempA);
455 pidlTemp = SHSimpleIDListFromPathA(szPath);
459 /* try to analyse the next element */
460 if (szNext && *szNext)
462 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
473 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr);
478 /**************************************************************************
479 * IShellFolder_fnEnumObjects
481 * HWND hwndOwner, //[in ] Parent Window
482 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
483 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
485 static HRESULT WINAPI IShellFolder_fnEnumObjects(
486 IShellFolder * iface,
489 LPENUMIDLIST* ppEnumIDList)
491 ICOM_THIS(IGenericSFImpl, iface);
493 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
495 *ppEnumIDList = NULL;
496 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE);
498 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
500 if(!*ppEnumIDList) return E_OUTOFMEMORY;
505 /**************************************************************************
506 * IShellFolder_fnBindToObject
508 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
509 * LPBC pbc, //[in ] reserved
510 * REFIID riid, //[in ] Initial Interface
511 * LPVOID* ppvObject //[out] Interface*
513 static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl,
514 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
516 ICOM_THIS(IGenericSFImpl, iface);
519 IShellFolder *pShellFolder, *pSubFolder;
520 IPersistFolder *pPersistFolder;
521 LPITEMIDLIST absPidl;
523 WINE_StringFromCLSID(riid,xriid);
525 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut);
529 if ((iid=_ILGetGUIDPointer(pidl)))
531 /* we have to create a alien folder */
532 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder))
533 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder)))
535 absPidl = ILCombine (This->absPidl, pidl);
536 IPersistFolder_Initialize(pPersistFolder, absPidl);
537 IPersistFolder_Release(pPersistFolder);
547 LPITEMIDLIST pidltemp = ILCloneFirst(pidl);
548 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp);
552 if (_ILIsPidlSimple(pidl))
554 *ppvOut = pShellFolder;
558 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder);
559 IShellFolder_Release(pShellFolder);
560 *ppvOut = pSubFolder;
563 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
568 /**************************************************************************
569 * IShellFolder_fnBindToStorage
571 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
572 * LPBC pbc, //[in ] reserved
573 * REFIID riid, //[in ] Initial storage interface
574 * LPVOID* ppvObject //[out] Interface* returned
576 static HRESULT WINAPI IShellFolder_fnBindToStorage(
577 IShellFolder * iface,
583 ICOM_THIS(IGenericSFImpl, iface);
586 WINE_StringFromCLSID(riid,xriid);
588 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",This,pidl,pbcReserved,xriid,ppvOut);
594 /**************************************************************************
595 * IShellFolder_fnCompareIDs
598 * LPARAM lParam, //[in ] Column?
599 * LPCITEMIDLIST pidl1, //[in ] simple pidl
600 * LPCITEMIDLIST pidl2) //[in ] simple pidl
603 * Special case - If one of the items is a Path and the other is a File,
604 * always make the Path come before the File.
607 * use SCODE_CODE() on the return value to get the result
610 static HRESULT WINAPI IShellFolder_fnCompareIDs(
611 IShellFolder * iface,
616 ICOM_THIS(IGenericSFImpl, iface);
618 CHAR szTemp1[MAX_PATH];
619 CHAR szTemp2[MAX_PATH];
622 HRESULT hr = E_OUTOFMEMORY;
623 LPCITEMIDLIST pidlTemp;
626 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2);
630 if (!pidl1 && !pidl2)
632 hr = ResultFromShort(0);
636 hr = ResultFromShort(-1);
640 hr = ResultFromShort(1);
645 pd1 = _ILGetDataPointer(pidl1);
646 pd2 = _ILGetDataPointer(pidl2);
648 /* compate the types. sort order is the PT_* constant */
649 pt1 = ( pd1 ? pd1->type: PT_DESKTOP);
650 pt2 = ( pd2 ? pd2->type: PT_DESKTOP);
654 hr = ResultFromShort(pt1-pt2);
656 else /* same type of pidl */
658 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH);
659 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH);
660 nReturn = strcasecmp(szTemp1, szTemp2);
662 if (nReturn == 0) /* first pidl different ? */
664 pidl1 = ILGetNext(pidl1);
666 if (pidl1 && pidl1->mkid.cb) /* go deeper? */
668 pidlTemp = ILCloneFirst(pidl1);
669 pidl2 = ILGetNext(pidl2);
671 hr = IShellFolder_BindToObject((IShellFolder*)This, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf);
674 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2);
675 IShellFolder_Release(psf);
676 hr = ResultFromShort(nReturn);
682 hr = ResultFromShort(nReturn); /* two equal simple pidls */
687 hr = ResultFromShort(nReturn); /* two different simple pidls */
692 TRACE("-- res=0x%08lx\n", hr);
696 /**************************************************************************
697 * IShellFolder_fnCreateViewObject
699 static HRESULT WINAPI IShellFolder_fnCreateViewObject( IShellFolder * iface,
700 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
702 ICOM_THIS(IGenericSFImpl, iface);
704 LPSHELLVIEW pShellView;
706 HRESULT hr = E_INVALIDARG;
708 WINE_StringFromCLSID(riid,xriid);
709 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut);
715 if(IsEqualIID(riid, &IID_IDropTarget))
717 hr = IShellFolder_QueryInterface((IShellFolder*)This, &IID_IDropTarget, ppvOut);
719 else if(IsEqualIID(riid, &IID_IContextMenu))
721 FIXME("IContextMenu not implemented\n");
724 else if(IsEqualIID(riid, &IID_IShellView))
726 pShellView = IShellView_Constructor((IShellFolder *) This);
729 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
730 IShellView_Release(pShellView);
734 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
738 /**************************************************************************
739 * IShellFolder_fnGetAttributesOf
742 * UINT cidl, //[in ] num elements in pidl array
743 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
744 * ULONG* rgfInOut) //[out] result array
747 static HRESULT WINAPI IShellFolder_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
749 ICOM_THIS(IGenericSFImpl, iface);
753 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);
755 if ( (!cidl) || (!apidl) || (!rgfInOut))
758 while (cidl > 0 && *apidl)
761 if (_ILIsFolder( *apidl))
763 *rgfInOut &= 0xe0000177;
766 else if (_ILIsValue( *apidl))
768 *rgfInOut &= 0x40000177;
777 TRACE("-- result=0x%08lx\n",*rgfInOut);
781 /**************************************************************************
782 * IShellFolder_fnGetUIObjectOf
785 * HWND hwndOwner, //[in ] Parent window for any output
786 * UINT cidl, //[in ] array size
787 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
788 * REFIID riid, //[in ] Requested Interface
789 * UINT* prgfInOut, //[ ] reserved
790 * LPVOID* ppvObject) //[out] Resulting Interface
793 * This function gets asked to return "view objects" for one or more (multiple select)
795 * The viewobject typically is an COM object with one of the following interfaces:
796 * IExtractIcon,IDataObject,IContextMenu
797 * In order to support icon positions in the default Listview your DataObject
798 * must implement the SetData method (in addition to GetData :) - the shell passes
799 * a barely documented "Icon positions" structure to SetData when the drag starts,
800 * and GetData's it if the drop is in another explorer window that needs the positions.
802 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf(
803 IShellFolder * iface,
806 LPCITEMIDLIST * apidl,
811 ICOM_THIS(IGenericSFImpl, iface);
815 IUnknown* pObj = NULL;
816 HRESULT hr = E_INVALIDARG;
818 WINE_StringFromCLSID(riid,xclsid);
820 TRACE("(%p)->(%u,%u,apidl=%p,\n\tIID:%s,%p,%p)\n",
821 This,hwndOwner,cidl,apidl,xclsid,prgfInOut,ppvOut);
827 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1))
829 pObj = (LPUNKNOWN)IContextMenu_Constructor((IShellFolder *)This, This->absPidl, apidl, cidl);
832 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1))
834 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl);
837 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1))
839 pidl = ILCombine(This->absPidl,apidl[0]);
840 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl );
844 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1))
846 hr = IShellFolder_QueryInterface((IShellFolder*)This, &IID_IDropTarget, (LPVOID*)&pObj);
858 TRACE("(%p)->hr=0x%08lx\n",This, hr);
862 /**************************************************************************
863 * IShellFolder_fnGetDisplayNameOf
864 * Retrieves the display name for the specified file object or subfolder
867 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
868 * DWORD dwFlags, //[in ] SHGNO formatting flags
869 * LPSTRRET lpName) //[out] Returned display name
872 * if the name is in the pidl the ret value should be a STRRET_OFFSET
874 #define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
875 #define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
877 static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf(
878 IShellFolder * iface,
883 ICOM_THIS(IGenericSFImpl, iface);
885 CHAR szPath[MAX_PATH]= "";
889 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
892 if(!pidl || !strRet) return E_INVALIDARG;
894 bSimplePidl = _ILIsPidlSimple(pidl);
896 /* take names of special folders only if its only this folder */
897 if (_ILIsSpecialFolder(pidl))
901 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
906 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath)
908 strcpy (szPath, This->sMyPath); /* get path to root*/
909 PathAddBackslashA(szPath);
910 len = strlen(szPath);
912 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len); /* append my own path */
915 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl) /* go deeper if needed */
917 PathAddBackslashA(szPath);
918 len = strlen(szPath);
920 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags, szPath + len, MAX_PATH - len)))
921 return E_OUTOFMEMORY;
923 strRet->uType = STRRET_CSTRA;
924 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
926 TRACE("-- (%p)->(%s)\n", This, szPath);
930 /**************************************************************************
931 * IShellFolder_fnSetNameOf
932 * Changes the name of a file object or subfolder, possibly changing its item
933 * identifier in the process.
936 * HWND hwndOwner, //[in ] Owner window for output
937 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
938 * LPCOLESTR lpszName, //[in ] the items new display name
939 * DWORD dwFlags, //[in ] SHGNO formatting flags
940 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
942 static HRESULT WINAPI IShellFolder_fnSetNameOf(
943 IShellFolder * iface,
945 LPCITEMIDLIST pidl, /*simple pidl*/
948 LPITEMIDLIST *pPidlOut)
950 ICOM_THIS(IGenericSFImpl, iface);
952 FIXME("(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n",
953 This,hwndOwner,pidl,debugstr_w(lpName),dw,pPidlOut);
958 /**************************************************************************
959 * IShellFolder_fnGetFolderPath
961 static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder * iface, LPSTR lpszOut, DWORD dwOutSize)
963 ICOM_THIS(IGenericSFImpl, iface);
965 TRACE("(%p)->(%p %lu)\n",This, lpszOut, dwOutSize);
967 if (!lpszOut) return FALSE;
971 if (! This->sMyPath) return FALSE;
973 lstrcpynA(lpszOut, This->sMyPath, dwOutSize);
975 TRACE("-- (%p)->(return=%s)\n",This, lpszOut);
979 static ICOM_VTABLE(IShellFolder) sfvt =
981 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
982 IShellFolder_fnQueryInterface,
983 IShellFolder_fnAddRef,
984 IShellFolder_fnRelease,
985 IShellFolder_fnParseDisplayName,
986 IShellFolder_fnEnumObjects,
987 IShellFolder_fnBindToObject,
988 IShellFolder_fnBindToStorage,
989 IShellFolder_fnCompareIDs,
990 IShellFolder_fnCreateViewObject,
991 IShellFolder_fnGetAttributesOf,
992 IShellFolder_fnGetUIObjectOf,
993 IShellFolder_fnGetDisplayNameOf,
994 IShellFolder_fnSetNameOf,
995 IShellFolder_fnGetFolderPath
998 /***********************************************************************
999 * [Desktopfolder] IShellFolder implementation
1001 static struct ICOM_VTABLE(IShellFolder) sfdvt;
1003 /**************************************************************************
1004 * ISF_Desktop_Constructor
1007 IShellFolder * ISF_Desktop_Constructor()
1009 IGenericSFImpl * sf;
1011 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
1014 sf->absPidl=_ILCreateDesktop(); /* my qualified pidl */
1019 return (IShellFolder *)sf;
1022 /**************************************************************************
1023 * ISF_Desktop_fnQueryInterface
1025 * NOTES supports not IPersist/IPersistFolder
1027 static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
1028 IShellFolder * iface,
1032 ICOM_THIS(IGenericSFImpl, iface);
1035 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1036 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1040 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
1043 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/
1044 { *ppvObj = (IShellFolder*)This;
1049 IUnknown_AddRef((IUnknown*)(*ppvObj));
1050 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1053 TRACE("-- Interface: E_NOINTERFACE\n");
1054 return E_NOINTERFACE;
1057 /**************************************************************************
1058 * ISF_Desktop_fnParseDisplayName
1061 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
1064 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName(
1065 IShellFolder * iface,
1068 LPOLESTR lpszDisplayName,
1070 LPITEMIDLIST *ppidl,
1071 DWORD *pdwAttributes)
1073 ICOM_THIS(IGenericSFImpl, iface);
1075 LPCWSTR szNext=NULL;
1076 LPITEMIDLIST pidlTemp=NULL;
1077 HRESULT hr=E_OUTOFMEMORY;
1079 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
1080 This,hwndOwner,pbcReserved,lpszDisplayName,
1081 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
1084 if (pchEaten) *pchEaten = 0; /* strange but like the original */
1086 /* fixme no real parsing implemented */
1087 pidlTemp = _ILCreateMyComputer();
1088 szNext = lpszDisplayName;
1090 if (szNext && *szNext)
1092 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
1101 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);
1106 /**************************************************************************
1107 * ISF_Desktop_fnEnumObjects
1109 static HRESULT WINAPI ISF_Desktop_fnEnumObjects(
1110 IShellFolder * iface,
1113 LPENUMIDLIST* ppEnumIDList)
1115 ICOM_THIS(IGenericSFImpl, iface);
1117 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
1119 *ppEnumIDList = NULL;
1120 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
1122 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
1124 if(!*ppEnumIDList) return E_OUTOFMEMORY;
1129 /**************************************************************************
1130 * ISF_Desktop_fnBindToObject
1132 static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl,
1133 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
1135 ICOM_THIS(IGenericSFImpl, iface);
1138 IShellFolder *pShellFolder, *pSubFolder;
1140 WINE_StringFromCLSID(riid,xriid);
1142 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut);
1146 if ((clsid=_ILGetGUIDPointer(pidl)))
1148 if ( IsEqualIID(clsid, &IID_MyComputer))
1150 pShellFolder = ISF_MyComputer_Constructor();
1154 /* shell extension */
1155 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))
1157 return E_INVALIDARG;
1163 /* file system folder on the desktop */
1164 LPITEMIDLIST pidltemp = ILCloneFirst(pidl);
1165 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp);
1169 if (_ILIsPidlSimple(pidl)) /* no sub folders */
1171 *ppvOut = pShellFolder;
1173 else /* go deeper */
1175 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder);
1176 IShellFolder_Release(pShellFolder);
1177 *ppvOut = pSubFolder;
1180 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
1185 /**************************************************************************
1186 * ISF_Desktop_fnCreateViewObject
1188 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder * iface,
1189 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
1191 ICOM_THIS(IGenericSFImpl, iface);
1193 LPSHELLVIEW pShellView;
1195 HRESULT hr = E_INVALIDARG;
1197 WINE_StringFromCLSID(riid,xriid);
1198 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut);
1204 if(IsEqualIID(riid, &IID_IDropTarget))
1206 FIXME("IDropTarget not implemented\n");
1209 else if(IsEqualIID(riid, &IID_IContextMenu))
1211 FIXME("IContextMenu not implemented\n");
1214 else if(IsEqualIID(riid, &IID_IShellView))
1216 pShellView = IShellView_Constructor((IShellFolder *) This);
1219 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
1220 IShellView_Release(pShellView);
1224 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
1228 /**************************************************************************
1229 * ISF_Desktop_fnGetAttributesOf
1231 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
1233 ICOM_THIS(IGenericSFImpl, iface);
1239 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut);
1241 if ( (!cidl) || (!apidl) || (!rgfInOut))
1242 return E_INVALIDARG;
1244 while (cidl > 0 && *apidl)
1248 if ((clsid=_ILGetGUIDPointer(*apidl)))
1250 if (IsEqualIID(clsid, &IID_MyComputer))
1252 *rgfInOut &= 0xb0000154;
1255 else if (HCR_GetFolderAttributes(clsid, &attributes))
1257 *rgfInOut &= attributes;
1261 { /* some shell-extension */
1262 *rgfInOut &= 0xb0000154;
1265 else if (_ILIsFolder( *apidl))
1267 *rgfInOut &= 0xe0000177;
1270 else if (_ILIsValue( *apidl))
1272 *rgfInOut &= 0x40000177;
1281 TRACE("-- result=0x%08lx\n",*rgfInOut);
1286 /**************************************************************************
1287 * ISF_Desktop_fnGetDisplayNameOf
1290 * special case: pidl = null gives desktop-name back
1292 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf(
1293 IShellFolder * iface,
1298 ICOM_THIS(IGenericSFImpl, iface);
1300 CHAR szPath[MAX_PATH]= "";
1302 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
1305 if(!strRet) return E_INVALIDARG;
1309 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH);
1311 else if ( _ILIsPidlSimple(pidl) )
1313 _ILSimpleGetText(pidl, szPath, MAX_PATH);
1317 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags, szPath, MAX_PATH)))
1318 return E_OUTOFMEMORY;
1320 strRet->uType = STRRET_CSTRA;
1321 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
1324 TRACE("-- (%p)->(%s)\n", This, szPath);
1328 static ICOM_VTABLE(IShellFolder) sfdvt =
1330 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1331 ISF_Desktop_fnQueryInterface,
1332 IShellFolder_fnAddRef,
1333 IShellFolder_fnRelease,
1334 ISF_Desktop_fnParseDisplayName,
1335 ISF_Desktop_fnEnumObjects,
1336 ISF_Desktop_fnBindToObject,
1337 IShellFolder_fnBindToStorage,
1338 IShellFolder_fnCompareIDs,
1339 ISF_Desktop_fnCreateViewObject,
1340 ISF_Desktop_fnGetAttributesOf,
1341 IShellFolder_fnGetUIObjectOf,
1342 ISF_Desktop_fnGetDisplayNameOf,
1343 IShellFolder_fnSetNameOf,
1344 IShellFolder_fnGetFolderPath
1348 /***********************************************************************
1349 * IShellFolder [MyComputer] implementation
1352 static struct ICOM_VTABLE(IShellFolder) sfmcvt;
1354 /**************************************************************************
1355 * ISF_MyComputer_Constructor
1357 static IShellFolder * ISF_MyComputer_Constructor(void)
1359 IGenericSFImpl * sf;
1361 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
1364 sf->lpvtbl = &sfmcvt;
1365 sf->lpvtblPersistFolder = &psfvt;
1366 sf->pclsid = (CLSID*)&CLSID_SFMyComp;
1367 sf->absPidl=_ILCreateMyComputer(); /* my qualified pidl */
1372 return (IShellFolder *)sf;
1375 /**************************************************************************
1376 * ISF_MyComputer_fnParseDisplayName
1378 static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName(
1379 IShellFolder * iface,
1382 LPOLESTR lpszDisplayName,
1384 LPITEMIDLIST *ppidl,
1385 DWORD *pdwAttributes)
1387 ICOM_THIS(IGenericSFImpl, iface);
1389 HRESULT hr = E_OUTOFMEMORY;
1390 LPCWSTR szNext=NULL;
1391 WCHAR szElement[MAX_PATH];
1392 CHAR szTempA[MAX_PATH];
1393 LPITEMIDLIST pidlTemp;
1395 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
1396 This,hwndOwner,pbcReserved,lpszDisplayName,
1397 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
1400 if (pchEaten) *pchEaten = 0; /* strange but like the original */
1402 if (PathIsRootW(lpszDisplayName))
1404 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);
1405 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1);
1406 pidlTemp = _ILCreateDrive(szTempA);
1408 if (szNext && *szNext)
1410 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
1419 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);
1424 /**************************************************************************
1425 * ISF_MyComputer_fnEnumObjects
1427 static HRESULT WINAPI ISF_MyComputer_fnEnumObjects(
1428 IShellFolder * iface,
1431 LPENUMIDLIST* ppEnumIDList)
1433 ICOM_THIS(IGenericSFImpl, iface);
1435 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
1437 *ppEnumIDList = NULL;
1438 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP);
1440 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
1442 if(!*ppEnumIDList) return E_OUTOFMEMORY;
1447 /**************************************************************************
1448 * ISF_MyComputer_fnBindToObject
1450 static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl,
1451 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
1453 ICOM_THIS(IGenericSFImpl, iface);
1456 IShellFolder *pShellFolder, *pSubFolder;
1457 LPITEMIDLIST pidltemp;
1459 WINE_StringFromCLSID(riid,xriid);
1461 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut);
1465 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &IID_MyComputer))
1467 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))
1474 if (!_ILIsDrive(pidl)) return E_INVALIDARG;
1476 pidltemp = ILCloneFirst(pidl);
1477 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp);
1481 if (_ILIsPidlSimple(pidl)) /* no sub folders */
1483 *ppvOut = pShellFolder;
1485 else /* go deeper */
1487 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder);
1488 IShellFolder_Release(pShellFolder);
1489 *ppvOut = pSubFolder;
1492 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
1497 /**************************************************************************
1498 * ISF_MyComputer_fnCreateViewObject
1500 static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder * iface,
1501 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
1503 ICOM_THIS(IGenericSFImpl, iface);
1505 LPSHELLVIEW pShellView;
1507 HRESULT hr = E_INVALIDARG;
1509 WINE_StringFromCLSID(riid,xriid);
1510 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut);
1516 if(IsEqualIID(riid, &IID_IDropTarget))
1518 FIXME("IDropTarget not implemented\n");
1521 else if(IsEqualIID(riid, &IID_IContextMenu))
1523 FIXME("IContextMenu not implemented\n");
1526 else if(IsEqualIID(riid, &IID_IShellView))
1528 pShellView = IShellView_Constructor((IShellFolder *) This);
1531 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
1532 IShellView_Release(pShellView);
1536 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
1540 /**************************************************************************
1541 * ISF_MyComputer_fnGetAttributesOf
1543 static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
1545 ICOM_THIS(IGenericSFImpl, iface);
1551 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);
1553 if ( (!cidl) || (!apidl) || (!rgfInOut))
1554 return E_INVALIDARG;
1556 *rgfInOut = 0xffffffff;
1558 while (cidl > 0 && *apidl)
1562 if (_ILIsDrive(*apidl))
1564 *rgfInOut &= 0xf0000144;
1567 else if ((clsid=_ILGetGUIDPointer(*apidl)))
1569 if (HCR_GetFolderAttributes(clsid, &attributes))
1571 *rgfInOut &= attributes;
1581 TRACE("-- result=0x%08lx\n",*rgfInOut);
1585 /**************************************************************************
1586 * ISF_MyComputer_fnGetDisplayNameOf
1589 * The desktopfolder creates only complete paths (SHGDN_FORPARSING).
1590 * SHGDN_INFOLDER makes no sense.
1592 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf(
1593 IShellFolder * iface,
1598 ICOM_THIS(IGenericSFImpl, iface);
1600 char szPath[MAX_PATH], szDrive[18];
1604 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
1607 if(!strRet) return E_INVALIDARG;
1609 szPath[0]=0x00; szDrive[0]=0x00;
1612 bSimplePidl = _ILIsPidlSimple(pidl);
1614 if (_ILIsSpecialFolder(pidl))
1616 /* take names of special folders only if its only this folder */
1619 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
1624 if (!_ILIsDrive(pidl))
1626 ERR("Wrong pidl type\n");
1627 return E_INVALIDARG;
1630 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
1632 /* long view "lw_name (C:)" */
1633 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING))
1635 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags;
1637 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0);
1638 strcat (szDrive," (");
1639 strncat (szDrive, szPath, 2);
1640 strcat (szDrive,")");
1641 strcpy (szPath, szDrive);
1645 if (!bSimplePidl) /* go deeper if needed */
1647 PathAddBackslashA(szPath);
1648 len = strlen(szPath);
1650 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len)))
1651 return E_OUTOFMEMORY;
1653 strRet->uType = STRRET_CSTRA;
1654 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
1657 TRACE("-- (%p)->(%s)\n", This, szPath);
1661 static ICOM_VTABLE(IShellFolder) sfmcvt =
1663 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1664 IShellFolder_fnQueryInterface,
1665 IShellFolder_fnAddRef,
1666 IShellFolder_fnRelease,
1667 ISF_MyComputer_fnParseDisplayName,
1668 ISF_MyComputer_fnEnumObjects,
1669 ISF_MyComputer_fnBindToObject,
1670 IShellFolder_fnBindToStorage,
1671 IShellFolder_fnCompareIDs,
1672 ISF_MyComputer_fnCreateViewObject,
1673 ISF_MyComputer_fnGetAttributesOf,
1674 IShellFolder_fnGetUIObjectOf,
1675 ISF_MyComputer_fnGetDisplayNameOf,
1676 IShellFolder_fnSetNameOf,
1677 IShellFolder_fnGetFolderPath
1681 /************************************************************************
1682 * ISFPersistFolder_QueryInterface (IUnknown)
1685 static HRESULT WINAPI ISFPersistFolder_QueryInterface(
1686 IPersistFolder * iface,
1690 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1692 TRACE("(%p)\n", This);
1694 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
1697 /************************************************************************
1698 * ISFPersistFolder_AddRef (IUnknown)
1701 static ULONG WINAPI ISFPersistFolder_AddRef(
1702 IPersistFolder * iface)
1704 _ICOM_THIS_From_IPersistFolder(IShellFolder, iface);
1706 TRACE("(%p)\n", This);
1708 return IShellFolder_AddRef((IShellFolder*)This);
1711 /************************************************************************
1712 * ISFPersistFolder_Release (IUnknown)
1715 static ULONG WINAPI ISFPersistFolder_Release(
1716 IPersistFolder * iface)
1718 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1720 TRACE("(%p)\n", This);
1722 return IShellFolder_Release((IShellFolder*)This);
1725 /************************************************************************
1726 * ISFPersistFolder_GetClassID (IPersist)
1728 static HRESULT WINAPI ISFPersistFolder_GetClassID(
1729 IPersistFolder * iface,
1732 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1734 TRACE("(%p)\n", This);
1736 if (!lpClassId) return E_POINTER;
1737 *lpClassId = *This->pclsid;
1742 /************************************************************************
1743 * ISFPersistFolder_Initialize (IPersistFolder)
1746 * sMyPath is not set. Don't know how to handle in a non rooted environment.
1748 static HRESULT WINAPI ISFPersistFolder_Initialize(
1749 IPersistFolder * iface,
1752 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1754 TRACE("(%p)\n", This);
1758 SHFree(This->absPidl);
1759 This->absPidl = NULL;
1761 This->absPidl = ILClone(pidl);
1765 static ICOM_VTABLE(IPersistFolder) psfvt =
1767 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1768 ISFPersistFolder_QueryInterface,
1769 ISFPersistFolder_AddRef,
1770 ISFPersistFolder_Release,
1771 ISFPersistFolder_GetClassID,
1772 ISFPersistFolder_Initialize
1775 /****************************************************************************
1776 * ISFDropTarget implementation
1778 static BOOL ISFDropTarget_QueryDrop(
1783 DWORD dwEffect = *pdwEffect;
1785 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1787 *pdwEffect = DROPEFFECT_NONE;
1789 if (This->fAcceptFmt)
1790 { /* Does our interpretation of the keystate ... */
1791 *pdwEffect = KeyStateToDropEffect(dwKeyState);
1793 /* ... matches the desired effect ? */
1794 if (dwEffect & *pdwEffect)
1802 static HRESULT WINAPI ISFDropTarget_QueryInterface(
1807 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1809 TRACE("(%p)\n", This);
1811 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1814 static ULONG WINAPI ISFDropTarget_AddRef( IDropTarget *iface)
1816 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1818 TRACE("(%p)\n", This);
1820 return IShellFolder_AddRef((IShellFolder*)This);
1823 static ULONG WINAPI ISFDropTarget_Release( IDropTarget *iface)
1825 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1827 TRACE("(%p)\n", This);
1829 return IShellFolder_Release((IShellFolder*)This);
1832 static HRESULT WINAPI ISFDropTarget_DragEnter(
1834 IDataObject *pDataObject,
1841 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1843 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject);
1845 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL);
1847 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE;
1849 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);
1854 static HRESULT WINAPI ISFDropTarget_DragOver(
1860 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1862 TRACE("(%p)\n",This);
1864 if(!pdwEffect) return E_INVALIDARG;
1866 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);
1871 static HRESULT WINAPI ISFDropTarget_DragLeave(
1874 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1876 TRACE("(%p)\n",This);
1878 This->fAcceptFmt = FALSE;
1883 static HRESULT WINAPI ISFDropTarget_Drop(
1885 IDataObject* pDataObject,
1890 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1892 FIXME("(%p) object dropped\n",This);
1897 static struct ICOM_VTABLE(IDropTarget) dtvt =
1899 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1900 ISFDropTarget_QueryInterface,
1901 ISFDropTarget_AddRef,
1902 ISFDropTarget_Release,
1903 ISFDropTarget_DragEnter,
1904 ISFDropTarget_DragOver,
1905 ISFDropTarget_DragLeave,