widl: Implemented __finally support in server functions.
This commit is contained in:
parent
3bab54cf04
commit
0f12f358cd
|
@ -63,21 +63,38 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(func);
|
||||
|
||||
print_server("struct __frame_%s_%s\n{\n", iface->name, get_name(def));
|
||||
indent++;
|
||||
print_server("__DECL_EXCEPTION_FRAME\n");
|
||||
print_server("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
|
||||
/* Declare arguments */
|
||||
declare_stub_args(server, indent, func);
|
||||
|
||||
indent--;
|
||||
print_server("};\n\n");
|
||||
|
||||
print_server("static void __finally_%s_%s(", iface->name, get_name(def));
|
||||
fprintf(server," struct __frame_%s_%s *__frame )\n{\n", iface->name, get_name(def));
|
||||
|
||||
indent++;
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE);
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(server, indent, func);
|
||||
|
||||
indent--;
|
||||
print_server("}\n\n");
|
||||
|
||||
print_server("void __RPC_STUB %s_%s( PRPC_MESSAGE _pRpcMessage )\n", iface->name, get_name(def));
|
||||
|
||||
/* write the functions body */
|
||||
fprintf(server, "{\n");
|
||||
indent++;
|
||||
print_server( "struct __server_frame __f, * const __frame = &__f;\n" );
|
||||
|
||||
/* Declare arguments */
|
||||
declare_stub_args(server, indent, func);
|
||||
|
||||
print_server("RPC_STATUS _Status;\n");
|
||||
print_server("struct __frame_%s_%s __f, * const __frame = &__f;\n", iface->name, get_name(def));
|
||||
if (has_out_arg_or_return(func)) print_server("RPC_STATUS _Status;\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
|
||||
print_server("((void)(_Status));\n");
|
||||
print_server("NdrServerInitializeNew(\n");
|
||||
indent++;
|
||||
print_server("_pRpcMessage,\n");
|
||||
|
@ -85,13 +102,13 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
print_server("&%s_StubDesc);\n", iface->name);
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
print_server( "RpcExceptionInit( __server_filter, __server_finally );\n" );
|
||||
print_server( "RpcExceptionInit( __server_filter, __finally_%s_%s );\n", iface->name, get_name(def));
|
||||
|
||||
write_parameters_init(server, indent, func, "");
|
||||
write_parameters_init(server, indent, func, "__frame->");
|
||||
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
print_server("%s = _pRpcMessage->Handle;\n", explicit_handle_var->name);
|
||||
print_server("__frame->%s = _pRpcMessage->Handle;\n", explicit_handle_var->name);
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
|
@ -117,7 +134,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
fprintf(server, "\n");
|
||||
|
||||
/* unmarshall arguments */
|
||||
write_remoting_arguments(server, indent, func, "", PASS_IN, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_IN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
print_server("if (__frame->_StubMsg.Buffer > __frame->_StubMsg.BufferEnd)\n");
|
||||
|
@ -138,11 +155,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
fprintf(server, "\n");
|
||||
|
||||
/* Assign 'out' arguments */
|
||||
assign_stub_out_args(server, indent, func, "");
|
||||
assign_stub_out_args(server, indent, func, "__frame->");
|
||||
|
||||
/* Call the real server function */
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
print_server("_RetVal = ");
|
||||
print_server("__frame->_RetVal = ");
|
||||
else
|
||||
print_server("");
|
||||
fprintf(server, "%s%s", prefix_server, get_name(def));
|
||||
|
@ -167,11 +184,12 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
|
||||
print_server("(");
|
||||
write_type_decl_left(server, var->type);
|
||||
fprintf(server, ")%sNDRSContextValue(%s)", is_ch_ptr ? "" : "*", var->name);
|
||||
fprintf(server, ")%sNDRSContextValue(__frame->%s)",
|
||||
is_ch_ptr ? "" : "*", var->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_server("%s%s", var->type->declarray ? "*" : "", get_name(var));
|
||||
print_server("%s__frame->%s", var->type->declarray ? "*" : "", var->name);
|
||||
}
|
||||
}
|
||||
fprintf(server, ");\n");
|
||||
|
@ -184,10 +202,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
|
||||
if (has_out_arg_or_return(func))
|
||||
{
|
||||
write_remoting_arguments(server, indent, func, "", PASS_OUT, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
|
||||
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
write_remoting_arguments(server, indent, func, "", PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;\n");
|
||||
fprintf(server, "\n");
|
||||
|
@ -202,23 +220,18 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
}
|
||||
|
||||
/* marshall arguments */
|
||||
write_remoting_arguments(server, indent, func, "", PASS_OUT, PHASE_MARSHAL);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_MARSHAL);
|
||||
|
||||
/* marshall the return value */
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
write_remoting_arguments(server, indent, func, "", PASS_RETURN, PHASE_MARSHAL);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL);
|
||||
|
||||
indent--;
|
||||
print_server("}\n");
|
||||
print_server("RpcFinally\n");
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
|
||||
write_remoting_arguments(server, indent, func, "", PASS_OUT, PHASE_FREE);
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(server, indent, func);
|
||||
|
||||
print_server("__finally_%s_%s( __frame );\n", iface->name, get_name(def));
|
||||
indent--;
|
||||
print_server("}\n");
|
||||
print_server("RpcEndFinally\n");
|
||||
|
@ -384,10 +397,6 @@ static void init_server(void)
|
|||
print_server( " return RPC_BAD_STUB_DATA_EXCEPTION_FILTER;\n");
|
||||
print_server( "}\n");
|
||||
print_server( "\n");
|
||||
print_server("static void __server_finally( struct __server_frame *__frame )\n");
|
||||
print_server( "{\n");
|
||||
print_server( "}\n");
|
||||
print_server( "\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue