[2/2] widl: Fix generation of a typelib for winhttp.

Dmitry Timoshkov dmitry at baikal.ru
Thu Oct 1 21:25:04 CDT 2015


This is a follow up to the discussion I had at wineconf with Jacek regarding
widl and broken typelib in winhttp. Just compare what programs/oleview shows
for dlls/winhttp/winhttp.dll.fake before and after this patch, for instance
have a look at both Option() methods of IWinHttpRequest interface.

This patch makes the winhttp typelib almost match the one generated by
midl: I've compared the midl and widl generated typelibs with winedump+diff
and now there are only minor differences between them, all the types now have
proper definitions and references (hrefs). Now both Wine built-in oleview
and oleview.exe from PSDK correctly show all the type definitions, methods
and their parameters in that typelib, and what is more important, this patch
actually makes ITypeInfo_Invoke work for winhttp's typelib. Although there are
still remaining cases when Invoke fails for some flags combinations used in
winhttp Invoke tests, but that's actually correct behaviour of the typelib
marshaller.

Still, the application I have here depends on the Invoke(HTTPREQUEST_OPTION)
succeeding for broken/incorrect flags, and that can't be fixed without custom
Invoke handler in winhttp.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/winhttp/tests/winhttp.c | 1 -
 tools/widl/write_msft.c      | 9 +++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index e221809..bd6b47f 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -3780,7 +3780,6 @@ todo_wine
     VariantInit(&ret);
     hr = IWinHttpRequest_Invoke(request, DISPID_HTTPREQUEST_SETAUTOLOGONPOLICY, &IID_NULL, 0,
                                 DISPATCH_METHOD, &params, &ret, NULL, NULL);
-todo_wine
     ok(hr == S_OK, "error %#x\n", hr);
 
     IWinHttpRequest_Release(request);
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 26600e4..7973113 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -974,8 +974,7 @@ static int encode_type(
       {
         int typeinfo_offset;
 
-        /* typedef'd types without public attribute aren't included in the typelib */
-        while (type->typelib_idx < 0 && type_is_alias(type) && !is_attr(type->attrs, ATTR_PUBLIC))
+        while (type->typelib_idx < 0 && type_is_alias(type))
           type = type_alias_get_aliasee(type);
 
         chat("encode_type: VT_USERDEFINED - type %p name = %s real type %d idx %d\n", type,
@@ -1836,7 +1835,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
     MSFT_TypeInfoBase *typeinfo;
     MSFT_GuidEntry guidentry;
 
-    chat("create_msft_typeinfo: name %s kind %d\n", name, kind);
+    chat("create_msft_typeinfo: name %s kind %d, index %d\n", name, kind, typelib->typelib_header.nrtypeinfos);
 
     msft_typeinfo = xmalloc(sizeof(*msft_typeinfo));
     memset( msft_typeinfo, 0, sizeof(*msft_typeinfo) );
@@ -2307,9 +2306,7 @@ static void add_entry(msft_typelib_t *typelib, const statement_t *stmt)
     {
         const type_list_t *type_entry = stmt->u.type_list;
         for (; type_entry; type_entry = type_entry->next) {
-            /* if the type is public then add the typedef, otherwise attempt
-             * to add the aliased type */
-            if (is_attr(type_entry->type->attrs, ATTR_PUBLIC))
+            if (type_get_type(type_entry->type) == TYPE_BASIC)
                 add_typedef_typeinfo(typelib, type_entry->type);
             else
                 add_type_typeinfo(typelib, type_alias_get_aliasee(type_entry->type));
-- 
2.6.0




More information about the wine-patches mailing list