include: Undefine the nameless union/struct macros to avoid conflicts with mingw.
[wine] / include / propidl.idl
1 /*
2  * Copyright 2002 Ove Kaaven
3  * Copyright 2004 Francois Gouget
4  * Copyright 2005 Juan Lang
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef DO_NO_IMPORTS
22 import "objidl.idl";
23 import "oaidl.idl";
24 #endif
25
26 /*
27  * Windows SDK braindamage alert
28  *
29  * PID_DICTIONARY and PID_CODEPAGE are defined by msidefs.h too
30  * PID_SECURITY is defined in msidefs.h with a different value!
31  * So these need to be undefined first.
32  */
33 cpp_quote("#ifdef PID_DICTIONARY")
34 cpp_quote("#undef PID_DICTIONARY")
35 cpp_quote("#endif")
36
37 cpp_quote("#ifdef PID_CODEPAGE")
38 cpp_quote("#undef PID_CODEPAGE")
39 cpp_quote("#endif")
40
41 cpp_quote("#ifdef PID_SECURITY")
42 cpp_quote("#undef PID_SECURITY")
43 cpp_quote("#endif")
44
45 /******************** Property Storage ********************/
46
47 interface IEnumSTATPROPSTG;
48 interface IEnumSTATPROPSETSTG;
49
50 [
51   object,
52   uuid(00000138-0000-0000-C000-000000000046),
53   pointer_default(unique)
54 ]
55 interface IPropertyStorage : IUnknown
56 {
57   typedef [unique] IPropertyStorage *LPPROPERTYSTORAGE;
58
59   const DWORD PROPSETFLAG_DEFAULT = 0;
60   const DWORD PROPSETFLAG_NONSIMPLE = 1;
61   const DWORD PROPSETFLAG_ANSI = 2;
62   const DWORD PROPSETFLAG_UNBUFFERED = 4;
63   const DWORD PROPSETFLAG_CASE_SENSITIVE = 8;
64
65   const DWORD PROPSET_BEHAVIOR_CASE_SENSITIVE = 1;
66
67   const PROPID PID_DICTIONARY          = 0x00000000;
68   const PROPID PID_CODEPAGE            = 0x00000001;
69   const PROPID PID_FIRST_USABLE        = 0x00000002;
70   const PROPID PID_FIRST_NAME_DEFAULT  = 0x00000fff;
71   const PROPID PID_LOCALE              = 0x80000000;
72   const PROPID PID_MODIFY_TIME         = 0x80000001;
73   const PROPID PID_SECURITY            = 0x80000002;
74   const PROPID PID_BEHAVIOR            = 0x80000003;
75   const PROPID PID_ILLEGAL             = 0xffffffff;
76   const PROPID PID_MIN_READONLY        = 0x80000000;
77   const PROPID PID_MAX_READONLY        = 0xbfffffff;
78
79   typedef struct tagPROPVARIANT PROPVARIANT;
80
81 #define TYPEDEF_CA(type, name) \
82     typedef struct tag##name { \
83       ULONG cElems; \
84       [size_is(cElems)] \
85       type *pElems; \
86     } name
87
88   TYPEDEF_CA(unsigned char, CAUB);
89   TYPEDEF_CA(short, CAI);
90   TYPEDEF_CA(USHORT, CAUI);
91   TYPEDEF_CA(long, CAL);
92   TYPEDEF_CA(ULONG, CAUL);
93   TYPEDEF_CA(float, CAFLT);
94   TYPEDEF_CA(double, CADBL);
95   TYPEDEF_CA(CY, CACY);
96   TYPEDEF_CA(DATE, CADATE);
97   TYPEDEF_CA(BSTR, CABSTR);
98   TYPEDEF_CA(BSTRBLOB, CABSTRBLOB);
99   TYPEDEF_CA(VARIANT_BOOL, CABOOL);
100   TYPEDEF_CA(SCODE,  CASCODE);
101   TYPEDEF_CA(PROPVARIANT, CAPROPVARIANT);
102   TYPEDEF_CA(LARGE_INTEGER, CAH);
103   TYPEDEF_CA(ULARGE_INTEGER, CAUH);
104   TYPEDEF_CA(LPSTR, CALPSTR);
105   TYPEDEF_CA(LPWSTR, CALPWSTR);
106   TYPEDEF_CA(FILETIME, CAFILETIME);
107   TYPEDEF_CA(CLIPDATA, CACLIPDATA);
108   TYPEDEF_CA(CLSID, CACLSID);
109
110   struct tagPROPVARIANT {
111     VARTYPE vt;
112     WORD wReserved1;
113     WORD wReserved2;
114     WORD wReserved3;
115     [switch_is(vt & 0x1fff)] union {
116     [case(VT_EMPTY, VT_NULL)]             ;
117     [case(VT_I1)]                         char cVal;
118     [case(VT_UI1)]                        UCHAR bVal;
119     [case(VT_I2)]                         short iVal;
120     [case(VT_UI2)]                        USHORT uiVal;
121     [case(VT_BOOL)]                       VARIANT_BOOL boolVal;
122 #if 0 /* illegal in C++ */
123     [case(VT_ILLEGAL)]                    _VARIANT_BOOL bool;
124 #endif
125     [case(VT_I4)]                         long lVal;
126     [case(VT_UI4)]                        ULONG ulVal;
127     [case(VT_R4)]                         float fltVal;
128     [case(VT_ERROR)]                      SCODE scode;
129     [case(VT_I8)]                         LARGE_INTEGER hVal;
130     [case(VT_UI8)]                        ULARGE_INTEGER uhVal;
131     [case(VT_R8)]                         double dblVal;
132     [case(VT_CY)]                         CY cyVal;
133     [case(VT_DATE)]                       DATE date;
134     [case(VT_FILETIME)]                   FILETIME filetime;
135     [case(VT_CLSID)]                      CLSID *puuid;
136     [case(VT_BLOB, VT_BLOB_OBJECT)]       BLOB blob;
137     [case(VT_CF)]                         CLIPDATA *pclipdata;
138     [case(VT_STREAM, VT_STREAMED_OBJECT)] IStream *pStream;
139     [case(VT_STORAGE, VT_STORED_OBJECT)]  IStorage *pStorage;
140     [case(VT_BSTR)]                       BSTR bstrVal;
141     [case(VT_BSTR_BLOB)]                  BSTRBLOB bstrblobVal;
142     [case(VT_LPSTR)]                      LPSTR pszVal;
143     [case(VT_LPWSTR)]                     LPWSTR pwszVal;
144     [case(VT_UI1|VT_VECTOR)]              CAUB caub;
145     [case(VT_I2|VT_VECTOR)]               CAI cai;
146     [case(VT_UI2|VT_VECTOR)]              CAUI caui;
147     [case(VT_BOOL|VT_VECTOR)]             CABOOL cabool;
148     [case(VT_I4|VT_VECTOR)]               CAL cal;
149     [case(VT_UI4|VT_VECTOR)]              CAUL caul;
150     [case(VT_R4|VT_VECTOR)]               CAFLT caflt;
151     [case(VT_ERROR|VT_VECTOR)]            CASCODE cascode;
152     [case(VT_I8|VT_VECTOR)]               CAH cah;
153     [case(VT_UI8|VT_VECTOR)]              CAUH cauh;
154     [case(VT_R8|VT_VECTOR)]               CADBL cadbl;
155     [case(VT_CY|VT_VECTOR)]               CACY cacy;
156     [case(VT_DATE|VT_VECTOR)]             CADATE cadate;
157     [case(VT_FILETIME|VT_VECTOR)]         CAFILETIME cafiletime;
158     [case(VT_CLSID|VT_VECTOR)]            CACLSID cauuid;
159     [case(VT_CF|VT_VECTOR)]               CACLIPDATA caclipdata;
160     [case(VT_BSTR|VT_VECTOR)]             CABSTR cabstr;
161     [case(VT_BSTR_BLOB|VT_VECTOR)]        CABSTRBLOB cabstrblob;
162     [case(VT_LPSTR|VT_VECTOR)]            CALPSTR calpstr;
163     [case(VT_LPWSTR|VT_VECTOR)]           CALPWSTR calpwstr;
164     [case(VT_VARIANT|VT_VECTOR)]          CAPROPVARIANT capropvar;
165     [case(VT_ARRAY|VT_I1,
166           VT_ARRAY|VT_UI1,
167           VT_ARRAY|VT_I2,
168           VT_ARRAY|VT_UI2,
169           VT_ARRAY|VT_I4,
170           VT_ARRAY|VT_UI4,
171           VT_ARRAY|VT_INT,
172           VT_ARRAY|VT_UINT,
173           VT_ARRAY|VT_R4,
174           VT_ARRAY|VT_R8,
175           VT_ARRAY|VT_CY,
176           VT_ARRAY|VT_DATE,
177           VT_ARRAY|VT_BSTR,
178           VT_ARRAY|VT_BOOL,
179           VT_ARRAY|VT_DECIMAL,
180           VT_ARRAY|VT_DISPATCH,
181           VT_ARRAY|VT_UNKNOWN,
182           VT_ARRAY|VT_ERROR,
183           VT_ARRAY|VT_VARIANT)]           LPSAFEARRAY parray;
184     [case(VT_BYREF|VT_I1)]                CHAR *pcVal;
185     [case(VT_BYREF|VT_UI1)]               UCHAR *pbVal;
186     [case(VT_BYREF|VT_I2)]                SHORT *piVal;
187     [case(VT_BYREF|VT_UI2)]               USHORT *puiVal;
188     [case(VT_BYREF|VT_I4)]                LONG *plVal;
189     [case(VT_BYREF|VT_UI4)]               ULONG *pulVal;
190     [case(VT_BYREF|VT_INT)]               INT *pintVal;
191     [case(VT_BYREF|VT_UINT)]              UINT *puintVal;
192     [case(VT_BYREF|VT_R4)]                FLOAT *pfltVal;
193     [case(VT_BYREF|VT_R8)]                DOUBLE *pdblVal;
194     [case(VT_BYREF|VT_BOOL)]              VARIANT_BOOL *pboolVal;
195     [case(VT_BYREF|VT_DECIMAL)]           DECIMAL *pdecVal;
196     [case(VT_BYREF|VT_ERROR)]             SCODE *pscode;
197     [case(VT_BYREF|VT_CY)]                CY *pcyVal;
198     [case(VT_BYREF|VT_DATE)]              DATE *pdate;
199     [case(VT_BYREF|VT_BSTR)]              BSTR *pbstrVal;
200     [case(VT_BYREF|VT_UNKNOWN)]           IUnknown **ppunkVal;
201     [case(VT_BYREF|VT_DISPATCH)]          IDispatch **ppdispVal;
202     [case(VT_BYREF|VT_ARRAY)]             LPSAFEARRAY *pparray;
203     [case(VT_BYREF|VT_VARIANT)]           PROPVARIANT *pvarVal;
204     } DUMMYUNIONNAME;
205   };
206
207   typedef struct tagPROPVARIANT *LPPROPVARIANT;
208
209   cpp_quote("#if 0")
210   typedef const PROPVARIANT * REFPROPVARIANT;
211   cpp_quote("#endif")
212   cpp_quote("#ifndef _REFPROPVARIANT_DEFINED")
213   cpp_quote("#define _REFPROPVARIANT_DEFINED")
214   cpp_quote("#ifdef __cplusplus")
215   cpp_quote("#define REFPROPVARIANT const PROPVARIANT &")
216   cpp_quote("#else")
217   cpp_quote("#define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST")
218   cpp_quote("#endif")
219   cpp_quote("#endif")
220
221   cpp_quote("#define PIDDI_THUMBNAIL 0x00000002L /* VT_BLOB */")
222   cpp_quote("")
223   cpp_quote("#define PIDSI_TITLE        0x00000002L /* VT_LPSTR */")
224   cpp_quote("#define PIDSI_SUBJECT      0x00000003L /* VT_LPSTR */")
225   cpp_quote("#define PIDSI_AUTHOR       0x00000004L /* VT_LPSTR */")
226   cpp_quote("#define PIDSI_KEYWORDS     0x00000005L /* VT_LPSTR */")
227   cpp_quote("#define PIDSI_COMMENTS     0x00000006L /* VT_LPSTR */")
228   cpp_quote("#define PIDSI_TEMPLATE     0x00000007L /* VT_LPSTR */")
229   cpp_quote("#define PIDSI_LASTAUTHOR   0x00000008L /* VT_LPSTR */")
230   cpp_quote("#define PIDSI_REVNUMBER    0x00000009L /* VT_LPSTR */")
231   cpp_quote("#define PIDSI_EDITTIME     0x0000000AL /* VT_FILETIME (UTC) */")
232   cpp_quote("#define PIDSI_LASTPRINTED  0x0000000BL /* VT_FILETIME (UTC) */")
233   cpp_quote("#define PIDSI_CREATE_DTM   0x0000000CL /* VT_FILETIME (UTC) */")
234   cpp_quote("#define PIDSI_LASTSAVE_DTM 0x0000000DL /* VT_FILETIME (UTC) */")
235   cpp_quote("#define PIDSI_PAGECOUNT    0x0000000EL /* VT_I4 */")
236   cpp_quote("#define PIDSI_WORDCOUNT    0x0000000FL /* VT_I4 */")
237   cpp_quote("#define PIDSI_CHARCOUNT    0x00000010L /* VT_I4 */")
238   cpp_quote("#define PIDSI_THUMBNAIL    0x00000011L /* VT_CF */")
239   cpp_quote("#define PIDSI_APPNAME      0x00000012L /* VT_LPSTR */")
240   cpp_quote("#define PIDSI_DOC_SECURITY 0x00000013L /* VT_I4 */")
241   cpp_quote("")
242   cpp_quote("#define PIDDSI_CATEGORY    0x00000002L /* VT_LPSTR */")
243   cpp_quote("#define PIDDSI_PRESFORMAT  0x00000003L /* VT_LPSTR */")
244   cpp_quote("#define PIDDSI_BYTECOUNT   0x00000004L /* VT_I4 */")
245   cpp_quote("#define PIDDSI_LINECOUNT   0x00000005L /* VT_I4 */")
246   cpp_quote("#define PIDDSI_PARCOUNT    0x00000006L /* VT_I4 */")
247   cpp_quote("#define PIDDSI_SLIDECOUNT  0x00000007L /* VT_I4 */")
248   cpp_quote("#define PIDDSI_NOTECOUNT   0x00000008L /* VT_I4 */")
249   cpp_quote("#define PIDDSI_HIDDENCOUNT 0x00000009L /* VT_I4 */")
250   cpp_quote("#define PIDDSI_MMCLIPCOUNT 0x0000000AL /* VT_I4 */")
251   cpp_quote("#define PIDDSI_SCALE       0x0000000BL /* VT_BOOL */")
252   cpp_quote("#define PIDDSI_HEADINGPAIR 0x0000000CL /* VT_VARIANT|VT_VECTOR */")
253   cpp_quote("#define PIDDSI_DOCPARTS    0x0000000DL /* VT_LPSTR|VT_VECTOR */")
254   cpp_quote("#define PIDDSI_MANAGER     0x0000000EL /* VT_LPSTR */")
255   cpp_quote("#define PIDDSI_COMPANY     0x0000000FL /* VT_LPSTR */")
256   cpp_quote("#define PIDDSI_LINKSDIRTY  0x00000010L /* VT_B0OL */")
257
258   const ULONG PRSPEC_INVALID = 0xffffffff;
259   const ULONG PRSPEC_LPWSTR = 0;
260   const ULONG PRSPEC_PROPID = 1;
261
262   typedef struct tagPROPSPEC {
263     ULONG ulKind;
264     [switch_is(ulKind)] union {
265     [case(PRSPEC_PROPID)] PROPID propid;
266     [case(PRSPEC_LPWSTR)] LPOLESTR lpwstr;
267     [default]             ;
268     } DUMMYUNIONNAME;
269   } PROPSPEC;
270
271   typedef struct tagSTATPROPSTG {
272     LPOLESTR lpwstrName;
273     PROPID propid;
274     VARTYPE vt;
275   } STATPROPSTG;
276
277   cpp_quote("/* Macros for dwOSVersion member of STATPROPSETSTG */")
278   cpp_quote("#define PROPSETHDR_OSVER_KIND(dwOSVer)  HIWORD((dwOSVer))")
279   cpp_quote("#define PROPSETHDR_OSVER_MAJOR(dwOSVer) LOBYTE(LOWORD((dwOSVer)))")
280   cpp_quote("#define PROPSETHDR_OSVER_MINOR(dwOSVer) HIBYTE(LOWORD((dwOSVer)))")
281   cpp_quote("#define PROPSETHDR_OSVERSION_UNKNOWN    0xffffffff")
282
283   typedef struct tagSTATPROPSETSTG {
284     FMTID fmtid;
285     CLSID clsid;
286     DWORD grfFlags;
287     FILETIME mtime;
288     FILETIME ctime;
289     FILETIME atime;
290     DWORD dwOSVersion;
291   } STATPROPSETSTG;
292
293   HRESULT ReadMultiple(
294     [in] ULONG cpspec,
295     [in, size_is(cpspec)] const PROPSPEC rgpspec[],
296     [out, size_is(cpspec)] PROPVARIANT rgpropvar[]);
297
298   HRESULT WriteMultiple(
299     [in] ULONG cpspec,
300     [in, size_is(cpspec)] const PROPSPEC rgpspec[],
301     [in, size_is(cpspec)] const PROPVARIANT rgpropvar[],
302     [in] PROPID propidNameFirst);
303
304   HRESULT DeleteMultiple(
305     [in] ULONG cpspec,
306     [in, size_is(cpspec)] const PROPSPEC rgpspec[]);
307
308   HRESULT ReadPropertyNames(
309     [in] ULONG cpropid,
310     [in, size_is(cpropid)] const PROPID rgpropid[],
311     [out, size_is(cpropid)] LPOLESTR rglpwstrName[]);
312
313   HRESULT WritePropertyNames(
314     [in] ULONG cpropid,
315     [in, size_is(cpropid)] const PROPID rgpropid[],
316     [in, size_is(cpropid)] const LPOLESTR rglpwstrName[]);
317
318   HRESULT DeletePropertyNames(
319     [in] ULONG cpropid,
320     [in, size_is(cpropid)] const PROPID rgpropid[]);
321
322   HRESULT Commit(
323     [in] DWORD grfCommitFlags);
324
325   HRESULT Revert();
326
327   HRESULT Enum(
328     [out] IEnumSTATPROPSTG **ppenum);
329
330   HRESULT SetTimes(
331     [in] const FILETIME *pctime,
332     [in] const FILETIME *patime,
333     [in] const FILETIME *pmtime);
334
335   HRESULT SetClass(
336     [in] REFCLSID clsid);
337
338   HRESULT Stat(
339     [out] STATPROPSETSTG *statpsstg);
340 }
341
342 [
343   object,
344   uuid(0000013A-0000-0000-C000-000000000046),
345   pointer_default(unique)
346 ]
347 interface IPropertySetStorage : IUnknown
348 {
349   typedef [unique] IPropertySetStorage *LPPROPERTYSETSTORAGE;
350
351   HRESULT Create(
352     [in] REFFMTID rfmtid,
353     [in, unique] const CLSID *pclsid,
354     [in] DWORD grfFlags,
355     [in] DWORD grfMode,
356     [out] IPropertyStorage **ppprstg);
357
358   HRESULT Open(
359     [in] REFFMTID rfmtid,
360     [in] DWORD grfMode,
361     [out] IPropertyStorage **ppprstg);
362
363   HRESULT Delete(
364     [in] REFFMTID rfmtid);
365
366   HRESULT Enum(
367     [out] IEnumSTATPROPSETSTG **ppenum);
368 }
369
370 [
371   object,
372   uuid(00000139-0000-0000-C000-000000000046),
373   pointer_default(unique)
374 ]
375 interface IEnumSTATPROPSTG : IUnknown
376 {
377   typedef [unique] IEnumSTATPROPSTG *LPENUMSTATPROPSTG;
378
379   [local]
380   HRESULT Next(
381     [in] ULONG celt,
382     [out, size_is(celt), length_is(*pceltFetched)]
383     STATPROPSTG *rgelt,
384     [out] ULONG *pceltFetched);
385
386   [call_as(Next)]
387   HRESULT RemoteNext(
388     [in] ULONG celt,
389     [out, size_is(celt), length_is(*pceltFetched)]
390     STATPROPSTG *rgelt,
391     [out] ULONG *pceltFetched);
392
393   HRESULT Skip(
394     [in] ULONG celt);
395
396   HRESULT Reset();
397
398   HRESULT Clone(
399     [out] IEnumSTATPROPSTG **ppenum);
400 }
401
402 [
403   object,
404   uuid(0000013B-0000-0000-C000-000000000046),
405   pointer_default(unique)
406 ]
407 interface IEnumSTATPROPSETSTG : IUnknown
408 {
409   typedef [unique] IEnumSTATPROPSETSTG *LPENUMSTATPROPSETSTG;
410
411   [local]
412   HRESULT Next(
413     [in] ULONG celt,
414     [out, size_is(celt), length_is(*pceltFetched)]
415     STATPROPSETSTG *rgelt,
416     [out] ULONG *pceltFetched);
417
418   [call_as(Next)]
419   HRESULT RemoteNext(
420     [in] ULONG celt,
421     [out, size_is(celt), length_is(*pceltFetched)]
422     STATPROPSETSTG *rgelt,
423     [out] ULONG *pceltFetched);
424
425   HRESULT Skip(
426     [in] ULONG celt);
427
428   HRESULT Reset();
429
430   HRESULT Clone(
431     [out] IEnumSTATPROPSETSTG **ppenum);
432 }
433
434
435 cpp_quote("HRESULT WINAPI FreePropVariantArray(ULONG,PROPVARIANT*);")
436 cpp_quote("HRESULT WINAPI PropVariantClear(PROPVARIANT*);")
437 cpp_quote("HRESULT WINAPI PropVariantCopy(PROPVARIANT*,const PROPVARIANT*);")
438 cpp_quote("")
439 cpp_quote("#define _PROPVARIANT_INIT_DEFINED_")
440 cpp_quote("#define PropVariantInit(p) memset((p), 0, sizeof(PROPVARIANT))")
441 cpp_quote("")
442 cpp_quote("#ifndef _STGCREATEPROPSTG_DEFINED_")
443 cpp_quote("#define _STGCREATEPROPSTG_DEFINED_")
444 cpp_quote("HRESULT WINAPI StgCreatePropStg(IUnknown *, REFFMTID, const CLSID *, DWORD, DWORD, IPropertyStorage **);")
445 cpp_quote("HRESULT WINAPI StgOpenPropStg(IUnknown *, REFFMTID, DWORD, DWORD, IPropertyStorage **);")
446 cpp_quote("HRESULT WINAPI StgCreatePropSetStg(IStorage *, DWORD, IPropertySetStorage **);")
447 cpp_quote("#define CCH_MAX_PROPSTG_NAME 31")
448 cpp_quote("HRESULT WINAPI FmtIdToPropStgName(const FMTID *, LPOLESTR);")
449 cpp_quote("HRESULT WINAPI PropStgNameToFmtId(const LPOLESTR, FMTID *);")
450 cpp_quote("#endif /* _STGCREATEPROPSTG_DEFINED_ */")
451 cpp_quote("")