[PATCH 5/5] widl: Respect wire-marshal typedefs in type libraries.

Zebediah Figura z.figura12 at gmail.com
Wed Aug 21 11:18:10 CDT 2019


From: Richard Pospesel <richard at torproject.org>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47041
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 4f6b4fc38a..79e72e0472 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 e972a26b59..0e6ef087e5 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));
-- 
2.22.0




More information about the wine-devel mailing list