Commit f4a96193 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Fix detection of non-pointer context handles.

is_ptr cannot be used because it follows the chain of types into the type which has the context_handle attribute, which is typically "void *" and so causes these context handles to be incorrectly detected as context handles. Instead, we can use is_aliaschain_ptr to follow the chain of aliases without following pointers and the absence of the context_handle attribute indicates that it must be present on a type after following a pointer.
parent 59556de0
......@@ -203,9 +203,13 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
}
else if (context_handle_var)
{
print_client("if (%s%s != 0)\n", is_ptr(context_handle_var->type) ? "*" : "", context_handle_var->name);
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
int is_ch_ptr = is_aliaschain_attr(context_handle_var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", context_handle_var->name);
indent++;
print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ptr(context_handle_var->type) ? "*" : "", context_handle_var->name);
print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ch_ptr ? "*" : "", context_handle_var->name);
indent--;
fprintf(client, "\n");
}
......
......@@ -184,9 +184,13 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
fprintf(server, ",\n");
if (is_context_handle(var->type))
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
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_ptr(var->type) ? "" : "*", var->name);
fprintf(server, ")%sNDRSContextValue(%s)", is_ch_ptr ? "" : "*", var->name);
}
else
{
......
......@@ -2778,9 +2778,13 @@ static void write_remoting_arg(FILE *file, int indent, const func_t *func,
{
if (pass == PASS_IN)
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
* be direct, otherwise it is a pointer */
int is_ch_ptr = is_aliaschain_attr(type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
print_file(file, indent, "NdrClientContextMarshall(\n");
print_file(file, indent + 1, "&_StubMsg,\n");
print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s,\n", is_ptr(type) ? "*" : "", var->name);
print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s,\n", is_ch_ptr ? "*" : "", var->name);
print_file(file, indent + 1, "%s);\n", in_attr && out_attr ? "1" : "0");
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment