Commit 87075726 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

vbscript: Implement ScriptTypeComp_Bind.

parent c47dfe45
......@@ -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);
......
......@@ -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,
......
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