1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*
* Copyright (C) 2005 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "tmarshal_dispids.h"
import "ocidl.idl";
[
uuid(d96d8a3e-78b6-4c8d-8f27-059db959be8a),
version(1.0),
helpstring("Test Typelib")
]
library TestTypelib
{
importlib("stdole2.tlb");
typedef enum tagSTATE
{
STATE_UNWIDGETIFIED = 1,
STATE_WIDGETIFIED
} STATE;
typedef struct tagMYSTRUCT
{
INT field1;
ULONGLONG field2;
} MYSTRUCT;
coclass ApplicationObject2;
[
odl,
uuid(12345678-1234-4321-1234-121212121212)
]
interface ISomethingFromDispatch : IDispatch
{
HRESULT anotherfn(void);
}
[
odl,
oleautomation,
dual,
uuid(3f7e06fe-0bce-46f0-8b7d-3a68393c7967)
]
interface ItestDual : IDispatch
{
HRESULT test();
}
[
odl,
uuid(a1f8cae3-c947-4c5f-b57d-c87b9b5f3586),
oleautomation,
dual
]
interface IWidget : IDispatch
{
[propput, id(DISPID_TM_NAME)]
HRESULT Name([in] BSTR name);
[propget, id(DISPID_TM_NAME)]
HRESULT Name([out, retval] BSTR *name);
[id(DISPID_TM_DOSOMETHING)]
HRESULT DoSomething([in] double number, [out] BSTR *str1, [in, defaultvalue("")] BSTR str2, [in, optional] VARIANT *opt);
[propget, id(DISPID_TM_STATE)]
HRESULT State([out, retval] STATE *state);
[propput, id(DISPID_TM_STATE)]
HRESULT State([in] STATE state);
[id(DISPID_TM_MAP)]
HRESULT Map([in] BSTR bstrId, [out, retval] BSTR *sValue);
[id(DISPID_TM_SETOLECOLOR)]
HRESULT SetOleColor([in] OLE_COLOR val);
[id(DISPID_TM_GETOLECOLOR)]
HRESULT GetOleColor([out, retval] OLE_COLOR *pVal);
[propget, id(DISPID_TM_CLONE)]
HRESULT Clone([out, retval] IWidget **ppVal);
[propget, id(DISPID_TM_CLONEDISPATCH)]
HRESULT CloneDispatch([out, retval] IDispatch **ppVal);
[propget, id(DISPID_TM_CLONECOCLASS)]
HRESULT CloneCoclass([out, retval] ApplicationObject2 **ppVal);
[propget, id(DISPID_VALUE)]
HRESULT Value([in] VARIANT *value, [out, retval] VARIANT *retval);
[id(DISPID_TM_ARRAY)]
HRESULT Array([in] SAFEARRAY(BSTR) values);
[id(DISPID_TM_VARARRAYPTR)]
HRESULT VariantArrayPtr([in] SAFEARRAY(VARIANT) *values);
[id(DISPID_TM_VARIANT)]
HRESULT Variant([in] VARIANT var);
[vararg, id(DISPID_TM_VARARG)]
HRESULT VarArg([in] int numexpect, [in] SAFEARRAY(VARIANT) values);
[id(DISPID_TM_STRUCTARGS)]
HRESULT StructArgs([in] MYSTRUCT byval, [in] MYSTRUCT *byptr, [in] MYSTRUCT arr[5]);
[id(DISPID_TM_ERROR)]
HRESULT Error();
[propget, id(DISPID_TM_CLONEINTERFACE)]
HRESULT CloneInterface([out, retval] ISomethingFromDispatch **ppVal);
[id(DISPID_TM_PROP_WITH_LCID), propput]
HRESULT prop_with_lcid([in,lcid] long lcid, [in] INT i);
[id(DISPID_TM_PROP_WITH_LCID), propget]
HRESULT prop_with_lcid([in,lcid] long lcid, [out,retval] INT *i);
}
[
odl,
uuid(a1f8cae3-c947-3c5f-a57c-c88b9b6f3586),
oleautomation,
dual
]
interface IStaticWidget : IDispatch
{
[id(DISPID_TM_TESTDUAL)]
HRESULT TestDual([in] ItestDual *p);
}
[
odl,
uuid(a028db05-30f0-4b93-b17a-41c72f831d84),
#if 0 /* FIXME: commented out as causes widl to generate incorrect typelib */
dual,
#endif
oleautomation
]
interface IKindaEnumWidget : IUnknown
{
HRESULT Next(
[out] IWidget **widget);
HRESULT Count(
[out] unsigned long *count);
HRESULT Reset();
HRESULT Clone(
[out] IKindaEnumWidget **ppenum);
}
[
odl,
uuid(a028db06-30f0-4b93-b17a-41c72f831d84),
]
interface INonOleAutomation : IUnknown
{
[id(DISPID_NOA_BSTRRET)]
BSTR BstrRet();
}
[
dllname("comm.drv"),
uuid(d377f60b-8639-4261-8ee7-75c8340d2cc9),
]
module BadModule
{
[
entry("Foo"),
]
HRESULT BadModuleFoo();
};
[
dllname("oleaut32.dll"),
uuid(d377f60c-8639-4261-8ee7-75c8340d2cc9),
]
module BadEntry
{
[
entry("Foo"),
]
HRESULT BadEntryFoo();
};
[
uuid(bb171948-10ec-407a-9a57-2f85f797ff1a),
appobject,
]
coclass ApplicationObject2
{
interface IWidget;
[source] interface IWidget;
};
[
odl,
uuid(375f8a9d-33d0-44f3-b972-61f8407899e0)
]
interface ItestIF1 : IUnknown
{
HRESULT fn1([in] int x);
HRESULT fn2([out,retval] int *x);
}
[
odl,
uuid(094056a3-666f-4956-be12-1859668310b8)
]
interface ItestIF2 : ItestIF1
{
HRESULT fn3([in] int y);
}
[
odl,
uuid(33baba09-2e68-43ab-81fe-d84b403df2e5)
]
dispinterface ItestIF3
{
interface ItestIF2;
}
[
odl,
uuid(a01005c7-7491-42eb-94f3-668e37ce60a6)
]
dispinterface ItestIF4
{
properties:
methods:
[id(0x1c)] HRESULT fn([in] int z);
}
[
odl,
uuid(4ab61e25-c09f-4239-8f7f-7a018ea0199f),
dual
]
interface ItestIF5 : ItestIF2
{
[id(0x1234)] HRESULT fn4([in] int a);
[id(0x1235)] HRESULT fn5([in] int a);
}
[
odl,
uuid(ec236d8e-2cc7-44f2-b394-36c86ff3da74)
]
interface ItestIF6 : IDispatch
{
[id(0x1234)] HRESULT fn4([in] int a);
[id(0x1235)] HRESULT fn5([in] int a);
}
[
odl,
uuid(f711b105-554d-4751-818c-46fcc5d7c0d5),
dual
]
interface ItestIF7 : ItestIF6
{
[id(0x1236)] HRESULT fn6([in] int a);
}
[
odl,
uuid(bdfa260b-ef40-43d3-b071-cddec919f132)
]
interface ItestIF8
{
HRESULT fn1([in] int x);
HRESULT fn2([out,retval] int *x);
}
[
odl,
uuid(51033a23-dc37-4f19-aa34-4d8a670458a0)
]
interface ItestIF9 : ItestIF8
{
HRESULT fn3([in] int y);
}
[
odl,
uuid(2e8f14fe-0bce-42f0-8b7d-3af8393c7967)
]
dispinterface ItestIF10
{
interface ItestIF9;
}
[
odl,
uuid(7d9e9371-482e-4944-9b19-511fc705236f)
]
dispinterface ItestIF11
{
interface ItestIF7;
}
};