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.
This commit is contained in:
Rob Shearman 2008-09-10 08:00:27 +01:00 committed by Alexandre Julliard
parent bfc34a3c9c
commit 39978c68f9
1 changed files with 6 additions and 20 deletions

View File

@ -885,7 +885,9 @@ static int encode_type(
next_vt = VT_VOID; next_vt = VT_VOID;
encode_type(typelib, next_vt, type->ref, &target_type, NULL, NULL, &child_size); 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"); chat("encode_type: skipping ptr\n");
*encoded_type = target_type; *encoded_type = target_type;
*width = 4; *width = 4;
@ -1030,24 +1032,6 @@ static int encode_type(
*encoded_type = typeoffset; *encoded_type = typeoffset;
*width = 0; *width = 0;
*alignment = 1; *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; break;
} }
@ -1177,7 +1161,9 @@ static int encode_var(
dump_type(type); dump_type(type);
encode_type(typelib, vt, type, encoded_type, width, alignment, decoded_size); 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; return 0;
} }