From c6296c418f9b7f7e77bf7c3afcc9c7f2648ee7a3 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Wed, 1 Jun 2005 11:03:40 +0000 Subject: [PATCH] If we are accessing a method from a superclass then we need to use the superclass's ITypeInfo otherwise we could get errors when accessing hreftypes that aren't present in the subclass. --- dlls/oleaut32/tmarshal.c | 54 +++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c index 5f78bd4c957..fbd6419fb0b 100644 --- a/dlls/oleaut32/tmarshal.c +++ b/dlls/oleaut32/tmarshal.c @@ -686,6 +686,7 @@ serialize_param( (DWORD*)(((LPBYTE)arg)+vdesc->u.oInst), buf ); + ITypeInfo_ReleaseVarDesc(tinfo2, vdesc); if (hres!=S_OK) return hres; if (debugout && (i<(tattr->cVars-1))) @@ -1432,7 +1433,7 @@ deserialize_DISPPARAM_ptr( /* Searches function, also in inherited interfaces */ static HRESULT _get_funcdesc( - ITypeInfo *tinfo, int iMethod, FUNCDESC **fdesc, BSTR *iname, BSTR *fname) + ITypeInfo *tinfo, int iMethod, ITypeInfo **tactual, FUNCDESC **fdesc, BSTR *iname, BSTR *fname) { int i = 0, j = 0; HRESULT hres; @@ -1440,6 +1441,9 @@ _get_funcdesc( if (fname) *fname = NULL; if (iname) *iname = NULL; + *tactual = tinfo; + ITypeInfo_AddRef(*tactual); + while (1) { hres = ITypeInfo_GetFuncDesc(tinfo, i, fdesc); if (hres) { @@ -1464,7 +1468,7 @@ _get_funcdesc( ERR("Did not find a typeinfo for reftype %ld?\n",href); continue; } - hres = _get_funcdesc(tinfo2,iMethod,fdesc,iname,fname); + hres = _get_funcdesc(tinfo2,iMethod,tactual,fdesc,iname,fname); ITypeInfo_Release(tinfo2); if (!hres) return S_OK; } @@ -1496,12 +1500,14 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) int nrofnames; int is_idispatch_getidsofnames = 0; DWORD remoteresult = 0; + ITypeInfo *tinfo; EnterCriticalSection(&tpinfo->crit); - hres = _get_funcdesc(tpinfo->tinfo,method,&fdesc,&iname,&fname); + hres = _get_funcdesc(tpinfo->tinfo,method,&tinfo,&fdesc,&iname,&fname); if (hres) { ERR("Did not find typeinfo/funcdesc entry for method %d!\n",method); + ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return E_FAIL; } @@ -1509,6 +1515,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) if (!tpinfo->chanbuf) { WARN("Tried to use disconnected proxy\n"); + ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return RPC_E_DISCONNECTED; } @@ -1537,6 +1544,8 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) hres = serialize_IDispatch_GetIDsOfNames(TRUE,relaydeb,args,&buf); if (hres != S_OK) { FIXME("serialize of IDispatch::GetIDsOfNames failed!\n"); + ITypeInfo_Release(tinfo); + LeaveCriticalSection(&tpinfo->crit); return hres; } goto afterserialize; @@ -1553,7 +1562,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) /* Need them for hack below */ memset(names,0,sizeof(names)); - if (ITypeInfo_GetNames(tpinfo->tinfo,fdesc->memid,names,sizeof(names)/sizeof(names[0]),&nrofnames)) + if (ITypeInfo_GetNames(tinfo,fdesc->memid,names,sizeof(names)/sizeof(names[0]),&nrofnames)) nrofnames = 0; if (nrofnames > sizeof(names)/sizeof(names[0])) ERR("Need more names!\n"); @@ -1582,7 +1591,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) /* DISPPARAMS* needs special serializer */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = serialize_DISPPARAM_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, relaydeb, FALSE, @@ -1594,7 +1603,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = serialize_LPVOID_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, relaydeb, FALSE, @@ -1608,7 +1617,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) } if (!isserialized) hres = serialize_param( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, relaydeb, FALSE, @@ -1695,7 +1704,7 @@ afterserialize: /* deserialize DISPPARAM */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = deserialize_DISPPARAM_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, relaydeb, FALSE, @@ -1711,7 +1720,7 @@ afterserialize: } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = deserialize_LPVOID_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, relaydeb, FALSE, @@ -1725,7 +1734,7 @@ afterserialize: } if (!isdeserialized) hres = deserialize_param( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, relaydeb, FALSE, @@ -1750,6 +1759,7 @@ after_deserialize: return status; HeapFree(GetProcessHeap(),0,buf.base); + ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return remoteresult; } @@ -1842,7 +1852,9 @@ PSFacBuf_CreateProxy( int j; /* nrofargs without This */ int nrofargs; - hres = _get_funcdesc(tinfo,i,&fdesc,NULL,NULL); + ITypeInfo *tinfo2; + hres = _get_funcdesc(tinfo,i,&tinfo2,&fdesc,NULL,NULL); + ITypeInfo_Release(tinfo2); if (hres) { ERR("GetFuncDesc %lx should not fail here.\n",hres); return hres; @@ -1976,6 +1988,7 @@ TMStubImpl_Invoke( BSTR names[10]; BSTR fname = NULL,iname = NULL; BOOL is_idispatch_getidsofnames = 0; + ITypeInfo *tinfo; memset(&buf,0,sizeof(buf)); buf.size = xmsg->cbBuffer; @@ -1996,7 +2009,7 @@ TMStubImpl_Invoke( xmsg->cbBuffer = buf.size; return hres; } - hres = _get_funcdesc(This->tinfo,xmsg->iMethod,&fdesc,&iname,&fname); + hres = _get_funcdesc(This->tinfo,xmsg->iMethod,&tinfo,&fdesc,&iname,&fname); if (hres) { ERR("GetFuncDesc on method %ld failed with %lx\n",xmsg->iMethod,hres); return hres; @@ -2010,7 +2023,7 @@ TMStubImpl_Invoke( /* Need them for hack below */ memset(names,0,sizeof(names)); - ITypeInfo_GetNames(This->tinfo,fdesc->memid,names,sizeof(names)/sizeof(names[0]),&nrofnames); + ITypeInfo_GetNames(tinfo,fdesc->memid,names,sizeof(names)/sizeof(names[0]),&nrofnames); if (nrofnames > sizeof(names)/sizeof(names[0])) { ERR("Need more names!\n"); } @@ -2047,7 +2060,7 @@ TMStubImpl_Invoke( /* deserialize DISPPARAM */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = deserialize_DISPPARAM_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, FALSE, TRUE, @@ -2063,7 +2076,7 @@ TMStubImpl_Invoke( } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = deserialize_LPVOID_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, FALSE, TRUE, @@ -2077,7 +2090,7 @@ TMStubImpl_Invoke( } if (!isdeserialized) hres = deserialize_param( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, FALSE, TRUE, @@ -2129,7 +2142,7 @@ afterdeserialize: /* DISPPARAMS* needs special serializer */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = serialize_DISPPARAM_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, FALSE, TRUE, @@ -2141,7 +2154,7 @@ afterdeserialize: } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = serialize_LPVOID_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, FALSE, TRUE, @@ -2155,7 +2168,7 @@ afterdeserialize: } if (!isserialized) hres = serialize_param( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, FALSE, TRUE, @@ -2173,7 +2186,8 @@ afterserialize: hres = xbuf_add (&buf, (LPBYTE)&res, sizeof(DWORD)); if (hres != S_OK) return hres; - + + ITypeInfo_Release(tinfo); xmsg->cbBuffer = buf.curoff; I_RpcGetBuffer((RPC_MESSAGE *)xmsg); memcpy(xmsg->Buffer, buf.base, buf.curoff);