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