1/*
2 * Copyright (C) 2005 Robert Shearman
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 *
18 */
19
20#pragma makedep ident
21#pragma makedep typelib
22
23import "ocidl.idl";
24
25enum IWidget_dispids
26{
27    DISPID_TM_NAME = 1,
28    DISPID_TM_DOSOMETHING,
29    DISPID_TM_STATE,
30    DISPID_TM_MAP,
31    DISPID_TM_SETOLECOLOR,
32    DISPID_TM_GETOLECOLOR,
33    DISPID_TM_CLONE,
34    DISPID_TM_CLONEDISPATCH,
35    DISPID_TM_CLONECOCLASS,
36    DISPID_TM_VALUE,
37    DISPID_TM_VARARRAYPTR,
38    DISPID_TM_VARARG,
39    DISPID_TM_ERROR,
40    DISPID_TM_CLONEINTERFACE,
41    DISPID_TM_TESTDUAL,
42    DISPID_TM_PROP_WITH_LCID,
43    DISPID_TM_PROP_INT,
44    DISPID_TM_PROP_UINT,
45    DISPID_TM_BYREF_UINT,
46    DISPID_TM_PROP_OPT_ARG,
47    DISPID_TM_PROP_REQ_ARG,
48    DISPID_TM_RESTRICTED,
49    DISPID_TM_TESTSECONDIFACE,
50    DISPID_TM_VARARG_RUN,
51    DISPID_TM_VARARG_REF_RUN,
52
53    DISPID_TM_BASETYPES_IN,
54    DISPID_TM_BASETYPES_OUT,
55    DISPID_TM_FLOAT_ABI,
56    DISPID_TM_INT_PTR,
57    DISPID_TM_INT_PTR_PTR,
58    DISPID_TM_IFACE_IN,
59    DISPID_TM_IFACE_OUT,
60    DISPID_TM_IFACE_PTR,
61    DISPID_TM_BSTR,
62    DISPID_TM_VARIANT,
63    DISPID_TM_SAFEARRAY,
64    DISPID_TM_STRUCT,
65    DISPID_TM_STRUCT_PTR_PTR,
66    DISPID_TM_THIN_STRUCT,
67    DISPID_TM_RECT,
68    DISPID_TM_ARRAY,
69    DISPID_TM_VARIANT_ARRAY,
70    DISPID_TM_STRUCT_ARRAY,
71    DISPID_TM_TYPEDEF,
72    DISPID_TM_COCLASS,
73    DISPID_TM_COCLASS_PTR,
74};
75
76static const int DISPID_TM_NEG_RESTRICTED = -26;
77
78enum INonOleAutomation_dispids
79{
80    DISPID_NOA_BSTRRET = 1,
81    DISPID_NOA_ERROR
82};
83
84[
85  uuid(d96d8a3e-78b6-4c8d-8f27-059db959be8a),
86  version(2.5),
87  helpstring("Test Typelib")
88]
89library TestTypelib
90{
91    importlib("stdole2.tlb");
92
93    typedef enum tagSTATE
94    {
95        STATE_UNWIDGETIFIED = 1,
96        STATE_WIDGETIFIED
97    } STATE;
98
99    typedef struct tagMYSTRUCT
100    {
101        INT field1;
102        ULONGLONG field2;
103        UINT uarr[8];
104    } MYSTRUCT;
105
106    typedef [public] int myint_t;
107
108    coclass ApplicationObject2;
109
110    [
111        odl,
112        oleautomation,
113        uuid(12345678-1234-4321-1234-121212121212)
114    ]
115    interface ISomethingFromDispatch : IDispatch
116    {
117        HRESULT anotherfn(void);
118    }
119
120    [
121        odl,
122        oleautomation,
123        dual,
124        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c7967)
125    ]
126    interface ItestDual : IDispatch
127    {
128        HRESULT test();
129    }
130
131    [
132        odl,
133        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c7968)
134    ]
135    interface ITestSecondIface : IUnknown
136    {
137        HRESULT test();
138    }
139
140    [
141        odl,
142        oleautomation,
143        dual,
144        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c7969)
145    ]
146    interface ITestSecondDisp : IDispatch
147    {
148        HRESULT test();
149    }
150
151    [
152        oleautomation,
153        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c796a)
154    ]
155    interface ICoclass1 : IDispatch
156    {
157        HRESULT test();
158    }
159
160    [
161        oleautomation,
162        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c796b)
163    ]
164    interface ICoclass2 : IDispatch
165    {
166        HRESULT test();
167    }
168
169    [
170        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c796c)
171    ]
172    coclass Coclass1
173    {
174        [default] interface ICoclass1;
175        interface ICoclass2;
176    }
177
178    [
179        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c796d)
180    ]
181    coclass Coclass2
182    {
183        interface ICoclass1;
184        [default] interface ICoclass2;
185    }
186
187    [
188        uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c796e)
189    ]
190    coclass Coclass3
191    {
192        interface ICoclass1;
193        interface ICoclass2;
194    }
195
196    [
197        odl,
198        uuid(a1f8cae3-c947-4c5f-b57d-c87b9b5f3586),
199        oleautomation,
200        dual
201    ]
202    interface IWidget : IDispatch
203    {
204        [propput, id(DISPID_TM_NAME)]
205        HRESULT Name([in] BSTR name);
206        [propget, id(DISPID_TM_NAME)]
207        HRESULT Name([out, retval] BSTR *name);
208
209        [id(DISPID_TM_DOSOMETHING)]
210        HRESULT DoSomething([in] double number, [out] BSTR *str1, [in, defaultvalue("")] BSTR str2, [in, optional] VARIANT *opt);
211
212        [propget, id(DISPID_TM_STATE)]
213        HRESULT State([out, retval] STATE *state);
214        [propput, id(DISPID_TM_STATE)]
215        HRESULT State([in] STATE state);
216
217        [id(DISPID_TM_MAP)]
218        HRESULT Map([in] BSTR bstrId, [out, retval] BSTR *sValue);
219
220        [id(DISPID_TM_SETOLECOLOR)]
221        HRESULT SetOleColor([in] OLE_COLOR val);
222
223        [id(DISPID_TM_GETOLECOLOR)]
224        HRESULT GetOleColor([out, retval] OLE_COLOR *pVal);
225
226        [propget, id(DISPID_TM_CLONE)]
227        HRESULT Clone([out, retval] IWidget **ppVal);
228
229        [propget, id(DISPID_TM_CLONEDISPATCH)]
230        HRESULT CloneDispatch([out, retval] IDispatch **ppVal);
231
232        [propget, id(DISPID_TM_CLONECOCLASS)]
233        HRESULT CloneCoclass([out, retval] ApplicationObject2 **ppVal);
234
235        [propget, id(DISPID_VALUE)]
236        HRESULT Value([in] VARIANT *value, [out, retval] VARIANT *retval);
237
238        [id(DISPID_TM_VARARRAYPTR)]
239        HRESULT VariantArrayPtr([in] SAFEARRAY(VARIANT) *values);
240
241        [vararg, id(DISPID_TM_VARARG)]
242        HRESULT VarArg([in] int numexpect, [in] SAFEARRAY(VARIANT) values);
243
244        [id(DISPID_TM_ERROR)]
245        HRESULT Error();
246
247        [propget, id(DISPID_TM_CLONEINTERFACE)]
248        HRESULT CloneInterface([out, retval] ISomethingFromDispatch **ppVal);
249
250        [id(DISPID_TM_PROP_WITH_LCID), propput]
251        HRESULT prop_with_lcid([in,lcid] long lcid, [in] INT i);
252
253        [id(DISPID_TM_PROP_WITH_LCID), propget]
254        HRESULT prop_with_lcid([in,lcid] long lcid, [out,retval] INT *i);
255
256        [id(DISPID_TM_PROP_INT), propget]
257        HRESULT prop_int([out,retval] INT *i);
258
259        [id(DISPID_TM_PROP_UINT), propget]
260        HRESULT prop_uint([out,retval] UINT *i);
261
262        [id(DISPID_TM_BYREF_UINT)]
263        HRESULT ByRefUInt([in, out] UINT *i);
264
265        [id(DISPID_TM_PROP_OPT_ARG), propput]
266        HRESULT prop_opt_arg([in,optional] INT opt, [in] INT i);
267
268        [id(DISPID_TM_PROP_REQ_ARG), propput]
269        HRESULT prop_req_arg([in] INT req, [in] INT i);
270
271        [id(DISPID_TM_RESTRICTED), restricted]
272        HRESULT pos_restrict([out, retval] INT *i);
273
274        [id(DISPID_TM_NEG_RESTRICTED), restricted]
275        HRESULT neg_restrict([out, retval] INT *i);
276
277        [id(DISPID_TM_VARARG_RUN), vararg]
278        HRESULT VarArg_Run([in] BSTR name, [in] SAFEARRAY(VARIANT) params, [out, retval] VARIANT *result);
279
280        [id(DISPID_TM_VARARG_REF_RUN), vararg]
281        HRESULT VarArg_Ref_Run([in] BSTR name, [in] SAFEARRAY(VARIANT) *params, [out, retval] VARIANT *result);
282
283        [id(DISPID_TM_BASETYPES_IN)]
284        HRESULT basetypes_in([in] signed char c, [in] short s, [in] int i, [in] hyper h,
285                [in] unsigned char uc, [in] unsigned short us, [in] unsigned int ui,
286                [in] unsigned hyper uh, [in] float f, [in] double d, [in] STATE st);
287
288        [id(DISPID_TM_BASETYPES_OUT)]
289        HRESULT basetypes_out([out] signed char *c, [out] short *s, [out] int *i, [out] hyper *h,
290                [out] unsigned char *uc, [out] unsigned short *us, [out] unsigned int *ui,
291                [out] unsigned hyper *uh, [out] float *f, [out] double *d, [out] STATE *st);
292
293        [id(DISPID_TM_FLOAT_ABI)]
294        HRESULT float_abi([in] float f, [in] double d, [in] int i, [in] float f2, [in] double d2);
295
296        [id(DISPID_TM_INT_PTR)]
297        HRESULT int_ptr([in] int *in, [out] int *out, [in, out] int *in_out);
298
299        [id(DISPID_TM_INT_PTR_PTR)]
300        HRESULT int_ptr_ptr([in] int **in, [out] int **out, [in, out] int **in_out);
301
302        [id(DISPID_TM_IFACE_IN)]
303        HRESULT iface_in([in] IUnknown *unk, [in] IDispatch *disp, [in] ISomethingFromDispatch *sfd);
304
305        [id(DISPID_TM_IFACE_OUT)]
306        HRESULT iface_out([out] IUnknown **unk, [out] IDispatch **disp, [out] ISomethingFromDispatch **sfd);
307
308        [id(DISPID_TM_IFACE_PTR)]
309        HRESULT iface_ptr([in] ISomethingFromDispatch **in, [out] ISomethingFromDispatch **out, [in, out] ISomethingFromDispatch **in_out);
310
311        [id(DISPID_TM_BSTR)]
312        HRESULT bstr([in] BSTR in, [out] BSTR *out, [in] BSTR *in_ptr, [in, out] BSTR *in_out);
313
314        [id(DISPID_TM_VARIANT)]
315        HRESULT variant([in] VARIANT in, [out] VARIANT *out, [in] VARIANT *in_ptr, [in, out] VARIANT *in_out);
316
317        [id(DISPID_TM_SAFEARRAY)]
318        HRESULT safearray([in] SAFEARRAY(int) in, [out] SAFEARRAY(int) *out, [in] SAFEARRAY(int) *in_ptr, [in, out] SAFEARRAY(int) *in_out);
319
320        [id(DISPID_TM_STRUCT)]
321        HRESULT mystruct([in] MYSTRUCT in, [out] MYSTRUCT *out, [in] MYSTRUCT *in_ptr, [in, out] MYSTRUCT *in_out);
322
323        [id(DISPID_TM_STRUCT_PTR_PTR)]
324        HRESULT mystruct_ptr_ptr([in] MYSTRUCT **in);
325
326        struct thin
327        {
328            short a;
329            char b;
330        };
331
332        [id(DISPID_TM_THIN_STRUCT)]
333        HRESULT thin_struct([in] struct thin in);
334
335        [id(DISPID_TM_RECT)]
336        HRESULT rect([in] RECT in, [out] RECT *out, [in] RECT *in_ptr, [in, out] RECT *in_out);
337
338        typedef int array_t[4];
339
340        [id(DISPID_TM_ARRAY)]
341        HRESULT array([in] array_t in, [out] array_t out, [in, out] array_t in_out);
342
343        [id(DISPID_TM_VARIANT_ARRAY)]
344        HRESULT variant_array([in] VARIANT in[2], [out] VARIANT out[2], [in, out] VARIANT in_out[2]);
345
346        [id(DISPID_TM_STRUCT_ARRAY)]
347        HRESULT mystruct_array([in] MYSTRUCT in[2]);
348
349        [id(DISPID_TM_TYPEDEF)]
350        HRESULT myint([in] myint_t val, [in] myint_t *ptr, [in] myint_t **ptr_ptr);
351
352        [id(DISPID_TM_COCLASS)]
353        HRESULT Coclass([in] Coclass1 *class1, [in] Coclass2 *class2, [in] Coclass3 *class3);
354
355        [id(DISPID_TM_COCLASS_PTR)]
356        HRESULT Coclass_ptr([in] Coclass1 **in, [out] Coclass1 **out, [in, out] Coclass1 **in_out);
357    }
358
359    [
360        odl,
361        uuid(a1f8cae3-c947-3c5f-a57c-c88b9b6f3586),
362        oleautomation,
363        dual
364    ]
365    interface IStaticWidget : IDispatch
366    {
367        [id(DISPID_TM_TESTDUAL)]
368        HRESULT TestDual([in] ItestDual *p);
369
370        [id(DISPID_TM_TESTSECONDIFACE)]
371        HRESULT TestSecondIface([in] ITestSecondIface *p);
372    }
373
374    [
375        odl,
376        uuid(a028db05-30f0-4b93-b17a-41c72f831d84),
377        dual,
378        oleautomation
379    ]
380    interface IKindaEnumWidget : IUnknown
381    {
382        HRESULT Next(
383                     [out] IWidget **widget);
384
385        HRESULT Count(
386                      [out] unsigned long *count);
387
388        HRESULT Reset();
389
390        HRESULT Clone(
391                      [out] IKindaEnumWidget **ppenum);
392    }
393
394    [
395        odl,
396        uuid(a028db06-30f0-4b93-b17a-41c72f831d84),
397    ]
398    interface INonOleAutomation : IUnknown
399    {
400        [id(DISPID_NOA_BSTRRET)]
401        BSTR BstrRet();
402
403        [id(DISPID_NOA_ERROR)]
404        HRESULT Error();
405    }
406
407
408    [
409        dllname("comm.drv"),
410        uuid(d377f60b-8639-4261-8ee7-75c8340d2cc9),
411    ]
412    module BadModule
413    {
414        [
415            entry("Foo"),
416        ]
417        HRESULT BadModuleFoo();
418    };
419
420    [
421        dllname("oleaut32.dll"),
422        uuid(d377f60c-8639-4261-8ee7-75c8340d2cc9),
423    ]
424    module BadEntry
425    {
426        [
427            entry("Foo"),
428        ]
429        HRESULT BadEntryFoo();
430    };
431
432    [
433        uuid(bb171948-10ec-407a-9a57-2f85f797ff1a),
434        appobject,
435    ]
436    coclass ApplicationObject2
437    {
438        interface IWidget;
439        [source] interface IWidget;
440    };
441
442    [
443        odl,
444        uuid(375f8a9d-33d0-44f3-b972-61f8407899e0)
445    ]
446        interface ItestIF1 : IUnknown
447    {
448        HRESULT fn1([in] int x);
449        HRESULT fn2([out,retval] int *x);
450    }
451
452    [
453        odl,
454        uuid(094056a3-666f-4956-be12-1859668310b8)
455    ]
456    interface ItestIF2 : ItestIF1
457    {
458        HRESULT fn3([in] int y);
459    }
460
461    [
462        odl,
463        uuid(33baba09-2e68-43ab-81fe-d84b403df2e5)
464    ]
465    dispinterface ItestIF3
466    {
467        interface ItestIF2;
468    }
469
470    [
471        odl,
472        uuid(a01005c7-7491-42eb-94f3-668e37ce60a6)
473    ]
474    dispinterface ItestIF4
475    {
476        properties:
477        methods:
478        [id(0x1c)] HRESULT fn([in] int z);
479    }
480
481    [
482        odl,
483        uuid(4ab61e25-c09f-4239-8f7f-7a018ea0199f),
484        dual
485    ]
486    interface ItestIF5 : ItestIF2
487    {
488        [id(0x1234)] HRESULT fn4([in] int a);
489        [id(0x1235)] HRESULT fn5([in] int a);
490    }
491
492    [
493        odl,
494        uuid(ec236d8e-2cc7-44f2-b394-36c86ff3da74)
495    ]
496    interface ItestIF6 : IDispatch
497    {
498        [id(0x1234)] HRESULT fn4([in] int a);
499        [id(0x1235)] HRESULT fn5([in] int a);
500    }
501
502    [
503        odl,
504        uuid(f711b105-554d-4751-818c-46fcc5d7c0d5),
505        dual
506    ]
507    interface ItestIF7 : ItestIF6
508    {
509        [id(0x1236)] HRESULT fn6([in] GUID a);
510    }
511
512    [
513        odl,
514        uuid(bdfa260b-ef40-43d3-b071-cddec919f132)
515    ]
516        interface ItestIF8
517    {
518        HRESULT fn1([in] int x);
519        HRESULT fn2([out,retval] int *x);
520    }
521
522    [
523        odl,
524        uuid(51033a23-dc37-4f19-aa34-4d8a670458a0)
525
526    ]
527    interface ItestIF9 : ItestIF8
528    {
529        HRESULT fn3([in] int y);
530    }
531
532    [
533        odl,
534        uuid(2e8f14fe-0bce-42f0-8b7d-3af8393c7967)
535    ]
536    dispinterface ItestIF10
537    {
538        interface ItestIF9;
539    }
540
541    [
542        odl,
543        uuid(7d9e9371-482e-4944-9b19-511fc705236f)
544    ]
545    dispinterface ItestIF11
546    {
547        interface ItestIF7;
548    }
549
550};
551