widl: Fix handling context handle return type in mixed mode.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jacek Caban 2019-01-30 13:48:46 +01:00 committed by Alexandre Julliard
parent 4179189ec6
commit 83b9438029
3 changed files with 25 additions and 13 deletions

View File

@ -1839,8 +1839,6 @@ static void test_handle_return(void)
{
ctx_handle_t handle, handle2;
if (!is_interp) return; /* broken in widl */
handle = get_handle();
test_handle(handle);
get_handle_by_ptr(&handle2);

View File

@ -55,6 +55,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
unsigned char explicit_fc, implicit_fc;
int has_full_pointer = is_full_pointer_function(func);
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
type_t *ret_type = type_function_get_rettype(func->type);
if (is_interpreted_func( iface, func )) return;
@ -75,7 +76,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
indent++;
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE);
if (!is_void(type_function_get_rettype(func->type)))
if (!is_void(ret_type))
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_FREE);
if (has_full_pointer)
@ -154,9 +155,16 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
assign_stub_out_args(server, indent, func, "__frame->");
/* Call the real server function */
print_server("%s%s%s",
is_void(type_function_get_rettype(func->type)) ? "" : "__frame->_RetVal = ",
prefix_server, get_name(func));
if (is_context_handle(ret_type))
{
print_server("__frame->_RetVal = NDRSContextUnmarshall((char*)0, _pRpcMessage->DataRepresentation);\n");
print_server("*((");
write_type_decl(server, ret_type, NULL);
fprintf(server, "*)NDRSContextValue(__frame->_RetVal)) = ");
}
else
print_server("%s", is_void(ret_type) ? "" : "__frame->_RetVal = ");
fprintf(server, "%s%s", prefix_server, get_name(func));
if (type_get_function_args(func->type))
{
@ -197,7 +205,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
{
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
if (!is_void(type_function_get_rettype(func->type)))
if (!is_void(ret_type))
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;\n");
@ -216,7 +224,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_MARSHAL);
/* marshall the return value */
if (!is_void(type_function_get_rettype(func->type)))
if (!is_void(ret_type))
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL);
indent--;

View File

@ -4246,13 +4246,14 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
}
else if (phase == PHASE_UNMARSHAL)
{
if (pass == PASS_OUT)
if (pass == PASS_OUT || pass == PASS_RETURN)
{
if (!in_attr)
print_file(file, indent, "*%s%s = 0;\n", local_var_prefix, var->name);
print_file(file, indent, "NdrClientContextUnmarshall(\n");
print_file(file, indent + 1, "&__frame->_StubMsg,\n");
print_file(file, indent + 1, "(NDR_CCONTEXT *)%s%s,\n", local_var_prefix, var->name);
print_file(file, indent + 1, "(NDR_CCONTEXT *)%s%s%s,\n",
pass == PASS_RETURN ? "&" : "", local_var_prefix, var->name);
print_file(file, indent + 1, "__frame->_Handle);\n");
}
else
@ -4605,9 +4606,14 @@ void declare_stub_args( FILE *file, int indent, const var_t *func )
/* declare return value */
if (!is_void(var->type))
{
print_file(file, indent, "%s", "");
write_type_decl(file, var->type, var->name);
fprintf(file, ";\n");
if (is_context_handle(var->type))
print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name);
else
{
print_file(file, indent, "%s", "");
write_type_decl(file, var->type, var->name);
fprintf(file, ";\n");
}
}
if (!type_get_function_args(func->type))