Gabriel Ivăncescu : vbscript: Implement ScriptTypeInfo_GetFuncDesc.

Alexandre Julliard julliard at winehq.org
Fri Dec 6 16:06:39 CST 2019


Module: wine
Branch: master
Commit: 2d753e2aa2e600f6739332414317e3ec5a25c2e1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2d753e2aa2e600f6739332414317e3ec5a25c2e1

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Fri Dec  6 13:46:00 2019 +0100

vbscript: Implement ScriptTypeInfo_GetFuncDesc.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 0eb8edf567..99d7dc5f5b 100644
--- a/dlls/vbscript/vbdisp.c
+++ b/dlls/vbscript/vbdisp.c
@@ -641,10 +641,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 *desc;
+    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->funcs[index].func;
+
+    /* Store the parameter array after the FUNCDESC structure */
+    desc = heap_alloc_zero(sizeof(*desc) + sizeof(ELEMDESC) * func->arg_cnt);
+    if (!desc) return E_OUTOFMEMORY;
+
+    desc->memid = This->funcs[index].memid;
+    desc->funckind = FUNC_DISPATCH;
+    desc->invkind = INVOKE_FUNC;
+    desc->callconv = CC_STDCALL;
+    desc->cParams = func->arg_cnt;
+    desc->elemdescFunc.tdesc.vt = (func->type == FUNC_SUB) ? VT_VOID : VT_VARIANT;
+
+    if (func->arg_cnt) desc->lprgelemdescParam = (ELEMDESC*)(desc + 1);
+    for (i = 0; i < func->arg_cnt; i++)
+        desc->lprgelemdescParam[i].tdesc.vt = VT_VARIANT;
+
+    *ppFuncDesc = desc;
+    return S_OK;
 }
 
 static HRESULT WINAPI ScriptTypeInfo_GetVarDesc(ITypeInfo *iface, UINT index, VARDESC **ppVarDesc)
@@ -783,7 +806,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)




More information about the wine-cvs mailing list