Marshalling of remotable handles

Rob Shearman robertshearman at
Fri Dec 26 11:20:24 CST 2008

2008/12/21 Michael Karcher <wine at>:
> Hello Wine developers,
> while trying to add proxy/stub code for shell32, I stumbled across the
> definition of remotable handles in IDL.
> We have
>  - a RemotableHandle union.
>  - the IDL typedefs for the wire representation of handles:
> |    typedef [unique] RemotableHandle *wireHXXX;
>  - the IDL declaration for the handle types itself:
> |    typedef [wire_marshal(wireHXXX)] void*HXXX;
> This makes widl generate null pointer checks for HWND parameters, as
> HXXX is a void pointer without the unique attribute. My question is:
> Should widl really add this check? As the type is marshalled as
> wireHXXX, the null value is no problem for marshalling, so it could be
> safely left out.

Yes, that's a widl bug - it shouldn't output NULL ref pointer checks
for user-marshaled types.

> What I did in my repository was adding the [unique] attribute to the IDL
> typedef of the handle type:
> | typedef [unique, wire_marshal(wireHXXX)] void*HXXX;
> Is this the right approach to generally get rid of the NULL pointer
> checks for handles, or is widl to be fixed instead?

widl should be fixed, since MIDL correctly doesn't output NULL ref
pointer checks when using the same source IDL files.

Rob Shearman

More information about the wine-devel mailing list