2 * internal pidl functions
4 * Copyright 1998 Juergen Schmied
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * DO NOT use this definitions outside the shell32.dll !
24 * The contents of a pidl should never used from a 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.
45 * the pidl does cache fileattributes to speed up SHGetAttributes when
46 * displaying a big number of files.
48 * a pidl of NULL means the desktop
50 * The structure of the pidl seems to be a union. The first byte of the
51 * PIDLDATA desribes the type of pidl.
53 * object ! first byte / ! format ! living space
55 * ----------------------------------------------------------------
56 * my computer 0x1F/20 guid (2) (usual)
59 * drive 0x23/25 drive (usual)
60 * drive 0x25/25 drive (lnk/persistent)
62 * shell extension 0x2E guid
63 * drive 0x2F drive (lnk/persistent)
64 * folder/file 0x30 folder/file (1) (lnk/persistent)
65 * folder 0x31 folder (usual)
66 * valueA 0x32 file (ANSI file name)
67 * valueW 0x34 file (Unicode file name)
68 * workgroup 0x41 network (3)
69 * computer 0x42 network (4)
70 * net provider 0x46 network
71 * whole network 0x47 network (5)
72 * MSITStore 0x61 htmlhlp (7)
73 * history/favorites 0xb1 file
74 * share 0xc3 network (6)
76 * guess: the persistent elements are non tracking
78 * (1) dummy byte is used, attributes are empty
79 * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
80 * (3) two strings "workgroup" "Microsoft Network"
81 * (4) two strings "\\sirius" "Microsoft Network"
82 * (5) one string "Entire Network"
83 * (6) two strings "\\sirius\c" "Microsoft Network"
84 * (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
85 * GUID 871C5380-42A0-1069-A2EA-08002B30309D
88 #define PT_DESKTOP 0x00 /* internal */
91 #define PT_DRIVE2 0x25
92 #define PT_DRIVE3 0x29
93 #define PT_SHELLEXT 0x2E
94 #define PT_DRIVE1 0x2F
95 #define PT_FOLDER1 0x30
96 #define PT_FOLDER 0x31
98 #define PT_WORKGRP 0x41
100 #define PT_NETPROVIDER 0x46
101 #define PT_NETWORK 0x47
102 #define PT_IESPECIAL1 0x61
103 #define PT_RAS_FOLDER 0x70
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 CHAR szName
[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */
119 typedef struct tagPIDLDATA
120 { PIDLTYPE type
; /*00*/
128 { CHAR szDriveName
[20]; /*01*/
129 DWORD dwUnknown
; /*21*/
130 /* the drive seems to be 25 bytes every time */
133 { BYTE dummy
; /*01 is 0x00 for files or dirs */
134 DWORD dwFileSize
; /*02*/
135 WORD uFileDate
; /*06*/
136 WORD uFileTime
; /*08*/
137 WORD uFileAttribs
; /*10*/
138 CHAR szNames
[1]; /*12*/
139 /* Here are coming two strings. The first is the long name.
140 The second the dos name when needed or just 0x00 */
141 } file
, folder
, generic
;
144 CHAR szNames
[1]; /*03*/
149 CHAR szName
[1]; /*06*/ /* terminated by 0x00 0x00 */
151 struct tagPIDLCPanelStruct cpanel
;
153 } PIDLDATA
, *LPPIDLDATA
;
157 * getting special values from simple pidls
159 DWORD
_ILSimpleGetText (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
160 DWORD
_ILSimpleGetTextW (LPCITEMIDLIST pidl
, LPWSTR pOut
, UINT uOutSize
);
161 BOOL
_ILGetFileDate (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
162 DWORD
_ILGetFileSize (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
163 BOOL
_ILGetExtension (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
164 void _ILGetFileType (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
165 DWORD
_ILGetFileAttributes (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
167 BOOL
_ILGetFileDateTime (LPCITEMIDLIST pidl
, FILETIME
*ft
);
168 DWORD
_ILGetDrive (LPCITEMIDLIST
, LPSTR
, UINT
);
171 * testing simple pidls
173 BOOL
_ILIsDesktop (LPCITEMIDLIST pidl
);
174 BOOL
_ILIsMyComputer (LPCITEMIDLIST pidl
);
175 BOOL
_ILIsDrive (LPCITEMIDLIST pidl
);
176 BOOL
_ILIsFolder (LPCITEMIDLIST pidl
);
177 BOOL
_ILIsValue (LPCITEMIDLIST pidl
);
178 BOOL
_ILIsSpecialFolder (LPCITEMIDLIST pidl
);
179 BOOL
_ILIsPidlSimple (LPCITEMIDLIST pidl
);
180 BOOL
_ILIsCPanelStruct (LPCITEMIDLIST pidl
);
186 /* Basic PIDL constructor. Allocates size + 2 bytes (to include space for the
187 * NULL PIDL terminator), and sets type to type.
189 LPITEMIDLIST
_ILCreateWithTypeAndSize(PIDLTYPE type
, UINT size
);
191 /* Creates a PIDL with guid format and type type, which must be either PT_GUID
194 LPITEMIDLIST
_ILCreateGuid(PIDLTYPE type
, REFIID guid
);
196 /* Like _ILCreateGuid, but using the string szGUID. */
197 LPITEMIDLIST
_ILCreateGuidFromStrA(LPCSTR szGUID
);
199 /* Commonly used PIDLs representing file system objects. */
200 LPITEMIDLIST
_ILCreateDesktop (void);
201 LPITEMIDLIST
_ILCreateFromFindDataA(WIN32_FIND_DATAA
*stffile
);
202 LPITEMIDLIST
_ILCreateFromPathA (LPCSTR szPath
);
205 LPITEMIDLIST
_ILCreateMyComputer (void);
206 LPITEMIDLIST
_ILCreateIExplore (void);
207 LPITEMIDLIST
_ILCreateControlPanel (void);
208 LPITEMIDLIST
_ILCreatePrinters (void);
209 LPITEMIDLIST
_ILCreateNetwork (void);
210 LPITEMIDLIST
_ILCreateBitBucket (void);
211 LPITEMIDLIST
_ILCreateDrive (LPCSTR
);
214 * helper functions (getting struct-pointer)
216 LPPIDLDATA
_ILGetDataPointer (LPCITEMIDLIST
);
217 LPSTR
_ILGetTextPointer (LPCITEMIDLIST
);
218 LPSTR
_ILGetSTextPointer (LPCITEMIDLIST
);
219 REFIID
_ILGetGUIDPointer (LPCITEMIDLIST pidl
);
224 void pdump (LPCITEMIDLIST pidl
);
225 BOOL
pcheck (LPCITEMIDLIST pidl
);
230 void _ILFreeaPidl(LPITEMIDLIST
* apidl
, UINT cidl
);
231 LPITEMIDLIST
* _ILCopyaPidl(LPCITEMIDLIST
* apidlsrc
, UINT cidl
);
232 LPITEMIDLIST
* _ILCopyCidaToaPidl(LPITEMIDLIST
* pidl
, LPIDA cida
);
234 BOOL WINAPI
ILGetDisplayNameExA(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, LPSTR path
, DWORD type
);
235 BOOL WINAPI
ILGetDisplayNameExW(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, LPWSTR path
, DWORD type
);
237 HRESULT
SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl
, LPSTR pszPath
, UINT uOutSize
);
238 HRESULT
SHELL_GetPathFromIDListW(LPCITEMIDLIST pidl
, LPWSTR pszPath
, UINT uOutSize
);