[PATCH 3/3] widl: Don't remove the FDUAL flag from non-dispatchable interfaces.

Zebediah Figura z.figura12 at gmail.com
Mon May 28 23:21:11 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/oleaut32/tests/tmarshal.idl |  2 --
 dlls/oleaut32/tests/typelib.c    | 31 +++++++++++--------------------
 tools/widl/write_msft.c          |  4 ----
 3 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl
index 12c0bd5..996e948 100644
--- a/dlls/oleaut32/tests/tmarshal.idl
+++ b/dlls/oleaut32/tests/tmarshal.idl
@@ -208,9 +208,7 @@ library TestTypelib
     [
         odl,
         uuid(a028db05-30f0-4b93-b17a-41c72f831d84),
-#if 0 /* FIXME: commented out as causes widl to generate incorrect typelib */
         dual,
-#endif
         oleautomation
     ]
     interface IKindaEnumWidget : IUnknown
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 05476a3..f4ad8f9 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -1507,16 +1507,10 @@ static void test_inheritance(void)
     FUNCDESC *pFD;
     WCHAR path[MAX_PATH];
     CHAR pathA[MAX_PATH];
-    static const WCHAR tl_path[] = {'.','\\','m','i','d','l','_','t','m','a','r','s','h','a','l','.','t','l','b',0};
-
-    BOOL use_midl_tlb = FALSE;
 
     GetModuleFileNameA(NULL, pathA, MAX_PATH);
     MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
 
-    if(use_midl_tlb)
-        memcpy(path, tl_path, sizeof(tl_path));
-
     hr = LoadTypeLib(path, &pTL);
     if(FAILED(hr)) return;
 
@@ -1592,17 +1586,13 @@ static void test_inheritance(void)
 
     hr = ITypeInfo_GetTypeAttr(pTI, &pTA);
     ok(hr == S_OK, "hr %08x\n", hr);
-    if (hr == S_OK)
-    {
-        ok(pTA->typekind == TKIND_DISPATCH, "kind %04x\n", pTA->typekind);
-        ok(pTA->cbSizeVft == 7 * sizeof(void *), "sizevft %d\n", pTA->cbSizeVft);
-        if(use_midl_tlb) {
-            ok(pTA->wTypeFlags == TYPEFLAG_FDUAL, "typeflags %x\n", pTA->wTypeFlags);
-        }
-        ok(pTA->cFuncs == 8, "cfuncs %d\n", pTA->cFuncs);
-        ok(pTA->cImplTypes == 1, "cimpltypes %d\n", pTA->cImplTypes);
-        ITypeInfo_ReleaseTypeAttr(pTI, pTA);
-    }
+    ok(pTA->typekind == TKIND_DISPATCH, "kind %04x\n", pTA->typekind);
+    ok(pTA->cbSizeVft == 7 * sizeof(void *), "sizevft %d\n", pTA->cbSizeVft);
+    ok(pTA->wTypeFlags == TYPEFLAG_FDUAL, "typeflags %x\n", pTA->wTypeFlags);
+    ok(pTA->cFuncs == 8, "cfuncs %d\n", pTA->cFuncs);
+    ok(pTA->cImplTypes == 1, "cimpltypes %d\n", pTA->cImplTypes);
+    ITypeInfo_ReleaseTypeAttr(pTI, pTA);
+
     hr = ITypeInfo_GetRefTypeOfImplType(pTI, 0, &href);
     ok(hr == S_OK, "hr %08x\n", hr);
     hr = ITypeInfo_GetRefTypeInfo(pTI, href, &pTI_p);
@@ -4903,8 +4893,8 @@ static void test_register_typelib(BOOL system_registration)
         { TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
         { TKIND_INTERFACE, TYPEFLAG_FOLEAUTOMATION },
         { TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE | TYPEFLAG_FOLEAUTOMATION },
-        { TKIND_DISPATCH,  0 /* TYPEFLAG_FDUAL - widl clears this flag for non-IDispatch derived interfaces */ },
-        { TKIND_DISPATCH,  0 /* TYPEFLAG_FDUAL - widl clears this flag for non-IDispatch derived interfaces */ },
+        { TKIND_DISPATCH,  TYPEFLAG_FDUAL },
+        { TKIND_DISPATCH,  TYPEFLAG_FDUAL },
         { TKIND_DISPATCH,  TYPEFLAG_FDISPATCHABLE | TYPEFLAG_FDUAL },
         { TKIND_DISPATCH,  TYPEFLAG_FDISPATCHABLE | TYPEFLAG_FDUAL },
         { TKIND_DISPATCH,  TYPEFLAG_FDISPATCHABLE },
@@ -4979,7 +4969,8 @@ static void test_register_typelib(BOOL system_registration)
             ok(hr == S_OK, "got %08x\n", hr);
 
             ok(dual_attr->typekind == TKIND_INTERFACE, "%d: got kind %d\n", i, dual_attr->typekind);
-            ok(dual_attr->wTypeFlags == (TYPEFLAG_FDISPATCHABLE | TYPEFLAG_FOLEAUTOMATION | TYPEFLAG_FDUAL), "%d: got flags %04x\n", i, dual_attr->wTypeFlags);
+            ok(dual_attr->wTypeFlags == (attrs[i].flags | TYPEFLAG_FOLEAUTOMATION),
+                "%d: got flags %04x\n", i, dual_attr->wTypeFlags);
 
             ITypeInfo_ReleaseTypeAttr(dual_info, dual_attr);
             ITypeInfo_Release(dual_info);
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index f8e9143..2e8c0dd 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -2163,10 +2163,6 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
         if (derived->name && !strcmp(derived->name, "IDispatch"))
             msft_typeinfo->typeinfo->flags |= 0x1000; /* TYPEFLAG_FDISPATCHABLE */
 
-    /* can't be dual if it doesn't derive from IDispatch */
-    if (!(msft_typeinfo->typeinfo->flags & 0x1000)) /* TYPEFLAG_FDISPATCHABLE */
-        msft_typeinfo->typeinfo->flags &= ~0x40; /* TYPEFLAG_FDUAL */
-
     if(type_iface_get_inherit(interface))
         add_impl_type(msft_typeinfo, type_iface_get_inherit(interface),
                       ref_importinfo);
-- 
2.7.4




More information about the wine-devel mailing list