From 6f2687a389861fbedbbb8c8e3b3c376aef1e3676 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Tue, 26 Aug 2008 20:05:17 +0100 Subject: [PATCH] widl: Raise RPC_X_SS_IN_NULL_CONTEXT exception for NULL in-only context handles instead of RPC_X_NULL_REF_PTR. Based on a patch by Michael Martin. --- tools/widl/client.c | 8 ++++++++ tools/widl/proxy.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/tools/widl/client.c b/tools/widl/client.c index 779492e9171..6f148c1c396 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -188,6 +188,14 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) indent++; print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ch_ptr ? "*" : "", context_handle_var->name); indent--; + if (is_attr(context_handle_var->attrs, ATTR_IN) && + !is_attr(context_handle_var->attrs, ATTR_OUT)) + { + print_client("else\n"); + indent++; + print_client("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n"); + indent--; + } fprintf(client, "\n"); } else if (implicit_handle) diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 60ee3c06fd6..c5c79c32ec8 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -199,6 +199,11 @@ int cant_be_null(const var_t *v) const attr_list_t *attrs = v->attrs; const type_t *type = v->type; + /* context handles have their own checking so they can be null for the + * purposes of null ref pointer checking */ + if (is_aliaschain_attr(type, ATTR_CONTEXTHANDLE)) + return 0; + if (! attrs && type) { attrs = type->attrs; -- 2.11.4.GIT