Commit c6296c41 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

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.
parent 9ddf17bf
...@@ -686,6 +686,7 @@ serialize_param( ...@@ -686,6 +686,7 @@ serialize_param(
(DWORD*)(((LPBYTE)arg)+vdesc->u.oInst), (DWORD*)(((LPBYTE)arg)+vdesc->u.oInst),
buf buf
); );
ITypeInfo_ReleaseVarDesc(tinfo2, vdesc);
if (hres!=S_OK) if (hres!=S_OK)
return hres; return hres;
if (debugout && (i<(tattr->cVars-1))) if (debugout && (i<(tattr->cVars-1)))
...@@ -1432,7 +1433,7 @@ deserialize_DISPPARAM_ptr( ...@@ -1432,7 +1433,7 @@ deserialize_DISPPARAM_ptr(
/* Searches function, also in inherited interfaces */ /* Searches function, also in inherited interfaces */
static HRESULT static HRESULT
_get_funcdesc( _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; int i = 0, j = 0;
HRESULT hres; HRESULT hres;
...@@ -1440,6 +1441,9 @@ _get_funcdesc( ...@@ -1440,6 +1441,9 @@ _get_funcdesc(
if (fname) *fname = NULL; if (fname) *fname = NULL;
if (iname) *iname = NULL; if (iname) *iname = NULL;
*tactual = tinfo;
ITypeInfo_AddRef(*tactual);
while (1) { while (1) {
hres = ITypeInfo_GetFuncDesc(tinfo, i, fdesc); hres = ITypeInfo_GetFuncDesc(tinfo, i, fdesc);
if (hres) { if (hres) {
...@@ -1464,7 +1468,7 @@ _get_funcdesc( ...@@ -1464,7 +1468,7 @@ _get_funcdesc(
ERR("Did not find a typeinfo for reftype %ld?\n",href); ERR("Did not find a typeinfo for reftype %ld?\n",href);
continue; continue;
} }
hres = _get_funcdesc(tinfo2,iMethod,fdesc,iname,fname); hres = _get_funcdesc(tinfo2,iMethod,tactual,fdesc,iname,fname);
ITypeInfo_Release(tinfo2); ITypeInfo_Release(tinfo2);
if (!hres) return S_OK; if (!hres) return S_OK;
} }
...@@ -1496,12 +1500,14 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1496,12 +1500,14 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
int nrofnames; int nrofnames;
int is_idispatch_getidsofnames = 0; int is_idispatch_getidsofnames = 0;
DWORD remoteresult = 0; DWORD remoteresult = 0;
ITypeInfo *tinfo;
EnterCriticalSection(&tpinfo->crit); EnterCriticalSection(&tpinfo->crit);
hres = _get_funcdesc(tpinfo->tinfo,method,&fdesc,&iname,&fname); hres = _get_funcdesc(tpinfo->tinfo,method,&tinfo,&fdesc,&iname,&fname);
if (hres) { if (hres) {
ERR("Did not find typeinfo/funcdesc entry for method %d!\n",method); ERR("Did not find typeinfo/funcdesc entry for method %d!\n",method);
ITypeInfo_Release(tinfo);
LeaveCriticalSection(&tpinfo->crit); LeaveCriticalSection(&tpinfo->crit);
return E_FAIL; return E_FAIL;
} }
...@@ -1509,6 +1515,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1509,6 +1515,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
if (!tpinfo->chanbuf) if (!tpinfo->chanbuf)
{ {
WARN("Tried to use disconnected proxy\n"); WARN("Tried to use disconnected proxy\n");
ITypeInfo_Release(tinfo);
LeaveCriticalSection(&tpinfo->crit); LeaveCriticalSection(&tpinfo->crit);
return RPC_E_DISCONNECTED; return RPC_E_DISCONNECTED;
} }
...@@ -1537,6 +1544,8 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1537,6 +1544,8 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
hres = serialize_IDispatch_GetIDsOfNames(TRUE,relaydeb,args,&buf); hres = serialize_IDispatch_GetIDsOfNames(TRUE,relaydeb,args,&buf);
if (hres != S_OK) { if (hres != S_OK) {
FIXME("serialize of IDispatch::GetIDsOfNames failed!\n"); FIXME("serialize of IDispatch::GetIDsOfNames failed!\n");
ITypeInfo_Release(tinfo);
LeaveCriticalSection(&tpinfo->crit);
return hres; return hres;
} }
goto afterserialize; goto afterserialize;
...@@ -1553,7 +1562,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1553,7 +1562,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
/* Need them for hack below */ /* Need them for hack below */
memset(names,0,sizeof(names)); 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; nrofnames = 0;
if (nrofnames > sizeof(names)/sizeof(names[0])) if (nrofnames > sizeof(names)/sizeof(names[0]))
ERR("Need more names!\n"); ERR("Need more names!\n");
...@@ -1582,7 +1591,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1582,7 +1591,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
/* DISPPARAMS* needs special serializer */ /* DISPPARAMS* needs special serializer */
if (!lstrcmpW(names[i+1],pdispparamsW)) { if (!lstrcmpW(names[i+1],pdispparamsW)) {
hres = serialize_DISPPARAM_ptr( hres = serialize_DISPPARAM_ptr(
tpinfo->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN,
relaydeb, relaydeb,
FALSE, FALSE,
...@@ -1594,7 +1603,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1594,7 +1603,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
} }
if (!lstrcmpW(names[i+1],ppvObjectW)) { if (!lstrcmpW(names[i+1],ppvObjectW)) {
hres = serialize_LPVOID_ptr( hres = serialize_LPVOID_ptr(
tpinfo->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN,
relaydeb, relaydeb,
FALSE, FALSE,
...@@ -1608,7 +1617,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */) ...@@ -1608,7 +1617,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
} }
if (!isserialized) if (!isserialized)
hres = serialize_param( hres = serialize_param(
tpinfo->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN,
relaydeb, relaydeb,
FALSE, FALSE,
...@@ -1695,7 +1704,7 @@ afterserialize: ...@@ -1695,7 +1704,7 @@ afterserialize:
/* deserialize DISPPARAM */ /* deserialize DISPPARAM */
if (!lstrcmpW(names[i+1],pdispparamsW)) { if (!lstrcmpW(names[i+1],pdispparamsW)) {
hres = deserialize_DISPPARAM_ptr( hres = deserialize_DISPPARAM_ptr(
tpinfo->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT,
relaydeb, relaydeb,
FALSE, FALSE,
...@@ -1711,7 +1720,7 @@ afterserialize: ...@@ -1711,7 +1720,7 @@ afterserialize:
} }
if (!lstrcmpW(names[i+1],ppvObjectW)) { if (!lstrcmpW(names[i+1],ppvObjectW)) {
hres = deserialize_LPVOID_ptr( hres = deserialize_LPVOID_ptr(
tpinfo->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT,
relaydeb, relaydeb,
FALSE, FALSE,
...@@ -1725,7 +1734,7 @@ afterserialize: ...@@ -1725,7 +1734,7 @@ afterserialize:
} }
if (!isdeserialized) if (!isdeserialized)
hres = deserialize_param( hres = deserialize_param(
tpinfo->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT,
relaydeb, relaydeb,
FALSE, FALSE,
...@@ -1750,6 +1759,7 @@ after_deserialize: ...@@ -1750,6 +1759,7 @@ after_deserialize:
return status; return status;
HeapFree(GetProcessHeap(),0,buf.base); HeapFree(GetProcessHeap(),0,buf.base);
ITypeInfo_Release(tinfo);
LeaveCriticalSection(&tpinfo->crit); LeaveCriticalSection(&tpinfo->crit);
return remoteresult; return remoteresult;
} }
...@@ -1842,7 +1852,9 @@ PSFacBuf_CreateProxy( ...@@ -1842,7 +1852,9 @@ PSFacBuf_CreateProxy(
int j; int j;
/* nrofargs without This */ /* nrofargs without This */
int nrofargs; 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) { if (hres) {
ERR("GetFuncDesc %lx should not fail here.\n",hres); ERR("GetFuncDesc %lx should not fail here.\n",hres);
return hres; return hres;
...@@ -1976,6 +1988,7 @@ TMStubImpl_Invoke( ...@@ -1976,6 +1988,7 @@ TMStubImpl_Invoke(
BSTR names[10]; BSTR names[10];
BSTR fname = NULL,iname = NULL; BSTR fname = NULL,iname = NULL;
BOOL is_idispatch_getidsofnames = 0; BOOL is_idispatch_getidsofnames = 0;
ITypeInfo *tinfo;
memset(&buf,0,sizeof(buf)); memset(&buf,0,sizeof(buf));
buf.size = xmsg->cbBuffer; buf.size = xmsg->cbBuffer;
...@@ -1996,7 +2009,7 @@ TMStubImpl_Invoke( ...@@ -1996,7 +2009,7 @@ TMStubImpl_Invoke(
xmsg->cbBuffer = buf.size; xmsg->cbBuffer = buf.size;
return hres; 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) { if (hres) {
ERR("GetFuncDesc on method %ld failed with %lx\n",xmsg->iMethod,hres); ERR("GetFuncDesc on method %ld failed with %lx\n",xmsg->iMethod,hres);
return hres; return hres;
...@@ -2010,7 +2023,7 @@ TMStubImpl_Invoke( ...@@ -2010,7 +2023,7 @@ TMStubImpl_Invoke(
/* Need them for hack below */ /* Need them for hack below */
memset(names,0,sizeof(names)); 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])) { if (nrofnames > sizeof(names)/sizeof(names[0])) {
ERR("Need more names!\n"); ERR("Need more names!\n");
} }
...@@ -2047,7 +2060,7 @@ TMStubImpl_Invoke( ...@@ -2047,7 +2060,7 @@ TMStubImpl_Invoke(
/* deserialize DISPPARAM */ /* deserialize DISPPARAM */
if (!lstrcmpW(names[i+1],pdispparamsW)) { if (!lstrcmpW(names[i+1],pdispparamsW)) {
hres = deserialize_DISPPARAM_ptr( hres = deserialize_DISPPARAM_ptr(
This->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN,
FALSE, FALSE,
TRUE, TRUE,
...@@ -2063,7 +2076,7 @@ TMStubImpl_Invoke( ...@@ -2063,7 +2076,7 @@ TMStubImpl_Invoke(
} }
if (!lstrcmpW(names[i+1],ppvObjectW)) { if (!lstrcmpW(names[i+1],ppvObjectW)) {
hres = deserialize_LPVOID_ptr( hres = deserialize_LPVOID_ptr(
This->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN,
FALSE, FALSE,
TRUE, TRUE,
...@@ -2077,7 +2090,7 @@ TMStubImpl_Invoke( ...@@ -2077,7 +2090,7 @@ TMStubImpl_Invoke(
} }
if (!isdeserialized) if (!isdeserialized)
hres = deserialize_param( hres = deserialize_param(
This->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN,
FALSE, FALSE,
TRUE, TRUE,
...@@ -2129,7 +2142,7 @@ afterdeserialize: ...@@ -2129,7 +2142,7 @@ afterdeserialize:
/* DISPPARAMS* needs special serializer */ /* DISPPARAMS* needs special serializer */
if (!lstrcmpW(names[i+1],pdispparamsW)) { if (!lstrcmpW(names[i+1],pdispparamsW)) {
hres = serialize_DISPPARAM_ptr( hres = serialize_DISPPARAM_ptr(
This->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT,
FALSE, FALSE,
TRUE, TRUE,
...@@ -2141,7 +2154,7 @@ afterdeserialize: ...@@ -2141,7 +2154,7 @@ afterdeserialize:
} }
if (!lstrcmpW(names[i+1],ppvObjectW)) { if (!lstrcmpW(names[i+1],ppvObjectW)) {
hres = serialize_LPVOID_ptr( hres = serialize_LPVOID_ptr(
This->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT,
FALSE, FALSE,
TRUE, TRUE,
...@@ -2155,7 +2168,7 @@ afterdeserialize: ...@@ -2155,7 +2168,7 @@ afterdeserialize:
} }
if (!isserialized) if (!isserialized)
hres = serialize_param( hres = serialize_param(
This->tinfo, tinfo,
elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT,
FALSE, FALSE,
TRUE, TRUE,
...@@ -2173,7 +2186,8 @@ afterserialize: ...@@ -2173,7 +2186,8 @@ afterserialize:
hres = xbuf_add (&buf, (LPBYTE)&res, sizeof(DWORD)); hres = xbuf_add (&buf, (LPBYTE)&res, sizeof(DWORD));
if (hres != S_OK) if (hres != S_OK)
return hres; return hres;
ITypeInfo_Release(tinfo);
xmsg->cbBuffer = buf.curoff; xmsg->cbBuffer = buf.curoff;
I_RpcGetBuffer((RPC_MESSAGE *)xmsg); I_RpcGetBuffer((RPC_MESSAGE *)xmsg);
memcpy(xmsg->Buffer, buf.base, buf.curoff); memcpy(xmsg->Buffer, buf.base, buf.curoff);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment