4 * Copyright 1998 Juergen Schmied
7 * a pidl == NULL means desktop and is legal
15 #include "debugtools.h"
20 #include "winversion.h"
21 #include "shell32_main.h"
25 #include "wine/undocshell.h"
27 DEFAULT_DEBUG_CHANNEL(pidl
)
28 DECLARE_DEBUG_CHANNEL(shell
)
30 void pdump (LPCITEMIDLIST pidl
)
34 LPITEMIDLIST pidltemp
= pidl
;
38 /* silence the sub-functions */
39 bIsShellDebug
= TRACE_ON(shell
);
40 __SET_DEBUGGING(__DBCL_TRACE
, dbch_shell
, FALSE
);
41 __SET_DEBUGGING(__DBCL_TRACE
, dbch_pidl
, FALSE
);
45 MESSAGE ("-------- pidl=NULL (Desktop)\n");
49 MESSAGE ("-------- pidl=%p\n", pidl
);
50 if (pidltemp
->mkid
.cb
)
55 LPPIDLDATA pData
= _ILGetDataPointer(pidltemp
);
56 DWORD type
= pData
->type
;
57 LPSTR szLongName
= _ILGetTextPointer(pidltemp
);
58 LPSTR szShortName
= _ILGetSTextPointer(pidltemp
);
59 char szName
[MAX_PATH
];
61 _ILSimpleGetText(pidltemp
, szName
, MAX_PATH
);
62 if( PT_FOLDER
== type
)
63 dwAttrib
= pData
->u
.folder
.uFileAttribs
;
64 else if( PT_VALUE
== type
)
65 dwAttrib
= pData
->u
.file
.uFileAttribs
;
67 MESSAGE ("-- pidl=%p size=%u type=%lx attr=0x%08lx name=%s (%s,%s)\n",
68 pidltemp
, pidltemp
->mkid
.cb
,type
,dwAttrib
,szName
,debugstr_a(szLongName
), debugstr_a(szShortName
));
70 pidltemp
= ILGetNext(pidltemp
);
72 } while (pidltemp
->mkid
.cb
);
76 MESSAGE ("empty pidl (Desktop)\n");
81 __SET_DEBUGGING(__DBCL_TRACE
, dbch_shell
, bIsShellDebug
);
82 __SET_DEBUGGING(__DBCL_TRACE
, dbch_pidl
, TRUE
);
85 #define BYTES_PRINTED 32
86 BOOL
pcheck (LPCITEMIDLIST pidl
)
87 { DWORD type
, ret
=TRUE
;
90 LPITEMIDLIST pidltemp
= pidl
;
92 bIsPidlDebug
= TRACE_ON(shell
);
93 __SET_DEBUGGING(__DBCL_TRACE
, dbch_pidl
, FALSE
);
95 if (pidltemp
&& pidltemp
->mkid
.cb
)
97 { type
= _ILGetDataPointer(pidltemp
)->type
;
117 char szTemp
[BYTES_PRINTED
*4 + 1];
121 memset(szTemp
, ' ', BYTES_PRINTED
*4 + 1);
122 for ( i
= 0; (i
<pidltemp
->mkid
.cb
) && (i
<BYTES_PRINTED
); i
++)
124 c
= ((unsigned char *)pidltemp
)[i
];
126 szTemp
[i
*3+0] = ((c
>>4)>9)? (c
>>4)+55 : (c
>>4)+48;
127 szTemp
[i
*3+1] = ((0x0F&c
)>9)? (0x0F&c
)+55 : (0x0F&c
)+48;
129 szTemp
[i
+BYTES_PRINTED
*3] = (c
>=0x20 && c
<=0x80) ? c
: '.';
131 szTemp
[BYTES_PRINTED
*4] = 0x00;
132 ERR("unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp
->mkid
.cb
,type
, szTemp
);
136 pidltemp
= ILGetNext(pidltemp
);
137 } while (pidltemp
->mkid
.cb
);
139 __SET_DEBUGGING(__DBCL_TRACE
, dbch_pidl
, bIsPidlDebug
);
143 /*************************************************************************
144 * ILGetDisplayName [SHELL32.15]
146 BOOL WINAPI
ILGetDisplayName(LPCITEMIDLIST pidl
,LPSTR path
)
148 TRACE_(shell
)("pidl=%p %p semi-stub\n",pidl
,path
);
149 return SHGetPathFromIDListA(pidl
, path
);
151 /*************************************************************************
152 * ILFindLastID [SHELL32.16]
155 * observed: pidl=Desktop return=pidl
157 LPITEMIDLIST WINAPI
ILFindLastID(LPITEMIDLIST pidl
)
158 { LPITEMIDLIST pidlLast
= pidl
;
160 TRACE("(pidl=%p)\n",pidl
);
162 while (pidl
->mkid
.cb
)
165 pidl
= ILGetNext(pidl
);
169 /*************************************************************************
170 * ILRemoveLastID [SHELL32.17]
173 * when pidl=Desktop return=FALSE
175 BOOL WINAPI
ILRemoveLastID(LPCITEMIDLIST pidl
)
177 TRACE_(shell
)("pidl=%p\n",pidl
);
179 if (!pidl
|| !pidl
->mkid
.cb
)
181 ILFindLastID(pidl
)->mkid
.cb
= 0;
185 /*************************************************************************
186 * ILClone [SHELL32.18]
191 LPITEMIDLIST WINAPI
ILClone (LPCITEMIDLIST pidl
)
193 LPITEMIDLIST newpidl
;
198 len
= ILGetSize(pidl
);
199 newpidl
= (LPITEMIDLIST
)SHAlloc(len
);
201 memcpy(newpidl
,pidl
,len
);
203 TRACE("pidl=%p newpidl=%p\n",pidl
, newpidl
);
208 /*************************************************************************
209 * ILCloneFirst [SHELL32.19]
212 * duplicates the first idlist of a complex pidl
214 LPITEMIDLIST WINAPI
ILCloneFirst(LPCITEMIDLIST pidl
)
216 LPITEMIDLIST pidlNew
= NULL
;
218 TRACE("pidl=%p \n",pidl
);
224 pidlNew
= (LPITEMIDLIST
) SHAlloc (len
+2);
227 memcpy(pidlNew
,pidl
,len
+2); /* 2 -> mind a desktop pidl */
230 ILGetNext(pidlNew
)->mkid
.cb
= 0x00;
233 TRACE("-- newpidl=%p\n",pidlNew
);
237 /*************************************************************************
241 * the first two bytes are the len, the pidl is following then
243 HRESULT WINAPI
ILLoadFromStream (IStream
* pStream
, LPITEMIDLIST
* ppPidl
)
246 HRESULT ret
= E_FAIL
;
249 TRACE_(shell
)("%p %p\n", pStream
, ppPidl
);
256 IStream_AddRef (pStream
);
258 if (SUCCEEDED(IStream_Read(pStream
, (LPVOID
)&wLen
, 2, &dwBytesRead
)))
259 { *ppPidl
= SHAlloc (wLen
);
260 if (SUCCEEDED(IStream_Read(pStream
, *ppPidl
, wLen
, &dwBytesRead
)))
269 /* we are not jet fully compatible */
270 if (!pcheck(*ppPidl
))
276 IStream_Release (pStream
);
280 /*************************************************************************
281 * SHILCreateFromPath [SHELL32.28]
284 * wraper for IShellFolder::ParseDisplayName()
286 HRESULT WINAPI
SHILCreateFromPathA (LPCSTR path
, LPITEMIDLIST
* ppidl
, DWORD
* attributes
)
288 WCHAR lpszDisplayName
[MAX_PATH
];
290 HRESULT ret
= E_FAIL
;
292 TRACE_(shell
)("%s %p 0x%08lx\n",path
,ppidl
,attributes
?*attributes
:0);
294 lstrcpynAtoW(lpszDisplayName
, path
, MAX_PATH
);
296 if (SUCCEEDED (SHGetDesktopFolder(&sf
)))
298 ret
= IShellFolder_ParseDisplayName(sf
,0, NULL
,lpszDisplayName
,&pchEaten
,ppidl
,attributes
);
299 IShellFolder_Release(sf
);
303 HRESULT WINAPI
SHILCreateFromPathW (LPCWSTR path
, LPITEMIDLIST
* ppidl
, DWORD
* attributes
)
306 HRESULT ret
= E_FAIL
;
308 TRACE_(shell
)("%s %p 0x%08lx\n",debugstr_w(path
),ppidl
,attributes
?*attributes
:0);
310 if (SUCCEEDED (SHGetDesktopFolder(&sf
)))
312 ret
= IShellFolder_ParseDisplayName(sf
,0, NULL
, (LPWSTR
) path
, &pchEaten
, ppidl
, attributes
);
313 IShellFolder_Release(sf
);
317 HRESULT WINAPI
SHILCreateFromPathAW (LPCVOID path
, LPITEMIDLIST
* ppidl
, DWORD
* attributes
)
319 if ( VERSION_OsIsUnicode())
320 return SHILCreateFromPathW (path
, ppidl
, attributes
);
321 return SHILCreateFromPathA (path
, ppidl
, attributes
);
324 /*************************************************************************
325 * SHCloneSpecialIDList [SHELL32.89]
329 * nFolder [in] CSIDL_xxxxx ??
334 * exported by ordinal
336 LPITEMIDLIST WINAPI
SHCloneSpecialIDList(HWND hwndOwner
,DWORD nFolder
,DWORD x3
)
337 { LPITEMIDLIST ppidl
;
338 WARN_(shell
)("(hwnd=0x%x,csidl=0x%lx,0x%lx):semi-stub.\n",
339 hwndOwner
,nFolder
,x3
);
341 SHGetSpecialFolderLocation(hwndOwner
, nFolder
, &ppidl
);
346 /*************************************************************************
347 * ILGlobalClone [SHELL32.97]
350 LPITEMIDLIST WINAPI
ILGlobalClone(LPCITEMIDLIST pidl
)
352 LPITEMIDLIST newpidl
;
357 len
= ILGetSize(pidl
);
358 newpidl
= (LPITEMIDLIST
)pCOMCTL32_Alloc(len
);
360 memcpy(newpidl
,pidl
,len
);
362 TRACE("pidl=%p newpidl=%p\n",pidl
, newpidl
);
368 /*************************************************************************
369 * ILIsEqual [SHELL32.21]
372 BOOL WINAPI
ILIsEqual(LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
374 char szData1
[MAX_PATH
];
375 char szData2
[MAX_PATH
];
377 LPITEMIDLIST pidltemp1
= pidl1
;
378 LPITEMIDLIST pidltemp2
= pidl2
;
380 TRACE("pidl1=%p pidl2=%p\n",pidl1
, pidl2
);
382 /* explorer reads from registry directly (StreamMRU),
383 so we can only check here */
384 if ((!pcheck (pidl1
)) || (!pcheck (pidl2
))) return FALSE
;
389 if ( (!pidl1
) || (!pidl2
) ) return FALSE
;
391 while (pidltemp1
->mkid
.cb
&& pidltemp2
->mkid
.cb
)
393 _ILSimpleGetText(pidltemp1
, szData1
, MAX_PATH
);
394 _ILSimpleGetText(pidltemp2
, szData2
, MAX_PATH
);
396 if (strcasecmp ( szData1
, szData2
)!=0 )
399 pidltemp1
= ILGetNext(pidltemp1
);
400 pidltemp2
= ILGetNext(pidltemp2
);
403 if (!pidltemp1
->mkid
.cb
&& !pidltemp2
->mkid
.cb
)
410 /*************************************************************************
411 * ILIsParent [SHELL32.23]
413 * parent=a/b child=a/b/c -> true, c is in folder a/b
414 * child=a/b/c/d -> false if bImmediate is true, d is not in folder a/b
415 * child=a/b/c/d -> true if bImmediate is false, d is in a subfolder of a/b
417 BOOL WINAPI
ILIsParent( LPCITEMIDLIST pidlParent
, LPCITEMIDLIST pidlChild
, BOOL bImmediate
)
419 char szData1
[MAX_PATH
];
420 char szData2
[MAX_PATH
];
422 LPITEMIDLIST pParent
= pidlParent
;
423 LPITEMIDLIST pChild
= pidlChild
;
425 TRACE("%p %p %x\n", pidlParent
, pidlChild
, bImmediate
);
427 while (pParent
->mkid
.cb
&& pChild
->mkid
.cb
)
429 _ILSimpleGetText(pParent
, szData1
, MAX_PATH
);
430 _ILSimpleGetText(pChild
, szData2
, MAX_PATH
);
432 if (strcasecmp ( szData1
, szData2
)!=0 )
435 pParent
= ILGetNext(pParent
);
436 pChild
= ILGetNext(pChild
);
439 if ( pParent
->mkid
.cb
|| ! pChild
->mkid
.cb
) /* child shorter or has equal length to parent */
442 if ( ILGetNext(pChild
)->mkid
.cb
&& bImmediate
) /* not immediate descent */
448 /*************************************************************************
449 * ILFindChild [SHELL32.24]
452 * Compares elements from pidl1 and pidl2.
454 * pidl1 is desktop pidl2
455 * pidl1 shorter pidl2 pointer to first different element of pidl2
456 * if there was at least one equal element
457 * pidl2 shorter pidl1 0
458 * pidl2 equal pidl1 pointer to last 0x00-element of pidl2
460 LPITEMIDLIST WINAPI
ILFindChild(LPCITEMIDLIST pidl1
,LPCITEMIDLIST pidl2
)
462 char szData1
[MAX_PATH
];
463 char szData2
[MAX_PATH
];
465 LPITEMIDLIST pidltemp1
= pidl1
;
466 LPITEMIDLIST pidltemp2
= pidl2
;
467 LPITEMIDLIST ret
=NULL
;
469 TRACE("pidl1=%p pidl2=%p\n",pidl1
, pidl2
);
471 /* explorer reads from registry directly (StreamMRU),
472 so we can only check here */
473 if ((!pcheck (pidl1
)) || (!pcheck (pidl2
)))
479 if ( _ILIsDesktop(pidl1
) )
485 while (pidltemp1
->mkid
.cb
&& pidltemp2
->mkid
.cb
)
487 _ILSimpleGetText(pidltemp1
, szData1
, MAX_PATH
);
488 _ILSimpleGetText(pidltemp2
, szData2
, MAX_PATH
);
490 if (strcasecmp(szData1
,szData2
))
493 pidltemp1
= ILGetNext(pidltemp1
);
494 pidltemp2
= ILGetNext(pidltemp2
);
498 if (pidltemp1
->mkid
.cb
)
500 ret
= NULL
; /* elements of pidl1 left*/
503 TRACE_(shell
)("--- %p\n", ret
);
504 return ret
; /* pidl 1 is shorter */
507 /*************************************************************************
508 * ILCombine [SHELL32.25]
511 * Concatenates two complex idlists.
512 * The pidl is the first one, pidlsub the next one
513 * Does not destroy the passed in idlists!
515 LPITEMIDLIST WINAPI
ILCombine(LPCITEMIDLIST pidl1
,LPCITEMIDLIST pidl2
)
518 LPITEMIDLIST pidlNew
;
520 TRACE("pidl=%p pidl=%p\n",pidl1
,pidl2
);
522 if(!pidl1
&& !pidl2
) return NULL
;
529 pidlNew
= ILClone(pidl2
);
535 pidlNew
= ILClone(pidl1
);
539 len1
= ILGetSize(pidl1
)-2;
540 len2
= ILGetSize(pidl2
);
541 pidlNew
= SHAlloc(len1
+len2
);
545 memcpy(pidlNew
,pidl1
,len1
);
546 memcpy(((BYTE
*)pidlNew
)+len1
,pidl2
,len2
);
549 /* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/
552 /*************************************************************************
553 * SHGetRealIDL [SHELL32.98]
557 LPITEMIDLIST WINAPI
SHGetRealIDL(LPSHELLFOLDER lpsf
, LPITEMIDLIST pidl
, DWORD z
)
559 FIXME("sf=%p pidl=%p 0x%04lx\n",lpsf
,pidl
,z
);
565 /*************************************************************************
566 * SHLogILFromFSIL [SHELL32.95]
569 * pild = CSIDL_DESKTOP ret = 0
570 * pild = CSIDL_DRIVES ret = 0
572 LPITEMIDLIST WINAPI
SHLogILFromFSIL(LPITEMIDLIST pidl
)
574 FIXME("(pidl=%p)\n",pidl
);
581 /*************************************************************************
582 * ILGetSize [SHELL32.152]
583 * gets the byte size of an idlist including zero terminator (pidl)
592 * exported by ordinal
594 DWORD WINAPI
ILGetSize(LPITEMIDLIST pidl
)
596 LPSHITEMID si
= &(pidl
->mkid
);
602 si
= (LPSHITEMID
)(((LPBYTE
)si
)+si
->cb
);
606 TRACE("pidl=%p size=%lu\n",pidl
, len
);
610 /*************************************************************************
611 * ILGetNext [SHELL32.153]
612 * gets the next simple pidl of a complex pidl
614 * observed return values:
617 * simple pidl -> pointer to 0x0000 element
620 LPITEMIDLIST WINAPI
ILGetNext(LPITEMIDLIST pidl
)
624 TRACE("(pidl=%p)\n",pidl
);
631 pidl
= (LPITEMIDLIST
) (((LPBYTE
)pidl
)+len
);
637 /*************************************************************************
638 * ILAppend [SHELL32.154]
641 * Adds the single item to the idlist indicated by pidl.
642 * if bEnd is 0, adds the item to the front of the list,
643 * otherwise adds the item to the end. (???)
644 * Destroys the passed in idlist! (???)
646 LPITEMIDLIST WINAPI
ILAppend(LPITEMIDLIST pidl
,LPCITEMIDLIST item
,BOOL bEnd
)
650 WARN("(pidl=%p,pidl=%p,%08u)semi-stub\n",pidl
,item
,bEnd
);
655 if (_ILIsDesktop(pidl
))
657 idlRet
= ILClone(item
);
665 idlRet
=ILCombine(pidl
,item
);
669 idlRet
=ILCombine(item
,pidl
);
675 /*************************************************************************
676 * ILFree [SHELL32.155]
679 * free_check_ptr - frees memory (if not NULL)
680 * allocated by SHMalloc allocator
681 * exported by ordinal
683 DWORD WINAPI
ILFree(LPITEMIDLIST pidl
)
685 TRACE("(pidl=0x%08lx)\n",(DWORD
)pidl
);
687 if(!pidl
) return FALSE
;
691 /*************************************************************************
692 * ILGlobalFree [SHELL32.156]
695 void WINAPI
ILGlobalFree( LPCITEMIDLIST pidl
)
700 pCOMCTL32_Free(pidl
);
702 /*************************************************************************
703 * ILCreateFromPath [SHELL32.157]
706 LPITEMIDLIST WINAPI
ILCreateFromPathA (LPCSTR path
)
708 LPITEMIDLIST pidlnew
;
709 DWORD attributes
= 0;
711 TRACE_(shell
)("%s\n",path
);
713 if (SUCCEEDED (SHILCreateFromPathA (path
, &pidlnew
, &attributes
)))
717 LPITEMIDLIST WINAPI
ILCreateFromPathW (LPCWSTR path
)
719 LPITEMIDLIST pidlnew
;
720 DWORD attributes
= 0;
722 TRACE_(shell
)("%s\n",debugstr_w(path
));
724 if (SUCCEEDED (SHILCreateFromPathW (path
, &pidlnew
, &attributes
)))
728 LPITEMIDLIST WINAPI
ILCreateFromPathAW (LPCVOID path
)
730 if ( VERSION_OsIsUnicode())
731 return ILCreateFromPathW (path
);
732 return ILCreateFromPathA (path
);
734 /*************************************************************************
735 * SHSimpleIDListFromPath [SHELL32.162]
737 LPITEMIDLIST WINAPI
SHSimpleIDListFromPathA (LPCSTR lpszPath
)
739 LPITEMIDLIST pidl
=NULL
;
741 WIN32_FIND_DATAA stffile
;
743 TRACE("path=%s\n", lpszPath
);
745 if (!lpszPath
) return NULL
;
747 hFile
= FindFirstFileA(lpszPath
, &stffile
);
749 if ( hFile
!= INVALID_HANDLE_VALUE
)
751 if (stffile
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
753 pidl
= _ILCreateFolder (&stffile
);
757 pidl
= _ILCreateValue (&stffile
);
763 LPITEMIDLIST WINAPI
SHSimpleIDListFromPathW (LPCWSTR lpszPath
)
765 char lpszTemp
[MAX_PATH
];
766 TRACE("path=%s\n",debugstr_w(lpszPath
));
768 lstrcpynWtoA(lpszTemp
, lpszPath
, MAX_PATH
);
770 return SHSimpleIDListFromPathA (lpszTemp
);
773 LPITEMIDLIST WINAPI
SHSimpleIDListFromPathAW (LPCVOID lpszPath
)
775 if ( VERSION_OsIsUnicode())
776 return SHSimpleIDListFromPathW (lpszPath
);
777 return SHSimpleIDListFromPathA (lpszPath
);
780 /*************************************************************************
781 * SHGetSpecialFolderLocation [SHELL32.223]
783 * gets the folder locations from the registry and creates a pidl
784 * creates missing reg keys and directorys
788 * nFolder [I] CSIDL_xxxxx
789 * ppidl [O] PIDL of a special folder
792 HRESULT WINAPI
SHGetSpecialFolderLocation(
795 LPITEMIDLIST
* ppidl
)
797 CHAR szPath
[MAX_PATH
];
798 HRESULT hr
= E_INVALIDARG
;
800 TRACE_(shell
)("(%04x,0x%x,%p)\n", hwndOwner
,nFolder
,ppidl
);
809 *ppidl
= _ILCreateDesktop();
814 *ppidl
= _ILCreateMyComputer();
819 *ppidl
= _ILCreateNetwork ();
824 *ppidl
= _ILCreateControl ();
829 *ppidl
= _ILCreatePrinter ();
833 case CSIDL_BITBUCKET
:
834 *ppidl
= _ILCreateBitBucket ();
839 if (SHGetSpecialFolderPathA(hwndOwner
, szPath
, nFolder
, TRUE
))
842 TRACE_(shell
)("Value=%s\n",szPath
);
843 hr
= SHILCreateFromPathA(szPath
, ppidl
, &attributes
);
848 TRACE_(shell
)("-- (new pidl %p)\n",*ppidl
);
852 /*************************************************************************
853 * SHGetFolderLocation [SHELL32]
856 * the pidl can be a simple one. since we cant get the path out of the pidl
857 * we have to take all data from the pidl
859 HRESULT WINAPI
SHGetFolderLocation(
866 FIXME("0x%04x 0x%08x 0x%08x 0x%08lx %p\n",
867 hwnd
, csidl
, hToken
, dwFlags
, ppidl
);
868 return SHGetSpecialFolderLocation(hwnd
, csidl
, ppidl
);
871 /*************************************************************************
872 * SHGetDataFromIDListA [SHELL32.247]
875 * the pidl can be a simple one. since we cant get the path out of the pidl
876 * we have to take all data from the pidl
878 HRESULT WINAPI
SHGetDataFromIDListA(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, int nFormat
, LPVOID dest
, int len
)
880 TRACE_(shell
)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf
,pidl
,nFormat
,dest
,len
);
883 if (!psf
|| !dest
) return E_INVALIDARG
;
887 case SHGDFIL_FINDDATA
:
889 WIN32_FIND_DATAA
* pfd
= dest
;
891 if ( len
< sizeof (WIN32_FIND_DATAA
)) return E_INVALIDARG
;
893 ZeroMemory(pfd
, sizeof (WIN32_FIND_DATAA
));
894 _ILGetFileDateTime( pidl
, &(pfd
->ftLastWriteTime
));
895 pfd
->dwFileAttributes
= _ILGetFileAttributes(pidl
, NULL
, 0);
896 pfd
->nFileSizeLow
= _ILGetFileSize ( pidl
, NULL
, 0);
897 lstrcpynA(pfd
->cFileName
,_ILGetTextPointer(pidl
), MAX_PATH
);
898 lstrcpynA(pfd
->cAlternateFileName
,_ILGetSTextPointer(pidl
), 14);
902 case SHGDFIL_NETRESOURCE
:
903 case SHGDFIL_DESCRIPTIONID
:
904 FIXME_(shell
)("SHGDFIL %i stub\n", nFormat
);
908 ERR_(shell
)("Unknown SHGDFIL %i, please report\n", nFormat
);
913 /*************************************************************************
914 * SHGetDataFromIDListW [SHELL32.247]
917 HRESULT WINAPI
SHGetDataFromIDListW(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, int nFormat
, LPVOID dest
, int len
)
919 TRACE_(shell
)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf
,pidl
,nFormat
,dest
,len
);
923 if (! psf
|| !dest
) return E_INVALIDARG
;
927 case SHGDFIL_FINDDATA
:
929 WIN32_FIND_DATAW
* pfd
= dest
;
931 if ( len
< sizeof (WIN32_FIND_DATAW
)) return E_INVALIDARG
;
933 ZeroMemory(pfd
, sizeof (WIN32_FIND_DATAA
));
934 _ILGetFileDateTime( pidl
, &(pfd
->ftLastWriteTime
));
935 pfd
->dwFileAttributes
= _ILGetFileAttributes(pidl
, NULL
, 0);
936 pfd
->nFileSizeLow
= _ILGetFileSize ( pidl
, NULL
, 0);
937 lstrcpynAtoW(pfd
->cFileName
,_ILGetTextPointer(pidl
), MAX_PATH
);
938 lstrcpynAtoW(pfd
->cAlternateFileName
,_ILGetSTextPointer(pidl
), 14);
941 case SHGDFIL_NETRESOURCE
:
942 case SHGDFIL_DESCRIPTIONID
:
943 FIXME_(shell
)("SHGDFIL %i stub\n", nFormat
);
947 ERR_(shell
)("Unknown SHGDFIL %i, please report\n", nFormat
);
953 /*************************************************************************
954 * SHGetPathFromIDListA [SHELL32.261][NT 4.0: SHELL32.220]
961 * path from a passed PIDL.
965 * desktop pidl gives path to desktopdirectory back
966 * special pidls returning FALSE
969 * fnGetDisplayNameOf can return different types of OLEString
971 BOOL WINAPI
SHGetPathFromIDListA (LPCITEMIDLIST pidl
,LPSTR pszPath
)
973 LPSHELLFOLDER shellfolder
;
975 TRACE_(shell
)("(pidl=%p,%p)\n",pidl
,pszPath
);
977 if (!pidl
) return FALSE
;
981 if(_ILIsDesktop(pidl
))
983 SHGetSpecialFolderPathA(0, pszPath
, CSIDL_DESKTOPDIRECTORY
, FALSE
);
985 else if (_ILIsSpecialFolder(ILFindLastID(pidl
)))
987 /* we are somewhere in a special folder */
992 if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
994 IShellFolder_GetDisplayNameOf(shellfolder
,pidl
,SHGDN_FORPARSING
,&str
);
995 StrRetToStrNA (pszPath
, MAX_PATH
, &str
, pidl
);
996 IShellFolder_Release(shellfolder
);
999 TRACE_(shell
)("-- (%s)\n",pszPath
);
1003 /*************************************************************************
1004 * SHGetPathFromIDListW [SHELL32.262]
1006 BOOL WINAPI
SHGetPathFromIDListW (LPCITEMIDLIST pidl
,LPWSTR pszPath
)
1007 { char sTemp
[MAX_PATH
];
1009 TRACE_(shell
)("(pidl=%p)\n", pidl
);
1011 SHGetPathFromIDListA (pidl
, sTemp
);
1012 lstrcpyAtoW(pszPath
, sTemp
);
1014 TRACE_(shell
)("-- (%s)\n",debugstr_w(pszPath
));
1019 /*************************************************************************
1020 * SHBindToParent [shell version 5.0]
1022 HRESULT WINAPI
SHBindToParent(LPCITEMIDLIST pidl
, REFIID riid
, LPVOID
*ppv
, LPCITEMIDLIST
*ppidlLast
)
1025 LPITEMIDLIST pidlChild
, pidlParent
;
1028 TRACE_(shell
)("pidl=%p\n", pidl
);
1032 if (ppidlLast
) *ppidlLast
= NULL
;
1034 if (_ILIsPidlSimple(pidl
))
1036 /* we are on desktop level */
1038 *ppidlLast
= ILClone(pidl
);
1039 hr
= SHGetDesktopFolder((IShellFolder
**)ppv
);
1043 pidlChild
= ILClone(ILFindLastID(pidl
));
1044 pidlParent
= ILClone(pidl
);
1045 ILRemoveLastID(pidlParent
);
1047 hr
= SHGetDesktopFolder(&psf
);
1050 hr
= IShellFolder_BindToObject(psf
, pidlParent
, NULL
, riid
, ppv
);
1052 if (SUCCEEDED(hr
) && ppidlLast
)
1053 *ppidlLast
= pidlChild
;
1057 SHFree (pidlParent
);
1058 if (psf
) IShellFolder_Release(psf
);
1062 TRACE_(shell
)("-- psf=%p pidl=%p ret=0x%08lx\n", *ppv
, (ppidlLast
)?*ppidlLast
:NULL
, hr
);
1066 /*************************************************************************
1067 * SHGetPathFromIDListAW [SHELL32.221][NT 4.0: SHELL32.219]
1069 BOOL WINAPI
SHGetPathFromIDListAW(LPCITEMIDLIST pidl
,LPVOID pszPath
)
1071 TRACE_(shell
)("(pidl=%p,%p)\n",pidl
,pszPath
);
1073 if (VERSION_OsIsUnicode())
1074 return SHGetPathFromIDListW(pidl
,pszPath
);
1075 return SHGetPathFromIDListA(pidl
,pszPath
);
1078 /**************************************************************************
1080 * internal functions
1082 * ### 1. section creating pidls ###
1084 *************************************************************************
1085 * _ILCreateDesktop()
1086 * _ILCreateIExplore()
1087 * _ILCreateMyComputer()
1092 LPITEMIDLIST
_ILCreateDesktop()
1094 return _ILCreate(PT_DESKTOP
, NULL
, 0);
1097 LPITEMIDLIST
_ILCreateMyComputer()
1099 return _ILCreate(PT_MYCOMP
, &CLSID_MyComputer
, sizeof(GUID
));
1102 LPITEMIDLIST
_ILCreateIExplore()
1104 return _ILCreate(PT_MYCOMP
, &CLSID_Internet
, sizeof(GUID
));
1107 LPITEMIDLIST
_ILCreateControl()
1109 return _ILCreate(PT_SPECIAL
, &CLSID_ControlPanel
, sizeof(GUID
));
1112 LPITEMIDLIST
_ILCreatePrinter()
1114 return _ILCreate(PT_SPECIAL
, &CLSID_Printers
, sizeof(GUID
));
1117 LPITEMIDLIST
_ILCreateNetwork()
1119 return _ILCreate(PT_MYCOMP
, &CLSID_NetworkPlaces
, sizeof(GUID
));
1122 LPITEMIDLIST
_ILCreateBitBucket()
1124 return _ILCreate(PT_MYCOMP
, &CLSID_RecycleBin
, sizeof(GUID
));
1127 LPITEMIDLIST
_ILCreateDrive( LPCSTR lpszNew
)
1129 lstrcpynA (sTemp
,lpszNew
,4);
1132 TRACE("(%s)\n",sTemp
);
1133 return _ILCreate(PT_DRIVE
,(LPVOID
)&sTemp
[0],4);
1136 LPITEMIDLIST
_ILCreateFolder( WIN32_FIND_DATAA
* stffile
)
1138 char buff
[MAX_PATH
+ 14 +1]; /* see WIN32_FIND_DATA */
1139 char * pbuff
= buff
;
1143 TRACE("(%s, %s)\n",stffile
->cAlternateFileName
, stffile
->cFileName
);
1145 /* prepare buffer with both names */
1146 len
= strlen (stffile
->cFileName
) + 1;
1147 memcpy (pbuff
, stffile
->cFileName
, len
);
1150 if (stffile
->cAlternateFileName
)
1152 len1
= strlen (stffile
->cAlternateFileName
)+1;
1153 memcpy (pbuff
, stffile
->cAlternateFileName
, len1
);
1161 pidl
= _ILCreate(PT_FOLDER
, (LPVOID
)buff
, len
+ len1
);
1163 /* set attributes */
1167 pData
= _ILGetDataPointer(pidl
);
1168 FileTimeToDosDateTime(&(stffile
->ftLastWriteTime
),&pData
->u
.folder
.uFileDate
,&pData
->u
.folder
.uFileTime
);
1169 pData
->u
.folder
.dwFileSize
= stffile
->nFileSizeLow
;
1170 pData
->u
.folder
.uFileAttribs
=stffile
->dwFileAttributes
;
1176 LPITEMIDLIST
_ILCreateValue(WIN32_FIND_DATAA
* stffile
)
1178 char buff
[MAX_PATH
+ 14 +1]; /* see WIN32_FIND_DATA */
1179 char * pbuff
= buff
;
1183 TRACE("(%s, %s)\n",stffile
->cAlternateFileName
, stffile
->cFileName
);
1185 /* prepare buffer with both names */
1186 len
= strlen (stffile
->cFileName
) + 1;
1187 memcpy (pbuff
, stffile
->cFileName
, len
);
1190 if (stffile
->cAlternateFileName
)
1192 len1
= strlen (stffile
->cAlternateFileName
)+1;
1193 memcpy (pbuff
, stffile
->cAlternateFileName
, len1
);
1201 pidl
= _ILCreate(PT_VALUE
, (LPVOID
)buff
, len
+ len1
);
1203 /* set attributes */
1207 pData
= _ILGetDataPointer(pidl
);
1208 FileTimeToDosDateTime(&(stffile
->ftLastWriteTime
),&pData
->u
.folder
.uFileDate
,&pData
->u
.folder
.uFileTime
);
1209 pData
->u
.folder
.dwFileSize
= stffile
->nFileSizeLow
;
1210 pData
->u
.folder
.uFileAttribs
=stffile
->dwFileAttributes
;
1216 LPITEMIDLIST
_ILCreateSpecial(LPCSTR szGUID
)
1219 CLSIDFromString16(szGUID
,&iid
);
1220 return _ILCreate(PT_MYCOMP
, &iid
, sizeof(IID
));
1223 /**************************************************************************
1225 * Creates a new PIDL
1226 * type = PT_DESKTOP | PT_DRIVE | PT_FOLDER | PT_VALUE
1228 * uInSize = size of data (raw)
1231 LPITEMIDLIST
_ILCreate(PIDLTYPE type
, LPCVOID pIn
, UINT16 uInSize
)
1232 { LPITEMIDLIST pidlOut
= NULL
, pidlTemp
= NULL
;
1237 TRACE("(0x%02x %p %i)\n",type
,pIn
,uInSize
);
1242 pidlOut
= SHAlloc(uSize
+ 2);
1243 pidlOut
->mkid
.cb
= uSize
;
1244 TRACE("- create Desktop\n");
1248 uSize
= 2 + 2 + sizeof(GUID
);
1249 pidlOut
= SHAlloc(uSize
+ 2);
1250 ZeroMemory(pidlOut
, uSize
+ 2);
1251 pidlOut
->mkid
.cb
= uSize
;
1252 pData
=_ILGetDataPointer(pidlOut
);
1254 memcpy(&(pData
->u
.mycomp
.guid
), pIn
, uInSize
);
1255 TRACE("- create GUID-pidl\n");
1260 pidlOut
= SHAlloc(uSize
+ 2);
1261 ZeroMemory(pidlOut
, uSize
+ 2);
1262 pidlOut
->mkid
.cb
= uSize
;
1263 pData
=_ILGetDataPointer(pidlOut
);
1265 pszDest
= _ILGetTextPointer(pidlOut
);
1266 memcpy(pszDest
, pIn
, uInSize
);
1267 TRACE("- create Drive: %s\n",debugstr_a(pszDest
));
1272 uSize
= 2 + 12 + uInSize
;
1273 pidlOut
= SHAlloc(uSize
+ 2);
1274 ZeroMemory(pidlOut
, uSize
+ 2);
1275 pidlOut
->mkid
.cb
= uSize
;
1276 pData
=_ILGetDataPointer(pidlOut
);
1278 pszDest
= _ILGetTextPointer(pidlOut
);
1279 memcpy(pszDest
, pIn
, uInSize
);
1280 TRACE("- create Value: %s\n",debugstr_a(pszDest
));
1284 pidlTemp
= ILGetNext(pidlOut
);
1286 pidlTemp
->mkid
.cb
= 0x00;
1288 TRACE("-- (pidl=%p, size=%u)\n", pidlOut
, uSize
);
1292 /**************************************************************************
1295 * Gets the text for the drive eg. 'c:\'
1300 DWORD
_ILGetDrive(LPCITEMIDLIST pidl
,LPSTR pOut
, UINT16 uSize
)
1301 { TRACE("(%p,%p,%u)\n",pidl
,pOut
,uSize
);
1303 if(_ILIsMyComputer(pidl
))
1304 pidl
= ILGetNext(pidl
);
1306 if (pidl
&& _ILIsDrive(pidl
))
1307 return _ILSimpleGetText(pidl
, pOut
, uSize
);
1312 /**************************************************************************
1314 * ### 2. section testing pidls ###
1316 **************************************************************************
1319 * _ILIsSpecialFolder()
1325 BOOL
_ILIsDesktop(LPCITEMIDLIST pidl
)
1326 { TRACE("(%p)\n",pidl
);
1327 return ( !pidl
|| (pidl
&& pidl
->mkid
.cb
== 0x00) );
1330 BOOL
_ILIsMyComputer(LPCITEMIDLIST pidl
)
1332 REFIID iid
= _ILGetGUIDPointer(pidl
);
1334 TRACE("(%p)\n",pidl
);
1337 return IsEqualIID(iid
, &CLSID_MyComputer
);
1341 BOOL
_ILIsSpecialFolder (LPCITEMIDLIST pidl
)
1343 LPPIDLDATA lpPData
= _ILGetDataPointer(pidl
);
1344 TRACE("(%p)\n",pidl
);
1345 return (pidl
&& ( (lpPData
&& (PT_MYCOMP
== lpPData
->type
|| PT_SPECIAL
== lpPData
->type
)) ||
1346 (pidl
&& pidl
->mkid
.cb
== 0x00)
1350 BOOL
_ILIsDrive(LPCITEMIDLIST pidl
)
1351 { LPPIDLDATA lpPData
= _ILGetDataPointer(pidl
);
1352 TRACE("(%p)\n",pidl
);
1353 return (pidl
&& lpPData
&& (PT_DRIVE
== lpPData
->type
||
1354 PT_DRIVE1
== lpPData
->type
||
1355 PT_DRIVE2
== lpPData
->type
||
1356 PT_DRIVE3
== lpPData
->type
));
1359 BOOL
_ILIsFolder(LPCITEMIDLIST pidl
)
1360 { LPPIDLDATA lpPData
= _ILGetDataPointer(pidl
);
1361 TRACE("(%p)\n",pidl
);
1362 return (pidl
&& lpPData
&& (PT_FOLDER
== lpPData
->type
|| PT_FOLDER1
== lpPData
->type
));
1365 BOOL
_ILIsValue(LPCITEMIDLIST pidl
)
1366 { LPPIDLDATA lpPData
= _ILGetDataPointer(pidl
);
1367 TRACE("(%p)\n",pidl
);
1368 return (pidl
&& lpPData
&& PT_VALUE
== lpPData
->type
);
1371 /**************************************************************************
1374 BOOL
_ILIsPidlSimple ( LPCITEMIDLIST pidl
)
1378 if(! _ILIsDesktop(pidl
)) /* pidl=NULL or mkid.cb=0 */
1380 WORD len
= pidl
->mkid
.cb
;
1381 LPCITEMIDLIST pidlnext
= (LPCITEMIDLIST
) (((LPBYTE
)pidl
) + len
);
1382 if (pidlnext
->mkid
.cb
)
1386 TRACE("%s\n", ret
? "Yes" : "No");
1390 /**************************************************************************
1392 * ### 3. section getting values from pidls ###
1395 /**************************************************************************
1398 * gets the text for the first item in the pidl (eg. simple pidl)
1400 * returns the lenght of the string
1402 DWORD
_ILSimpleGetText (LPCITEMIDLIST pidl
, LPSTR szOut
, UINT uOutSize
)
1407 char szTemp
[MAX_PATH
];
1409 TRACE("(%p %p %x)\n",pidl
,szOut
,uOutSize
);
1411 if (!pidl
) return 0;
1416 if (_ILIsDesktop(pidl
))
1419 if (HCR_GetClassName(&CLSID_ShellDesktop
, szTemp
, MAX_PATH
))
1422 lstrcpynA(szOut
, szTemp
, uOutSize
);
1424 dwReturn
= strlen (szTemp
);
1427 else if (( szSrc
= _ILGetTextPointer(pidl
) ))
1431 lstrcpynA(szOut
, szSrc
, uOutSize
);
1433 dwReturn
= strlen(szSrc
);
1435 else if (( riid
= _ILGetGUIDPointer(pidl
) ))
1437 /* special folder */
1438 if ( HCR_GetClassName(riid
, szTemp
, MAX_PATH
) )
1441 lstrcpynA(szOut
, szTemp
, uOutSize
);
1443 dwReturn
= strlen (szTemp
);
1448 ERR("-- no text\n");
1451 TRACE("-- (%p=%s 0x%08lx)\n",szOut
,(char*)szOut
,dwReturn
);
1455 /**************************************************************************
1457 * ### 4. getting pointers to parts of pidls ###
1459 **************************************************************************
1460 * _ILGetDataPointer()
1462 LPPIDLDATA
_ILGetDataPointer(LPITEMIDLIST pidl
)
1464 if(pidl
&& pidl
->mkid
.cb
!= 0x00)
1465 return (LPPIDLDATA
) &(pidl
->mkid
.abID
);
1469 /**************************************************************************
1470 * _ILGetTextPointer()
1471 * gets a pointer to the long filename string stored in the pidl
1473 LPSTR
_ILGetTextPointer(LPCITEMIDLIST pidl
)
1474 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/
1476 LPPIDLDATA pdata
=_ILGetDataPointer(pidl
);
1480 switch (pdata
->type
)
1490 return (LPSTR
)&(pdata
->u
.drive
.szDriveName
);
1496 return (LPSTR
)&(pdata
->u
.file
.szNames
);
1502 return (LPSTR
)&(pdata
->u
.network
.szNames
);
1508 /**************************************************************************
1509 * _ILGetSTextPointer()
1510 * gets a pointer to the short filename string stored in the pidl
1512 LPSTR
_ILGetSTextPointer(LPCITEMIDLIST pidl
)
1513 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/
1515 LPPIDLDATA pdata
=_ILGetDataPointer(pidl
);
1519 switch (pdata
->type
)
1524 return (LPSTR
)(pdata
->u
.file
.szNames
+ strlen (pdata
->u
.file
.szNames
) + 1);
1527 return (LPSTR
)(pdata
->u
.network
.szNames
+ strlen (pdata
->u
.network
.szNames
) + 1);
1533 /**************************************************************************
1534 * _ILGetGUIDPointer()
1536 * returns reference to guid stored in some pidls
1538 REFIID
_ILGetGUIDPointer(LPCITEMIDLIST pidl
)
1540 LPPIDLDATA pdata
=_ILGetDataPointer(pidl
);
1544 switch (pdata
->type
)
1548 return (REFIID
) &(pdata
->u
.mycomp
.guid
);
1554 /*************************************************************************
1555 * _ILGetFileDateTime
1557 * Given the ItemIdList, get the FileTime
1560 * pidl [I] The ItemIDList
1561 * pFt [I] the resulted FILETIME of the file
1564 * True if Successful
1569 BOOL
_ILGetFileDateTime(LPCITEMIDLIST pidl
, FILETIME
*pFt
)
1571 LPPIDLDATA pdata
=_ILGetDataPointer(pidl
);
1573 if(! pdata
) return FALSE
;
1575 switch (pdata
->type
)
1578 DosDateTimeToFileTime(pdata
->u
.folder
.uFileDate
, pdata
->u
.folder
.uFileTime
, pFt
);
1581 DosDateTimeToFileTime(pdata
->u
.file
.uFileDate
, pdata
->u
.file
.uFileTime
, pFt
);
1589 BOOL
_ILGetFileDate (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
)
1594 if (! _ILGetFileDateTime( pidl
, &ft
)) return FALSE
;
1596 FileTimeToLocalFileTime(&ft
, &lft
);
1597 FileTimeToSystemTime (&lft
, &time
);
1598 return GetDateFormatA(LOCALE_USER_DEFAULT
,DATE_SHORTDATE
,&time
, NULL
, pOut
, uOutSize
);
1601 /*************************************************************************
1604 * Given the ItemIdList, get the FileSize
1607 * pidl [I] The ItemIDList
1608 * pOut [I] The buffer to save the result
1609 * uOutsize [I] The size of the buffer
1615 * pOut can be null when no string is needed
1618 DWORD
_ILGetFileSize (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
)
1620 LPPIDLDATA pdata
=_ILGetDataPointer(pidl
);
1623 if(! pdata
) return 0;
1625 switch (pdata
->type
)
1628 dwSize
= pdata
->u
.file
.dwFileSize
;
1629 if (pOut
) StrFormatByteSizeA(dwSize
, pOut
, uOutSize
);
1632 if (pOut
) *pOut
= 0x00;
1636 BOOL
_ILGetExtension (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
)
1638 char szTemp
[MAX_PATH
];
1639 const char * pPoint
;
1640 LPITEMIDLIST pidlTemp
=pidl
;
1642 TRACE("pidl=%p\n",pidl
);
1644 if (!pidl
) return FALSE
;
1646 pidlTemp
= ILFindLastID(pidl
);
1648 if (!_ILIsValue(pidlTemp
)) return FALSE
;
1649 if (!_ILSimpleGetText(pidlTemp
, szTemp
, MAX_PATH
)) return FALSE
;
1651 pPoint
= PathFindExtensionA(szTemp
);
1653 if (! *pPoint
) return FALSE
;
1656 lstrcpynA(pOut
, pPoint
, uOutSize
);
1662 /*************************************************************************
1665 * Given the ItemIdList, get the file type description
1668 * pidl [I] The ItemIDList (simple)
1669 * pOut [I] The buffer to save the result
1670 * uOutsize [I] The size of the buffer
1676 * This function copies as much as possible into the buffer.
1678 void _ILGetFileType(LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
)
1680 if(_ILIsValue(pidl
))
1687 if (_ILGetExtension (pidl
, sTemp
, 64))
1689 if (!( HCR_MapTypeToValue(sTemp
, sTemp
, 64, TRUE
)
1690 && HCR_MapTypeToValue(sTemp
, pOut
, uOutSize
, FALSE
)))
1692 lstrcpynA (pOut
, sTemp
, uOutSize
- 6);
1693 strcat (pOut
, "-file");
1699 lstrcpynA(pOut
, "Folder", uOutSize
);
1703 /*************************************************************************
1704 * _ILGetFileAttributes
1706 * Given the ItemIdList, get the Attrib string format
1709 * pidl [I] The ItemIDList
1710 * pOut [I] The buffer to save the result
1711 * uOutsize [I] The size of the Buffer
1717 * return value 0 in case of error is a valid return value
1720 DWORD
_ILGetFileAttributes(LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
)
1722 LPPIDLDATA pData
=_ILGetDataPointer(pidl
);
1726 if(! pData
) return 0;
1731 wAttrib
= pData
->u
.folder
.uFileAttribs
;
1734 wAttrib
= pData
->u
.file
.uFileAttribs
;
1741 if(wAttrib
& FILE_ATTRIBUTE_READONLY
)
1745 if(wAttrib
& FILE_ATTRIBUTE_HIDDEN
)
1749 if(wAttrib
& FILE_ATTRIBUTE_SYSTEM
)
1753 if(wAttrib
& FILE_ATTRIBUTE_ARCHIVE
)
1757 if(wAttrib
& FILE_ATTRIBUTE_COMPRESSED
)
1766 /*************************************************************************
1769 * free a aPidl struct
1771 void _ILFreeaPidl(LPITEMIDLIST
* apidl
, UINT cidl
)
1777 for(i
= 0; i
< cidl
; i
++) SHFree(apidl
[i
]);
1782 /*************************************************************************
1785 * copys a aPidl struct
1787 LPITEMIDLIST
* _ILCopyaPidl(LPITEMIDLIST
* apidlsrc
, UINT cidl
)
1790 LPITEMIDLIST
* apidldest
= (LPITEMIDLIST
*)SHAlloc(cidl
* sizeof(LPITEMIDLIST
));
1791 if(!apidlsrc
) return NULL
;
1793 for(i
= 0; i
< cidl
; i
++)
1794 apidldest
[i
] = ILClone(apidlsrc
[i
]);
1799 /*************************************************************************
1800 * _ILCopyCidaToaPidl
1802 * creates aPidl from CIDA
1804 LPITEMIDLIST
* _ILCopyCidaToaPidl(LPITEMIDLIST
* pidl
, LPCIDA cida
)
1807 LPITEMIDLIST
* dst
= (LPITEMIDLIST
*)SHAlloc(cida
->cidl
* sizeof(LPITEMIDLIST
));
1809 if(!dst
) return NULL
;
1812 *pidl
= ILClone((LPITEMIDLIST
)(&((LPBYTE
)cida
)[cida
->aoffset
[0]]));
1814 for(i
= 0; i
< cida
->cidl
; i
++)
1815 dst
[i
] = ILClone((LPITEMIDLIST
)(&((LPBYTE
)cida
)[cida
->aoffset
[i
+ 1]]));