ole: Remove the no longer used _copy_arg function.

This commit is contained in:
Robert Shearman 2006-01-06 21:16:21 +01:00 committed by Alexandre Julliard
parent 8cf5373f60
commit d2bdbd4ea5
1 changed files with 0 additions and 159 deletions

View File

@ -4939,165 +4939,6 @@ _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args) {
extern int _argsize(DWORD vt);
/****************************************************************************
* Helper functions for Dispcall / Invoke, which copies one variant
* with target type onto the argument stack.
*/
static HRESULT
_copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
DWORD *argpos, VARIANT *arg, VARTYPE vt
) {
UINT arglen = _argsize(vt)*sizeof(DWORD);
VARIANT va;
if ((vt==VT_PTR) && tdesc && (tdesc->u.lptdesc->vt == VT_VARIANT)) {
memcpy(argpos,&arg,sizeof(void*));
return S_OK;
}
if (V_VT(arg) == vt) {
memcpy(argpos, &V_I4(arg), arglen);
return S_OK;
}
if (V_ISARRAY(arg) && (vt == VT_SAFEARRAY)) {
memcpy(argpos, &V_ARRAY(arg), sizeof(SAFEARRAY*));
return S_OK;
}
if (vt == VT_VARIANT) {
memcpy(argpos, arg, arglen);
return S_OK;
}
/* Deref BYREF vars if there is need */
if(V_ISBYREF(arg) && ((V_VT(arg) & ~VT_BYREF)==vt)) {
memcpy(argpos,(void*)V_I4(arg), arglen);
return S_OK;
}
if (vt==VT_UNKNOWN && V_VT(arg)==VT_DISPATCH) {
/* in this context, if the type lib specifies IUnknown*, giving an
IDispatch* is correct; so, don't invoke VariantChangeType */
memcpy(argpos,&V_I4(arg), arglen);
return S_OK;
}
if ((vt == VT_PTR) && tdesc)
return _copy_arg(tinfo, tdesc->u.lptdesc, argpos, arg, tdesc->u.lptdesc->vt);
if ((vt == VT_USERDEFINED) && tdesc && tinfo) {
ITypeInfo *tinfo2 = NULL;
TYPEATTR *tattr = NULL;
HRESULT hres;
hres = ITypeInfo_GetRefTypeInfo(tinfo,tdesc->u.hreftype,&tinfo2);
if (hres) {
FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED, "
"while coercing from vt 0x%x. Copying 4 byte.\n",
tdesc->u.hreftype,V_VT(arg));
memcpy(argpos, &V_I4(arg), 4);
return S_OK;
}
hres = ITypeInfo_GetTypeAttr(tinfo2,&tattr);
if( hres )
{
ERR("GetTypeAttr failed\n");
ITypeInfo_Release(tinfo2);
return hres;
}
switch (tattr->typekind) {
case TKIND_ENUM:
switch ( V_VT( arg ) ) {
case VT_I2:
*argpos = V_I2(arg);
hres = S_OK;
break;
case VT_I4:
memcpy(argpos, &V_I4(arg), 4);
hres = S_OK;
break;
case VT_BYREF|VT_I4:
memcpy(argpos, V_I4REF(arg), 4);
hres = S_OK;
break;
default:
FIXME("vt 0x%x -> TKIND_ENUM unhandled.\n",V_VT(arg));
hres = E_FAIL;
break;
}
break;
case TKIND_ALIAS:
tdesc = &(tattr->tdescAlias);
hres = _copy_arg((ITypeInfo2*)tinfo2, tdesc, argpos, arg, tdesc->vt);
break;
case TKIND_INTERFACE:
if (V_VT(arg) == VT_DISPATCH) {
IDispatch *disp;
if (IsEqualIID(&IID_IDispatch,&(tattr->guid))) {
memcpy(argpos, &V_DISPATCH(arg), 4);
hres = S_OK;
break;
}
hres=IUnknown_QueryInterface(V_DISPATCH(arg),
&IID_IDispatch,(LPVOID*)&disp);
if (SUCCEEDED(hres)) {
memcpy(argpos,&disp,4);
IUnknown_Release(V_DISPATCH(arg));
hres = S_OK;
break;
}
FIXME("Failed to query IDispatch interface from %s while "
"converting to VT_DISPATCH!\n",debugstr_guid(&(tattr->guid)));
hres = E_FAIL;
break;
}
if (V_VT(arg) == VT_UNKNOWN) {
memcpy(argpos, &V_UNKNOWN(arg), 4);
hres = S_OK;
break;
}
FIXME("vt 0x%x -> TKIND_INTERFACE(%s) unhandled\n",
V_VT(arg),debugstr_guid(&(tattr->guid)));
hres = E_FAIL;
break;
case TKIND_DISPATCH:
if (V_VT(arg) == VT_DISPATCH) {
memcpy(argpos, &V_DISPATCH(arg), 4);
hres = S_OK;
}
else {
hres = E_FAIL;
FIXME("TKIND_DISPATCH unhandled for target vt 0x%x.\n",V_VT(arg));
}
break;
case TKIND_RECORD:
FIXME("TKIND_RECORD unhandled.\n");
hres = E_FAIL;
break;
default:
FIXME("TKIND %d unhandled.\n",tattr->typekind);
hres = E_FAIL;
break;
}
ITypeInfo_ReleaseTypeAttr(tinfo2, tattr);
ITypeInfo_Release(tinfo2);
return hres;
}
VariantInit(&va);
if (VariantChangeType(&va,arg,0,vt)==S_OK) {
memcpy(argpos,&V_I4(&va), arglen);
FIXME("Should not use VariantChangeType here."
" (conversion from 0x%x -> 0x%x) %08lx\n",
V_VT(arg), vt, *argpos
);
return S_OK;
}
ERR("Set arg to disparg type 0x%x vs 0x%x\n",V_VT(arg),vt);
return E_FAIL;
}
static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, VARTYPE *vt)
{
HRESULT hr = S_OK;