vbscript: Implement ScriptTypeComp_Bind.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2019-12-09 17:29:24 +02:00 committed by Alexandre Julliard
parent c47dfe45c7
commit 8707572669
2 changed files with 49 additions and 6 deletions

View File

@ -1070,16 +1070,12 @@ static void test_script_typeinfo(void)
ITypeComp_Release(typecomp2);
wcscpy(str, L"not_found");
hr = ITypeComp_Bind(typecomp, NULL, 0, 0, &typeinfo2, &desckind, &bindptr);
todo_wine
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
hr = ITypeComp_Bind(typecomp, str, 0, 0, NULL, &desckind, &bindptr);
todo_wine
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, NULL, &bindptr);
todo_wine
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, NULL);
todo_wine
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
ITypeComp_Release(typecomp);

View File

@ -932,9 +932,56 @@ static HRESULT WINAPI ScriptTypeComp_Bind(ITypeComp *iface, LPOLESTR szName, ULO
ITypeInfo **ppTInfo, DESCKIND *pDescKind, BINDPTR *pBindPtr)
{
ScriptTypeInfo *This = ScriptTypeInfo_from_ITypeComp(iface);
FIXME("(%p)->(%s %08x %d %p %p %p)\n", This, debugstr_w(szName), lHashVal,
UINT flags = wFlags ? wFlags : ~0;
ITypeInfo *disp_typeinfo;
ITypeComp *disp_typecomp;
HRESULT hr;
UINT i;
TRACE("(%p)->(%s %08x %d %p %p %p)\n", This, debugstr_w(szName), lHashVal,
wFlags, ppTInfo, pDescKind, pBindPtr);
return E_NOTIMPL;
if (!szName || !ppTInfo || !pDescKind || !pBindPtr)
return E_INVALIDARG;
for (i = 0; i < This->num_funcs; i++)
{
if (wcsicmp(szName, This->funcs[i].func->name)) continue;
if (!(flags & INVOKE_FUNC)) return TYPE_E_TYPEMISMATCH;
hr = ITypeInfo_GetFuncDesc(&This->ITypeInfo_iface, i, &pBindPtr->lpfuncdesc);
if (FAILED(hr)) return hr;
*pDescKind = DESCKIND_FUNCDESC;
*ppTInfo = &This->ITypeInfo_iface;
ITypeInfo_AddRef(*ppTInfo);
return S_OK;
}
for (i = 0; i < This->num_vars; i++)
{
if (wcsicmp(szName, This->disp->global_vars[i]->name)) continue;
if (!(flags & INVOKE_PROPERTYGET)) return TYPE_E_TYPEMISMATCH;
hr = ITypeInfo_GetVarDesc(&This->ITypeInfo_iface, i, &pBindPtr->lpvardesc);
if (FAILED(hr)) return hr;
*pDescKind = DESCKIND_VARDESC;
*ppTInfo = &This->ITypeInfo_iface;
ITypeInfo_AddRef(*ppTInfo);
return S_OK;
}
/* Look into the inherited IDispatch */
hr = get_dispatch_typeinfo(&disp_typeinfo);
if (FAILED(hr)) return hr;
hr = ITypeInfo_GetTypeComp(disp_typeinfo, &disp_typecomp);
if (FAILED(hr)) return hr;
hr = ITypeComp_Bind(disp_typecomp, szName, lHashVal, wFlags, ppTInfo, pDescKind, pBindPtr);
ITypeComp_Release(disp_typecomp);
return hr;
}
static HRESULT WINAPI ScriptTypeComp_BindType(ITypeComp *iface, LPOLESTR szName, ULONG lHashVal,