Module: wine
Branch: master
Commit: 57f697e137e099837d8ed3eb00cd2814bfc135df
URL: https://source.winehq.org/git/wine.git/?a=commit;h=57f697e137e099837d8ed3eb…
Author: Richard Pospesel <richard(a)torproject.org>
Date: Wed Aug 21 11:18:10 2019 -0500
widl: Respect wire-marshal typedefs in type libraries.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47041
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
tools/widl/typelib.c | 3 ++-
tools/widl/write_msft.c | 19 ++++++++++++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 4f6b4fc..79e72e0 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -129,7 +129,8 @@ unsigned short get_type_vt(type_t *t)
if (vt) return vt;
}
- if (type_is_alias(t) && is_attr(t->attrs, ATTR_PUBLIC))
+ if (type_is_alias(t) &&
+ (is_attr(t->attrs, ATTR_PUBLIC) || is_attr(t->attrs, ATTR_WIREMARSHAL)))
return VT_USERDEFINED;
switch (type_get_type(t)) {
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index e972a26..0e6ef08 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -967,9 +967,22 @@ static int encode_type(
}
else
{
- /* typedef'd types without public attribute aren't included in the typelib */
- while (type_is_alias(type) && !is_attr(type->attrs, ATTR_PUBLIC))
- type = type_alias_get_aliasee_type(type);
+ /* Typedefs without the [public] attribute aren't included in the
+ * typelib, unless the aliasee is an anonymous UDT or the typedef
+ * is wire-marshalled. In the latter case the wire-marshal type,
+ * which may be a non-public alias, is used instead. */
+ while (type_is_alias(type))
+ {
+ if (is_attr(type->attrs, ATTR_WIREMARSHAL))
+ {
+ type = get_attrp(type->attrs, ATTR_WIREMARSHAL);
+ break;
+ }
+ else if (!is_attr(type->attrs, ATTR_PUBLIC))
+ type = type_alias_get_aliasee_type(type);
+ else
+ break;
+ }
chat("encode_type: VT_USERDEFINED - adding new type %s, real type %d\n",
type->name, type_get_type(type));