PATCH: tmarshal VT_USERDEFINED / TKIND* handling
Marcus Meissner
meissner at suse.de
Tue Sep 6 10:32:10 CDT 2005
Hi,
Robert noted that VT_PTR -> VT_USERDEFINED (TKIND_*) handling
was broken to some degree, when using TKIND_ENUM (and perhaps
TKIND_RECORD).
This patch fixes this and his testcase now goes much further.
Ciao, Marcus
Changelog:
VT_PTR->VT_USERDEFINED chains depend on the TKIND of
the userdefined type due to our handling of COM
interfaces in there.
Index: dlls/oleaut32/tmarshal.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tmarshal.c,v
retrieving revision 1.64
diff -u -r1.64 tmarshal.c
--- dlls/oleaut32/tmarshal.c 29 Aug 2005 21:46:51 -0000 1.64
+++ dlls/oleaut32/tmarshal.c 6 Sep 2005 15:30:01 -0000
@@ -608,9 +608,35 @@
}
case VT_PTR: {
DWORD cookie;
- BOOL derefhere;
+ BOOL derefhere = TRUE;
- derefhere = (tdesc->u.lptdesc->vt != VT_USERDEFINED);
+ if (tdesc->u.lptdesc->vt == VT_USERDEFINED) {
+ ITypeInfo *tinfo2;
+ TYPEATTR *tattr;
+
+ hres = ITypeInfo_GetRefTypeInfo(tinfo,tdesc->u.lptdesc->u.hreftype,&tinfo2);
+ if (hres) {
+ ERR("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc->u.lptdesc->u.hreftype);
+ return hres;
+ }
+ ITypeInfo_GetTypeAttr(tinfo2,&tattr);
+ switch (tattr->typekind) {
+ case TKIND_ENUM: /* confirmed */
+ case TKIND_RECORD: /* FIXME: mostly untested */
+ derefhere=TRUE;
+ break;
+ case TKIND_ALIAS: /* FIXME: untested */
+ case TKIND_DISPATCH: /* will be done in VT_USERDEFINED case */
+ case TKIND_INTERFACE: /* will be done in VT_USERDEFINED case */
+ derefhere=FALSE;
+ break;
+ default:
+ FIXME("unhandled switch cases tattr->typekind %d\n", tattr->typekind);
+ derefhere=FALSE;
+ break;
+ }
+ ITypeInfo_Release(tinfo2);
+ }
if (debugout) TRACE_(olerelay)("*");
/* Write always, so the other side knows when it gets a NULL pointer.
@@ -1184,9 +1210,35 @@
}
case VT_PTR: {
DWORD cookie;
- BOOL derefhere = 0;
+ BOOL derefhere = TRUE;
- derefhere = (tdesc->u.lptdesc->vt != VT_USERDEFINED);
+ if (tdesc->u.lptdesc->vt == VT_USERDEFINED) {
+ ITypeInfo *tinfo2;
+ TYPEATTR *tattr;
+
+ hres = ITypeInfo_GetRefTypeInfo(tinfo,tdesc->u.lptdesc->u.hreftype,&tinfo2);
+ if (hres) {
+ ERR("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc->u.lptdesc->u.hreftype);
+ return hres;
+ }
+ ITypeInfo_GetTypeAttr(tinfo2,&tattr);
+ switch (tattr->typekind) {
+ case TKIND_ENUM: /* confirmed */
+ case TKIND_RECORD: /* FIXME: mostly untested */
+ derefhere=TRUE;
+ break;
+ case TKIND_ALIAS: /* FIXME: untested */
+ case TKIND_DISPATCH: /* will be done in VT_USERDEFINED case */
+ case TKIND_INTERFACE: /* will be done in VT_USERDEFINED case */
+ derefhere=FALSE;
+ break;
+ default:
+ FIXME("unhandled switch cases tattr->typekind %d\n", tattr->typekind);
+ derefhere=FALSE;
+ break;
+ }
+ ITypeInfo_Release(tinfo2);
+ }
/* read it in all cases, we need to know if we have
* NULL pointer or not.
*/
More information about the wine-patches
mailing list