Removed unnecessary HANDLE typecasts.
[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 "shlobj.h"
38
39 /*
40 * the pidl does cache fileattributes to speed up SHGetAttributes when
41 * displaying a big number of files.
42 *
43 * a pidl of NULL means the desktop
44 *
45 * The structure of the pidl seems to be a union. The first byte of the
46 * PIDLDATA desribes the type of pidl.
47 *
48 *       object        ! first byte /  ! format       ! living space
49 *                     ! size
50 *       ----------------------------------------------------------------
51 *       my computer     0x1F/20         mycomp (2)      (usual)
52 *       network         0x1F            mycomp
53 *       bitbucket       0x1F            mycomp
54 *       drive           0x23/25         drive           (usual)
55 *       drive           0x25/25         drive           (lnk/persistant)
56 *       drive           0x29/25         drive
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 *       value           0x32            file            (usual)
62 *       workgroup       0x41            network (3)
63 *       computer        0x42            network (4)
64 *       whole network   0x47            network (5)
65 *       MSITStore       0x61            htmlhlp (7)
66 *       history/favorites 0xb1          file
67 *       share           0xc3            network (6)
68 *
69 * guess: the persistant elements are non tracking
70 *
71 * (1) dummy byte is used, attributes are empty
72 * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
73 * (3) two strings       "workgroup" "microsoft network"
74 * (4) one string        "\\sirius"
75 * (5) one string        "whole network"
76 * (6) one string        "\\sirius\c"
77 * (7) contains string   "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
78 *               GUID    871C5380-42A0-1069-A2EA-08002B30309D
79 */
80
81 #define PT_DESKTOP      0x00 /* internal */
82 #define PT_MYCOMP       0x1F
83 #define PT_DRIVE        0x23
84 #define PT_DRIVE2       0x25
85 #define PT_DRIVE3       0x29
86 #define PT_SPECIAL      0x2E
87 #define PT_DRIVE1       0x2F
88 #define PT_FOLDER1      0x30
89 #define PT_FOLDER       0x31
90 #define PT_VALUE        0x32
91 #define PT_WORKGRP      0x41
92 #define PT_COMP         0x42
93 #define PT_NETWORK      0x47
94 #define PT_IESPECIAL1   0x61
95 #define PT_IESPECIAL2   0xb1
96 #define PT_SHARE        0xc3
97
98 #include "pshpack1.h"
99 typedef BYTE PIDLTYPE;
100
101 typedef struct tagPIDLDATA
102 {       PIDLTYPE type;                  /*00*/
103         union
104         { struct
105           { BYTE dummy;                 /*01*/
106             GUID guid;                  /*02*/
107             BYTE dummy1;                /*18*/
108           } mycomp;
109           struct
110           { CHAR szDriveName[20];       /*01*/
111             DWORD dwUnknown;            /*21*/
112             /* the drive seems to be 25 bytes every time */
113           } drive;
114           struct
115           { BYTE dummy;                 /*01 is 0x00 for files or dirs */
116             DWORD dwFileSize;           /*02*/
117             WORD uFileDate;             /*06*/
118             WORD uFileTime;             /*08*/
119             WORD uFileAttribs;          /*10*/
120             CHAR szNames[1];            /*12*/
121             /* Here are comming two strings. The first is the long name.
122             The second the dos name when needed or just 0x00 */
123           } file, folder, generic;
124           struct
125           { WORD dummy;         /*01*/
126             CHAR szNames[1];    /*03*/
127           } network;
128           struct
129           { WORD dummy;         /*01*/
130             DWORD dummy1;       /*02*/
131             CHAR szName[1];     /*06*/ /* teminated by 0x00 0x00 */
132           } htmlhelp;
133         }u;
134 } PIDLDATA, *LPPIDLDATA;
135 #include "poppack.h"
136
137 /*
138  * getting special values from simple pidls
139  */
140 DWORD   _ILSimpleGetText        (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
141 BOOL    _ILGetFileDate          (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
142 DWORD   _ILGetFileSize          (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
143 BOOL    _ILGetExtension         (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
144 void    _ILGetFileType          (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
145 DWORD   _ILGetFileAttributes    (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
146
147 BOOL    _ILGetFileDateTime      (LPCITEMIDLIST pidl, FILETIME *ft);
148 DWORD   _ILGetDrive             (LPCITEMIDLIST, LPSTR, UINT);
149
150 /*
151  * testing simple pidls
152  */
153 BOOL    _ILIsDesktop            (LPCITEMIDLIST pidl);
154 BOOL    _ILIsMyComputer         (LPCITEMIDLIST pidl);
155 BOOL    _ILIsDrive              (LPCITEMIDLIST pidl);
156 BOOL    _ILIsFolder             (LPCITEMIDLIST pidl);
157 BOOL    _ILIsValue              (LPCITEMIDLIST pidl);
158 BOOL    _ILIsSpecialFolder      (LPCITEMIDLIST pidl);
159 BOOL    _ILIsPidlSimple         (LPCITEMIDLIST pidl);
160
161 /*
162  * simple pidls from strings
163  */
164 LPITEMIDLIST    _ILCreate       (PIDLTYPE,LPCVOID,UINT);
165
166 LPITEMIDLIST    _ILCreateDesktop        (void);
167 LPITEMIDLIST    _ILCreateMyComputer     (void);
168 LPITEMIDLIST    _ILCreateIExplore       (void);
169 LPITEMIDLIST    _ILCreateControl        (void);
170 LPITEMIDLIST    _ILCreatePrinter        (void);
171 LPITEMIDLIST    _ILCreateNetwork        (void);
172 LPITEMIDLIST    _ILCreateBitBucket      (void);
173 LPITEMIDLIST    _ILCreateDrive          (LPCSTR);
174 LPITEMIDLIST    _ILCreateFolder         (WIN32_FIND_DATAA * stffile);
175 LPITEMIDLIST    _ILCreateValue          (WIN32_FIND_DATAA * stffile);
176 LPITEMIDLIST    _ILCreateSpecial        (LPCSTR szGUID);
177
178 /*
179  * helper functions (getting struct-pointer)
180  */
181 LPPIDLDATA      _ILGetDataPointer       (LPCITEMIDLIST);
182 LPSTR           _ILGetTextPointer       (LPCITEMIDLIST);
183 LPSTR           _ILGetSTextPointer      (LPCITEMIDLIST);
184 REFIID          _ILGetGUIDPointer       (LPCITEMIDLIST pidl);
185
186 /*
187  * debug helper
188  */
189 void    pdump   (LPCITEMIDLIST pidl);
190 BOOL    pcheck  (LPCITEMIDLIST pidl);
191
192 /*
193  * aPidl helper
194  */
195 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
196 LPITEMIDLIST * _ILCopyaPidl(LPITEMIDLIST * apidlsrc, UINT cidl);
197 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPIDA cida);
198
199 #endif