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.
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?
Best regards and thanks for advice, Michael Karcher
2008/12/21 Michael Karcher wine@mkarcher.dialup.fu-berlin.de:
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.
Am Freitag, den 26.12.2008, 17:20 +0000 schrieb Rob Shearman:
2008/12/21 Michael Karcher wine@mkarcher.dialup.fu-berlin.de:
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.
OK, thanks for your info. I will try to send a patch.
Best regards, Michael Karcher