Fixed a few more headers dependency issues.
[wine] / dlls / shell32 / pidl.h
1 /*
2  * internal pidl functions
3  *
4  * Copyright 1998 Juergen Schmied
5  *
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.
10  *
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.
15  *
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
19  *
20  * NOTES:
21  *
22  * DO NOT use this definitions outside the shell32.dll !
23  *
24  * The contents of a pidl should never used from a application
25  * directly.
26  *
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.
32  */
33
34 #ifndef __WINE_PIDL_H
35 #define __WINE_PIDL_H
36
37 #include <stdarg.h>
38
39 #include "windef.h"
40 #include "winbase.h"
41 #include "winuser.h"
42 #include "shlobj.h"
43
44 /*
45 * the pidl does cache fileattributes to speed up SHGetAttributes when
46 * displaying a big number of files.
47 *
48 * a pidl of NULL means the desktop
49 *
50 * The structure of the pidl seems to be a union. The first byte of the
51 * PIDLDATA desribes the type of pidl.
52 *
53 *       object        ! first byte /  ! format       ! living space
54 *                     ! size
55 *       ----------------------------------------------------------------
56 *       my computer     0x1F/20         mycomp (2)      (usual)
57 *       network         0x1F            mycomp
58 *       bitbucket       0x1F            mycomp
59 *       drive           0x23/25         drive           (usual)
60 *       drive           0x25/25         drive           (lnk/persistant)
61 *       drive           0x29/25         drive
62 *       shell extension 0x2E            mycomp
63 *       drive           0x2F            drive           (lnk/persistant)
64 *       folder/file     0x30            folder/file (1) (lnk/persistant)
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)
75 *
76 * guess: the persistant elements are non tracking
77 *
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) one string        "\\sirius"
82 * (5) one string        "whole network"
83 * (6) one string        "\\sirius\c"
84 * (7) contains string   "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
85 *               GUID    871C5380-42A0-1069-A2EA-08002B30309D
86 */
87
88 #define PT_DESKTOP      0x00 /* internal */
89 #define PT_MYCOMP       0x1F
90 #define PT_DRIVE        0x23
91 #define PT_DRIVE2       0x25
92 #define PT_DRIVE3       0x29
93 #define PT_SPECIAL      0x2E
94 #define PT_DRIVE1       0x2F
95 #define PT_FOLDER1      0x30
96 #define PT_FOLDER       0x31
97 #define PT_VALUE        0x32
98 #define PT_WORKGRP      0x41
99 #define PT_COMP         0x42
100 #define PT_NETPROVIDER  0x46
101 #define PT_NETWORK      0x47
102 #define PT_IESPECIAL1   0x61
103 #define PT_IESPECIAL2   0xb1
104 #define PT_SHARE        0xc3
105
106 #include "pshpack1.h"
107 typedef BYTE PIDLTYPE;
108
109 typedef struct tagPIDLDATA
110 {       PIDLTYPE type;                  /*00*/
111         union
112         { struct
113           { BYTE dummy;                 /*01*/
114             GUID guid;                  /*02*/
115             BYTE dummy1;                /*18*/
116           } mycomp;
117           struct
118           { CHAR szDriveName[20];       /*01*/
119             DWORD dwUnknown;            /*21*/
120             /* the drive seems to be 25 bytes every time */
121           } drive;
122           struct
123           { BYTE dummy;                 /*01 is 0x00 for files or dirs */
124             DWORD dwFileSize;           /*02*/
125             WORD uFileDate;             /*06*/
126             WORD uFileTime;             /*08*/
127             WORD uFileAttribs;          /*10*/
128             CHAR szNames[1];            /*12*/
129             /* Here are comming two strings. The first is the long name.
130             The second the dos name when needed or just 0x00 */
131           } file, folder, generic;
132           struct
133           { WORD dummy;         /*01*/
134             CHAR szNames[1];    /*03*/
135           } network;
136           struct
137           { WORD dummy;         /*01*/
138             DWORD dummy1;       /*02*/
139             CHAR szName[1];     /*06*/ /* teminated by 0x00 0x00 */
140           } htmlhelp;
141         }u;
142 } PIDLDATA, *LPPIDLDATA;
143 #include "poppack.h"
144
145 /*
146  * getting special values from simple pidls
147  */
148 DWORD   _ILSimpleGetText        (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
149 DWORD   _ILSimpleGetTextW       (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize);
150 BOOL    _ILGetFileDate          (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
151 DWORD   _ILGetFileSize          (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
152 BOOL    _ILGetExtension         (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
153 void    _ILGetFileType          (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
154 DWORD   _ILGetFileAttributes    (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
155
156 BOOL    _ILGetFileDateTime      (LPCITEMIDLIST pidl, FILETIME *ft);
157 DWORD   _ILGetDrive             (LPCITEMIDLIST, LPSTR, UINT);
158
159 /*
160  * testing simple pidls
161  */
162 BOOL    _ILIsDesktop            (LPCITEMIDLIST pidl);
163 BOOL    _ILIsMyComputer         (LPCITEMIDLIST pidl);
164 BOOL    _ILIsDrive              (LPCITEMIDLIST pidl);
165 BOOL    _ILIsFolder             (LPCITEMIDLIST pidl);
166 BOOL    _ILIsValue              (LPCITEMIDLIST pidl);
167 BOOL    _ILIsSpecialFolder      (LPCITEMIDLIST pidl);
168 BOOL    _ILIsPidlSimple         (LPCITEMIDLIST pidl);
169
170 /*
171  * simple pidls from strings
172  */
173 LPITEMIDLIST    _ILCreate       (PIDLTYPE,LPCVOID,UINT);
174
175 LPITEMIDLIST    _ILCreateDesktop        (void);
176 LPITEMIDLIST    _ILCreateMyComputer     (void);
177 LPITEMIDLIST    _ILCreateIExplore       (void);
178 LPITEMIDLIST    _ILCreateControl        (void);
179 LPITEMIDLIST    _ILCreatePrinter        (void);
180 LPITEMIDLIST    _ILCreateNetwork        (void);
181 LPITEMIDLIST    _ILCreateBitBucket      (void);
182 LPITEMIDLIST    _ILCreateDrive          (LPCSTR);
183 LPITEMIDLIST    _ILCreateFolder         (WIN32_FIND_DATAA * stffile);
184 LPITEMIDLIST    _ILCreateValue          (WIN32_FIND_DATAA * stffile);
185 LPITEMIDLIST    _ILCreateSpecial        (LPCSTR szGUID);
186 LPITEMIDLIST    _ILCreateFromPathA      (LPCSTR szPath);
187
188 /*
189  * helper functions (getting struct-pointer)
190  */
191 LPPIDLDATA      _ILGetDataPointer       (LPCITEMIDLIST);
192 LPSTR           _ILGetTextPointer       (LPCITEMIDLIST);
193 LPSTR           _ILGetSTextPointer      (LPCITEMIDLIST);
194 REFIID          _ILGetGUIDPointer       (LPCITEMIDLIST pidl);
195
196 /*
197  * debug helper
198  */
199 void    pdump   (LPCITEMIDLIST pidl);
200 BOOL    pcheck  (LPCITEMIDLIST pidl);
201
202 /*
203  * aPidl helper
204  */
205 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
206 LPITEMIDLIST * _ILCopyaPidl(LPCITEMIDLIST * apidlsrc, UINT cidl);
207 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida);
208
209 BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type);
210 BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
211
212 #endif