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.
40 * the pidl does cache fileattributes to speed up SHGetAttributes when
41 * displaying a big number of files.
43 * a pidl of NULL means the desktop
45 * The structure of the pidl seems to be a union. The first byte of the
46 * PIDLDATA desribes the type of pidl.
48 * object ! first byte / ! format ! living space
50 * ----------------------------------------------------------------
51 * my computer 0x1F/20 mycomp (2) (usual)
53 * bitbucket 0x1F mycomp
54 * drive 0x23/25 drive (usual)
55 * drive 0x25/25 drive (lnk/persistant)
57 * shell extension 0x2E mycomp
58 * drive 0x2F drive (lnk/persistant)
59 * folder/file 0x30 folder/file (1) (lnk/persistant)
60 * folder 0x31 folder (usual)
61 * valueA 0x32 file (ANSI file name)
62 * valueW 0x34 file (Unicode file name)
63 * workgroup 0x41 network (3)
64 * computer 0x42 network (4)
65 * net provider 0x46 network
66 * whole network 0x47 network (5)
67 * MSITStore 0x61 htmlhlp (7)
68 * history/favorites 0xb1 file
69 * share 0xc3 network (6)
71 * guess: the persistant elements are non tracking
73 * (1) dummy byte is used, attributes are empty
74 * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
75 * (3) two strings "workgroup" "microsoft network"
76 * (4) one string "\\sirius"
77 * (5) one string "whole network"
78 * (6) one string "\\sirius\c"
79 * (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
80 * GUID 871C5380-42A0-1069-A2EA-08002B30309D
83 #define PT_DESKTOP 0x00 /* internal */
84 #define PT_MYCOMP 0x1F
86 #define PT_DRIVE2 0x25
87 #define PT_DRIVE3 0x29
88 #define PT_SPECIAL 0x2E
89 #define PT_DRIVE1 0x2F
90 #define PT_FOLDER1 0x30
91 #define PT_FOLDER 0x31
93 #define PT_WORKGRP 0x41
95 #define PT_NETPROVIDER 0x46
96 #define PT_NETWORK 0x47
97 #define PT_IESPECIAL1 0x61
98 #define PT_IESPECIAL2 0xb1
101 #include "pshpack1.h"
102 typedef BYTE PIDLTYPE
;
104 typedef struct tagPIDLDATA
105 { PIDLTYPE type
; /*00*/
113 { CHAR szDriveName
[20]; /*01*/
114 DWORD dwUnknown
; /*21*/
115 /* the drive seems to be 25 bytes every time */
118 { BYTE dummy
; /*01 is 0x00 for files or dirs */
119 DWORD dwFileSize
; /*02*/
120 WORD uFileDate
; /*06*/
121 WORD uFileTime
; /*08*/
122 WORD uFileAttribs
; /*10*/
123 CHAR szNames
[1]; /*12*/
124 /* Here are comming two strings. The first is the long name.
125 The second the dos name when needed or just 0x00 */
126 } file
, folder
, generic
;
129 CHAR szNames
[1]; /*03*/
134 CHAR szName
[1]; /*06*/ /* teminated by 0x00 0x00 */
137 } PIDLDATA
, *LPPIDLDATA
;
141 * getting special values from simple pidls
143 DWORD
_ILSimpleGetText (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
144 BOOL
_ILGetFileDate (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
145 DWORD
_ILGetFileSize (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
146 BOOL
_ILGetExtension (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
147 void _ILGetFileType (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
148 DWORD
_ILGetFileAttributes (LPCITEMIDLIST pidl
, LPSTR pOut
, UINT uOutSize
);
150 BOOL
_ILGetFileDateTime (LPCITEMIDLIST pidl
, FILETIME
*ft
);
151 DWORD
_ILGetDrive (LPCITEMIDLIST
, LPSTR
, UINT
);
154 * testing simple pidls
156 BOOL
_ILIsDesktop (LPCITEMIDLIST pidl
);
157 BOOL
_ILIsMyComputer (LPCITEMIDLIST pidl
);
158 BOOL
_ILIsDrive (LPCITEMIDLIST pidl
);
159 BOOL
_ILIsFolder (LPCITEMIDLIST pidl
);
160 BOOL
_ILIsValue (LPCITEMIDLIST pidl
);
161 BOOL
_ILIsSpecialFolder (LPCITEMIDLIST pidl
);
162 BOOL
_ILIsPidlSimple (LPCITEMIDLIST pidl
);
165 * simple pidls from strings
167 LPITEMIDLIST
_ILCreate (PIDLTYPE
,LPCVOID
,UINT
);
169 LPITEMIDLIST
_ILCreateDesktop (void);
170 LPITEMIDLIST
_ILCreateMyComputer (void);
171 LPITEMIDLIST
_ILCreateIExplore (void);
172 LPITEMIDLIST
_ILCreateControl (void);
173 LPITEMIDLIST
_ILCreatePrinter (void);
174 LPITEMIDLIST
_ILCreateNetwork (void);
175 LPITEMIDLIST
_ILCreateBitBucket (void);
176 LPITEMIDLIST
_ILCreateDrive (LPCSTR
);
177 LPITEMIDLIST
_ILCreateFolder (WIN32_FIND_DATAA
* stffile
);
178 LPITEMIDLIST
_ILCreateValue (WIN32_FIND_DATAA
* stffile
);
179 LPITEMIDLIST
_ILCreateSpecial (LPCSTR szGUID
);
180 LPITEMIDLIST
_ILCreateFromPathA (LPCSTR szPath
);
183 * helper functions (getting struct-pointer)
185 LPPIDLDATA
_ILGetDataPointer (LPCITEMIDLIST
);
186 LPSTR
_ILGetTextPointer (LPCITEMIDLIST
);
187 LPSTR
_ILGetSTextPointer (LPCITEMIDLIST
);
188 REFIID
_ILGetGUIDPointer (LPCITEMIDLIST pidl
);
193 void pdump (LPCITEMIDLIST pidl
);
194 BOOL
pcheck (LPCITEMIDLIST pidl
);
199 void _ILFreeaPidl(LPITEMIDLIST
* apidl
, UINT cidl
);
200 LPITEMIDLIST
* _ILCopyaPidl(LPITEMIDLIST
* apidlsrc
, UINT cidl
);
201 LPITEMIDLIST
* _ILCopyCidaToaPidl(LPITEMIDLIST
* pidl
, LPIDA cida
);
203 BOOL WINAPI
ILGetDisplayNameExA(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, LPSTR path
, DWORD type
);
204 BOOL WINAPI
ILGetDisplayNameExW(LPSHELLFOLDER psf
, LPCITEMIDLIST pidl
, LPWSTR path
, DWORD type
);