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:
parent
c47dfe45c7
commit
8707572669
|
@ -1070,16 +1070,12 @@ static void test_script_typeinfo(void)
|
||||||
ITypeComp_Release(typecomp2);
|
ITypeComp_Release(typecomp2);
|
||||||
wcscpy(str, L"not_found");
|
wcscpy(str, L"not_found");
|
||||||
hr = ITypeComp_Bind(typecomp, NULL, 0, 0, &typeinfo2, &desckind, &bindptr);
|
hr = ITypeComp_Bind(typecomp, NULL, 0, 0, &typeinfo2, &desckind, &bindptr);
|
||||||
todo_wine
|
|
||||||
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
||||||
hr = ITypeComp_Bind(typecomp, str, 0, 0, NULL, &desckind, &bindptr);
|
hr = ITypeComp_Bind(typecomp, str, 0, 0, NULL, &desckind, &bindptr);
|
||||||
todo_wine
|
|
||||||
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
||||||
hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, NULL, &bindptr);
|
hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, NULL, &bindptr);
|
||||||
todo_wine
|
|
||||||
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
||||||
hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, NULL);
|
hr = ITypeComp_Bind(typecomp, str, 0, 0, &typeinfo2, &desckind, NULL);
|
||||||
todo_wine
|
|
||||||
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
ok(hr == E_INVALIDARG, "Bind returned: %08x\n", hr);
|
||||||
ITypeComp_Release(typecomp);
|
ITypeComp_Release(typecomp);
|
||||||
|
|
||||||
|
|
|
@ -932,9 +932,56 @@ static HRESULT WINAPI ScriptTypeComp_Bind(ITypeComp *iface, LPOLESTR szName, ULO
|
||||||
ITypeInfo **ppTInfo, DESCKIND *pDescKind, BINDPTR *pBindPtr)
|
ITypeInfo **ppTInfo, DESCKIND *pDescKind, BINDPTR *pBindPtr)
|
||||||
{
|
{
|
||||||
ScriptTypeInfo *This = ScriptTypeInfo_from_ITypeComp(iface);
|
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);
|
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,
|
static HRESULT WINAPI ScriptTypeComp_BindType(ITypeComp *iface, LPOLESTR szName, ULONG lHashVal,
|
||||||
|
|
Loading…
Reference in New Issue