Make sure we include config.h before including twain_i.h.
[wine/hacks.git] / dlls / shell32 / pidl.h
blob8e09c4c009d9f6fada8d3f1a2d39a386933bd5bd
1 /*
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * NOTES:
23 * DO NOT use this definitions outside the shell32.dll !
25 * The contents of a pidl should never used from a application
26 * directly.
28 * Undocumented:
29 * MS says: the abID of SHITEMID should be treated as binary data and not
30 * be interpreted by applications. Applies to everyone but MS itself.
31 * Word95 interprets the contents of abID (Filesize/Date) so we have to go
32 * for binary compatibility here.
35 #ifndef __WINE_PIDL_H
36 #define __WINE_PIDL_H
38 #include <stdarg.h>
40 #include "windef.h"
41 #include "winbase.h"
42 #include "winuser.h"
43 #include "shlobj.h"
46 * the pidl does cache fileattributes to speed up SHGetAttributes when
47 * displaying a big number of files.
49 * a pidl of NULL means the desktop
51 * The structure of the pidl seems to be a union. The first byte of the
52 * PIDLDATA desribes the type of pidl.
54 * object ! first byte / ! format ! living space
55 * ! size
56 * ----------------------------------------------------------------
57 * my computer 0x1F/20 guid (2) (usual)
58 * network 0x1F guid
59 * bitbucket 0x1F guid
60 * drive 0x23/25 drive (usual)
61 * drive 0x25/25 drive (lnk/persistent)
62 * drive 0x29/25 drive
63 * shell extension 0x2E guid
64 * drive 0x2F drive (lnk/persistent)
65 * folder/file 0x30 folder/file (1) (lnk/persistent)
66 * folder 0x31 folder (usual)
67 * valueA 0x32 file (ANSI file name)
68 * valueW 0x34 file (Unicode file name)
69 * workgroup 0x41 network (3)
70 * computer 0x42 network (4)
71 * net provider 0x46 network
72 * whole network 0x47 network (5)
73 * MSITStore 0x61 htmlhlp (7)
74 * history/favorites 0xb1 file
75 * share 0xc3 network (6)
77 * guess: the persistent elements are non tracking
79 * (1) dummy byte is used, attributes are empty
80 * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
81 * (3) two strings "workgroup" "Microsoft Network"
82 * (4) two strings "\\sirius" "Microsoft Network"
83 * (5) one string "Entire Network"
84 * (6) two strings "\\sirius\c" "Microsoft Network"
85 * (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
86 * GUID 871C5380-42A0-1069-A2EA-08002B30309D
89 #define PT_CPLAPPLET 0x00
90 #define PT_GUID 0x1F
91 #define PT_DRIVE 0x23
92 #define PT_DRIVE2 0x25
93 #define PT_DRIVE3 0x29
94 #define PT_SHELLEXT 0x2E
95 #define PT_DRIVE1 0x2F
96 #define PT_FOLDER1 0x30
97 #define PT_FOLDER 0x31
98 #define PT_VALUE 0x32
99 #define PT_WORKGRP 0x41
100 #define PT_COMP 0x42
101 #define PT_NETPROVIDER 0x46
102 #define PT_NETWORK 0x47
103 #define PT_IESPECIAL1 0x61
104 #define PT_RAS_FOLDER 0x70
105 #define PT_IESPECIAL2 0xb1
106 #define PT_SHARE 0xc3
108 #include "pshpack1.h"
109 typedef BYTE PIDLTYPE;
111 typedef struct tagPIDLCPanelStruct
113 BYTE dummy; /*01 is 0x00 */
114 DWORD iconIdx; /*02 negative icon ID */
115 WORD offsDispName; /*06*/
116 WORD offsComment; /*08*/
117 CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */
118 } PIDLCPanelStruct;
120 typedef struct tagGUIDStruct
122 BYTE dummy; /* offset 01 is unknown */
123 GUID guid; /* offset 02 */
124 } GUIDStruct;
126 typedef struct tagDriveStruct
128 CHAR szDriveName[20]; /*01*/
129 WORD unknown; /*21*/
130 } DriveStruct;
132 typedef struct tagFileStruct
134 BYTE dummy; /*01 is 0x00 for files or dirs */
135 DWORD dwFileSize; /*02*/
136 WORD uFileDate; /*06*/
137 WORD uFileTime; /*08*/
138 WORD uFileAttribs; /*10*/
139 CHAR szNames[1]; /*12*/
140 /* Here are coming two strings. The first is the long name.
141 The second the dos name when needed or just 0x00 */
142 } FileStruct;
144 typedef struct tagPIDLDATA
145 { PIDLTYPE type; /*00*/
146 union
148 struct tagGUIDStruct guid;
149 struct tagDriveStruct drive;
150 struct tagFileStruct file;
151 struct
152 { WORD dummy; /*01*/
153 CHAR szNames[1]; /*03*/
154 } network;
155 struct
156 { WORD dummy; /*01*/
157 DWORD dummy1; /*02*/
158 CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */
159 } htmlhelp;
160 struct tagPIDLCPanelStruct cpanel;
162 } PIDLDATA, *LPPIDLDATA;
163 #include "poppack.h"
166 * getting special values from simple pidls
168 DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
169 DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize);
170 BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
171 DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
172 BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
173 void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
174 DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
176 BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft);
177 DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT);
180 * testing simple pidls
182 BOOL _ILIsDesktop (LPCITEMIDLIST pidl);
183 BOOL _ILIsMyComputer (LPCITEMIDLIST pidl);
184 BOOL _ILIsDrive (LPCITEMIDLIST pidl);
185 BOOL _ILIsFolder (LPCITEMIDLIST pidl);
186 BOOL _ILIsValue (LPCITEMIDLIST pidl);
187 BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl);
188 BOOL _ILIsPidlSimple (LPCITEMIDLIST pidl);
189 BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl);
192 * simple pidls
195 /* Basic PIDL constructor. Allocates size + 5 bytes, where:
196 * - two bytes are SHITEMID.cb
197 * - one byte is PIDLDATA.type
198 * - two bytes are the NULL PIDL terminator
199 * Sets type of the returned PIDL to type.
201 LPITEMIDLIST _ILAlloc(PIDLTYPE type, size_t size);
203 /* Creates a PIDL with guid format and type type, which must be either PT_GUID
204 * or PT_SHELLEXT.
206 LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid);
208 /* Like _ILCreateGuid, but using the string szGUID. */
209 LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID);
211 /* Commonly used PIDLs representing file system objects. */
212 LPITEMIDLIST _ILCreateDesktop (void);
213 LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA *stffile);
214 HRESULT _ILCreateFromPathA (LPCSTR szPath, LPITEMIDLIST* ppidl);
216 /* Other helpers */
217 LPITEMIDLIST _ILCreateMyComputer (void);
218 LPITEMIDLIST _ILCreateIExplore (void);
219 LPITEMIDLIST _ILCreateControlPanel (void);
220 LPITEMIDLIST _ILCreatePrinters (void);
221 LPITEMIDLIST _ILCreateNetwork (void);
222 LPITEMIDLIST _ILCreateBitBucket (void);
223 LPITEMIDLIST _ILCreateDrive (LPCWSTR);
226 * helper functions (getting struct-pointer)
228 LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
229 LPSTR _ILGetTextPointer (LPCITEMIDLIST);
230 LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
231 IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl);
234 * debug helper
236 void pdump (LPCITEMIDLIST pidl);
237 BOOL pcheck (LPCITEMIDLIST pidl);
240 * aPidl helper
242 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
243 LPITEMIDLIST * _ILCopyaPidl(LPCITEMIDLIST * apidlsrc, UINT cidl);
244 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida);
246 BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type);
247 BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
249 HRESULT SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSize);
250 HRESULT SHELL_GetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath, UINT uOutSize);
252 #endif