Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/vbscript/vbdisp.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index bada859..93d37ca 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -633,10 +633,33 @@ static HRESULT WINAPI ScriptTypeInfo_GetTypeComp(ITypeInfo *iface, ITypeComp **p static HRESULT WINAPI ScriptTypeInfo_GetFuncDesc(ITypeInfo *iface, UINT index, FUNCDESC **ppFuncDesc) { ScriptTypeInfo *This = ScriptTypeInfo_from_ITypeInfo(iface); + function_t *func; + FUNCDESC *p; + UINT i;
- FIXME("(%p)->(%u %p)\n", This, index, ppFuncDesc); + TRACE("(%p)->(%u %p)\n", This, index, ppFuncDesc);
- return E_NOTIMPL; + if (!ppFuncDesc) return E_INVALIDARG; + if (index >= This->num_funcs) return TYPE_E_ELEMENTNOTFOUND; + func = This->disp->global_funcs[This->func_ids[index]]; + + /* Store the parameter array after the FUNCDESC structure */ + p = heap_alloc_zero(sizeof(*p) + sizeof(ELEMDESC) * func->arg_cnt); + if (!p) return E_OUTOFMEMORY; + + p->memid = This->func_ids[index] + 1 + DISPID_FUNCTION_MASK; + p->funckind = FUNC_DISPATCH; + p->invkind = INVOKE_FUNC; + p->callconv = CC_STDCALL; + p->cParams = func->arg_cnt; + p->elemdescFunc.tdesc.vt = (func->type == FUNC_SUB) ? VT_VOID : VT_VARIANT; + + if (func->arg_cnt) p->lprgelemdescParam = (ELEMDESC*)(p + 1); + for (i = 0; i < func->arg_cnt; i++) + p->lprgelemdescParam[i].tdesc.vt = VT_VARIANT; + + *ppFuncDesc = p; + return S_OK; }
static HRESULT WINAPI ScriptTypeInfo_GetVarDesc(ITypeInfo *iface, UINT index, VARDESC **ppVarDesc) @@ -775,7 +798,9 @@ static void WINAPI ScriptTypeInfo_ReleaseFuncDesc(ITypeInfo *iface, FUNCDESC *pF { ScriptTypeInfo *This = ScriptTypeInfo_from_ITypeInfo(iface);
- FIXME("(%p)->(%p)\n", This, pFuncDesc); + TRACE("(%p)->(%p)\n", This, pFuncDesc); + + heap_free(pFuncDesc); }
static void WINAPI ScriptTypeInfo_ReleaseVarDesc(ITypeInfo *iface, VARDESC *pVarDesc)