4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998 Juergen Schmied
15 #include "wine/obj_base.h"
21 #include "shell32_main.h"
23 static HRESULT WINAPI IShellFolder_QueryInterface(LPSHELLFOLDER,REFIID,LPVOID*);
24 static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER);
25 static ULONG WINAPI IShellFolder_Release(LPSHELLFOLDER);
26 static HRESULT WINAPI IShellFolder_Initialize(LPSHELLFOLDER,LPCITEMIDLIST);
27 static HRESULT WINAPI IShellFolder_ParseDisplayName(LPSHELLFOLDER,HWND32,LPBC,LPOLESTR32,DWORD*,LPITEMIDLIST*,DWORD*);
28 static HRESULT WINAPI IShellFolder_EnumObjects(LPSHELLFOLDER,HWND32,DWORD,LPENUMIDLIST*);
29 static HRESULT WINAPI IShellFolder_BindToObject(LPSHELLFOLDER,LPCITEMIDLIST,LPBC,REFIID,LPVOID*);
30 static HRESULT WINAPI IShellFolder_BindToStorage(LPSHELLFOLDER,LPCITEMIDLIST,LPBC,REFIID,LPVOID*);
31 static HRESULT WINAPI IShellFolder_CompareIDs(LPSHELLFOLDER,LPARAM,LPCITEMIDLIST,LPCITEMIDLIST);
32 static HRESULT WINAPI IShellFolder_CreateViewObject(LPSHELLFOLDER,HWND32,REFIID,LPVOID*);
33 static HRESULT WINAPI IShellFolder_GetAttributesOf(LPSHELLFOLDER,UINT32,LPCITEMIDLIST*,DWORD*);
34 static HRESULT WINAPI IShellFolder_GetUIObjectOf(LPSHELLFOLDER,HWND32,UINT32,LPCITEMIDLIST*,REFIID,UINT32*,LPVOID*);
35 static HRESULT WINAPI IShellFolder_GetDisplayNameOf(LPSHELLFOLDER,LPCITEMIDLIST,DWORD,LPSTRRET);
36 static HRESULT WINAPI IShellFolder_SetNameOf(LPSHELLFOLDER,HWND32,LPCITEMIDLIST,LPCOLESTR32,DWORD,LPITEMIDLIST*);
37 static BOOL32 WINAPI IShellFolder_GetFolderPath(LPSHELLFOLDER,LPSTR,DWORD);
39 /***************************************************************************
40 * GetNextElement (internal function)
42 * gets a part of a string till the first backslash
45 * pszNext [IN] string to get the element from
46 * pszOut [IN] pointer to buffer whitch receives string
47 * dwOut [IN] length of pszOut
50 * LPSTR pointer to first, not yet parsed char
52 LPSTR GetNextElement(LPSTR pszNext,LPSTR pszOut,DWORD dwOut)
53 { LPSTR pszTail = pszNext;
55 TRACE(shell,"(%s %p 0x%08lx)\n",debugstr_a(pszNext),pszOut,dwOut);
57 if(!pszNext || !*pszNext)
60 while(*pszTail && (*pszTail != '\\'))
63 dwCopy=((LPBYTE)pszTail-(LPBYTE)pszNext)/sizeof(CHAR)+1;
64 lstrcpyn32A(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy);
70 TRACE(shell,"--(%s %s 0x%08lx)\n",debugstr_a(pszNext),debugstr_a(pszOut),dwOut);
74 /***********************************************************************
75 * IShellFolder implementation
77 static struct IShellFolder_VTable sfvt =
78 { IShellFolder_QueryInterface,
81 IShellFolder_ParseDisplayName,
82 IShellFolder_EnumObjects,
83 IShellFolder_BindToObject,
84 IShellFolder_BindToStorage,
85 IShellFolder_CompareIDs,
86 IShellFolder_CreateViewObject,
87 IShellFolder_GetAttributesOf,
88 IShellFolder_GetUIObjectOf,
89 IShellFolder_GetDisplayNameOf,
90 IShellFolder_SetNameOf,
91 IShellFolder_GetFolderPath
93 /**************************************************************************
94 * IShellFolder_Constructor
97 LPSHELLFOLDER IShellFolder_Constructor(LPSHELLFOLDER pParent,LPITEMIDLIST pidl)
100 sf=(LPSHELLFOLDER)HeapAlloc(GetProcessHeap(),0,sizeof(IShellFolder));
103 sf->sMyPath=NULL; /* path of the folder */
104 sf->pMyPidl=NULL; /* my qualified pidl */
106 TRACE(shell,"(%p)->(parent=%p, pidl=%p)\n",sf,pParent, pidl);
109 /* keep a copy of the pidl in the instance*/
110 sf->mpidl = ILClone(pidl); /* my short pidl */
112 if(sf->mpidl) /* do we have a pidl? */
114 if(pParent->sMyPath) /* get the size of the parents path */
115 { dwSize += strlen(pParent->sMyPath) ;
116 TRACE(shell,"-- (%p)->(parent's path=%s)\n",sf, debugstr_a(pParent->sMyPath));
118 dwSize += _ILGetFolderText(sf->mpidl,NULL,0); /* add the size of the foldername*/
119 sf->sMyPath = SHAlloc(dwSize+2); /* '\0' and backslash */
123 if(pParent->sMyPath) /* if the parent has a path, get it*/
124 { strcpy(sf->sMyPath, pParent->sMyPath);
125 PathAddBackslash32A (sf->sMyPath);
127 sf->pMyPidl = ILCombine(pParent->pMyPidl, pidl);
128 len = strlen(sf->sMyPath);
129 _ILGetFolderText(sf->mpidl, sf->sMyPath+len, dwSize-len);
130 TRACE(shell,"-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->pMyPidl,debugstr_a(sf->sMyPath));
137 /**************************************************************************
138 * IShellFolder::QueryInterface
140 * REFIID riid, //[in ] Requested InterfaceID
141 * LPVOID* ppvObject) //[out] Interface* to hold the result
143 static HRESULT WINAPI IShellFolder_QueryInterface(
144 LPSHELLFOLDER this, REFIID riid, LPVOID *ppvObj)
146 WINE_StringFromCLSID((LPCLSID)riid,xriid);
147 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
151 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
154 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/
155 { *ppvObj = (IShellFolder*)this;
159 { (*(LPSHELLFOLDER*)ppvObj)->lpvtbl->fnAddRef(this);
160 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
163 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
164 return E_NOINTERFACE;
167 /**************************************************************************
168 * IShellFolder::AddRef
171 static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER this)
172 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
174 return ++(this->ref);
177 /**************************************************************************
178 * IShellFolder_Release
180 static ULONG WINAPI IShellFolder_Release(LPSHELLFOLDER this)
181 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
185 { TRACE(shell,"-- destroying IShellFolder(%p)\n",this);
187 if (pdesktopfolder==this)
188 { pdesktopfolder=NULL;
189 TRACE(shell,"-- destroyed IShellFolder(%p) was Desktopfolder\n",this);
192 { SHFree(this->pMyPidl);
195 { SHFree(this->mpidl);
198 { SHFree(this->sMyPath);
201 HeapFree(GetProcessHeap(),0,this);
207 /**************************************************************************
208 * IShellFolder_ParseDisplayName
210 * HWND hwndOwner, //[in ] Parent window for any message's
211 * LPBC pbc, //[in ] reserved
212 * LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
213 * ULONG* pchEaten, //[out] (unicode) characters processed
214 * LPITEMIDLIST* ppidl, //[out] complex pidl to item
215 * ULONG* pdwAttributes //[out] items attributes
218 * pdwAttributes: not used
220 static HRESULT WINAPI IShellFolder_ParseDisplayName(
224 LPOLESTR32 lpszDisplayName,
227 DWORD *pdwAttributes)
228 { HRESULT hr=E_OUTOFMEMORY;
229 LPITEMIDLIST pidlFull=NULL, pidlTemp = NULL, pidlOld = NULL;
231 CHAR szTemp[MAX_PATH],szElement[MAX_PATH];
234 TRACE(shell,"(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
235 this,hwndOwner,pbcReserved,lpszDisplayName,
236 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
239 WideCharToLocal32(szTemp, lpszDisplayName, lstrlen32W(lpszDisplayName) + 1);
241 { if (strcmp(szTemp,"Desktop")==0)
242 { pidlFull = _ILCreateDesktop();
244 else if (strcmp(szTemp,"My Computer")==0)
245 { pidlFull = _ILCreateMyComputer();
248 { if (!PathIsRoot32A(szTemp))
249 { if (this->sMyPath && strlen (this->sMyPath))
250 { if (strcmp(this->sMyPath,"My Computer"))
251 { strcpy (szElement,this->sMyPath);
252 PathAddBackslash32A (szElement);
253 strcat (szElement, szTemp);
254 strcpy (szTemp, szElement);
259 /* check if the lpszDisplayName is Folder or File*/
260 bIsFile = ! (GetFileAttributes32A(szTemp) & FILE_ATTRIBUTE_DIRECTORY);
261 pszNext = GetNextElement(szTemp, szElement, MAX_PATH);
263 pidlFull = _ILCreateMyComputer();
264 pidlTemp = _ILCreateDrive(szElement);
266 pidlFull = ILCombine(pidlFull,pidlTemp);
270 { while((pszNext=GetNextElement(pszNext, szElement, MAX_PATH)))
271 { if(!*pszNext && bIsFile)
272 { pidlTemp = _ILCreateValue(szElement);
275 { pidlTemp = _ILCreateFolder(szElement);
278 pidlFull = ILCombine(pidlFull,pidlTemp);
290 /**************************************************************************
291 * IShellFolder_EnumObjects
293 * HWND hwndOwner, //[in ] Parent Window
294 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
295 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
297 static HRESULT WINAPI IShellFolder_EnumObjects(
301 LPENUMIDLIST* ppEnumIDList)
302 { TRACE(shell,"(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",this,hwndOwner,dwFlags,ppEnumIDList);
304 *ppEnumIDList = NULL;
305 *ppEnumIDList = IEnumIDList_Constructor (this->sMyPath, dwFlags);
306 TRACE(shell,"-- (%p)->(new ID List: %p)\n",this,*ppEnumIDList);
308 { return E_OUTOFMEMORY;
312 /**************************************************************************
313 * IShellFolder_Initialize()
314 * IPersistFolder Method
316 static HRESULT WINAPI IShellFolder_Initialize( LPSHELLFOLDER this,LPCITEMIDLIST pidl)
317 { TRACE(shell,"(%p)->(pidl=%p)\n",this,pidl);
320 { SHFree(this->pMyPidl);
321 this->pMyPidl = NULL;
323 this->pMyPidl = ILClone(pidl);
327 /**************************************************************************
328 * IShellFolder_BindToObject
330 * LPCITEMIDLIST pidl, //[in ] complex pidl to open
331 * LPBC pbc, //[in ] reserved
332 * REFIID riid, //[in ] Initial Interface
333 * LPVOID* ppvObject //[out] Interface*
335 static HRESULT WINAPI IShellFolder_BindToObject( LPSHELLFOLDER this, LPCITEMIDLIST pidl,
336 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
339 LPSHELLFOLDER pShellFolder;
341 WINE_StringFromCLSID(riid,xriid);
343 TRACE(shell,"(%p)->(pidl=%p,%p,\n\tIID:%s,%p)\n",this,pidl,pbcReserved,xriid,ppvOut);
347 pShellFolder = IShellFolder_Constructor(this, pidl);
350 return E_OUTOFMEMORY;
352 hr = pShellFolder->lpvtbl->fnQueryInterface(pShellFolder, riid, ppvOut);
353 pShellFolder->lpvtbl->fnRelease(pShellFolder);
354 TRACE(shell,"-- (%p)->(interface=%p)\n",this, ppvOut);
358 /**************************************************************************
359 * IShellFolder_BindToStorage
361 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
362 * LPBC pbc, //[in ] reserved
363 * REFIID riid, //[in ] Initial storage interface
364 * LPVOID* ppvObject //[out] Interface* returned
366 static HRESULT WINAPI IShellFolder_BindToStorage(LPSHELLFOLDER this,
367 LPCITEMIDLIST pidl,LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
369 WINE_StringFromCLSID(riid,xriid);
371 FIXME(shell,"(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",this,pidl,pbcReserved,xriid,ppvOut);
377 /**************************************************************************
378 * IShellFolder_CompareIDs
381 * LPARAM lParam, //[in ] Column?
382 * LPCITEMIDLIST pidl1, //[in ] simple pidl
383 * LPCITEMIDLIST pidl2) //[in ] simple pidl
386 * Special case - If one of the items is a Path and the other is a File,
387 * always make the Path come before the File.
390 * we have to handle simple pidl's only (?)
392 static HRESULT WINAPI IShellFolder_CompareIDs(LPSHELLFOLDER this,
393 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
394 { CHAR szString1[MAX_PATH] = "";
395 CHAR szString2[MAX_PATH] = "";
397 LPCITEMIDLIST pidlTemp1 = pidl1, pidlTemp2 = pidl2;
399 TRACE(shell,"(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",this,lParam,pidl1,pidl2);
403 if (!pidl1 && !pidl2)
405 if (!pidl1) /* Desktop < anything */
410 /* get the last item in each list */
411 while((ILGetNext(pidlTemp1))->mkid.cb)
412 pidlTemp1 = ILGetNext(pidlTemp1);
413 while((ILGetNext(pidlTemp2))->mkid.cb)
414 pidlTemp2 = ILGetNext(pidlTemp2);
416 /* at this point, both pidlTemp1 and pidlTemp2 point to the last item in the list */
417 if(_ILIsValue(pidlTemp1) != _ILIsValue(pidlTemp2))
418 { if(_ILIsValue(pidlTemp1))
423 _ILGetDrive( pidl1,szString1,sizeof(szString1));
424 _ILGetDrive( pidl2,szString1,sizeof(szString2));
425 nReturn = strcasecmp(szString1, szString2);
430 _ILGetFolderText( pidl1,szString1,sizeof(szString1));
431 _ILGetFolderText( pidl2,szString2,sizeof(szString2));
432 nReturn = strcasecmp(szString1, szString2);
437 _ILGetValueText(pidl1,szString1,sizeof(szString1));
438 _ILGetValueText(pidl2,szString2,sizeof(szString2));
439 return strcasecmp(szString1, szString2);
442 /**************************************************************************
443 * IShellFolder_CreateViewObject
444 * Creates an View Object representing the ShellFolder
445 * IShellView / IShellBrowser / IContextMenu
448 * HWND hwndOwner, // Handle of owner window
449 * REFIID riid, // Requested initial interface
450 * LPVOID* ppvObject) // Resultant interface*
453 * the same as SHCreateShellFolderViewEx ???
455 static HRESULT WINAPI IShellFolder_CreateViewObject( LPSHELLFOLDER this,
456 HWND32 hwndOwner, REFIID riid, LPVOID *ppvOut)
457 { LPSHELLVIEW pShellView;
461 WINE_StringFromCLSID(riid,xriid);
462 TRACE(shell,"(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",this,hwndOwner,xriid,ppvOut);
466 pShellView = IShellView_Constructor(this, this->mpidl);
469 return E_OUTOFMEMORY;
471 hr = pShellView->lpvtbl->fnQueryInterface(pShellView, riid, ppvOut);
472 pShellView->lpvtbl->fnRelease(pShellView);
473 TRACE(shell,"-- (%p)->(interface=%p)\n",this, ppvOut);
477 /**************************************************************************
478 * IShellFolder_GetAttributesOf
481 * UINT cidl, //[in ] num elements in pidl array
482 + LPCITEMIDLIST* apidl, //[in ] simple pidl array
483 * ULONG* rgfInOut) //[out] result array
486 * Note: rgfInOut is documented as being an array of ULONGS.
487 * This does not seem to be the case. Testing this function using the shell to
488 * call it with cidl > 1 (by deleting multiple items) reveals that the shell
489 * passes ONE element in the array and writing to further elements will
490 * cause the shell to fail later.
492 static HRESULT WINAPI IShellFolder_GetAttributesOf(LPSHELLFOLDER this,UINT32 cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
493 { LPCITEMIDLIST * pidltemp;
496 TRACE(shell,"(%p)->(%d,%p,%p)\n",this,cidl,apidl,rgfInOut);
498 if ((! cidl )| (!apidl) | (!rgfInOut))
505 TRACE(shell,"-- mask=0x%08lx\n",*rgfInOut);
510 if (_ILIsDesktop( *pidltemp))
511 { *rgfInOut |= ( SFGAO_HASSUBFOLDER | SFGAO_FOLDER | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANLINK );
513 else if (_ILIsMyComputer( *pidltemp))
514 { *rgfInOut |= ( SFGAO_HASSUBFOLDER | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR
515 | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANRENAME | SFGAO_CANLINK );
517 else if (_ILIsDrive( *pidltemp))
518 { *rgfInOut |= ( SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR |
519 SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANLINK );
521 else if (_ILIsFolder( *pidltemp))
522 { *rgfInOut |= ( SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_CAPABILITYMASK );
524 else if (_ILIsValue( *pidltemp))
525 { *rgfInOut |= (SFGAO_FILESYSTEM | SFGAO_CAPABILITYMASK );
530 } while (cidl > 0 && *pidltemp);
534 /**************************************************************************
535 * IShellFolder_GetUIObjectOf
538 * HWND hwndOwner, //[in ] Parent window for any output
539 * UINT cidl, //[in ] array size
540 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
541 * REFIID riid, //[in ] Requested Interface
542 * UINT* prgfInOut, //[ ] reserved
543 * LPVOID* ppvObject) //[out] Resulting Interface
546 * This function gets asked to return "view objects" for one or more (multiple select)
548 * The viewobject typically is an COM object with one of the following interfaces:
549 * IExtractIcon,IDataObject,IContextMenu
550 * In order to support icon positions in the default Listview your DataObject
551 * must implement the SetData method (in addition to GetData :) - the shell passes
552 * a barely documented "Icon positions" structure to SetData when the drag starts,
553 * and GetData's it if the drop is in another explorer window that needs the positions.
555 static HRESULT WINAPI IShellFolder_GetUIObjectOf( LPSHELLFOLDER this,HWND32 hwndOwner,UINT32 cidl,
556 LPCITEMIDLIST * apidl, REFIID riid, UINT32 * prgfInOut,LPVOID * ppvOut)
559 LPUNKNOWN pObj = NULL;
561 WINE_StringFromCLSID(riid,xclsid);
563 TRACE(shell,"(%p)->(%u,%u,apidl=%p,\n\tIID:%s,%p,%p)\n",
564 this,hwndOwner,cidl,apidl,xclsid,prgfInOut,ppvOut);
568 if(IsEqualIID(riid, &IID_IContextMenu))
571 pObj = (LPUNKNOWN)IContextMenu_Constructor(this, apidl, cidl);
573 else if (IsEqualIID(riid, &IID_IDataObject))
575 return(E_INVALIDARG);
576 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, this, apidl, cidl);
578 else if(IsEqualIID(riid, &IID_IExtractIcon))
580 return(E_INVALIDARG);
581 pidl = ILCombine(this->pMyPidl,apidl[0]);
582 pObj = (LPUNKNOWN)IExtractIcon_Constructor( pidl );
586 { ERR(shell,"(%p)->E_NOINTERFACE\n",this);
587 return E_NOINTERFACE;
590 return E_OUTOFMEMORY;
595 /**************************************************************************
596 * IShellFolder_GetDisplayNameOf
597 * Retrieves the display name for the specified file object or subfolder
600 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
601 * DWORD dwFlags, //[in ] SHGNO formatting flags
602 * LPSTRRET lpName) //[out] Returned display name
605 * if the name is in the pidl the ret value should be a STRRET_OFFSET
607 #define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
608 #define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
610 static HRESULT WINAPI IShellFolder_GetDisplayNameOf( LPSHELLFOLDER this, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET lpName)
611 { CHAR szText[MAX_PATH];
612 CHAR szTemp[MAX_PATH];
613 CHAR szSpecial[MAX_PATH];
614 CHAR szDrive[MAX_PATH];
615 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags;
616 LPITEMIDLIST pidlTemp=NULL;
617 BOOL32 bSimplePidl=FALSE;
619 TRACE(shell,"(%p)->(pidl=%p,0x%08lx,%p)\n",this,pidl,dwFlags,lpName);
627 /* test if simple(relative) or complex(absolute) pidl */
628 pidlTemp = ILGetNext(pidl);
629 if (pidlTemp && pidlTemp->mkid.cb==0x00)
630 { bSimplePidl = TRUE;
631 TRACE(shell,"-- simple pidl\n");
634 if (_ILIsDesktop( pidl))
635 { strcpy (szText,"Desktop");
638 { if (_ILIsMyComputer(pidl))
639 { _ILGetItemText(pidl, szSpecial, MAX_PATH);
640 pidl = ILGetNext(pidl);
643 if (_ILIsDrive(pidl))
644 { _ILGetDrive( pidl, szTemp, MAX_PATH);
646 if ( dwFlags==SHGDN_NORMAL || dwFlags==SHGDN_INFOLDER) /* like "A1-dos (C:)" */
647 { GetVolumeInformation32A(szTemp,szDrive,MAX_PATH,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0);
648 szTemp[2]=0x00; /* overwrite '\' */
649 strcat (szDrive," (");
650 strcat (szDrive,szTemp);
651 strcat (szDrive,")");
653 else /* like "C:\" */
654 { PathAddBackslash32A (szTemp);
655 strcpy(szDrive,szTemp);
661 { case SHGDN_NORMAL: /* 0x0000 */
662 _ILGetPidlPath( pidl, szText, MAX_PATH);
665 case SHGDN_INFOLDER | SHGDN_FORPARSING: /* 0x8001 */
666 case SHGDN_INFOLDER: /* 0x0001 */
667 pidlTemp = ILFindLastID(pidl);
669 { _ILGetItemText( pidlTemp, szText, MAX_PATH);
673 case SHGDN_FORPARSING: /* 0x8000 */
675 { /* if the IShellFolder has parents, get the path from the
676 parent and add the ItemName*/
678 if (this->sMyPath && strlen (this->sMyPath))
679 { if (strcmp(this->sMyPath,"My Computer"))
680 { strcpy (szText,this->sMyPath);
681 PathAddBackslash32A (szText);
684 pidlTemp = ILFindLastID(pidl);
686 { _ILGetItemText( pidlTemp, szTemp, MAX_PATH );
688 strcat(szText,szTemp);
690 else /* if the pidl is absolute, get everything from the pidl*/
691 { _ILGetPidlPath( pidl, szText, MAX_PATH);
695 TRACE(shell,"--- wrong flags=%lx\n", dwFlags);
698 if ((szText[0]==0x00 && szDrive[0]!=0x00)|| (bSimplePidl && szDrive[0]!=0x00))
699 { strcpy(szText,szDrive);
701 if (szText[0]==0x00 && szSpecial[0]!=0x00)
702 { strcpy(szText,szSpecial);
706 TRACE(shell,"-- (%p)->(%s)\n",this,szText);
709 { return E_OUTOFMEMORY;
711 lpName->uType = STRRET_CSTRA;
712 strcpy(lpName->u.cStr,szText);
716 /**************************************************************************
717 * IShellFolder_SetNameOf
718 * Changes the name of a file object or subfolder, possibly changing its item
719 * identifier in the process.
722 * HWND hwndOwner, //[in ] Owner window for output
723 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
724 * LPCOLESTR lpszName, //[in ] the items new display name
725 * DWORD dwFlags, //[in ] SHGNO formatting flags
726 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
728 static HRESULT WINAPI IShellFolder_SetNameOf(
731 LPCITEMIDLIST pidl, /*simple pidl*/
734 LPITEMIDLIST *pPidlOut)
735 { FIXME(shell,"(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n",
736 this,hwndOwner,pidl,debugstr_w(lpName),dw,pPidlOut);
739 /**************************************************************************
740 * IShellFolder_GetFolderPath
741 * FIXME: drive not included
743 static BOOL32 WINAPI IShellFolder_GetFolderPath(LPSHELLFOLDER this, LPSTR lpszOut, DWORD dwOutSize)
746 TRACE(shell,"(%p)->(%p %lu)\n",this, lpszOut, dwOutSize);
756 dwSize = strlen (this->sMyPath) +1;
757 if ( dwSize > dwOutSize)
759 strcpy(lpszOut, this->sMyPath);
761 TRACE(shell,"-- (%p)->(return=%s)\n",this, lpszOut);