oleaut: Support conversion of VT_SAFEARRAY into VT_ARRAY|type.

Typelib variant types that cannot be converted should return
DISP_E_BADVARTYPE.
Don't call DispCallFunc if conversion of one of the arguments failed.
This commit is contained in:
Robert Shearman 2006-01-12 11:53:47 +01:00 committed by Alexandre Julliard
parent f431353058
commit 9227902714
1 changed files with 12 additions and 3 deletions

View File

@ -5008,7 +5008,7 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
HRESULT hr = S_OK; HRESULT hr = S_OK;
/* enforce only one level of pointer indirection */ /* enforce only one level of pointer indirection */
if (!(*vt & VT_BYREF) && (tdesc->vt == VT_PTR)) if (!(*vt & VT_BYREF) && !(*vt & VT_ARRAY) && (tdesc->vt == VT_PTR))
{ {
tdesc = tdesc->u.lptdesc; tdesc = tdesc->u.lptdesc;
@ -5045,9 +5045,17 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
case VT_USERDEFINED: case VT_USERDEFINED:
hr = userdefined_to_variantvt(tinfo, tdesc, vt); hr = userdefined_to_variantvt(tinfo, tdesc, vt);
break; break;
case VT_VOID:
case VT_CARRAY:
case VT_PTR: case VT_PTR:
ERR("cannot convert VT_PTR into variant VT\n"); case VT_LPSTR:
hr = E_FAIL; case VT_LPWSTR:
ERR("cannot convert type %d into variant VT\n", tdesc->vt);
hr = DISP_E_BADVARTYPE;
break;
case VT_SAFEARRAY:
*vt |= VT_ARRAY;
hr = typedescvt_to_variantvt(tinfo, tdesc->u.lptdesc, vt);
break; break;
default: default:
*vt |= tdesc->vt; *vt |= tdesc->vt;
@ -5288,6 +5296,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
break; break;
} }
} }
if (FAILED(hres)) goto func_fail; /* FIXME: we don't free changed types here */
if (func_desc->cParamsOpt < 0) if (func_desc->cParamsOpt < 0)
{ {
FIXME("Does not support safearray optional parameters\n"); FIXME("Does not support safearray optional parameters\n");