setupapi/tests: Trace error codes when SetupOpenLog fails.
[wine.git] / dlls / shell32 / pidl.h
blobfc14ab3c1c81e7a48ac8cc42b90dde862f51e360
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * NOTES:
23 * DO NOT use these definitions outside the shell32.dll!
25 * The contents of a pidl should never be used directly from an application.
27 * Undocumented:
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.
34 #ifndef __WINE_PIDL_H
35 #define __WINE_PIDL_H
37 #include <stdarg.h>
39 #include "windef.h"
40 #include "winbase.h"
41 #include "winuser.h"
42 #include "shlobj.h"
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 describes the type of pidl.
53 * object ! first byte / ! format ! living space
54 * ! size
55 * ----------------------------------------------------------------
56 * my computer 0x1F/20 guid (2) (usual)
57 * network 0x1F guid
58 * bitbucket 0x1F guid
59 * drive 0x23/25 drive (usual)
60 * drive 0x25/25 drive (lnk/persistent)
61 * drive 0x29/25 drive
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 * printers/ras connections 0x70 guid
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_VALUEW 0x34
100 #define PT_FOLDERW 0x35
101 #define PT_WORKGRP 0x41
102 #define PT_COMP 0x42
103 #define PT_NETPROVIDER 0x46
104 #define PT_NETWORK 0x47
105 #define PT_IESPECIAL1 0x61
106 #define PT_YAGUID 0x70 /* yet another guid.. */
107 #define PT_IESPECIAL2 0xb1
108 #define PT_SHARE 0xc3
110 #include "pshpack1.h"
111 typedef BYTE PIDLTYPE;
113 typedef struct tagPIDLCPanelStruct
115 BYTE dummy; /*01 is 0x00 */
116 DWORD iconIdx; /*02 negative icon ID */
117 WORD offsDispName; /*06*/
118 WORD offsComment; /*08*/
119 CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */
120 } PIDLCPanelStruct;
122 typedef struct tagGUIDStruct
124 BYTE dummy; /* offset 01 is unknown */
125 GUID guid; /* offset 02 */
126 } GUIDStruct;
128 typedef struct tagDriveStruct
130 CHAR szDriveName[20]; /*01*/
131 WORD unknown; /*21*/
132 } DriveStruct;
134 typedef struct tagFileStruct
136 BYTE dummy; /*01 is 0x00 for files or dirs */
137 DWORD dwFileSize; /*02*/
138 WORD uFileDate; /*06*/
139 WORD uFileTime; /*08*/
140 WORD uFileAttribs; /*10*/
141 CHAR szNames[1]; /*12*/
142 /* Here are coming two strings. The first is the long name.
143 The second the dos name when needed or just 0x00 */
144 } FileStruct;
146 /* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows
147 * a WORD member after the wszName string, which gives the offset from the beginning of the PIDL
148 * to the FileStructW member. */
149 typedef struct tagFileStructW {
150 WORD cbLen;
151 BYTE dummy1[6];
152 WORD uCreationDate;
153 WORD uCreationTime;
154 WORD uLastAccessDate;
155 WORD uLastAccessTime;
156 BYTE dummy2[4];
157 WCHAR wszName[1];
158 } FileStructW;
160 typedef struct tagValueW
162 WCHAR name[1];
163 } ValueWStruct;
165 typedef struct tagPIDLDATA
166 { PIDLTYPE type; /*00*/
167 union
169 struct tagGUIDStruct guid;
170 struct tagDriveStruct drive;
171 struct tagFileStruct file;
172 struct
173 { WORD dummy; /*01*/
174 CHAR szNames[1]; /*03*/
175 } network;
176 struct
177 { WORD dummy; /*01*/
178 DWORD dummy1; /*02*/
179 CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */
180 } htmlhelp;
181 struct tagPIDLCPanelStruct cpanel;
182 struct tagValueW valueW;
184 } PIDLDATA, *LPPIDLDATA;
185 #include "poppack.h"
188 * getting special values from simple pidls
190 DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
191 DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
192 BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
193 DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
194 BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
195 void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
196 DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN;
198 BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft) DECLSPEC_HIDDEN;
199 DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT) DECLSPEC_HIDDEN;
202 * testing simple pidls
204 BOOL _ILIsUnicode (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
205 BOOL _ILIsDesktop (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
206 BOOL _ILIsMyComputer (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
207 BOOL _ILIsDrive (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
208 BOOL _ILIsFolder (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
209 BOOL _ILIsValue (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
210 BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
211 BOOL _ILIsPidlSimple (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
212 BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
213 static inline
214 BOOL _ILIsEqualSimple (LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
216 return (pidlA->mkid.cb > 0 && !memcmp(pidlA, pidlB, pidlA->mkid.cb)) ||
217 (!pidlA->mkid.cb && !pidlB->mkid.cb);
219 static inline
220 BOOL _ILIsEmpty (LPCITEMIDLIST pidl) { return _ILIsDesktop(pidl); }
223 * simple pidls
226 /* Creates a PIDL with guid format and type type, which must be one of PT_GUID,
227 * PT_SHELLEXT, or PT_YAGUID.
229 LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid) DECLSPEC_HIDDEN;
231 /* Like _ILCreateGuid, but using the string szGUID. */
232 LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID) DECLSPEC_HIDDEN;
233 LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID) DECLSPEC_HIDDEN;
235 /* Commonly used PIDLs representing file system objects. */
236 LPITEMIDLIST _ILCreateDesktop (void) DECLSPEC_HIDDEN;
237 LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *stffile) DECLSPEC_HIDDEN;
238 HRESULT _ILCreateFromPathW (LPCWSTR szPath, LPITEMIDLIST* ppidl) DECLSPEC_HIDDEN;
240 /* Other helpers */
241 LPITEMIDLIST _ILCreateMyComputer (void) DECLSPEC_HIDDEN;
242 LPITEMIDLIST _ILCreateMyDocuments (void) DECLSPEC_HIDDEN;
243 LPITEMIDLIST _ILCreateIExplore (void) DECLSPEC_HIDDEN;
244 LPITEMIDLIST _ILCreateControlPanel (void) DECLSPEC_HIDDEN;
245 LPITEMIDLIST _ILCreatePrinters (void) DECLSPEC_HIDDEN;
246 LPITEMIDLIST _ILCreateNetwork (void) DECLSPEC_HIDDEN;
247 LPITEMIDLIST _ILCreateNetHood (void) DECLSPEC_HIDDEN;
248 LPITEMIDLIST _ILCreateBitBucket (void) DECLSPEC_HIDDEN;
249 LPITEMIDLIST _ILCreateDrive (LPCWSTR) DECLSPEC_HIDDEN;
250 LPITEMIDLIST _ILCreateEntireNetwork (void) DECLSPEC_HIDDEN;
253 * helper functions (getting struct-pointer)
255 LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST) DECLSPEC_HIDDEN;
256 LPSTR _ILGetTextPointer (LPCITEMIDLIST) DECLSPEC_HIDDEN;
257 IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
258 FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
261 * debug helper
263 void pdump (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
264 BOOL pcheck (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
267 * aPidl helper
269 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN;
270 LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl) DECLSPEC_HIDDEN;
271 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida) DECLSPEC_HIDDEN;
273 BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type) DECLSPEC_HIDDEN;
275 #endif