Raising exception for SC_RPC_HANDLE being NULL

Rob Shearman robertshearman at gmail.com
Tue Aug 19 01:57:06 CDT 2008


2008/8/18 Michael Martin <martinmnet at hotmail.com>:
>
> In widl code generated for services an
> exception is raised for null string with RPC_X_NULL_REF_POINTER
> In windows calls made to for example CreateService with all NULL's
> checks are made on the handle being null and its checked first before null strings.
>
> Windows documentation on RPC_X_ exceptions say that
> RPC_X_SS_IN_NULL_CONTEXT is raised for null handles.
>
> suggested patch
>
> Index: widl/client.c
> ===================================================================
> --- widl/client.c    (trunk)
> +++ widl/client.c    (working copy)
> @@ -67,6 +67,15 @@
>             indent--;
>             print_client("}\n\n");
>         }
> +        else if ((var->type->name) && (strncmp(var->type->name,"SC_RPC_HANDLE", 13)==0))

How on earth do you think it is the right fix to hard-code a services
type into widl? Did you not notice that SC_RPC_LOCK also needs the
right treatment and that renaming SC_RPC_HANDLE to XXXFOOBAR shouldn't
make any difference to the generated code?

The correct fix is to check for context handles and the output the below code.

> +        {
> +            print_client("if (!%s)\n",var->name);
> +            print_client("{\n");
> +            indent++;
> +            print_client("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n");
> +            indent--;
> +            print_client("}\n\n");
> +        }
>     }
>  }

-- 
Rob Shearman



More information about the wine-devel mailing list