oleaut: Better support for invoking methods with VT_VARIANT argument types.

This commit is contained in:
Robert Shearman 2006-03-21 13:45:22 +00:00 committed by Alexandre Julliard
parent dc03c0e3f3
commit 264b122d52
1 changed files with 14 additions and 6 deletions

View File

@ -5110,6 +5110,9 @@ DispCallFunc(
{ {
VARIANT *arg = prgpvarg[i]; VARIANT *arg = prgpvarg[i];
TRACE("Storing arg %d (%d as %d)\n",i,V_VT(arg),prgvt[i]); TRACE("Storing arg %d (%d as %d)\n",i,V_VT(arg),prgvt[i]);
if (prgvt[i] == VT_VARIANT)
memcpy(&args[argspos], arg, _argsize(prgvt[i]) * sizeof(DWORD));
else
memcpy(&args[argspos], &V_NONE(arg), _argsize(prgvt[i]) * sizeof(DWORD)); memcpy(&args[argspos], &V_NONE(arg), _argsize(prgvt[i]) * sizeof(DWORD));
argspos += _argsize(prgvt[i]); argspos += _argsize(prgvt[i]);
} }
@ -5231,20 +5234,26 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
else if (i < pDispParams->cArgs) else if (i < pDispParams->cArgs)
{ {
VARIANTARG *src_arg = &pDispParams->rgvarg[pDispParams->cArgs - 1 - i]; VARIANTARG *src_arg = &pDispParams->rgvarg[pDispParams->cArgs - 1 - i];
V_VT(&rgvarg[i]) = V_VT(src_arg);
dump_Variant(src_arg); dump_Variant(src_arg);
/* FIXME: this doesn't work for VT_BYREF arguments if if (rgvt[i] == VT_VARIANT)
* they are not the same type as in the paramdesc */ VariantCopy(&rgvarg[i], src_arg);
if ((rgvt[i] & VT_BYREF) && !V_ISBYREF(src_arg)) else if ((rgvt[i] & VT_BYREF) && !V_ISBYREF(src_arg))
{ {
VARIANTARG *missing_arg = INVBUF_GET_MISSING_ARG_ARRAY(buffer, func_desc->cParams); VARIANTARG *missing_arg = INVBUF_GET_MISSING_ARG_ARRAY(buffer, func_desc->cParams);
V_VT(&missing_arg[i]) = V_VT(src_arg); V_VT(&missing_arg[i]) = V_VT(src_arg);
hres = VariantChangeType(&missing_arg[i], src_arg, 0, rgvt[i] & ~VT_BYREF); hres = VariantChangeType(&missing_arg[i], src_arg, 0, rgvt[i] & ~VT_BYREF);
V_BYREF(&rgvarg[i]) = &V_NONE(&missing_arg[i]); V_BYREF(&rgvarg[i]) = &V_NONE(&missing_arg[i]);
V_VT(&rgvarg[i]) = rgvt[i];
} }
else else
{
/* FIXME: this doesn't work for VT_BYREF arguments if
* they are not the same type as in the paramdesc */
V_VT(&rgvarg[i]) = V_VT(src_arg);
hres = VariantChangeType(&rgvarg[i], src_arg, 0, rgvt[i]); hres = VariantChangeType(&rgvarg[i], src_arg, 0, rgvt[i]);
V_VT(&rgvarg[i]) = rgvt[i];
}
if (FAILED(hres)) if (FAILED(hres))
{ {
@ -5253,7 +5262,6 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
debugstr_VT(src_arg), debugstr_VF(src_arg)); debugstr_VT(src_arg), debugstr_VF(src_arg));
break; break;
} }
V_VT(&rgvarg[i]) = rgvt[i];
prgpvarg[i] = &rgvarg[i]; prgpvarg[i] = &rgvarg[i];
} }
else if (wParamFlags & PARAMFLAG_FOPT) else if (wParamFlags & PARAMFLAG_FOPT)