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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 static int indent
= 0;
42 /* FIXME: support generation of stubless proxies */
44 int print_proxy( char *format
, ... )
49 va_start( va
, format
);
50 for( i
=0; i
<indent
; i
++ )
51 fprintf( proxy
, " " );
52 r
= vfprintf( proxy
, format
, va
);
57 static type_t
*get_base_type( type_t
*type
)
64 static void write_stubdescproto(void)
66 print_proxy( "extern const MIDL_STUB_DESC Object_StubDesc;\n");
70 static void write_stubdesc(void)
72 print_proxy( "const MIDL_STUB_DESC Object_StubDesc = {\n");
73 print_proxy( " 0,\n");
74 print_proxy( " NdrOleAllocate,\n");
75 print_proxy( " NdrOleFree,\n");
76 print_proxy( " {0}, 0, 0, 0, 0,\n");
77 print_proxy( " 0 /* __MIDL_TypeFormatString.Format */\n");
82 static void write_formatdesc( char *str
)
84 print_proxy( "typedef struct _MIDL_%s_FORMAT_STRING {\n", str
);
85 print_proxy( " short Pad;\n");
86 print_proxy( " unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str
);
87 print_proxy( "} MIDL_%s_FORMAT_STRING;\n", str
);
91 static void write_formatstringsdecl(void)
93 print_proxy( "#define TYPE_FORMAT_STRING_SIZE %d\n",1); /* FIXME */
94 print_proxy( "#define PROC_FORMAT_STRING_SIZE %d\n",1); /* FIXME */
96 write_formatdesc( "TYPE" );
97 write_formatdesc( "PROC" );
98 print_proxy( "extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
99 print_proxy( "extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
103 static void write_formatstring( int proc
)
116 print_proxy( "static const MIDL_%s_FORMAT_STRING __MIDL_%sFormatString =\n", t
, n
);
119 print_proxy( "0,\n");
126 print_proxy( "};\n");
130 static void init_proxy(void)
133 proxy
= fopen(proxy_name
, "w");
134 print_proxy( "/*** Autogenerated by WIDL %s - Do not edit ***/\n", WIDL_FULLVERSION
);
136 print_proxy( "#ifndef __REDQ_RPCPROXY_H_VERSION__\n");
137 print_proxy( "#define __REQUIRED_RPCPROXY_H_VERSION__ 440\n");
138 print_proxy( "#endif /* __REDQ_RPCPROXY_H_VERSION__ */\n");
140 print_proxy( "#include \"rpcproxy.h\"\n");
142 print_proxy( "#ifndef __RPCPROXY_H_VERSION__\n");
143 print_proxy( "#error This code needs a newer version of rpcproxy.h\n");
144 print_proxy( "#endif /* __RPCPROXY_H_VERSION__ */\n");
146 print_proxy( "#include \"%s\"\n", header_name
);
148 write_formatstringsdecl();
149 write_stubdescproto();
152 static void clear_output_vars( var_t
*arg
)
155 while (NEXT_LINK(arg
))
156 arg
= NEXT_LINK(arg
);
159 if (is_attr(arg
->attrs
, ATTR_OUT
) && !is_attr(arg
->attrs
, ATTR_IN
)) {
160 print_proxy( "if(%s)\n", arg
->name
);
162 print_proxy( "MIDL_memset( %s, 0, sizeof( ", arg
->name
);
164 write_type(proxy
, arg
->type
, arg
, arg
->tname
);
165 fprintf( proxy
, " ));\n" );
167 arg
= PREV_LINK(arg
);
171 static void proxy_gen_marshall_size( var_t
*arg
)
173 print_proxy( "_StubMsg.BufferLength = 0U;\n" );
176 while (NEXT_LINK(arg
))
177 arg
= NEXT_LINK(arg
);
180 if (is_attr(arg
->attrs
, ATTR_IN
)) {
182 type_t
*type
= get_base_type(arg
->type
);
188 print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 1, arg
->name
);
194 print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 2, arg
->name
);
200 print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 4, arg
->name
);
204 print_proxy( "NdrSimpleStructBufferSize(&_StubMsg, (unsigned char*)%s, ", arg
->name
);
205 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d] );\n", index
);
209 print_proxy( "NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, ", arg
->name
);
210 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d]);\n", index
);
214 printf("FIXME: arg %s has unknown type %d\n", arg
->name
, type
->type
);
217 arg
= PREV_LINK(arg
);
221 static void gen_marshall_copydata( var_t
*arg
)
224 while (NEXT_LINK(arg
))
225 arg
= NEXT_LINK(arg
);
228 if (is_attr(arg
->attrs
, ATTR_IN
)) {
230 type_t
*type
= get_base_type(arg
->type
);
243 write_type(proxy
, arg
->type
, arg
, arg
->tname
);
244 fprintf(proxy
,"*)_StubMsg.Buffer)++ = %s;\n", arg
->name
);
248 /* FIXME: add the format string, and set the index below */
249 print_proxy( "NdrSimpleStructMarshall(&_StubMsg, (unsigned char*)%s, ", arg
->name
);
250 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d]);\n", index
);
254 print_proxy( "NdrPointerMarshall( &_StubMsg, (unsigned char*)%s, ", arg
->name
);
255 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d]);\n", index
);
259 printf("FIXME: arg %s has unknown type %d\n", arg
->name
, type
->type
);
262 arg
= PREV_LINK(arg
);
266 static void gen_marshall( var_t
*arg
)
268 /* generated code to determine the size of the buffer required */
269 proxy_gen_marshall_size( arg
);
271 /* generated code to allocate the buffer */
272 print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
274 /* generated code to copy the args into the buffer */
275 gen_marshall_copydata( arg
);
280 static void gen_unmarshall( var_t
*arg
)
283 while (NEXT_LINK(arg
))
284 arg
= NEXT_LINK(arg
);
287 if (is_attr(arg
->attrs
, ATTR_IN
)) {
289 print_proxy( "NdrPointerUnmarshall(&_StubMsg, (unsigned char**)&%s, ", arg
->name
);
290 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d], 0);\n", index
);
292 arg
= PREV_LINK(arg
);
296 static void proxy_free_variables( var_t
*arg
)
299 while (NEXT_LINK(arg
))
300 arg
= NEXT_LINK(arg
);
303 if (is_attr(arg
->attrs
, ATTR_OUT
)) {
305 int index
= 0; /* FIXME */
306 type_t
*type
= get_base_type(arg
->type
);
322 constraint
= get_attrp( arg
->attrs
, ATTR_IIDIS
);
324 print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint
->name
);
325 print_proxy( "NdrClearOutParameters( &_StubMsg, ");
326 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d], ", index
);
327 fprintf(proxy
, "(void*)%s );\n", arg
->name
);
331 printf("FIXME: arg %s has unknown type %d\n", arg
->name
, type
->type
);
334 arg
= PREV_LINK(arg
);
338 static void gen_proxy(type_t
*iface
, func_t
*cur
, int idx
)
340 var_t
*def
= cur
->def
;
341 int has_ret
= !is_void(def
->type
, def
);
344 write_type(proxy
, def
->type
, def
, def
->tname
);
345 print_proxy( " CALLBACK %s_", iface
->name
);
346 write_name(proxy
, def
);
347 print_proxy( "_Proxy(\n");
348 write_args(proxy
, cur
->args
, iface
->name
, 1, TRUE
);
352 /* local variables */
355 write_type(proxy
, def
->type
, def
, def
->tname
);
356 print_proxy( " _RetVal;\n");
358 print_proxy( "RPC_MESSAGE _Msg;\n" );
359 print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n" );
363 clear_output_vars( cur
->args
);
365 print_proxy( "RpcTryExcept\n" );
366 print_proxy( "{\n" );
368 print_proxy( "NdrProxyInitialize(This, &_Msg, &_StubMsg, &Object_StubDesc, %d);\n", idx
);
370 print_proxy( "RpcTryFinally\n" );
371 print_proxy( "{\n" );
374 gen_marshall( cur
->args
);
376 print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" );
377 fprintf(proxy
, "\n");
378 print_proxy("if ((_Msg.DataRepresentation&0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
380 print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[0]);\n" );
382 fprintf(proxy
, "\n");
384 gen_unmarshall( cur
->args
);
387 * FIXME: We only need to round the buffer up if it could be unaligned...
388 * We should calculate how much buffer we used and output the following
389 * line only if necessary.
391 print_proxy( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n");
393 print_proxy( "_RetVal = *((" );
394 write_type(proxy
, def
->type
, def
, def
->tname
);
395 fprintf(proxy
, "*)_StubMsg.Buffer)++;\n");
400 print_proxy( "RpcFinally\n" );
401 print_proxy( "{\n" );
403 print_proxy( "NdrProxyFreeBuffer(This, &_StubMsg);\n" );
406 print_proxy( "RpcEndFinally\n" );
408 print_proxy( "}\n" );
409 print_proxy( "RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)\n" );
410 print_proxy( "{\n" );
413 proxy_free_variables( cur
->args
);
414 print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
417 print_proxy( "}\n" );
418 print_proxy( "RpcEndExcept\n" );
421 print_proxy( "return _RetVal;\n" );
428 static void stub_write_locals( var_t
*arg
)
432 int outptr
= is_attr(arg
->attrs
, ATTR_OUT
);
434 /* create a temporary variable to store the output */
437 memset( &temp
, 0, sizeof temp
);
438 temp
.ptr_level
= arg
->ptr_level
- 1; /* dereference once */
440 write_type(proxy
, arg
->type
, &temp
, arg
->tname
);
441 fprintf(proxy
, " _M%d;\n",n
++);
444 write_type(proxy
, arg
->type
, arg
, arg
->tname
);
446 write_name(proxy
, arg
);
447 /* if (outptr) fprintf(proxy, " = &_M%d;\n",n++); */
448 fprintf(proxy
, ";\n");
449 arg
= NEXT_LINK(arg
);
453 static void stub_unmarshall( var_t
*arg
)
457 while (NEXT_LINK(arg
))
458 arg
= NEXT_LINK(arg
);
461 if (is_attr(arg
->attrs
, ATTR_IN
)) {
463 type_t
*type
= get_base_type(arg
->type
);
475 print_proxy( "%s = *((", arg
->name
);
476 write_type(proxy
, arg
->type
, arg
, arg
->tname
);
477 fprintf(proxy
,"*)_StubMsg.Buffer)++;\n");
481 /* FIXME: add the format string, and set the index below */
482 print_proxy( "NdrSimpleStructUnmarshall(&_StubMsg, (unsigned char**)&%s, ", arg
->name
);
483 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d],0);\n", index
);
487 printf("FIXME: arg %s has unknown type %d\n", arg
->name
, type
->type
);
490 else if (is_attr(arg
->attrs
, ATTR_OUT
)) {
492 write_name(proxy
, arg
);
493 fprintf(proxy
," = &_M%d;\n", n
);
494 print_proxy("_M%d = 0;\n", n
++);
496 arg
= PREV_LINK(arg
);
500 static void stub_gen_marshall_size( var_t
*arg
)
502 print_proxy( "_StubMsg.BufferLength = 0U;\n" );
505 while (NEXT_LINK(arg
))
506 arg
= NEXT_LINK(arg
);
509 if (is_attr(arg
->attrs
, ATTR_OUT
)) {
512 type_t
*type
= get_base_type(arg
->type
);
518 print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 1, arg
->name
);
524 print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 2, arg
->name
);
530 print_proxy( "_StubMsg.BufferLength += %d; /* %s */\n", 4, arg
->name
);
534 print_proxy( "NdrSimpleStructBufferSize(&_StubMsg, (unsigned char*)%s, ", arg
->name
);
535 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d] );\n", index
);
539 constraint
= get_attrp( arg
->attrs
, ATTR_IIDIS
);
541 print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint
->name
);
542 print_proxy( "NdrPointerBufferSize( &_StubMsg, (unsigned char*)%s, ", arg
->name
);
543 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d]);\n", index
);
547 printf("FIXME: arg %s has unknown type %d\n", arg
->name
, type
->type
);
550 arg
= PREV_LINK(arg
);
554 static void stub_gen_marshall_copydata( var_t
*arg
)
557 while (NEXT_LINK(arg
))
558 arg
= NEXT_LINK(arg
);
561 if (is_attr(arg
->attrs
, ATTR_OUT
)) {
564 type_t
*type
= get_base_type(arg
->type
);
577 write_type(proxy
, arg
->type
, arg
, arg
->tname
);
578 fprintf(proxy
,"*)_StubMsg.Buffer)++ = %s;\n", arg
->name
);
582 /* FIXME: add the format string, and set the index below */
583 print_proxy( "NdrSimpleStructMarshall(&_StubMsg, (unsigned char*)%s, ", arg
->name
);
584 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d]);\n", index
);
588 constraint
= get_attrp( arg
->attrs
, ATTR_IIDIS
);
590 print_proxy( "_StubMsg.MaxCount = (unsigned long) ( %s );\n",constraint
->name
);
591 print_proxy( "NdrPointerMarshall( &_StubMsg, (unsigned char*)%s, ", arg
->name
);
592 fprintf(proxy
, "&__MIDL_TypeFormatString.Format[%d]);\n", index
);
596 printf("FIXME: arg %s has unknown type %d\n", arg
->name
, type
->type
);
599 arg
= PREV_LINK(arg
);
603 static void stub_genmarshall( var_t
*args
)
605 /* FIXME: size buffer */
606 stub_gen_marshall_size( args
);
608 print_proxy("NdrStubGetBuffer(This, pRpcChannelBuffer, &_StubMsg);\n");
610 stub_gen_marshall_copydata( args
);
613 static void gen_stub(type_t
*iface
, func_t
*cur
, char *cas
)
615 var_t
*def
= cur
->def
;
617 int has_ret
= !is_void(def
->type
, def
);
620 print_proxy( "void __RPC_STUB %s_", iface
->name
);
621 write_name(proxy
, def
);
622 print_proxy( "_Stub(\n");
624 print_proxy( "IRpcStubBuffer* This,\n");
625 print_proxy( "IRpcChannelBuffer* pRpcChannelBuffer,\n");
626 print_proxy( "PRPC_MESSAGE _Msg,\n");
627 print_proxy( "DWORD* _pdwStubPhase)\n");
631 /* local variables */
634 write_type(proxy
, def
->type
, def
, def
->tname
);
635 fprintf(proxy
, " _RetVal;\n");
637 print_proxy("%s* _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n", iface
->name
, iface
->name
);
638 print_proxy("MIDL_STUB_MESSAGE _StubMsg;\n");
639 stub_write_locals( cur
->args
);
640 fprintf(proxy
, "\n");
644 print_proxy("NdrStubInitialize(_Msg, &_StubMsg, &Object_StubDesc, pRpcChannelBuffer);\n");
645 fprintf(proxy
, "\n");
647 print_proxy("RpcTryFinally\n");
650 print_proxy("if ((_Msg->DataRepresentation&0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
652 print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[0]);\n" );
654 fprintf(proxy
, "\n");
656 stub_unmarshall( cur
->args
);
657 fprintf(proxy
, "\n");
659 print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n");
660 fprintf(proxy
, "\n");
662 if (has_ret
) fprintf(proxy
, "_RetVal = ");
663 fprintf(proxy
, "%s_", iface
->name
);
664 if (cas
) fprintf(proxy
, "%s_Stub", cas
);
665 else write_name(proxy
, def
);
666 fprintf(proxy
, "(_This");
669 while (NEXT_LINK(arg
)) arg
= NEXT_LINK(arg
);
671 fprintf(proxy
, ", ");
672 write_name(proxy
, arg
);
673 arg
= PREV_LINK(arg
);
676 fprintf(proxy
, ");\n");
677 fprintf(proxy
, "\n");
678 print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n");
679 fprintf(proxy
, "\n");
681 stub_genmarshall( cur
->args
);
682 fprintf(proxy
, "\n");
686 * FIXME: We only need to round the buffer up if it could be unaligned...
687 * We should calculate how much buffer we used and output the following
688 * line only if necessary.
690 print_proxy( "_StubMsg.Buffer = (unsigned char *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);\n");
692 print_proxy( "*((" );
693 write_type(proxy
, def
->type
, def
, def
->tname
);
694 fprintf(proxy
, "*)_StubMsg.Buffer)++ = _RetVal;\n");
699 print_proxy("RpcFinally\n");
702 print_proxy("RpcEndFinally\n");
704 print_proxy("_Msg->BufferLength = ((long)_StubMsg.Buffer - (long)_Msg->Buffer);\n");
711 static int write_proxy_methods(type_t
*iface
)
713 func_t
*cur
= iface
->funcs
;
715 while (NEXT_LINK(cur
)) cur
= NEXT_LINK(cur
);
717 if (iface
->ref
) i
= write_proxy_methods(iface
->ref
);
719 var_t
*def
= cur
->def
;
720 if (!is_callas(def
->attrs
)) {
721 if (i
) fprintf(proxy
, ",\n");
722 print_proxy( "%s_", iface
->name
);
723 write_name(proxy
, def
);
724 fprintf(proxy
, "_Proxy");
727 cur
= PREV_LINK(cur
);
732 static int write_stub_methods(type_t
*iface
)
734 func_t
*cur
= iface
->funcs
;
736 while (NEXT_LINK(cur
)) cur
= NEXT_LINK(cur
);
738 if (iface
->ref
) i
= write_stub_methods(iface
->ref
);
739 else return i
; /* skip IUnknown */
741 var_t
*def
= cur
->def
;
742 if (!is_local(def
->attrs
)) {
743 if (i
) fprintf(proxy
,",\n");
744 print_proxy( "%s_", iface
->name
);
745 write_name(proxy
, def
);
746 fprintf(proxy
, "_Stub");
749 cur
= PREV_LINK(cur
);
754 static void write_proxy(type_t
*iface
)
756 int midx
= -1, stubs
;
757 func_t
*cur
= iface
->funcs
;
760 if (!do_everything
) return;
762 while (NEXT_LINK(cur
)) cur
= NEXT_LINK(cur
);
764 /* FIXME: check for [oleautomation], shouldn't generate proxies/stubs if specified */
768 fprintf(proxy
, "/*****************************************************************************\n");
769 fprintf(proxy
, " * %s interface\n", iface
->name
);
770 fprintf(proxy
, " */\n");
772 var_t
*def
= cur
->def
;
773 if (!is_local(def
->attrs
)) {
774 var_t
*cas
= is_callas(def
->attrs
);
775 char *cname
= cas
? cas
->name
: NULL
;
778 func_t
*m
= iface
->funcs
;
779 while (m
&& strcmp(get_name(m
->def
), cname
))
783 gen_proxy(iface
, cur
, idx
);
784 gen_stub(iface
, cur
, cname
);
785 if (midx
== -1) midx
= idx
;
786 else if (midx
!= idx
) yyerror("method index mismatch in write_proxy");
789 cur
= PREV_LINK(cur
);
795 print_proxy( "const CINTERFACE_PROXY_VTABLE(%d) %sProxyVtbl =\n", midx
, iface
->name
);
798 print_proxy( "{&IID_%s},{\n", iface
->name
);
799 write_proxy_methods(iface
);
800 fprintf(proxy
, "}\n");
802 print_proxy( "};\n");
806 print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface
->name
);
809 stubs
= write_stub_methods(iface
);
810 fprintf(proxy
, "\n");
812 fprintf(proxy
, "};\n");
814 print_proxy( "const CInterfaceStubVtbl %sStubVtbl = {\n", iface
->name
);
816 print_proxy( "{&IID_%s,\n", iface
->name
);
817 print_proxy( " 0,\n");
818 print_proxy( " %d,\n", stubs
+3);
819 print_proxy( " &%s_table[-3]},\n", iface
->name
);
820 print_proxy( "{CStdStubBuffer_METHODS}\n");
822 print_proxy( "};\n");
824 print_proxy( "#if !defined(__RPC_WIN32__)\n");
825 print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
826 print_proxy( "#endif\n");
828 write_formatstring( 1 );
829 write_formatstring( 0 );
832 void write_proxies(ifref_t
*ifaces
)
834 ifref_t
*lcur
= ifaces
;
836 char *file_id
= proxy_token
;
840 while (NEXT_LINK(lcur
)) lcur
= NEXT_LINK(lcur
);
844 if (is_object(cur
->iface
->attrs
) && !is_local(cur
->iface
->attrs
))
845 write_proxy(cur
->iface
);
846 cur
= PREV_LINK(cur
);
851 fprintf(proxy
, "const CInterfaceProxyVtbl* _%s_ProxyVtblList[] =\n", file_id
);
852 fprintf(proxy
, "{\n");
856 fprintf(proxy
, " (CInterfaceProxyVtbl*)&%sProxyVtbl,\n", cur
->iface
->name
);
857 cur
= PREV_LINK(cur
);
859 fprintf(proxy
, " 0\n");
860 fprintf(proxy
, "};\n");
861 fprintf(proxy
, "\n");
863 fprintf(proxy
, "const CInterfaceStubVtbl* _%s_StubVtblList[] =\n", file_id
);
864 fprintf(proxy
, "{\n");
868 fprintf(proxy
, " (CInterfaceStubVtbl*)&%sStubVtbl,\n", cur
->iface
->name
);
869 cur
= PREV_LINK(cur
);
871 fprintf(proxy
, " 0\n");
872 fprintf(proxy
, "};\n");
873 fprintf(proxy
, "\n");
875 fprintf(proxy
, "const PCInterfaceName _%s_InterfaceNamesList[] =\n", file_id
);
876 fprintf(proxy
, "{\n");
880 fprintf(proxy
, " \"%s\",\n", cur
->iface
->name
);
881 cur
= PREV_LINK(cur
);
883 fprintf(proxy
, " 0\n");
884 fprintf(proxy
, "};\n");
885 fprintf(proxy
, "\n");
887 fprintf(proxy
, "#define _%s_CHECK_IID(n) IID_GENERIC_CHECK_IID(_%s, pIID, n)\n", file_id
, file_id
);
888 fprintf(proxy
, "\n");
889 fprintf(proxy
, "int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id
);
890 fprintf(proxy
, "{\n");
896 fprintf(proxy
, " if (!_%s_CHECK_IID(%d)) {\n", file_id
, c
);
897 fprintf(proxy
, " *pIndex = %d;\n", c
);
898 fprintf(proxy
, " return 1;\n");
899 fprintf(proxy
, " }\n");
902 cur
= PREV_LINK(cur
);
904 fprintf(proxy
, " return 0;\n");
905 fprintf(proxy
, "}\n");
906 fprintf(proxy
, "\n");
908 fprintf(proxy
, "const ExtendedProxyFileInfo %s_ProxyFileInfo =\n", file_id
);
909 fprintf(proxy
, "{\n");
910 fprintf(proxy
, " (PCInterfaceProxyVtblList*)&_%s_ProxyVtblList,\n", file_id
);
911 fprintf(proxy
, " (PCInterfaceStubVtblList*)&_%s_StubVtblList,\n", file_id
);
912 fprintf(proxy
, " (const PCInterfaceName*)&_%s_InterfaceNamesList,\n", file_id
);
913 fprintf(proxy
, " 0,\n");
914 fprintf(proxy
, " &_%s_IID_Lookup,\n", file_id
);
915 fprintf(proxy
, " %d,\n", c
);
916 fprintf(proxy
, " 1,\n");
917 fprintf(proxy
, " 0,\n");
918 fprintf(proxy
, " 0,\n");
919 fprintf(proxy
, " 0,\n");
920 fprintf(proxy
, " 0\n");
921 fprintf(proxy
, "};\n");