Rob Shearman : widl: Fix the writing typedefs to dispinterfaces and pointers to interfaces.

Alexandre Julliard julliard at winehq.org
Wed Sep 10 06:01:35 CDT 2008


Module: wine
Branch: master
Commit: 39978c68f9ed140f71811109523cd9dadf198f24
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=39978c68f9ed140f71811109523cd9dadf198f24

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Wed Sep 10 08:00:27 2008 +0100

widl: Fix the writing typedefs to dispinterfaces and pointers to interfaces.

Currently, stdole2.tlb isn't generated correctly and causes "<failed>"
to appear instead of "FontEvents" in the IFontEventsDisp typedef when
viewed with oleview.

The problem is that the typedef should just generate a VT_USERDEFINED
record, but ends up generating a VT_PTR -> VT_USERDEFINED. So remove
the extra writing of VT_PTR entries.

Fix the skipped pointers checks in encode_type and encode_type to
specifically detect VT_UNKNOWN and VT_DISPATCH types which don't need
one level of pointers, whereas interfaces encoded as VT_USERDEFINED
do.

---

 tools/widl/write_msft.c |   26 ++++++--------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 198ce2d..28a74f2 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -885,7 +885,9 @@ static int encode_type(
             next_vt = VT_VOID;
 
         encode_type(typelib, next_vt, type->ref, &target_type, NULL, NULL, &child_size);
-        if(type->ref && (type->ref->type == RPC_FC_IP)) {
+        /* these types already have an implicit pointer, so we don't need to
+         * add another */
+        if(next_vt == VT_DISPATCH || next_vt == VT_UNKNOWN) {
             chat("encode_type: skipping ptr\n");
             *encoded_type = target_type;
             *width = 4;
@@ -1030,24 +1032,6 @@ static int encode_type(
 	*encoded_type = typeoffset;
 	*width = 0;
 	*alignment = 1;
-
-        if(type->type == RPC_FC_IP) {
-            for (typeoffset = 0; typeoffset < typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) {
-                typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset];
-                if ((typedata[0] == ((0x7fff << 16) | VT_PTR)) && (typedata[1] == *encoded_type)) break;
-            }
-            if (typeoffset == typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length) {
-                typeoffset = ctl2_alloc_segment(typelib, MSFT_SEG_TYPEDESC, 8, 0);
-                typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset];
-
-                typedata[0] = (0x7fff << 16) | VT_PTR;
-                typedata[1] = *encoded_type;
-            }
-            *encoded_type = typeoffset;
-            *width = 4;
-            *alignment = 4;
-            *decoded_size += 8;
-        }
         break;
       }
 
@@ -1177,7 +1161,9 @@ static int encode_var(
     dump_type(type);
 
     encode_type(typelib, vt, type, encoded_type, width, alignment, decoded_size);
-    if(type->type == RPC_FC_IP) return 2;
+    /* these types already have an implicit pointer, so we don't need to
+     * add another */
+    if(vt == VT_DISPATCH || vt == VT_UNKNOWN) return 2;
     return 0;
 }
 




More information about the wine-cvs mailing list