user32: Keep track of whether the app has asked for the text buffer handle.
[wine/hacks.git] / tools / widl / proxy.c
blobe07d2afccc23dd52804cf742aa00036520e7aa23
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 int print_proxy( const char *format, ... )
56 va_list va;
57 int i, r;
59 va_start( va, format );
60 if ( format[0] != '\n' )
61 for( i=0; i<indent; i++ )
62 fprintf( proxy, " " );
63 r = vfprintf( proxy, format, va );
64 va_end( va );
65 return r;
68 static void write_stubdescproto(void)
70 print_proxy( "static const MIDL_STUB_DESC Object_StubDesc;\n");
71 print_proxy( "\n");
74 static void write_stubdesc(void)
76 print_proxy( "static const MIDL_STUB_DESC Object_StubDesc =\n{\n");
77 indent++;
78 print_proxy( "0,\n");
79 print_proxy( "NdrOleAllocate,\n");
80 print_proxy( "NdrOleFree,\n");
81 print_proxy( "{0}, 0, 0, 0, 0,\n");
82 print_proxy( "__MIDL_TypeFormatString.Format,\n");
83 print_proxy( "1, /* -error bounds_check flag */\n");
84 print_proxy( "0x10001, /* Ndr library version */\n");
85 print_proxy( "0,\n");
86 print_proxy( "0x50100a4, /* MIDL Version 5.1.164 */\n");
87 print_proxy( "0,\n");
88 print_proxy( "0,\n");
89 print_proxy( "0, /* notify & notify_flag routine table */\n");
90 print_proxy( "1, /* Flags */\n");
91 print_proxy( "0, /* Reserved3 */\n");
92 print_proxy( "0, /* Reserved4 */\n");
93 print_proxy( "0 /* Reserved5 */\n");
94 indent--;
95 print_proxy( "};\n");
96 print_proxy( "\n");
99 static void init_proxy(ifref_list_t *ifaces)
101 if (proxy) return;
102 if(!(proxy = fopen(proxy_name, "w")))
103 error("Could not open %s for output\n", proxy_name);
104 print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
105 print_proxy( "\n");
106 print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n");
107 print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ 440\n");
108 print_proxy( "#endif /* __REDQ_RPCPROXY_H_VERSION__ */\n");
109 print_proxy( "\n");
110 print_proxy( "#define __midl_proxy\n");
111 print_proxy( "#include \"objbase.h\"\n");
112 print_proxy( "#include \"rpcproxy.h\"\n");
113 print_proxy( "#ifndef __RPCPROXY_H_VERSION__\n");
114 print_proxy( "#error This code needs a newer version of rpcproxy.h\n");
115 print_proxy( "#endif /* __RPCPROXY_H_VERSION__ */\n");
116 print_proxy( "\n");
117 print_proxy( "#include \"%s\"\n", header_name);
118 print_proxy( "\n");
119 write_formatstringsdecl(proxy, indent, ifaces, 1);
120 write_stubdescproto();
123 static void clear_output_vars( const var_list_t *args )
125 const var_t *arg;
127 if (!args) return;
128 LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
130 if (is_attr(arg->attrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) {
131 print_proxy( "if(%s)\n", arg->name );
132 indent++;
133 print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name );
134 indent--;
139 int is_var_ptr(const var_t *v)
141 return v->ptr_level || is_ptr(v->type);
144 int cant_be_null(const var_t *v)
146 /* Search backwards for the most recent pointer attribute. */
147 const attr_list_t *attrs = v->attrs;
148 const type_t *type = v->type;
150 if (! attrs && type)
152 attrs = type->attrs;
153 type = type->ref;
156 while (attrs)
158 int t = get_attrv(attrs, ATTR_POINTERTYPE);
160 if (t == RPC_FC_FP || t == RPC_FC_OP || t == RPC_FC_UP)
161 return 0;
163 if (t == RPC_FC_RP)
164 return 1;
166 if (type)
168 attrs = type->attrs;
169 type = type->ref;
171 else
172 attrs = NULL;
175 return 1; /* Default is RPC_FC_RP. */
178 static void proxy_check_pointers( const var_list_t *args )
180 const var_t *arg;
182 if (!args) return;
183 LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
185 if (is_var_ptr(arg) && cant_be_null(arg)) {
186 print_proxy( "if(!%s)\n", arg->name );
187 indent++;
188 print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
189 indent--;
194 static void free_variable( const var_t *arg, unsigned int type_offset )
196 var_t *constraint;
197 type_t *type;
198 expr_list_t *expr;
200 expr = get_attrp( arg->attrs, ATTR_SIZEIS );
201 if (expr)
203 const expr_t *size = LIST_ENTRY( list_head(expr), const expr_t, entry );
204 print_proxy( "_StubMsg.MaxCount = " );
205 write_expr(proxy, size, 0);
206 fprintf(proxy, ";\n\n");
207 print_proxy( "NdrClearOutParameters( &_StubMsg, ");
208 fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
209 fprintf(proxy, "(void*)%s );\n", arg->name );
210 return;
213 type = arg->type;
214 switch( type->type )
216 case RPC_FC_BYTE:
217 case RPC_FC_CHAR:
218 case RPC_FC_WCHAR:
219 case RPC_FC_SHORT:
220 case RPC_FC_USHORT:
221 case RPC_FC_ENUM16:
222 case RPC_FC_LONG:
223 case RPC_FC_ULONG:
224 case RPC_FC_ENUM32:
225 case RPC_FC_STRUCT:
226 break;
228 case RPC_FC_FP:
229 case RPC_FC_IP:
230 constraint = get_attrp( arg->attrs, ATTR_IIDIS );
231 if( constraint )
232 print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint->name);
233 print_proxy( "NdrClearOutParameters( &_StubMsg, ");
234 fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
235 fprintf(proxy, "(void*)%s );\n", arg->name );
236 break;
238 default:
239 print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type );
243 static void proxy_free_variables( var_list_t *args, unsigned int type_offset )
245 const var_t *arg;
247 if (!args) return;
248 LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
250 if (is_attr(arg->attrs, ATTR_OUT))
252 free_variable( arg, type_offset );
253 fprintf(proxy, "\n");
255 type_offset += get_size_typeformatstring_var(arg);
259 static void gen_proxy(type_t *iface, const func_t *cur, int idx,
260 unsigned int proc_offset, unsigned int *type_offset)
262 var_t *def = cur->def;
263 int has_ret = !is_void(def->type, def);
264 unsigned int offset;
266 indent = 0;
267 write_type(proxy, def->type, def, def->tname);
268 print_proxy( " STDMETHODCALLTYPE %s_", iface->name);
269 write_name(proxy, def);
270 print_proxy( "_Proxy(\n");
271 write_args(proxy, cur->args, iface->name, 1, TRUE);
272 print_proxy( ")\n");
273 print_proxy( "{\n");
274 indent ++;
275 /* local variables */
276 if (has_ret) {
277 print_proxy( "" );
278 write_type(proxy, def->type, def, def->tname);
279 print_proxy( " _RetVal;\n");
281 print_proxy( "RPC_MESSAGE _RpcMessage;\n" );
282 print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n" );
283 print_proxy( "\n");
285 /* FIXME: trace */
286 clear_output_vars( cur->args );
288 print_proxy( "RpcTryExcept\n" );
289 print_proxy( "{\n" );
290 indent++;
291 print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &_StubMsg, &Object_StubDesc, %d);\n", idx);
292 proxy_check_pointers( cur->args );
294 print_proxy( "RpcTryFinally\n" );
295 print_proxy( "{\n" );
296 indent++;
298 offset = *type_offset;
299 write_remoting_arguments(proxy, indent, cur, &offset, PASS_IN, PHASE_BUFFERSIZE);
301 print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
303 offset = *type_offset;
304 write_remoting_arguments(proxy, indent, cur, &offset, PASS_IN, PHASE_MARSHAL);
306 print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" );
307 fprintf(proxy, "\n");
308 print_proxy( "_StubMsg.BufferStart = _RpcMessage.Buffer;\n" );
309 print_proxy( "_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n\n" );
311 print_proxy("if ((_RpcMessage.DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
312 indent++;
313 print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
314 indent--;
315 fprintf(proxy, "\n");
317 offset = *type_offset;
318 write_remoting_arguments(proxy, indent, cur, type_offset, PASS_OUT, PHASE_UNMARSHAL);
320 if (has_ret)
321 print_phase_basetype(proxy, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal");
323 indent--;
324 print_proxy( "}\n");
325 print_proxy( "RpcFinally\n" );
326 print_proxy( "{\n" );
327 indent++;
328 print_proxy( "NdrProxyFreeBuffer(This, &_StubMsg);\n" );
329 indent--;
330 print_proxy( "}\n");
331 print_proxy( "RpcEndFinally\n" );
332 indent--;
333 print_proxy( "}\n" );
334 print_proxy( "RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)\n" );
335 print_proxy( "{\n" );
336 if (has_ret) {
337 indent++;
338 proxy_free_variables( cur->args, offset );
339 print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
340 indent--;
342 print_proxy( "}\n" );
343 print_proxy( "RpcEndExcept\n" );
345 if (has_ret) {
346 print_proxy( "return _RetVal;\n" );
348 indent--;
349 print_proxy( "}\n");
350 print_proxy( "\n");
353 static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
354 unsigned int proc_offset, unsigned int *type_offset)
356 var_t *def = cur->def;
357 const var_t *arg;
358 int has_ret = !is_void(def->type, def);
359 unsigned int offset;
361 indent = 0;
362 print_proxy( "void __RPC_STUB %s_", iface->name);
363 write_name(proxy, def);
364 print_proxy( "_Stub(\n");
365 indent++;
366 print_proxy( "IRpcStubBuffer* This,\n");
367 print_proxy( "IRpcChannelBuffer *_pRpcChannelBuffer,\n");
368 print_proxy( "PRPC_MESSAGE _pRpcMessage,\n");
369 print_proxy( "DWORD* _pdwStubPhase)\n");
370 indent--;
371 print_proxy( "{\n");
372 indent++;
373 print_proxy("%s * _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n", iface->name, iface->name);
374 print_proxy("MIDL_STUB_MESSAGE _StubMsg;\n");
375 declare_stub_args( proxy, indent, cur );
376 fprintf(proxy, "\n");
378 /* FIXME: trace */
380 print_proxy("NdrStubInitialize(_pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n");
381 fprintf(proxy, "\n");
383 if (cur->args)
384 LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
385 print_proxy("%s = 0;\n", arg->name);
387 print_proxy("RpcTryFinally\n");
388 print_proxy("{\n");
389 indent++;
390 print_proxy("if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
391 indent++;
392 print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
393 indent--;
394 fprintf(proxy, "\n");
396 offset = *type_offset;
397 write_remoting_arguments(proxy, indent, cur, &offset, PASS_IN, PHASE_UNMARSHAL);
398 fprintf(proxy, "\n");
400 assign_stub_out_args( proxy, indent, cur );
402 print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n");
403 fprintf(proxy, "\n");
404 print_proxy("");
405 if (has_ret) fprintf(proxy, "_RetVal = ");
406 if (cas) fprintf(proxy, "%s_%s_Stub", iface->name, cas);
407 else
409 fprintf(proxy, "_This->lpVtbl->");
410 write_name(proxy, def);
412 fprintf(proxy, "(_This");
414 if (cur->args)
416 LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
418 fprintf(proxy, ", ");
419 write_name(proxy, arg);
422 fprintf(proxy, ");\n");
423 fprintf(proxy, "\n");
424 print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n");
425 fprintf(proxy, "\n");
427 offset = *type_offset;
428 write_remoting_arguments(proxy, indent, cur, &offset, PASS_OUT, PHASE_BUFFERSIZE);
430 print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);\n");
432 offset = *type_offset;
433 write_remoting_arguments(proxy, indent, cur, &offset, PASS_OUT, PHASE_MARSHAL);
434 fprintf(proxy, "\n");
436 if (has_ret)
437 print_phase_basetype(proxy, indent, PHASE_MARSHAL, PASS_RETURN, def, "_RetVal");
439 indent--;
440 print_proxy("}\n");
441 print_proxy("RpcFinally\n");
442 print_proxy("{\n");
444 offset = *type_offset;
445 write_remoting_arguments(proxy, indent+1, cur, &offset, PASS_OUT, PHASE_FREE);
447 print_proxy("}\n");
448 print_proxy("RpcEndFinally\n");
450 print_proxy("_pRpcMessage->BufferLength = _StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
451 indent--;
453 print_proxy("}\n");
454 print_proxy("\n");
457 static int write_proxy_methods(type_t *iface)
459 const func_t *cur;
460 int i = 0;
462 if (iface->ref) i = write_proxy_methods(iface->ref);
463 if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
464 var_t *def = cur->def;
465 if (!is_callas(def->attrs)) {
466 if (i) fprintf(proxy, ",\n");
467 print_proxy( "%s_", iface->name);
468 write_name(proxy, def);
469 fprintf(proxy, "_Proxy");
470 i++;
473 return i;
476 static int write_stub_methods(type_t *iface)
478 const func_t *cur;
479 int i = 0;
481 if (iface->ref) i = write_stub_methods(iface->ref);
482 else return i; /* skip IUnknown */
484 if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
485 var_t *def = cur->def;
486 if (!is_local(def->attrs)) {
487 if (i) fprintf(proxy,",\n");
488 print_proxy( "%s_", iface->name);
489 write_name(proxy, def);
490 fprintf(proxy, "_Stub");
491 i++;
494 return i;
497 static void write_proxy(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset)
499 int midx = -1, stubs;
500 const func_t *cur;
501 unsigned int offset;
503 if (!iface->funcs) return;
505 /* FIXME: check for [oleautomation], shouldn't generate proxies/stubs if specified */
507 fprintf(proxy, "/*****************************************************************************\n");
508 fprintf(proxy, " * %s interface\n", iface->name);
509 fprintf(proxy, " */\n");
510 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
512 const var_t *def = cur->def;
513 if (!is_local(def->attrs)) {
514 const var_t *cas = is_callas(def->attrs);
515 const char *cname = cas ? cas->name : NULL;
516 int idx = cur->idx;
517 if (cname) {
518 const func_t *m;
519 LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
520 if (!strcmp(get_name(m->def), cname))
522 idx = m->idx;
523 break;
526 offset = *type_offset;
527 gen_proxy(iface, cur, idx, *proc_offset, type_offset);
528 gen_stub(iface, cur, cname, *proc_offset, &offset);
529 *proc_offset += get_size_procformatstring_func( cur );
530 if (midx == -1) midx = idx;
531 else if (midx != idx) parser_error("method index mismatch in write_proxy");
532 midx++;
536 /* proxy vtable */
537 print_proxy( "static const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", midx, iface->name);
538 print_proxy( "{\n");
539 indent++;
540 print_proxy( "{\n", iface->name);
541 indent++;
542 print_proxy( "&IID_%s,\n", iface->name);
543 indent--;
544 print_proxy( "},\n");
545 print_proxy( "{\n");
546 indent++;
547 write_proxy_methods(iface);
548 fprintf(proxy, "\n");
549 indent--;
550 print_proxy( "}\n");
551 indent--;
552 print_proxy( "};\n");
553 fprintf(proxy, "\n\n");
555 /* stub vtable */
556 print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
557 print_proxy( "{\n");
558 indent++;
559 stubs = write_stub_methods(iface);
560 fprintf(proxy, "\n");
561 indent--;
562 fprintf(proxy, "};\n");
563 print_proxy( "\n");
564 print_proxy( "static const CInterfaceStubVtbl _%sStubVtbl =\n", iface->name);
565 print_proxy( "{\n");
566 indent++;
567 print_proxy( "{\n");
568 indent++;
569 print_proxy( "&IID_%s,\n", iface->name);
570 print_proxy( "0,\n");
571 print_proxy( "%d,\n", stubs+3);
572 print_proxy( "&%s_table[-3],\n", iface->name);
573 indent--;
574 print_proxy( "},\n", iface->name);
575 print_proxy( "{\n");
576 indent++;
577 print_proxy( "CStdStubBuffer_METHODS\n");
578 indent--;
579 print_proxy( "}\n");
580 indent--;
581 print_proxy( "};\n");
582 print_proxy( "\n");
585 void write_proxies(ifref_list_t *ifaces)
587 ifref_t *cur;
588 char *file_id = proxy_token;
589 int c;
590 unsigned int proc_offset = 0, type_offset = 0;
592 if (!do_proxies) return;
593 if (do_everything && !ifaces) return;
595 init_proxy(ifaces);
596 if(!proxy) return;
598 if (ifaces)
599 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
600 if (is_object(cur->iface->attrs) && !is_local(cur->iface->attrs))
601 write_proxy(cur->iface, &proc_offset, &type_offset);
603 write_stubdesc();
605 print_proxy( "#if !defined(__RPC_WIN32__)\n");
606 print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
607 print_proxy( "#endif\n");
608 print_proxy( "\n");
609 write_procformatstring(proxy, ifaces, 1);
610 write_typeformatstring(proxy, ifaces, 1);
612 fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id);
613 fprintf(proxy, "{\n");
614 if (ifaces)
615 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
616 if(cur->iface->ref && cur->iface->funcs &&
617 is_object(cur->iface->attrs) && !is_local(cur->iface->attrs))
618 fprintf(proxy, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", cur->iface->name);
620 fprintf(proxy, " 0\n");
621 fprintf(proxy, "};\n");
622 fprintf(proxy, "\n");
624 fprintf(proxy, "static const CInterfaceStubVtbl* const _%s_StubVtblList[] =\n", file_id);
625 fprintf(proxy, "{\n");
626 if (ifaces)
627 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
628 if(cur->iface->ref && cur->iface->funcs &&
629 is_object(cur->iface->attrs) && !is_local(cur->iface->attrs))
630 fprintf(proxy, " (const CInterfaceStubVtbl*)&_%sStubVtbl,\n", cur->iface->name);
631 fprintf(proxy, " 0\n");
632 fprintf(proxy, "};\n");
633 fprintf(proxy, "\n");
635 fprintf(proxy, "static PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id);
636 fprintf(proxy, "{\n");
637 if (ifaces)
638 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
639 if(cur->iface->ref && cur->iface->funcs &&
640 is_object(cur->iface->attrs) && !is_local(cur->iface->attrs))
641 fprintf(proxy, " \"%s\",\n", cur->iface->name);
642 fprintf(proxy, " 0\n");
643 fprintf(proxy, "};\n");
644 fprintf(proxy, "\n");
646 fprintf(proxy, "#define _%s_CHECK_IID(n) IID_GENERIC_CHECK_IID(_%s, pIID, n)\n", file_id, file_id);
647 fprintf(proxy, "\n");
648 fprintf(proxy, "int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id);
649 fprintf(proxy, "{\n");
650 c = 0;
651 if (ifaces)
652 LIST_FOR_EACH_ENTRY( cur, ifaces, ifref_t, entry )
653 if(cur->iface->ref)
655 fprintf(proxy, " if (!_%s_CHECK_IID(%d))\n", file_id, c);
656 fprintf(proxy, " {\n");
657 fprintf(proxy, " *pIndex = %d;\n", c);
658 fprintf(proxy, " return 1;\n");
659 fprintf(proxy, " }\n");
660 c++;
662 fprintf(proxy, " return 0;\n");
663 fprintf(proxy, "}\n");
664 fprintf(proxy, "\n");
666 fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo =\n", file_id);
667 fprintf(proxy, "{\n");
668 fprintf(proxy, " (const PCInterfaceProxyVtblList*)&_%s_ProxyVtblList,\n", file_id);
669 fprintf(proxy, " (const PCInterfaceStubVtblList*)&_%s_StubVtblList,\n", file_id);
670 fprintf(proxy, " _%s_InterfaceNamesList,\n", file_id);
671 fprintf(proxy, " 0,\n");
672 fprintf(proxy, " &_%s_IID_Lookup,\n", file_id);
673 fprintf(proxy, " %d,\n", c);
674 fprintf(proxy, " 1,\n");
675 fprintf(proxy, " 0,\n");
676 fprintf(proxy, " 0,\n");
677 fprintf(proxy, " 0,\n");
678 fprintf(proxy, " 0\n");
679 fprintf(proxy, "};\n");
681 fclose(proxy);