push bd0608bf727e2241b2885edad5c5c753477ffd22
[wine/hacks.git] / tools / widl / proxy.c
blob8a81885bfd22a47d9db611d7f1550a93af7a4c48
1 /*
2 * IDL Compiler
4 * Copyright 2002 Ove Kaaven
5 * Copyright 2004 Mike McCormack
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <stdio.h>
26 #include <stdlib.h>
27 #ifdef HAVE_UNISTD_H
28 # include <unistd.h>
29 #endif
30 #include <string.h>
31 #include <assert.h>
32 #include <ctype.h>
33 #include <signal.h>
35 #include "widl.h"
36 #include "utils.h"
37 #include "parser.h"
38 #include "header.h"
39 #include "typegen.h"
41 #define END_OF_LIST(list) \
42 do { \
43 if (list) { \
44 while (NEXT_LINK(list)) \
45 list = NEXT_LINK(list); \
46 } \
47 } while(0)
49 static FILE* proxy;
50 static int indent = 0;
52 /* FIXME: support generation of stubless proxies */
54 static void print_proxy( const char *format, ... )
56 va_list va;
57 va_start( va, format );
58 print( proxy, indent, format, va );
59 va_end( va );
62 static void write_stubdescproto(void)
64 print_proxy( "static const MIDL_STUB_DESC Object_StubDesc;\n");
65 print_proxy( "\n");
68 static void write_stubdesc(int expr_eval_routines)
70 print_proxy( "static const MIDL_STUB_DESC Object_StubDesc =\n{\n");
71 indent++;
72 print_proxy( "0,\n");
73 print_proxy( "NdrOleAllocate,\n");
74 print_proxy( "NdrOleFree,\n");
75 print_proxy( "{0}, 0, 0, %s, 0,\n", expr_eval_routines ? "ExprEvalRoutines" : "0");
76 print_proxy( "__MIDL_TypeFormatString.Format,\n");
77 print_proxy( "1, /* -error bounds_check flag */\n");
78 print_proxy( "0x10001, /* Ndr library version */\n");
79 print_proxy( "0,\n");
80 print_proxy( "0x50100a4, /* MIDL Version 5.1.164 */\n");
81 print_proxy( "0,\n");
82 print_proxy("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
83 print_proxy( "0, /* notify & notify_flag routine table */\n");
84 print_proxy( "1, /* Flags */\n");
85 print_proxy( "0, /* Reserved3 */\n");
86 print_proxy( "0, /* Reserved4 */\n");
87 print_proxy( "0 /* Reserved5 */\n");
88 indent--;
89 print_proxy( "};\n");
90 print_proxy( "\n");
93 static void init_proxy(ifref_list_t *ifaces)
95 if (proxy) return;
96 if(!(proxy = fopen(proxy_name, "w")))
97 error("Could not open %s for output\n", proxy_name);
98 print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
99 print_proxy( "\n");
100 print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n");
101 print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ 440\n");
102 print_proxy( "#endif /* __REDQ_RPCPROXY_H_VERSION__ */\n");
103 print_proxy( "\n");
104 print_proxy( "#define __midl_proxy\n");
105 print_proxy( "#include \"objbase.h\"\n");
106 print_proxy( "#include \"rpcproxy.h\"\n");
107 print_proxy( "#ifndef __RPCPROXY_H_VERSION__\n");
108 print_proxy( "#error This code needs a newer version of rpcproxy.h\n");
109 print_proxy( "#endif /* __RPCPROXY_H_VERSION__ */\n");
110 print_proxy( "\n");
111 print_proxy( "#include \"%s\"\n", header_name);
112 print_proxy( "\n");
113 write_formatstringsdecl(proxy, indent, ifaces, need_proxy);
114 write_stubdescproto();
117 static void clear_output_vars( const var_list_t *args )
119 const var_t *arg;
121 if (!args) return;
122 LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
124 if (is_attr(arg->attrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) {
125 print_proxy( "if(%s)\n", arg->name );
126 indent++;
127 print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name );
128 indent--;
133 int is_var_ptr(const var_t *v)
135 return is_ptr(v->type);
138 int cant_be_null(const var_t *v)
140 /* Search backwards for the most recent pointer attribute. */
141 const attr_list_t *attrs = v->attrs;
142 const type_t *type = v->type;
144 if (! attrs && type)
146 attrs = type->attrs;
147 type = type->ref;
150 while (attrs)
152 int t = get_attrv(attrs, ATTR_POINTERTYPE);
154 if (t == RPC_FC_FP || t == RPC_FC_OP || t == RPC_FC_UP)
155 return 0;
157 if (t == RPC_FC_RP)
158 return 1;
160 if (type)
162 attrs = type->attrs;
163 type = type->ref;
165 else
166 attrs = NULL;
169 return 1; /* Default is RPC_FC_RP. */
172 static void proxy_check_pointers( const var_list_t *args )
174 const var_t *arg;
176 if (!args) return;
177 LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
179 if (is_var_ptr(arg) && cant_be_null(arg)) {
180 print_proxy( "if(!%s)\n", arg->name );
181 indent++;
182 print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
183 indent--;
188 static void free_variable( const var_t *arg )
190 unsigned int type_offset = arg->type->typestring_offset;
191 var_t *constraint;
192 type_t *type = arg->type;
193 expr_t *size = get_size_is_expr(type, arg->name);
195 if (size)
197 print_proxy( "_StubMsg.MaxCount = " );
198 write_expr(proxy, size, 0);
199 fprintf(proxy, ";\n\n");
200 print_proxy( "NdrClearOutParameters( &_StubMsg, ");
201 fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
202 fprintf(proxy, "(void*)%s );\n", arg->name );
203 return;
206 switch( type->type )
208 case RPC_FC_BYTE:
209 case RPC_FC_CHAR:
210 case RPC_FC_WCHAR:
211 case RPC_FC_SHORT:
212 case RPC_FC_USHORT:
213 case RPC_FC_ENUM16:
214 case RPC_FC_LONG:
215 case RPC_FC_ULONG:
216 case RPC_FC_ENUM32:
217 case RPC_FC_STRUCT:
218 break;
220 case RPC_FC_FP:
221 case RPC_FC_IP:
222 constraint = get_attrp( arg->attrs, ATTR_IIDIS );
223 if( constraint )
224 print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint->name);
225 print_proxy( "NdrClearOutParameters( &_StubMsg, ");
226 fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
227 fprintf(proxy, "(void*)%s );\n", arg->name );
228 break;
230 default:
231 print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type );
235 static void proxy_free_variables( var_list_t *args )
237 const var_t *arg;
239 if (!args) return;
240 LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
241 if (is_attr(arg->attrs, ATTR_OUT))
243 free_variable( arg );
244 fprintf(proxy, "\n");
248 static void gen_proxy(type_t *iface, const func_t *cur, int idx,
249 unsigned int proc_offset)
251 var_t *def = cur->def;
252 int has_ret = !is_void(def->type);
254 indent = 0;
255 write_type_decl_left(proxy, def->type);
256 print_proxy( " STDMETHODCALLTYPE %s_", iface->name);
257 write_name(proxy, def);
258 print_proxy( "_Proxy(\n");
259 write_args(proxy, cur->args, iface->name, 1, TRUE);
260 print_proxy( ")\n");
261 print_proxy( "{\n");
262 indent ++;
263 /* local variables */
264 if (has_ret) {
265 print_proxy( "" );
266 write_type_decl_left(proxy, def->type);
267 print_proxy( " _RetVal;\n");
269 print_proxy( "RPC_MESSAGE _RpcMessage;\n" );
270 print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n" );
271 print_proxy( "\n");
273 /* FIXME: trace */
274 clear_output_vars( cur->args );
276 print_proxy( "RpcTryExcept\n" );
277 print_proxy( "{\n" );
278 indent++;
279 print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &_StubMsg, &Object_StubDesc, %d);\n", idx);
280 proxy_check_pointers( cur->args );
282 print_proxy( "RpcTryFinally\n" );
283 print_proxy( "{\n" );
284 indent++;
286 write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_BUFFERSIZE);
288 print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
290 write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_MARSHAL);
292 print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" );
293 fprintf(proxy, "\n");
294 print_proxy( "_StubMsg.BufferStart = _RpcMessage.Buffer;\n" );
295 print_proxy( "_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n\n" );
297 print_proxy("if ((_RpcMessage.DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
298 indent++;
299 print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
300 indent--;
301 fprintf(proxy, "\n");
303 write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_UNMARSHAL);
305 if (has_ret)
306 print_phase_basetype(proxy, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal");
308 indent--;
309 print_proxy( "}\n");
310 print_proxy( "RpcFinally\n" );
311 print_proxy( "{\n" );
312 indent++;
313 print_proxy( "NdrProxyFreeBuffer(This, &_StubMsg);\n" );
314 indent--;
315 print_proxy( "}\n");
316 print_proxy( "RpcEndFinally\n" );
317 indent--;
318 print_proxy( "}\n" );
319 print_proxy( "RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)\n" );
320 print_proxy( "{\n" );
321 if (has_ret) {
322 indent++;
323 proxy_free_variables( cur->args );
324 print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
325 indent--;
327 print_proxy( "}\n" );
328 print_proxy( "RpcEndExcept\n" );
330 if (has_ret) {
331 print_proxy( "return _RetVal;\n" );
333 indent--;
334 print_proxy( "}\n");
335 print_proxy( "\n");
338 static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
339 unsigned int proc_offset)
341 var_t *def = cur->def;
342 const var_t *arg;
343 int has_ret = !is_void(def->type);
345 indent = 0;
346 print_proxy( "void __RPC_STUB %s_", iface->name);
347 write_name(proxy, def);
348 print_proxy( "_Stub(\n");
349 indent++;
350 print_proxy( "IRpcStubBuffer* This,\n");
351 print_proxy( "IRpcChannelBuffer *_pRpcChannelBuffer,\n");
352 print_proxy( "PRPC_MESSAGE _pRpcMessage,\n");
353 print_proxy( "DWORD* _pdwStubPhase)\n");
354 indent--;
355 print_proxy( "{\n");
356 indent++;
357 print_proxy("%s * _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n", iface->name, iface->name);
358 print_proxy("MIDL_STUB_MESSAGE _StubMsg;\n");
359 declare_stub_args( proxy, indent, cur );
360 fprintf(proxy, "\n");
362 /* FIXME: trace */
364 print_proxy("NdrStubInitialize(_pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n");
365 fprintf(proxy, "\n");
367 write_parameters_init(proxy, indent, cur);
369 print_proxy("RpcTryFinally\n");
370 print_proxy("{\n");
371 indent++;
372 print_proxy("if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
373 indent++;
374 print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
375 indent--;
376 fprintf(proxy, "\n");
378 write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_UNMARSHAL);
379 fprintf(proxy, "\n");
381 assign_stub_out_args( proxy, indent, cur );
383 print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n");
384 fprintf(proxy, "\n");
385 print_proxy("");
386 if (has_ret) fprintf(proxy, "_RetVal = ");
387 if (cas) fprintf(proxy, "%s_%s_Stub", iface->name, cas);
388 else
390 fprintf(proxy, "_This->lpVtbl->");
391 write_name(proxy, def);
393 fprintf(proxy, "(_This");
395 if (cur->args)
397 LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
399 fprintf(proxy, ", ");
400 if (arg->type->declarray)
401 fprintf(proxy, "*");
402 write_name(proxy, arg);
405 fprintf(proxy, ");\n");
406 fprintf(proxy, "\n");
407 print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n");
408 fprintf(proxy, "\n");
410 write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_BUFFERSIZE);
412 print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);\n");
414 write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_MARSHAL);
415 fprintf(proxy, "\n");
417 if (has_ret)
418 print_phase_basetype(proxy, indent, PHASE_MARSHAL, PASS_RETURN, def, "_RetVal");
420 indent--;
421 print_proxy("}\n");
422 print_proxy("RpcFinally\n");
423 print_proxy("{\n");
425 write_remoting_arguments(proxy, indent+1, cur, PASS_OUT, PHASE_FREE);
427 print_proxy("}\n");
428 print_proxy("RpcEndFinally\n");
430 print_proxy("_pRpcMessage->BufferLength = _StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
431 indent--;
433 print_proxy("}\n");
434 print_proxy("\n");
437 static int write_proxy_methods(type_t *iface)
439 const func_t *cur;
440 int i = 0;
442 if (iface->ref) i = write_proxy_methods(iface->ref);
443 if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
444 var_t *def = cur->def;
445 if (!is_callas(def->attrs)) {
446 if (i) fprintf(proxy, ",\n");
447 print_proxy( "%s_", iface->name);
448 write_name(proxy, def);
449 fprintf(proxy, "_Proxy");
450 i++;
453 return i;
456 static int write_stub_methods(type_t *iface)
458 const func_t *cur;
459 int i = 0;
461 if (iface->ref) i = write_stub_methods(iface->ref);
462 else return i; /* skip IUnknown */
464 if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
465 var_t *def = cur->def;
466 if (!is_local(def->attrs)) {
467 if (i) fprintf(proxy,",\n");
468 print_proxy( "%s_", iface->name);
469 write_name(proxy, def);
470 fprintf(proxy, "_Stub");
471 i++;
474 return i;
477 static void write_proxy(type_t *iface, unsigned int *proc_offset)
479 int midx = -1, stubs;
480 const func_t *cur;
482 if (!iface->funcs) return;
484 /* FIXME: check for [oleautomation], shouldn't generate proxies/stubs if specified */
486 fprintf(proxy, "/*****************************************************************************\n");
487 fprintf(proxy, " * %s interface\n", iface->name);
488 fprintf(proxy, " */\n");
489 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
491 const var_t *def = cur->def;
492 if (!is_local(def->attrs)) {
493 const var_t *cas = is_callas(def->attrs);
494 const char *cname = cas ? cas->name : NULL;
495 int idx = cur->idx;
496 if (cname) {
497 const func_t *m;
498 LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
499 if (!strcmp(m->def->name, cname))
501 idx = m->idx;
502 break;
505 gen_proxy(iface, cur, idx, *proc_offset);
506 gen_stub(iface, cur, cname, *proc_offset);
507 *proc_offset += get_size_procformatstring_func( cur );
508 if (midx == -1) midx = idx;
509 else if (midx != idx) error("method index mismatch in write_proxy\n");
510 midx++;
514 /* proxy vtable */
515 print_proxy( "static const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", midx, iface->name);
516 print_proxy( "{\n");
517 indent++;
518 print_proxy( "{\n", iface->name);
519 indent++;
520 print_proxy( "&IID_%s,\n", iface->name);
521 indent--;
522 print_proxy( "},\n");
523 print_proxy( "{\n");
524 indent++;
525 write_proxy_methods(iface);
526 fprintf(proxy, "\n");
527 indent--;
528 print_proxy( "}\n");
529 indent--;
530 print_proxy( "};\n");
531 fprintf(proxy, "\n\n");
533 /* stub vtable */
534 print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
535 print_proxy( "{\n");
536 indent++;
537 stubs = write_stub_methods(iface);
538 fprintf(proxy, "\n");
539 indent--;
540 fprintf(proxy, "};\n");
541 print_proxy( "\n");
542 print_proxy( "static const CInterfaceStubVtbl _%sStubVtbl =\n", iface->name);
543 print_proxy( "{\n");
544 indent++;
545 print_proxy( "{\n");
546 indent++;
547 print_proxy( "&IID_%s,\n", iface->name);
548 print_proxy( "0,\n");
549 print_proxy( "%d,\n", stubs+3);
550 print_proxy( "&%s_table[-3],\n", iface->name);
551 indent--;
552 print_proxy( "},\n", iface->name);
553 print_proxy( "{\n");
554 indent++;
555 print_proxy( "CStdStubBuffer_METHODS\n");
556 indent--;
557 print_proxy( "}\n");
558 indent--;
559 print_proxy( "};\n");
560 print_proxy( "\n");
563 static int does_any_iface(const ifref_list_t *ifaces, type_pred_t pred)
565 ifref_t *ir;
567 if (ifaces)
568 LIST_FOR_EACH_ENTRY(ir, ifaces, ifref_t, entry)
569 if (pred(ir->iface))
570 return TRUE;
572 return FALSE;
575 int need_proxy(const type_t *iface)
577 return is_object(iface->attrs) && !is_local(iface->attrs);
580 int need_stub(const type_t *iface)
582 return !is_object(iface->attrs) && !is_local(iface->attrs);
585 int need_proxy_file(const ifref_list_t *ifaces)
587 return does_any_iface(ifaces, need_proxy);
590 int need_stub_files(const ifref_list_t *ifaces)
592 return does_any_iface(ifaces, need_stub);
595 void write_proxies(ifref_list_t *ifaces)
597 ifref_t *cur;
598 int expr_eval_routines;
599 char *file_id = proxy_token;
600 int c;
601 unsigned int proc_offset = 0;
603 if (!do_proxies) return;
604 if (do_everything && !need_proxy_file(ifaces)) return;
606 init_proxy(ifaces);
607 if(!proxy) return;
609 if (ifaces)
610 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
611 if (need_proxy(cur->iface))
612 write_proxy(cur->iface, &proc_offset);
614 expr_eval_routines = write_expr_eval_routines(proxy, proxy_token);
615 if (expr_eval_routines)
616 write_expr_eval_routine_list(proxy, proxy_token);
617 write_user_quad_list(proxy);
618 write_stubdesc(expr_eval_routines);
620 print_proxy( "#if !defined(__RPC_WIN32__)\n");
621 print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
622 print_proxy( "#endif\n");
623 print_proxy( "\n");
624 write_procformatstring(proxy, ifaces, need_proxy);
625 write_typeformatstring(proxy, ifaces, need_proxy);
627 fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id);
628 fprintf(proxy, "{\n");
629 if (ifaces)
630 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
631 if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
632 fprintf(proxy, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", cur->iface->name);
634 fprintf(proxy, " 0\n");
635 fprintf(proxy, "};\n");
636 fprintf(proxy, "\n");
638 fprintf(proxy, "static const CInterfaceStubVtbl* const _%s_StubVtblList[] =\n", file_id);
639 fprintf(proxy, "{\n");
640 if (ifaces)
641 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
642 if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
643 fprintf(proxy, " (const CInterfaceStubVtbl*)&_%sStubVtbl,\n", cur->iface->name);
644 fprintf(proxy, " 0\n");
645 fprintf(proxy, "};\n");
646 fprintf(proxy, "\n");
648 fprintf(proxy, "static PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id);
649 fprintf(proxy, "{\n");
650 if (ifaces)
651 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
652 if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
653 fprintf(proxy, " \"%s\",\n", cur->iface->name);
654 fprintf(proxy, " 0\n");
655 fprintf(proxy, "};\n");
656 fprintf(proxy, "\n");
658 fprintf(proxy, "#define _%s_CHECK_IID(n) IID_GENERIC_CHECK_IID(_%s, pIID, n)\n", file_id, file_id);
659 fprintf(proxy, "\n");
660 fprintf(proxy, "int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id);
661 fprintf(proxy, "{\n");
662 c = 0;
663 if (ifaces)
664 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
665 if(cur->iface->ref && cur->iface->funcs && need_proxy(cur->iface))
667 fprintf(proxy, " if (!_%s_CHECK_IID(%d))\n", file_id, c);
668 fprintf(proxy, " {\n");
669 fprintf(proxy, " *pIndex = %d;\n", c);
670 fprintf(proxy, " return 1;\n");
671 fprintf(proxy, " }\n");
672 c++;
674 fprintf(proxy, " return 0;\n");
675 fprintf(proxy, "}\n");
676 fprintf(proxy, "\n");
678 fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo =\n", file_id);
679 fprintf(proxy, "{\n");
680 fprintf(proxy, " (const PCInterfaceProxyVtblList*)&_%s_ProxyVtblList,\n", file_id);
681 fprintf(proxy, " (const PCInterfaceStubVtblList*)&_%s_StubVtblList,\n", file_id);
682 fprintf(proxy, " _%s_InterfaceNamesList,\n", file_id);
683 fprintf(proxy, " 0,\n");
684 fprintf(proxy, " &_%s_IID_Lookup,\n", file_id);
685 fprintf(proxy, " %d,\n", c);
686 fprintf(proxy, " 1,\n");
687 fprintf(proxy, " 0,\n");
688 fprintf(proxy, " 0,\n");
689 fprintf(proxy, " 0,\n");
690 fprintf(proxy, " 0\n");
691 fprintf(proxy, "};\n");
693 fclose(proxy);