oleaut32: Handle TKIND_COCLASS subtype for VT_PTR/VT_USERDEFINED.

Jan Ohlsen jan.t.ohlsen at gmail.com
Wed Sep 8 21:25:56 CDT 2010


---
 dlls/oleaut32/tmarshal.c |   69
++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100909/20c03659/attachment.htm>
-------------- next part --------------
From ef0e7fac6b2675f6a3a5031abc05521fefc9adab Mon Sep 17 00:00:00 2001
From: Jan T. Ohlsen <jan.t.ohlsen at gmail.com>
Date: Mon, 6 Sep 2010 01:36:04 +0100
Subject: oleaut32: Handle TKIND_COCLASS subtype for VT_PTR/VT_USERDEFINED.
           (May resolve #19016.)

---
 dlls/oleaut32/tmarshal.c |   69 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c
index 26babdb..3264b42 100644
--- a/dlls/oleaut32/tmarshal.c
+++ b/dlls/oleaut32/tmarshal.c
@@ -724,6 +724,7 @@ serialize_param(
 		break;
 	    case TKIND_DISPATCH:	/* will be done in VT_USERDEFINED case */
 	    case TKIND_INTERFACE:	/* will be done in VT_USERDEFINED case */
+       case TKIND_COCLASS:     /* will be done in VT_USERDEFINED case */
 		derefhere=FALSE;
 		break;
 	    default:
@@ -785,6 +786,41 @@ serialize_param(
 	    if (dealloc)
 	        IUnknown_Release((LPUNKNOWN)arg);
 	    break;
+   case TKIND_COCLASS: {
+       ITypeInfo	*pSubTypeInfo = NULL;
+       TYPEATTR	*tattr2 = NULL;
+       GUID 	*iid = &(tattr->guid);
+
+       if (tattr->cImplTypes > 0) {
+           /* Use IID of the coclass' default interface */
+           HREFTYPE href;
+           HRESULT hr;
+
+           hr = ITypeInfo_GetRefTypeOfImplType(tinfo2, 0, &href);
+           if (!hr) {
+               hr = ITypeInfo_GetRefTypeInfo(tinfo2, href, &pSubTypeInfo);
+               if (!hr) {
+                   hr = ITypeInfo_GetTypeAttr(pSubTypeInfo, &tattr2);
+                   if (!hr)
+                       iid = &tattr2->guid;
+                   }
+           }
+       }
+
+       if (writeit)
+           hres=_marshal_interface(buf,iid,(LPUNKNOWN)arg);
+
+       if (tattr2)
+           ITypeInfo_ReleaseTypeAttr(pSubTypeInfo, tattr2);
+
+       if (pSubTypeInfo)
+           ITypeInfo_Release(pSubTypeInfo);	
+
+       if (dealloc)
+           IUnknown_Release((LPUNKNOWN)arg);
+
+       break;
+   }
 	case TKIND_RECORD: {
 	    int i;
 	    if (debugout) TRACE_(olerelay)("{");
@@ -1000,6 +1036,7 @@ deserialize_param(
 		    break;
 		case TKIND_DISPATCH:	/* will be done in VT_USERDEFINED case */
 		case TKIND_INTERFACE:	/* will be done in VT_USERDEFINED case */
+       case TKIND_COCLASS:	/* will be done in VT_USERDEFINED case */
 		    derefhere=FALSE;
 		    break;
 		default:
@@ -1074,6 +1111,38 @@ deserialize_param(
 		    if (readit)
 			hres = _unmarshal_interface(buf,&(tattr->guid),(LPUNKNOWN*)arg);
 		    break;
+       case TKIND_COCLASS: {
+           ITypeInfo	*pSubTypeInfo = NULL;
+           TYPEATTR	*tattr2 = NULL;
+           GUID 	*iid = &(tattr->guid);
+
+           if (tattr->cImplTypes > 0) {
+               /* Use IID of the coclass' default interface */
+               HREFTYPE href;
+               HRESULT hr;
+
+               hr = ITypeInfo_GetRefTypeOfImplType(tinfo2, 0, &href);
+               if (!hr) {
+                   hr = ITypeInfo_GetRefTypeInfo(tinfo2, href, &pSubTypeInfo);
+                   if (!hr) {
+                       hr = ITypeInfo_GetTypeAttr(pSubTypeInfo, &tattr2);
+                       if (!hr)
+                           iid = &tattr2->guid;
+                   }
+               }
+           }
+
+           if (readit)
+               hres = _unmarshal_interface(buf,iid,(LPUNKNOWN*)arg);
+
+           if (tattr2)
+               ITypeInfo_ReleaseTypeAttr(pSubTypeInfo, tattr2);
+
+           if (pSubTypeInfo)
+               ITypeInfo_Release(pSubTypeInfo);	
+
+           break;
+       }
 		case TKIND_RECORD: {
 		    int i;
 
-- 
1.5.6.5


More information about the wine-patches mailing list