New loading scheme for Winelib apps, makes them behave like builtin
[wine] / include / wine / obj_propertystorage.h
1 /*
2  * Defines the COM interfaces and APIs related to saving properties to file.
3  *
4  * Copyright (C) the Wine project
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
21 #ifndef __WINE_WINE_OBJ_PROPERTYSTORAGE_H
22 #define __WINE_WINE_OBJ_PROPERTYSTORAGE_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* defined(__cplusplus) */
27
28 /*****************************************************************************
29  * Predeclare the interfaces
30  */
31 DEFINE_OLEGUID(IID_IEnumSTATPROPSETSTG, 0x0000013bL, 0, 0);
32 typedef struct IEnumSTATPROPSETSTG IEnumSTATPROPSETSTG,*LPENUMSTATPROPSETSTG;
33
34 DEFINE_OLEGUID(IID_IEnumSTATPROPSTG,    0x00000139L, 0, 0);
35 typedef struct IEnumSTATPROPSTG IEnumSTATPROPSTG,*LPENUMSTATPROPSTG;
36
37 DEFINE_OLEGUID(IID_IPropertySetStorage, 0x0000013aL, 0, 0);
38 typedef struct IPropertySetStorage IPropertySetStorage,*LPPROPERTYSETSTORAGE;
39
40 DEFINE_OLEGUID(IID_IPropertyStorage,    0x00000138L, 0, 0);
41 typedef struct IPropertyStorage IPropertyStorage,*LPPROPERTYSTORAGE;
42
43
44 /*****************************************************************************
45  * Predeclare the structures
46  */
47
48 typedef struct tagSTATPROPSETSTG STATPROPSETSTG;
49 typedef struct tagSTATPROPSTG STATPROPSTG;
50
51 extern const FMTID FMTID_SummaryInformation;
52 extern const FMTID FMTID_DocSummaryInformation;
53 extern const FMTID FMTID_UserDefinedProperties;
54
55 /*****************************************************************************
56  * PROPSPEC structure
57  */
58
59 /* Reserved global Property IDs */
60 #define PID_DICTIONARY  ( 0 )
61
62 #define PID_CODEPAGE    ( 0x1 )
63
64 #define PID_FIRST_USABLE        ( 0x2 )
65
66 #define PID_FIRST_NAME_DEFAULT  ( 0xfff )
67
68 #define PID_LOCALE      ( 0x80000000 )
69
70 #define PID_MODIFY_TIME ( 0x80000001 )
71
72 #define PID_SECURITY    ( 0x80000002 )
73
74 #define PID_ILLEGAL     ( 0xffffffff )
75
76 /* Property IDs for the SummaryInformation Property Set */
77
78 #define PIDSI_TITLE               0x00000002L  /* VT_LPSTR */
79 #define PIDSI_SUBJECT             0x00000003L  /* VT_LPSTR */
80 #define PIDSI_AUTHOR              0x00000004L  /* VT_LPSTR */
81 #define PIDSI_KEYWORDS            0x00000005L  /* VT_LPSTR */
82 #define PIDSI_COMMENTS            0x00000006L  /* VT_LPSTR */
83 #define PIDSI_TEMPLATE            0x00000007L  /* VT_LPSTR */
84 #define PIDSI_LASTAUTHOR          0x00000008L  /* VT_LPSTR */
85 #define PIDSI_REVNUMBER           0x00000009L  /* VT_LPSTR */
86 #define PIDSI_EDITTIME            0x0000000aL  /* VT_FILETIME (UTC) */
87 #define PIDSI_LASTPRINTED         0x0000000bL  /* VT_FILETIME (UTC) */
88 #define PIDSI_CREATE_DTM          0x0000000cL  /* VT_FILETIME (UTC) */
89 #define PIDSI_LASTSAVE_DTM        0x0000000dL  /* VT_FILETIME (UTC) */
90 #define PIDSI_PAGECOUNT           0x0000000eL  /* VT_I4 */
91 #define PIDSI_WORDCOUNT           0x0000000fL  /* VT_I4 */
92 #define PIDSI_CHARCOUNT           0x00000010L  /* VT_I4 */
93 #define PIDSI_THUMBNAIL           0x00000011L  /* VT_CF */
94 #define PIDSI_APPNAME             0x00000012L  /* VT_LPSTR */
95 #define PIDSI_DOC_SECURITY        0x00000013L  /* VT_I4 */
96 #define PRSPEC_INVALID  ( 0xffffffff )
97
98
99 #define PRSPEC_LPWSTR   ( 0 )
100 #define PRSPEC_PROPID   ( 1 )
101
102 typedef struct tagPROPSPEC
103 {
104     ULONG ulKind;
105     union 
106     {
107         PROPID propid;
108         LPOLESTR lpwstr;
109     } u;
110 } PROPSPEC;
111
112
113 /*****************************************************************************
114  * STATPROPSETSTG structure
115  */
116 /* Macros for parsing the OS Version of the Property Set Header */
117 #define PROPSETHDR_OSVER_KIND(dwOSVer)      HIWORD( (dwOSVer) )
118 #define PROPSETHDR_OSVER_MAJOR(dwOSVer)     LOBYTE(LOWORD( (dwOSVer) ))
119 #define PROPSETHDR_OSVER_MINOR(dwOSVer)     HIBYTE(LOWORD( (dwOSVer) ))
120 #define PROPSETHDR_OSVERSION_UNKNOWN        0xFFFFFFFF
121
122 struct tagSTATPROPSETSTG
123 {
124     FMTID fmtid;
125     CLSID clsid;
126     DWORD grfFlags;
127     FILETIME mtime;
128     FILETIME ctime;
129     FILETIME atime;
130     DWORD dwOSVersion;
131 };
132
133
134 /*****************************************************************************
135  * STATPROPSTG structure
136  */
137 struct tagSTATPROPSTG
138 {
139     LPOLESTR lpwstrName;
140     PROPID propid;
141     VARTYPE vt;
142 };
143
144
145 /*****************************************************************************
146  * IEnumSTATPROPSETSTG interface
147  */
148 #define ICOM_INTERFACE IEnumSTATPROPSETSTG
149 #define IEnumSTATPROPSETSTG_METHODS \
150     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, STATPROPSETSTG*,rgelt, ULONG*,pceltFethed) \
151     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
152     ICOM_METHOD (HRESULT,Reset) \
153     ICOM_METHOD1(HRESULT,Clone, IEnumSTATPROPSETSTG**,ppenum)
154 #define IEnumSTATPROPSETSTG_IMETHODS \
155                 IUnknown_IMETHODS \
156                 IEnumSTATPROPSETSTG_METHODS
157 ICOM_DEFINE(IEnumSTATPROPSETSTG,IUnknown)
158 #undef ICOM_INTERFACE
159
160 /*** IUnknown methods ***/
161 #define IEnumSTATPROPSETSTG_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
162 #define IEnumSTATPROPSETSTG_AddRef(p)             ICOM_CALL (AddRef,p)
163 #define IEnumSTATPROPSETSTG_Release(p)            ICOM_CALL (Release,p)
164 /*** IEnumSTATPROPSETSTG methods ***/
165 #define IEnumSTATPROPSETSTG_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
166 #define IEnumSTATPROPSETSTG_Skip(p,a)     ICOM_CALL1(Skip,p,a)
167 #define IEnumSTATPROPSETSTG_Reset(p)      ICOM_CALL (Reset,p)
168 #define IEnumSTATPROPSETSTG_Clone(p,a)    ICOM_CALL1(Clone,p,a)
169
170
171 /*****************************************************************************
172  * IEnumSTATPROPSTG interface
173  */
174 #define ICOM_INTERFACE IEnumSTATPROPSTG
175 #define IEnumSTATPROPSTG_METHODS \
176     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, STATPROPSTG*,rgelt, ULONG*,pceltFethed) \
177     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
178     ICOM_METHOD (HRESULT,Reset) \
179     ICOM_METHOD1(HRESULT,Clone, IEnumSTATPROPSTG**,ppenum)
180 #define IEnumSTATPROPSTG_IMETHODS \
181                 IUnknown_IMETHODS \
182                 IEnumSTATPROPSTG_METHODS 
183 ICOM_DEFINE(IEnumSTATPROPSTG,IUnknown)
184 #undef ICOM_INTERFACE
185
186 /*** IUnknown methods ***/
187 #define IEnumSTATPROPSTG_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
188 #define IEnumSTATPROPSTG_AddRef(p)             ICOM_CALL (AddRef,p)
189 #define IEnumSTATPROPSTG_Release(p)            ICOM_CALL (Release,p)
190 /*** IEnumSTATPROPSTG methods ***/
191 #define IEnumSTATPROPSTG_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
192 #define IEnumSTATPROPSTG_Skip(p,a)     ICOM_CALL1(Skip,p,a)
193 #define IEnumSTATPROPSTG_Reset(p)      ICOM_CALL (Reset,p)
194 #define IEnumSTATPROPSTG_Clone(p,a)    ICOM_CALL1(Clone,p,a)
195
196
197 /*****************************************************************************
198  * IPropertySetStorage interface
199  */
200 #define ICOM_INTERFACE IPropertySetStorage
201 #define IPropertySetStorage_METHODS \
202     ICOM_METHOD5(HRESULT,Create, REFFMTID,rfmtid, const CLSID*,pclsid, DWORD,grfFlags, DWORD,grfMode, IPropertyStorage**,ppprstg) \
203     ICOM_METHOD3(HRESULT,Open,   REFFMTID,rfmtid, DWORD,grfMode, IPropertyStorage**,ppprstg) \
204     ICOM_METHOD1(HRESULT,Delete, REFFMTID,rfmtid) \
205     ICOM_METHOD1(HRESULT,Enum,   IEnumSTATPROPSETSTG**,ppenum)
206 #define IPropertySetStorage_IMETHODS \
207                 IUnknown_IMETHODS \
208                 IPropertySetStorage_METHODS
209 ICOM_DEFINE(IPropertySetStorage,IUnknown)
210 #undef ICOM_INTERFACE
211
212 /*** IUnknown methods ***/
213 #define IPropertySetStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
214 #define IPropertySetStorage_AddRef(p)             ICOM_CALL (AddRef,p)
215 #define IPropertySetStorage_Release(p)            ICOM_CALL (Release,p)
216 /*** IPropertySetStorage methods ***/
217 #define IPropertySetStorage_Create(p,a,b,c,d,e) ICOM_CALL5(Create,p,a,b,c,d,e)
218 #define IPropertySetStorage_Open(p,a,b,c)       ICOM_CALL3(Open,p,a,b,c)
219 #define IPropertySetStorage_Delete(p,a)         ICOM_CALL1(Delete,p,a)
220 #define IPropertySetStorage_Enum(p,a)           ICOM_CALL1(Enum,p,a)
221
222
223 /*****************************************************************************
224  * IPropertyStorage interface
225  */
226 typedef struct tagPROPVARIANT PROPVARIANT,*LPPROPVARIANT;
227
228 /* Flags for IPropertySetStorage::Create */
229 #define PROPSETFLAG_DEFAULT     ( 0 )
230 #define PROPSETFLAG_NONSIMPLE   ( 1 )
231 #define PROPSETFLAG_ANSI        ( 2 )
232
233 typedef struct  tagCAUB
234 {
235     ULONG cElems;
236     unsigned char *pElems;
237 } CAUB;
238
239 typedef struct tagCAI
240 {
241     ULONG cElems;
242     short *pElems;
243 } CAI;
244
245 typedef struct tagCAUI
246 {
247     ULONG cElems;
248     USHORT *pElems;
249 } CAUI;
250
251 typedef struct tagCAL
252 {
253     ULONG cElems;
254     long *pElems;
255 } CAL;
256
257 typedef struct tagCAUL
258 {
259     ULONG cElems;
260     ULONG *pElems;
261 } CAUL;
262
263 typedef struct tagCAFLT
264 {
265     ULONG cElems;
266     float *pElems;
267 } CAFLT;
268
269 typedef struct tagCADBL
270 {
271     ULONG cElems;
272     double *pElems;
273 } CADBL;
274
275 typedef struct tagCACY
276 {
277     ULONG cElems;
278     CY *pElems;
279 } CACY;
280
281 typedef struct tagCADATE
282 {
283     ULONG cElems;
284     DATE *pElems;
285 } CADATE;
286
287 typedef struct tagCABSTR
288 {
289     ULONG cElems;
290     BSTR *pElems;
291 } CABSTR;
292
293 typedef struct tagCABOOL
294 {
295     ULONG cElems;
296     VARIANT_BOOL *pElems;
297 } CABOOL;
298
299 typedef struct tagCASCODE
300 {
301     ULONG cElems;
302     SCODE *pElems;
303 } CASCODE;
304
305 typedef struct tagCAPROPVARIANT
306 {
307     ULONG cElems;
308     PROPVARIANT *pElems;
309 } CAPROPVARIANT;
310
311 typedef struct tagCAH
312 {
313     ULONG cElems;
314     LARGE_INTEGER *pElems;
315 } CAH;
316
317 typedef struct tagCAUH
318 {
319     ULONG cElems;
320     ULARGE_INTEGER *pElems;
321 } CAUH;
322
323 typedef struct tagCALPSTR
324 {
325     ULONG cElems;
326     LPSTR *pElems;
327 } CALPSTR;
328
329 typedef struct tagCALPWSTR
330 {
331     ULONG cElems;
332     LPWSTR *pElems;
333 } CALPWSTR;
334
335 typedef struct tagCAFILETIME
336 {
337     ULONG cElems;
338     FILETIME *pElems;
339 } CAFILETIME;
340
341 typedef struct tagCACLIPDATA
342 {
343     ULONG cElems;
344     CLIPDATA *pElems;
345 } CACLIPDATA;
346
347 typedef struct tagCACLSID
348 {
349     ULONG cElems;
350     CLSID *pElems;
351 } CACLSID;
352
353 struct tagPROPVARIANT
354 {
355     VARTYPE vt;
356     WORD wReserved1;
357     WORD wReserved2;
358     WORD wReserved3;
359     union 
360     {
361          /* Empty union arm */ 
362         UCHAR bVal;
363         short iVal;
364         USHORT uiVal;
365         VARIANT_BOOL boolVal;
366 #ifndef __cplusplus
367        /* FIXME: bool is reserved in C++, how can we deal with that ? */
368         _VARIANT_BOOL bool;
369 #endif
370         long lVal;
371         ULONG ulVal;
372         float fltVal;
373         SCODE scode;
374         LARGE_INTEGER hVal;
375         ULARGE_INTEGER uhVal;
376         double dblVal;
377         CY cyVal;
378         DATE date;
379         FILETIME filetime;
380         CLSID *puuid;
381         BLOB blob;
382         CLIPDATA *pclipdata;
383         IStream *pStream;
384         IStorage *pStorage;
385         BSTR bstrVal;
386         LPSTR pszVal;
387         LPWSTR pwszVal;
388         CAUB caub;
389         CAI cai;
390         CAUI caui;
391         CABOOL cabool;
392         CAL cal;
393         CAUL caul;
394         CAFLT caflt;
395         CASCODE cascode;
396         CAH cah;
397         CAUH cauh;
398         CADBL cadbl;
399         CACY cacy;
400         CADATE cadate;
401         CAFILETIME cafiletime;
402         CACLSID cauuid;
403         CACLIPDATA caclipdata;
404         CABSTR cabstr;
405         CALPSTR calpstr;
406         CALPWSTR calpwstr;
407         CAPROPVARIANT capropvar;
408     } u;
409 };
410
411
412 #define ICOM_INTERFACE IPropertyStorage
413 #define IPropertyStorage_METHODS \
414     ICOM_METHOD3(HRESULT,ReadMultiple,        ULONG,cpspec, const PROPSPEC*,rgpspec, PROPVARIANT*,rgpropvar) \
415     ICOM_METHOD4(HRESULT,WriteMultiple,       ULONG,cpspec, const PROPSPEC*,rgpspec, const PROPVARIANT*,rgpropvar, PROPID,propidNameFirst) \
416     ICOM_METHOD2(HRESULT,DeleteMultiple,      ULONG,cpspec, const PROPSPEC*,rgpspec) \
417     ICOM_METHOD2(HRESULT,ReadPropertyNames,   const PROPID*,rgpropid, LPOLESTR*,rglpwstrName) \
418     ICOM_METHOD3(HRESULT,WritePropertyNames,  ULONG,cpropid, const PROPID*,rgpropid, LPOLESTR*,rglpwstrName) \
419     ICOM_METHOD2(HRESULT,DeletePropertyNames, ULONG,cpropid, const PROPID*,rgpropid) \
420     ICOM_METHOD1(HRESULT,Commit,              DWORD,grfCommitFlags) \
421     ICOM_METHOD (HRESULT,Revert) \
422     ICOM_METHOD1(HRESULT,Enum,                IEnumSTATPROPSTG**,ppenum) \
423     ICOM_METHOD3(HRESULT,SetTimes,            const FILETIME*,pctime, const FILETIME*,patime, const FILETIME*,pmtime) \
424     ICOM_METHOD1(HRESULT,SetClass,            REFCLSID,clsid) \
425     ICOM_METHOD1(HRESULT,Stat,                STATPROPSETSTG*,pstatpsstg)
426 #define IPropertyStorage_IMETHODS \
427                 IUnknown_IMETHODS \
428                 IPropertyStorage_METHODS
429 ICOM_DEFINE(IPropertyStorage,IUnknown)
430 #undef ICOM_INTERFACE
431
432 /*** IUnknown methods ***/
433 #define IPropertyStorage_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
434 #define IPropertyStorage_AddRef(p)             ICOM_CALL (AddRef,p)
435 #define IPropertyStorage_Release(p)            ICOM_CALL (Release,p)
436 /*** IPropertyStorage methods ***/
437 #define IPropertyStorage_ReadMultiple(p,a,b,c)       ICOM_CALL3(ReadMultiple,p,a,b,c)
438 #define IPropertyStorage_WriteMultiple(p,a,b,c,d)    ICOM_CALL4(WriteMultiple,p,a,b,c,d)
439 #define IPropertyStorage_DeleteMultiple(p,a,b)       ICOM_CALL2(DeleteMultiple,p,a,b)
440 #define IPropertyStorage_ReadPropertyNames(p,a,b)    ICOM_CALL2(ReadPropertyNames,p,a,b)
441 #define IPropertyStorage_WritePropertyNames(p,a,b,c) ICOM_CALL3(WritePropertyNames,p,a,b,c)
442 #define IPropertyStorage_DeletePropertyNames(p,a,b)  ICOM_CALL2(DeletePropertyNames,p,a,b)
443 #define IPropertyStorage_Commit(p,a)                 ICOM_CALL1(Commit,p,a)
444 #define IPropertyStorage_Revert(p)                   ICOM_CALL (Revert,p)
445 #define IPropertyStorage_Enum(p,a)                   ICOM_CALL1(Enum,p,a)
446 #define IPropertyStorage_SetTimes(p,a,b,c)           ICOM_CALL3(SetTimes,p,a,b,c)
447 #define IPropertyStorage_SetClass(p,a)               ICOM_CALL1(SetClass,p,a)
448 #define IPropertyStorage_Stat(p,a)                   ICOM_CALL1(Stat,p,a)
449
450 #ifdef __cplusplus
451 } /* extern "C" */
452 #endif /* defined(__cplusplus) */
453
454 #endif /* __WINE_WINE_OBJ_PROPERTYSTORAGE_H */