diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 3e8be5dfbe7..a3ffc33a706 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -610,18 +610,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) count = count_methods(iface); - /* proc format string offsets */ - print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name ); - print_proxy( "{\n" ); - indent++; - STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) - { - var_t *func = stmt->u.var; - if (is_local( func->attrs )) continue; - print_proxy( "%u, /* %s */\n", func->procstring_offset, func->name ); - } - indent--; - print_proxy( "};\n\n" ); + write_procformatstring_offsets( proxy, iface ); /* proxy vtable */ print_proxy( "static %sCINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", diff --git a/tools/widl/server.c b/tools/widl/server.c index 513f37b1906..d02ffed66c9 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -57,7 +57,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { - const var_t *func = stmt->u.var; + var_t *func = stmt->u.var; int has_full_pointer = is_full_pointer_function(func); /* check for a defined binding handle */ @@ -243,6 +243,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) fprintf(server, "\n"); /* update proc_offset */ + func->procstring_offset = *proc_offset; *proc_offset += get_size_procformatstring_func( func ); } } @@ -278,6 +279,42 @@ static void write_dispatchtable(type_t *iface) } +static void write_routinetable(type_t *iface) +{ + const statement_t *stmt; + + print_server( "static const SERVER_ROUTINE %s_ServerRoutineTable[] =\n", iface->name ); + print_server( "{\n" ); + indent++; + STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) + { + var_t *func = stmt->u.var; + if (is_local( func->attrs )) continue; + print_server( "(SERVER_ROUTINE)%s,\n", func->name ); + } + indent--; + print_server( "};\n\n" ); +} + + +static void write_serverinfo(type_t *iface) +{ + print_server( "static const MIDL_SERVER_INFO %s_ServerInfo =\n", iface->name ); + print_server( "{\n" ); + indent++; + print_server( "&%s_StubDesc,\n", iface->name ); + print_server( "%s_ServerRoutineTable,\n", iface->name ); + print_server( "__MIDL_ProcFormatString.Format,\n" ); + print_server( "%s_FormatStringOffsetTable,\n", iface->name ); + print_server( "0,\n" ); + print_server( "0,\n" ); + print_server( "0,\n" ); + print_server( "0\n" ); + indent--; + print_server( "};\n\n" ); +} + + static void write_stubdescdecl(type_t *iface) { print_server("static const MIDL_STUB_DESC %s_StubDesc;\n", iface->name); @@ -332,6 +369,7 @@ static void write_serverinterfacedecl(type_t *iface) if (endpoints) write_endpoints( server, iface->name, endpoints ); print_server("static RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver)); + print_server( "static const MIDL_SERVER_INFO %s_ServerInfo;\n", iface->name ); fprintf(server, "\n"); print_server("static const RPC_SERVER_INTERFACE %s___RpcServerInterface =\n", iface->name ); print_server("{\n"); @@ -354,7 +392,7 @@ static void write_serverinterfacedecl(type_t *iface) print_server("0,\n"); } print_server("0,\n"); - print_server("0,\n"); + print_server("&%s_ServerInfo,\n", iface->name); print_server("0,\n"); indent--; print_server("};\n"); @@ -417,8 +455,11 @@ static void write_server_stmts(const statement_list_t *stmts, int expr_eval_rout print_server("#endif\n"); fprintf(server, "\n"); + write_procformatstring_offsets( server, iface ); write_stubdescriptor(iface, expr_eval_routines); write_dispatchtable(iface); + write_routinetable(iface); + write_serverinfo(iface); } } } @@ -454,8 +495,6 @@ static void write_server_routines(const statement_list_t *stmts) write_server_stmts(stmts, expr_eval_routines, &proc_offset); - fprintf(server, "\n"); - write_procformatstring(server, stmts, need_stub); write_typeformatstring(server, stmts, need_stub); } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index eb305b4ff4e..244baeafd45 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -953,6 +953,25 @@ void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred print_file(file, indent, "\n"); } +void write_procformatstring_offsets( FILE *file, const type_t *iface ) +{ + const statement_t *stmt; + int indent = 0; + + print_file( file, indent, "static const unsigned short %s_FormatStringOffsetTable[] =\n", + iface->name ); + print_file( file, indent, "{\n" ); + indent++; + STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) + { + var_t *func = stmt->u.var; + if (is_local( func->attrs )) continue; + print_file( file, indent, "%u, /* %s */\n", func->procstring_offset, func->name ); + } + indent--; + print_file( file, indent, "};\n\n" ); +} + static int write_base_type(FILE *file, const type_t *type, int convert_to_signed_type, unsigned int *typestring_offset) { unsigned char fc; diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h index e519ee0b7d2..5d46614d166 100644 --- a/tools/widl/typegen.h +++ b/tools/widl/typegen.h @@ -65,6 +65,7 @@ typedef int (*type_pred_t)(const type_t *); void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred); void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred); void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred); +void write_procformatstring_offsets( FILE *file, const type_t *iface ); void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname); void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix,