2 * internal pidl functions
4 * Copyright 1998 Juergen Schmied
5 * Copyright 2004 Juan Lang
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * DO NOT use these definitions outside the shell32.dll!
25 * The contents of a pidl should never be used directly from an application.
28 * MS says: the abID of SHITEMID should be treated as binary data and not
29 * be interpreted by applications. Applies to everyone but MS itself.
30 * Word95 interprets the contents of abID (Filesize/Date) so we have to go
31 * for binary compatibility here.
42 * the pidl does cache fileattributes to speed up SHGetAttributes when
43 * displaying a big number of files.
45 * a pidl of NULL means the desktop
47 * The structure of the pidl seems to be a union. The first byte of the
48 * PIDLDATA describes the type of pidl.
50 * object ! first byte / ! format ! living space
52 * ----------------------------------------------------------------
53 * my computer 0x1F/20 guid (2) (usual)
56 * drive 0x23/25 drive (usual)
57 * drive 0x25/25 drive (lnk/persistent)
59 * shell extension 0x2E guid
60 * drive 0x2F drive (lnk/persistent)
61 * folder/file 0x30 folder/file (1) (lnk/persistent)
62 * folder 0x31 folder (usual)
63 * valueA 0x32 file (ANSI file name)
64 * valueW 0x34 file (Unicode file name)
65 * workgroup 0x41 network (3)
66 * computer 0x42 network (4)
67 * net provider 0x46 network
68 * whole network 0x47 network (5)
69 * MSITStore 0x61 htmlhlp (7)
70 * printers/ras connections 0x70 guid
71 * history/favorites 0xb1 file
72 * share 0xc3 network (6)
74 * guess: the persistent elements are non tracking
76 * (1) dummy byte is used, attributes are empty
77 * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
78 * (3) two strings "workgroup" "Microsoft Network"
79 * (4) two strings "\\sirius" "Microsoft Network"
80 * (5) one string "Entire Network"
81 * (6) two strings "\\sirius\c" "Microsoft Network"
82 * (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
83 * GUID 871C5380-42A0-1069-A2EA-08002B30309D
86 #define PT_CPLAPPLET 0x00
89 #define PT_DRIVE2 0x25
90 #define PT_DRIVE3 0x29
91 #define PT_SHELLEXT 0x2E
92 #define PT_DRIVE1 0x2F
93 #define PT_FOLDER1 0x30
94 #define PT_FOLDER 0x31
96 #define PT_VALUEW 0x34
97 #define PT_FOLDERW 0x35
98 #define PT_WORKGRP 0x41
100 #define PT_NETPROVIDER 0x46
101 #define PT_NETWORK 0x47
102 #define PT_IESPECIAL1 0x61
103 #define PT_YAGUID 0x70 /* yet another guid.. */
104 #define PT_IESPECIAL2 0xb1
105 #define PT_SHARE 0xc3
107 #include "pshpack1.h"
108 typedef BYTE PIDLTYPE
;
110 typedef struct tagPIDLCPanelStruct
112 BYTE dummy
; /*01 is 0x00 */
113 DWORD iconIdx
; /*02 negative icon ID */
114 WORD offsDispName
; /*06*/
115 WORD offsComment
; /*08*/
116 WCHAR szName
[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */
121 typedef struct tagPIDLFontStruct
128 typedef struct tagPIDLPrinterStruct
136 typedef struct tagPIDLRecycleStruct
138 FILETIME LastModification
;
139 FILETIME DeletionTime
;
140 ULARGE_INTEGER FileSize
;
141 ULARGE_INTEGER PhysicalFileSize
;
146 #endif /* !__REACTOS__ */
148 typedef struct tagGUIDStruct
150 BYTE dummy
; /* offset 01 is unknown */
151 GUID guid
; /* offset 02 */
154 typedef struct tagDriveStruct
156 CHAR szDriveName
[20]; /*01*/
160 typedef struct tagFileStruct
162 BYTE dummy
; /*01 is 0x00 for files or dirs */
163 DWORD dwFileSize
; /*02*/
164 WORD uFileDate
; /*06*/
165 WORD uFileTime
; /*08*/
166 WORD uFileAttribs
; /*10*/
167 CHAR szNames
[1]; /*12*/
168 /* Here are coming two strings. The first is the long name.
169 The second the dos name when needed or just 0x00 */
172 /* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows
173 * a WORD member after the wszName string, which gives the offset from the beginning of the PIDL
174 * to the FileStructW member. */
175 typedef struct tagFileStructW
{
180 WORD uLastAccessDate
;
181 WORD uLastAccessTime
;
186 typedef struct tagValueW
191 typedef struct tagPIDLDATA
192 { PIDLTYPE type
; /*00*/
195 struct tagGUIDStruct guid
;
196 struct tagDriveStruct drive
;
197 struct tagFileStruct file
;
200 CHAR szNames
[1]; /*03*/
205 CHAR szName
[1]; /*06*/ /* terminated by 0x00 0x00 */
207 struct tagPIDLCPanelStruct cpanel
;
208 struct tagValueW valueW
;
210 struct tagPIDLFontStruct cfont
;
211 struct tagPIDLPrinterStruct cprinter
;
212 struct tagPIDLRecycleStruct crecycle
;
215 } PIDLDATA
, *LPPIDLDATA
;
219 * getting special values from simple pidls
221 DWORD
_ILSimpleGetText (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
222 DWORD
_ILSimpleGetTextW (LPCITEMIDLIST pidl
, LPWSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
223 BOOL
_ILGetFileDate (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
224 DWORD
_ILGetFileSize (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
225 BOOL
_ILGetExtension (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
226 void _ILGetFileType (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
227 DWORD
_ILGetFileAttributes (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
) DECLSPEC_HIDDEN
;
229 BOOL
_ILGetFileDateTime (LPCITEMIDLIST pidl
, FILETIME
*ft
) DECLSPEC_HIDDEN
;
230 DWORD
_ILGetDrive (LPCITEMIDLIST
, LPSTR
, UINT
) DECLSPEC_HIDDEN
;
233 * testing simple pidls
235 BOOL
_ILIsUnicode (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
236 BOOL
_ILIsDesktop (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
237 BOOL
_ILIsMyComputer (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
239 BOOL
_ILIsMyDocuments (LPCITEMIDLIST pidl
);
240 BOOL
_ILIsBitBucket (LPCITEMIDLIST pidl
);
241 BOOL
_ILIsNetHood (LPCITEMIDLIST pidl
);
243 BOOL
_ILIsDrive (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
244 BOOL
_ILIsFolder (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
245 BOOL
_ILIsValue (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
246 BOOL
_ILIsSpecialFolder (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
247 BOOL
_ILIsPidlSimple (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
248 BOOL
_ILIsCPanelStruct (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
250 BOOL
_ILIsEqualSimple (LPCITEMIDLIST pidlA
, LPCITEMIDLIST pidlB
)
252 return (pidlA
->mkid
.cb
> 0 && !memcmp(pidlA
, pidlB
, pidlA
->mkid
.cb
)) ||
253 (!pidlA
->mkid
.cb
&& !pidlB
->mkid
.cb
);
256 BOOL
_ILIsEmpty (LPCITEMIDLIST pidl
) { return _ILIsDesktop(pidl
); }
262 /* Creates a PIDL with guid format and type type, which must be one of PT_GUID,
263 * PT_SHELLEXT, or PT_YAGUID.
265 LPITEMIDLIST
_ILCreateGuid(PIDLTYPE type
, REFIID guid
) DECLSPEC_HIDDEN
;
267 /* Like _ILCreateGuid, but using the string szGUID. */
268 LPITEMIDLIST
_ILCreateGuidFromStrA(LPCSTR szGUID
) DECLSPEC_HIDDEN
;
269 LPITEMIDLIST
_ILCreateGuidFromStrW(LPCWSTR szGUID
) DECLSPEC_HIDDEN
;
271 /* Commonly used PIDLs representing file system objects. */
272 LPITEMIDLIST
_ILCreateDesktop (void) DECLSPEC_HIDDEN
;
273 LPITEMIDLIST
_ILCreateFromFindDataW(const WIN32_FIND_DATAW
*stffile
) DECLSPEC_HIDDEN
;
274 HRESULT
_ILCreateFromPathW (LPCWSTR szPath
, LPITEMIDLIST
* ppidl
) DECLSPEC_HIDDEN
;
277 LPITEMIDLIST
_ILCreateMyComputer (void) DECLSPEC_HIDDEN
;
278 LPITEMIDLIST
_ILCreateMyDocuments (void) DECLSPEC_HIDDEN
;
279 LPITEMIDLIST
_ILCreateIExplore (void) DECLSPEC_HIDDEN
;
280 LPITEMIDLIST
_ILCreateControlPanel (void) DECLSPEC_HIDDEN
;
281 LPITEMIDLIST
_ILCreatePrinters (void) DECLSPEC_HIDDEN
;
282 LPITEMIDLIST
_ILCreateNetwork (void) DECLSPEC_HIDDEN
;
283 LPITEMIDLIST
_ILCreateNetHood (void) DECLSPEC_HIDDEN
;
285 LPITEMIDLIST
_ILCreateAdminTools (void);
287 LPITEMIDLIST
_ILCreateBitBucket (void) DECLSPEC_HIDDEN
;
288 LPITEMIDLIST
_ILCreateDrive (LPCWSTR
) DECLSPEC_HIDDEN
;
289 LPITEMIDLIST
_ILCreateEntireNetwork (void) DECLSPEC_HIDDEN
;
292 * helper functions (getting struct-pointer)
294 LPPIDLDATA
_ILGetDataPointer (LPCITEMIDLIST
) DECLSPEC_HIDDEN
;
295 LPSTR
_ILGetTextPointer (LPCITEMIDLIST
) DECLSPEC_HIDDEN
;
296 IID
*_ILGetGUIDPointer (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
297 FileStructW
*_ILGetFileStructW (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
302 void pdump (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
303 BOOL
pcheck (LPCITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
308 void _ILFreeaPidl(LPITEMIDLIST
* apidl
, UINT cidl
) DECLSPEC_HIDDEN
;
309 LPITEMIDLIST
* _ILCopyaPidl(const LPCITEMIDLIST
* apidlsrc
, UINT cidl
) DECLSPEC_HIDDEN
;
310 LPITEMIDLIST
* _ILCopyCidaToaPidl(LPITEMIDLIST
* pidl
, const CIDA
* cida
) DECLSPEC_HIDDEN
;
312 BOOL
ILGetDisplayNameExW(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, LPWSTR path
, DWORD type
) DECLSPEC_HIDDEN
;
318 #endif /* __WINE_PIDL_H */