2 * Shell Folder stuff (...and all the OLE-Objects of SHELL32.DLL)
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998 Juergen Schmied
16 #include "interfaces.h"
24 #include "shell32_main.h"
26 static HRESULT WINAPI
IShellFolder_QueryInterface(LPSHELLFOLDER
,REFIID
,LPVOID
*);
27 static ULONG WINAPI
IShellFolder_AddRef(LPSHELLFOLDER
);
28 static ULONG WINAPI
IShellFolder_Release(LPSHELLFOLDER
);
29 static HRESULT WINAPI
IShellFolder_Initialize(LPSHELLFOLDER
,LPCITEMIDLIST
);
30 static HRESULT WINAPI
IShellFolder_ParseDisplayName(LPSHELLFOLDER
,HWND32
,LPBC
,LPOLESTR32
,DWORD
*,LPITEMIDLIST
*,DWORD
*);
31 static HRESULT WINAPI
IShellFolder_EnumObjects(LPSHELLFOLDER
,HWND32
,DWORD
,LPENUMIDLIST
*);
32 static HRESULT WINAPI
IShellFolder_BindToObject(LPSHELLFOLDER
,LPCITEMIDLIST
,LPBC
,REFIID
,LPVOID
*);
33 static HRESULT WINAPI
IShellFolder_BindToStorage(LPSHELLFOLDER
,LPCITEMIDLIST
,LPBC
,REFIID
,LPVOID
*);
34 static HRESULT WINAPI
IShellFolder_CompareIDs(LPSHELLFOLDER
,LPARAM
,LPCITEMIDLIST
,LPCITEMIDLIST
);
35 static HRESULT WINAPI
IShellFolder_CreateViewObject(LPSHELLFOLDER
,HWND32
,REFIID
,LPVOID
*);
36 static HRESULT WINAPI
IShellFolder_GetAttributesOf(LPSHELLFOLDER
,UINT32
,LPCITEMIDLIST
*,DWORD
*);
37 static HRESULT WINAPI
IShellFolder_GetUIObjectOf(LPSHELLFOLDER
,HWND32
,UINT32
,LPCITEMIDLIST
*,REFIID
,UINT32
*,LPVOID
*);
38 static HRESULT WINAPI
IShellFolder_GetDisplayNameOf(LPSHELLFOLDER
,LPCITEMIDLIST
,DWORD
,LPSTRRET
);
39 static HRESULT WINAPI
IShellFolder_SetNameOf(LPSHELLFOLDER
,HWND32
,LPCITEMIDLIST
,LPCOLESTR32
,DWORD
,LPITEMIDLIST
*);
40 static BOOL32 WINAPI
IShellFolder_GetFolderPath(LPSHELLFOLDER
,LPSTR
,DWORD
);
42 /***************************************************************************
43 * GetNextElement (internal function)
45 * gets a part of a string till the first backslash
48 * pszNext [IN] string to get the element from
49 * pszOut [IN] pointer to buffer whitch receives string
50 * dwOut [IN] length of pszOut
53 * LPSTR pointer to first, not yet parsed char
55 LPSTR
GetNextElement(LPSTR pszNext
,LPSTR pszOut
,DWORD dwOut
)
56 { LPSTR pszTail
= pszNext
;
58 TRACE(shell
,"(%s %p 0x%08lx)\n",debugstr_a(pszNext
),pszOut
,dwOut
);
60 if(!pszNext
|| !*pszNext
)
63 while(*pszTail
&& (*pszTail
!= '\\'))
66 dwCopy
=((LPBYTE
)pszTail
-(LPBYTE
)pszNext
)/sizeof(CHAR
)+1;
67 lstrcpyn32A(pszOut
, pszNext
, (dwOut
<dwCopy
)? dwOut
: dwCopy
);
73 TRACE(shell
,"--(%s %s 0x%08lx)\n",debugstr_a(pszNext
),debugstr_a(pszOut
),dwOut
);
77 /***********************************************************************
78 * IShellFolder implementation
80 static struct IShellFolder_VTable sfvt
=
81 { IShellFolder_QueryInterface
,
84 IShellFolder_ParseDisplayName
,
85 IShellFolder_EnumObjects
,
86 IShellFolder_BindToObject
,
87 IShellFolder_BindToStorage
,
88 IShellFolder_CompareIDs
,
89 IShellFolder_CreateViewObject
,
90 IShellFolder_GetAttributesOf
,
91 IShellFolder_GetUIObjectOf
,
92 IShellFolder_GetDisplayNameOf
,
93 IShellFolder_SetNameOf
,
94 IShellFolder_GetFolderPath
96 /**************************************************************************
97 * IShellFolder_Constructor
100 LPSHELLFOLDER
IShellFolder_Constructor(LPSHELLFOLDER pParent
,LPITEMIDLIST pidl
)
103 sf
=(LPSHELLFOLDER
)HeapAlloc(GetProcessHeap(),0,sizeof(IShellFolder
));
106 sf
->sMyPath
=NULL
; /* path of the folder */
107 sf
->pMyPidl
=NULL
; /* my qualified pidl */
108 sf
->mpSFParent
=pParent
; /* parrent shellfolder */
110 TRACE(shell
,"(%p)->(parent=%p, pidl=%p)\n",sf
,pParent
, pidl
);
112 /* keep a copy of the pidl in the instance*/
113 sf
->mpidl
= ILClone(pidl
);
115 if(sf
->mpidl
) /* do we have a pidl? */
117 if(sf
->mpSFParent
->sMyPath
) /* get the size of the parents path */
118 { dwSize
+= strlen(sf
->mpSFParent
->sMyPath
) + 1;
119 TRACE(shell
,"-- (%p)->(parent's path=%s)\n",sf
, debugstr_a(sf
->mpSFParent
->sMyPath
));
121 dwSize
+= _ILGetFolderText(sf
->mpidl
,NULL
,0); /* add the size of the foldername*/
122 sf
->sMyPath
= SHAlloc(dwSize
);
124 { *(sf
->sMyPath
)=0x00;
125 if(sf
->mpSFParent
->sMyPath
) /* if the parent has a path, get it*/
126 { strcpy(sf
->sMyPath
, sf
->mpSFParent
->sMyPath
);
127 PathAddBackslash32A (sf
->sMyPath
);
129 sf
->pMyPidl
= ILCombine(sf
->pMyPidl
, pidl
);
130 _ILGetFolderText(sf
->mpidl
, sf
->sMyPath
+strlen(sf
->sMyPath
), dwSize
-strlen(sf
->sMyPath
));
131 TRACE(shell
,"-- (%p)->(my path=%s)\n",sf
, debugstr_a(sf
->sMyPath
));
136 /**************************************************************************
137 * IShellFolder::QueryInterface
139 * REFIID riid, //[in ] Requested InterfaceID
140 * LPVOID* ppvObject) //[out] Interface* to hold the result
142 static HRESULT WINAPI
IShellFolder_QueryInterface(
143 LPSHELLFOLDER
this, REFIID riid
, LPVOID
*ppvObj
)
145 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
146 TRACE(shell
,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid
,ppvObj
);
150 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
153 else if(IsEqualIID(riid
, &IID_IShellFolder
)) /*IShellFolder*/
154 { *ppvObj
= (IShellFolder
*)this;
158 { (*(LPSHELLFOLDER
*)ppvObj
)->lpvtbl
->fnAddRef(this);
159 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
162 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
163 return E_NOINTERFACE
;
166 /**************************************************************************
167 * IShellFolder::AddRef
170 static ULONG WINAPI
IShellFolder_AddRef(LPSHELLFOLDER
this)
171 { TRACE(shell
,"(%p)->(count=%lu)\n",this,(this->ref
)+1);
172 return ++(this->ref
);
175 /**************************************************************************
176 * IShellFolder_Release
178 static ULONG WINAPI
IShellFolder_Release(LPSHELLFOLDER
this)
179 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
181 { TRACE(shell
,"-- destroying IShellFolder(%p)\n",this);
183 if (pdesktopfolder
==this)
184 { pdesktopfolder
=NULL
;
185 TRACE(shell
,"-- destroyed IShellFolder(%p) was Desktopfolder\n",this);
188 { SHFree(this->pMyPidl
);
191 { SHFree(this->mpidl
);
194 { SHFree(this->sMyPath
);
197 HeapFree(GetProcessHeap(),0,this);
203 /**************************************************************************
204 * IShellFolder_ParseDisplayName
206 * HWND hwndOwner, //[in ] Parent window for any message's
207 * LPBC pbc, //[in ] reserved
208 * LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
209 * ULONG* pchEaten, //[out] (unicode) characters processed
210 * LPITEMIDLIST* ppidl, //[out] complex pidl to item
211 * ULONG* pdwAttributes //[out] items attributes
214 * pdwAttributes: not used
216 static HRESULT WINAPI
IShellFolder_ParseDisplayName(
220 LPOLESTR32 lpszDisplayName
,
223 DWORD
*pdwAttributes
)
224 { HRESULT hr
=E_OUTOFMEMORY
;
225 LPITEMIDLIST pidlFull
=NULL
, pidlTemp
= NULL
, pidlOld
= NULL
;
226 LPSTR pszTemp
, pszNext
=NULL
;
227 CHAR szElement
[MAX_PATH
];
231 TRACE(shell
,"(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
232 this,hwndOwner
,pbcReserved
,lpszDisplayName
,
233 debugstr_w(lpszDisplayName
),pchEaten
,ppidl
,pdwAttributes
);
235 dwChars
=lstrlen32W(lpszDisplayName
) + 1;
236 pszTemp
=(LPSTR
)HeapAlloc(GetProcessHeap(),0,dwChars
);
240 WideCharToLocal32(pszTemp
, lpszDisplayName
, dwChars
);
242 { if (strcmp(pszTemp
,"Desktop")==0)
243 { pidlFull
= (LPITEMIDLIST
)HeapAlloc(GetProcessHeap(),0,2);
244 pidlFull
->mkid
.cb
= 0;
246 else if (strcmp(pszTemp
,"My Computer")==0)
247 { pidlFull
= _ILCreateMyComputer();
250 { pidlFull
= _ILCreateMyComputer();
252 /* check if the lpszDisplayName is Folder or File*/
253 bIsFile
= ! (GetFileAttributes32A(pszTemp
) & FILE_ATTRIBUTE_DIRECTORY
);
254 pszNext
= GetNextElement(pszTemp
, szElement
, MAX_PATH
);
256 pidlTemp
= _ILCreateDrive(szElement
);
258 pidlFull
= ILCombine(pidlFull
,pidlTemp
);
262 { while((pszNext
=GetNextElement(pszNext
, szElement
, MAX_PATH
)))
263 { if(!*pszNext
&& bIsFile
)
264 { pidlTemp
= _ILCreateValue(szElement
);
267 { pidlTemp
= _ILCreateFolder(szElement
);
270 pidlFull
= ILCombine(pidlFull
,pidlTemp
);
278 HeapFree(GetProcessHeap(),0,pszTemp
);
283 /**************************************************************************
284 * IShellFolder_EnumObjects
286 * HWND hwndOwner, //[in ] Parent Window
287 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
288 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
290 static HRESULT WINAPI
IShellFolder_EnumObjects(
294 LPENUMIDLIST
* ppEnumIDList
)
295 { TRACE(shell
,"(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",this,hwndOwner
,dwFlags
,ppEnumIDList
);
297 *ppEnumIDList
= NULL
;
298 *ppEnumIDList
= IEnumIDList_Constructor (this->sMyPath
, dwFlags
);
299 TRACE(shell
,"-- (%p)->(new ID List: %p)\n",this,*ppEnumIDList
);
301 { return E_OUTOFMEMORY
;
305 /**************************************************************************
306 * IShellFolder_Initialize()
307 * IPersistFolder Method
309 static HRESULT WINAPI
IShellFolder_Initialize( LPSHELLFOLDER
this,LPCITEMIDLIST pidl
)
310 { TRACE(shell
,"(%p)->(pidl=%p)\n",this,pidl
);
313 { SHFree(this->pMyPidl
);
314 this->pMyPidl
= NULL
;
316 this->pMyPidl
= ILClone(pidl
);
320 /**************************************************************************
321 * IShellFolder_BindToObject
323 * LPCITEMIDLIST pidl, //[in ] complex pidl to open
324 * LPBC pbc, //[in ] reserved
325 * REFIID riid, //[in ] Initial Interface
326 * LPVOID* ppvObject //[out] Interface*
328 static HRESULT WINAPI
IShellFolder_BindToObject( LPSHELLFOLDER
this, LPCITEMIDLIST pidl
,
329 LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
332 LPSHELLFOLDER pShellFolder
;
334 WINE_StringFromCLSID(riid
,xriid
);
336 TRACE(shell
,"(%p)->(pidl=%p,%p,\n\tIID:%s,%p)\n",this,pidl
,pbcReserved
,xriid
,ppvOut
);
340 pShellFolder
= IShellFolder_Constructor(this, pidl
);
343 return E_OUTOFMEMORY
;
345 IShellFolder_Initialize(pShellFolder
, this->pMyPidl
);
347 hr
= pShellFolder
->lpvtbl
->fnQueryInterface(pShellFolder
, riid
, ppvOut
);
348 pShellFolder
->lpvtbl
->fnRelease(pShellFolder
);
349 TRACE(shell
,"-- (%p)->(interface=%p)\n",this, ppvOut
);
353 /**************************************************************************
354 * IShellFolder_BindToStorage
356 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
357 * LPBC pbc, //[in ] reserved
358 * REFIID riid, //[in ] Initial storage interface
359 * LPVOID* ppvObject //[out] Interface* returned
361 static HRESULT WINAPI
IShellFolder_BindToStorage(
363 LPCITEMIDLIST pidl
, /*simple/complex pidl*/
368 WINE_StringFromCLSID(riid
,xriid
);
370 FIXME(shell
,"(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",this,pidl
,pbcReserved
,xriid
,ppvOut
);
376 /**************************************************************************
377 * IShellFolder_CompareIDs
380 * LPARAM lParam, //[in ] Column?
381 * LPCITEMIDLIST pidl1, //[in ] simple pidl
382 * LPCITEMIDLIST pidl2) //[in ] simple pidl
385 * Special case - If one of the items is a Path and the other is a File,
386 * always make the Path come before the File.
389 * we have to handle simple pidl's only (?)
391 static HRESULT WINAPI
IShellFolder_CompareIDs(LPSHELLFOLDER
this,
392 LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
393 { CHAR szString1
[MAX_PATH
] = "";
394 CHAR szString2
[MAX_PATH
] = "";
396 LPCITEMIDLIST pidlTemp1
= pidl1
, pidlTemp2
= pidl2
;
398 TRACE(shell
,"(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",this,lParam
,pidl1
,pidl2
);
402 if (!pidl1
&& !pidl2
)
404 if (!pidl1
) /* Desktop < anything */
409 /* get the last item in each list */
410 while((ILGetNext(pidlTemp1
))->mkid
.cb
)
411 pidlTemp1
= ILGetNext(pidlTemp1
);
412 while((ILGetNext(pidlTemp2
))->mkid
.cb
)
413 pidlTemp2
= ILGetNext(pidlTemp2
);
415 /* at this point, both pidlTemp1 and pidlTemp2 point to the last item in the list */
416 if(_ILIsValue(pidlTemp1
) != _ILIsValue(pidlTemp2
))
417 { if(_ILIsValue(pidlTemp1
))
422 _ILGetDrive( pidl1
,szString1
,sizeof(szString1
));
423 _ILGetDrive( pidl2
,szString1
,sizeof(szString2
));
424 nReturn
= strcasecmp(szString1
, szString2
);
429 _ILGetFolderText( pidl1
,szString1
,sizeof(szString1
));
430 _ILGetFolderText( pidl2
,szString2
,sizeof(szString2
));
431 nReturn
= strcasecmp(szString1
, szString2
);
436 _ILGetValueText(pidl1
,szString1
,sizeof(szString1
));
437 _ILGetValueText(pidl2
,szString2
,sizeof(szString2
));
438 return strcasecmp(szString1
, szString2
);
441 /**************************************************************************
442 * IShellFolder_CreateViewObject
443 * Creates an View Object representing the ShellFolder
444 * IShellView / IShellBrowser / IContextMenu
447 * HWND hwndOwner, // Handle of owner window
448 * REFIID riid, // Requested initial interface
449 * LPVOID* ppvObject) // Resultant interface*
452 * the same as SHCreateShellFolderViewEx ???
454 static HRESULT WINAPI
IShellFolder_CreateViewObject( LPSHELLFOLDER
this,
455 HWND32 hwndOwner
, REFIID riid
, LPVOID
*ppvOut
)
456 { LPSHELLVIEW pShellView
;
460 WINE_StringFromCLSID(riid
,xriid
);
461 TRACE(shell
,"(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",this,hwndOwner
,xriid
,ppvOut
);
465 pShellView
= IShellView_Constructor(this, this->mpidl
);
467 return E_OUTOFMEMORY
;
468 hr
= pShellView
->lpvtbl
->fnQueryInterface(pShellView
, riid
, ppvOut
);
469 pShellView
->lpvtbl
->fnRelease(pShellView
);
470 TRACE(shell
,"-- (%p)->(interface=%p)\n",this, ppvOut
);
474 /**************************************************************************
475 * IShellFolder_GetAttributesOf
478 * UINT cidl, //[in ] num elements in pidl array
479 + LPCITEMIDLIST* apidl, //[in ] simple pidl array
480 * ULONG* rgfInOut) //[out] result array
483 * Note: rgfInOut is documented as being an array of ULONGS.
484 * This does not seem to be the case. Testing this function using the shell to
485 * call it with cidl > 1 (by deleting multiple items) reveals that the shell
486 * passes ONE element in the array and writing to further elements will
487 * cause the shell to fail later.
489 static HRESULT WINAPI
IShellFolder_GetAttributesOf(LPSHELLFOLDER
this,UINT32 cidl
,LPCITEMIDLIST
*apidl
,DWORD
*rgfInOut
)
490 { LPCITEMIDLIST
* pidltemp
;
493 TRACE(shell
,"(%p)->(%d,%p,%p)\n",this,cidl
,apidl
,rgfInOut
);
495 if ((! cidl
)| (!apidl
) | (!rgfInOut
))
502 TRACE(shell
,"-- mask=0x%08lx\n",*rgfInOut
);
507 if (_ILIsDesktop( *pidltemp
))
508 { *rgfInOut
|= ( SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANLINK
);
510 else if (_ILIsMyComputer( *pidltemp
))
511 { *rgfInOut
|= ( SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
512 | SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANRENAME
| SFGAO_CANLINK
);
514 else if (_ILIsDrive( *pidltemp
))
515 { *rgfInOut
|= ( SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
|
516 SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANLINK
);
518 else if (_ILIsFolder( *pidltemp
))
519 { *rgfInOut
|= ( SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_CAPABILITYMASK
);
521 else if (_ILIsValue( *pidltemp
))
522 { *rgfInOut
|= (SFGAO_FILESYSTEM
| SFGAO_CAPABILITYMASK
);
527 } while (cidl
> 0 && *pidltemp
);
531 /**************************************************************************
532 * IShellFolder_GetUIObjectOf
535 * HWND hwndOwner, //[in ] Parent window for any output
536 * UINT cidl, //[in ] array size
537 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
538 * REFIID riid, //[in ] Requested Interface
539 * UINT* prgfInOut, //[ ] reserved
540 * LPVOID* ppvObject) //[out] Resulting Interface
543 * This function gets asked to return "view objects" for one or more (multiple select)
545 * The viewobject typically is an COM object with one of the following interfaces:
546 * IExtractIcon,IDataObject,IContextMenu
547 * In order to support icon positions in the default Listview your DataObject
548 * must implement the SetData method (in addition to GetData :) - the shell passes
549 * a barely documented "Icon positions" structure to SetData when the drag starts,
550 * and GetData's it if the drop is in another explorer window that needs the positions.
552 static HRESULT WINAPI
IShellFolder_GetUIObjectOf( LPSHELLFOLDER
this,HWND32 hwndOwner
,UINT32 cidl
,
553 LPCITEMIDLIST
* apidl
, REFIID riid
, UINT32
* prgfInOut
,LPVOID
* ppvOut
)
556 LPUNKNOWN pObj
= NULL
;
558 WINE_StringFromCLSID(riid
,xclsid
);
560 TRACE(shell
,"(%p)->(%u,%u,apidl=%p,\n\tIID:%s,%p,%p)\n",
561 this,hwndOwner
,cidl
,apidl
,xclsid
,prgfInOut
,ppvOut
);
565 if(IsEqualIID(riid
, &IID_IContextMenu
))
568 pObj
= (LPUNKNOWN
)IContextMenu_Constructor(this, apidl
, cidl
);
570 else if (IsEqualIID(riid
, &IID_IDataObject
))
572 return(E_INVALIDARG
);
573 pObj
= (LPUNKNOWN
)IDataObject_Constructor (hwndOwner
, this, apidl
, cidl
);
575 else if(IsEqualIID(riid
, &IID_IExtractIcon
))
577 return(E_INVALIDARG
);
578 pidl
= ILCombine(this->pMyPidl
,apidl
[0]);
579 pObj
= (LPUNKNOWN
)IExtractIcon_Constructor( pidl
);
583 { ERR(shell
,"(%p)->E_NOINTERFACE\n",this);
584 return E_NOINTERFACE
;
587 return E_OUTOFMEMORY
;
592 /**************************************************************************
593 * IShellFolder_GetDisplayNameOf
594 * Retrieves the display name for the specified file object or subfolder
597 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
598 * DWORD dwFlags, //[in ] SHGNO formatting flags
599 * LPSTRRET lpName) //[out] Returned display name
602 * if the name is in the pidl the ret value should be a STRRET_OFFSET
604 #define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
605 #define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
607 static HRESULT WINAPI
IShellFolder_GetDisplayNameOf( LPSHELLFOLDER
this, LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET lpName
)
608 { CHAR szText
[MAX_PATH
];
609 CHAR szTemp
[MAX_PATH
];
610 CHAR szSpecial
[MAX_PATH
];
611 CHAR szDrive
[MAX_PATH
];
612 DWORD dwVolumeSerialNumber
,dwMaximumComponetLength
,dwFileSystemFlags
;
613 LPITEMIDLIST pidlTemp
=NULL
;
614 BOOL32 bSimplePidl
=FALSE
;
616 TRACE(shell
,"(%p)->(pidl=%p,0x%08lx,%p)\n",this,pidl
,dwFlags
,lpName
);
621 /* test if simple(relative) or complex(absolute) pidl */
622 pidlTemp
= ILGetNext(pidl
);
623 if (pidlTemp
&& pidlTemp
->mkid
.cb
==0x00)
624 { bSimplePidl
= TRUE
;
625 TRACE(shell
,"-- simple pidl\n");
627 if (_ILIsDesktop( pidl
))
628 { strcpy (szText
,"Desktop");
631 { if (_ILIsMyComputer( pidl
))
632 { _ILGetItemText( pidl
, szSpecial
, MAX_PATH
);
634 if (_ILIsDrive( pidl
))
635 { pidlTemp
= ILFindLastID(pidl
);
637 { _ILGetItemText( pidlTemp
, szTemp
, MAX_PATH
);
639 if ( dwFlags
==SHGDN_NORMAL
|| dwFlags
==SHGDN_INFOLDER
)
640 { GetVolumeInformation32A(szTemp
,szDrive
,MAX_PATH
,&dwVolumeSerialNumber
,&dwMaximumComponetLength
,&dwFileSystemFlags
,NULL
,0);
644 strcat (szDrive
," (");
645 strcat (szDrive
,szTemp
);
646 strcat (szDrive
,")");
649 { PathAddBackslash32A (szTemp
);
650 strcpy(szDrive
,szTemp
);
656 _ILGetPidlPath( pidl
, szText
, MAX_PATH
);
659 case SHGDN_INFOLDER
| SHGDN_FORPARSING
: /*fall thru*/
661 pidlTemp
= ILFindLastID(pidl
);
663 { _ILGetItemText( pidlTemp
, szText
, MAX_PATH
);
667 case SHGDN_FORPARSING
:
669 { /* if the IShellFolder has parents, get the path from the
670 parent and add the ItemName*/
672 if (this->sMyPath
&& strlen (this->sMyPath
))
673 { if (strcmp(this->sMyPath
,"My Computer"))
674 { strcpy (szText
,this->sMyPath
);
675 PathAddBackslash32A (szText
);
678 pidlTemp
= ILFindLastID(pidl
);
680 { _ILGetItemText( pidlTemp
, szTemp
, MAX_PATH
);
682 strcat(szText
,szTemp
);
685 { /* if the pidl is absolute, get everything from the pidl*/
686 _ILGetPidlPath( pidl
, szText
, MAX_PATH
);
690 TRACE(shell
,"--- wrong flags=%lx\n", dwFlags
);
693 if ((szText
[0]==0x00 && szDrive
[0]!=0x00)|| (bSimplePidl
&& szDrive
[0]!=0x00))
694 { strcpy(szText
,szDrive
);
696 if (szText
[0]==0x00 && szSpecial
[0]!=0x00)
697 { strcpy(szText
,szSpecial
);
701 TRACE(shell
,"-- (%p)->(%s)\n",this,szText
);
704 { return E_OUTOFMEMORY
;
706 lpName
->uType
= STRRET_CSTRA
;
707 strcpy(lpName
->u
.cStr
,szText
);
711 /**************************************************************************
712 * IShellFolder_SetNameOf
713 * Changes the name of a file object or subfolder, possibly changing its item
714 * identifier in the process.
717 * HWND hwndOwner, //[in ] Owner window for output
718 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
719 * LPCOLESTR lpszName, //[in ] the items new display name
720 * DWORD dwFlags, //[in ] SHGNO formatting flags
721 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
723 static HRESULT WINAPI
IShellFolder_SetNameOf(
726 LPCITEMIDLIST pidl
, /*simple pidl*/
729 LPITEMIDLIST
*pPidlOut
)
730 { FIXME(shell
,"(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n",
731 this,hwndOwner
,pidl
,debugstr_w(lpName
),dw
,pPidlOut
);
734 /**************************************************************************
735 * IShellFolder_GetFolderPath
736 * FIXME: drive not included
738 static BOOL32 WINAPI
IShellFolder_GetFolderPath(LPSHELLFOLDER
this, LPSTR lpszOut
, DWORD dwOutSize
)
741 TRACE(shell
,"(%p)->(%p %lu)\n",this, lpszOut
, dwOutSize
);
751 dwSize
= strlen (this->sMyPath
) +1;
752 if ( dwSize
> dwOutSize
)
754 strcpy(lpszOut
, this->sMyPath
);
756 TRACE(shell
,"-- (%p)->(return=%s)\n",this, lpszOut
);