Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/msscript.ocx/msscript.c | 9 +++++++-- dlls/msscript.ocx/tests/msscript.c | 13 +++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c index a510db7..a339e70 100644 --- a/dlls/msscript.ocx/msscript.c +++ b/dlls/msscript.ocx/msscript.c @@ -98,6 +98,7 @@ typedef struct {
BSTR name; USHORT num_args; + VARTYPE ret_type; } ScriptProcedure;
struct ScriptProcedureCollection { @@ -901,9 +902,12 @@ static HRESULT WINAPI ScriptProcedure_get_HasReturnValue(IScriptProcedure *iface { ScriptProcedure *This = impl_from_IScriptProcedure(iface);
- FIXME("(%p)->(%p)\n", This, pfHasReturnValue); + TRACE("(%p)->(%p)\n", This, pfHasReturnValue);
- return E_NOTIMPL; + if (!pfHasReturnValue) return E_POINTER; + + *pfHasReturnValue = (This->ret_type == VT_VOID) ? VARIANT_FALSE : VARIANT_TRUE; + return S_OK; }
static const IScriptProcedureVtbl ScriptProcedureVtbl = { @@ -962,6 +966,7 @@ static HRESULT get_script_procedure(ScriptProcedureCollection *procedures, IType proc->hash = hash; proc->name = str; proc->num_args = desc->cParams + desc->cParamsOpt; + proc->ret_type = desc->elemdescFunc.tdesc.vt; list_add_tail(proc_list, &proc->entry);
*procedure = &proc->IScriptProcedure_iface; diff --git a/dlls/msscript.ocx/tests/msscript.c b/dlls/msscript.ocx/tests/msscript.c index ad7e48f..7233af5 100644 --- a/dlls/msscript.ocx/tests/msscript.c +++ b/dlls/msscript.ocx/tests/msscript.c @@ -3295,6 +3295,7 @@ static void test_IScriptControl_get_Procedures(void) IScriptProcedureCollection *procs, *procs2; IScriptProcedure *proc, *proc2; IScriptControl *sc; + VARIANT_BOOL vbool; VARIANT var; LONG count; HRESULT hr; @@ -3363,6 +3364,11 @@ static void test_IScriptControl_get_Procedures(void) hr = IScriptProcedure_get_NumArgs(proc, &count); ok(hr == S_OK, "IScriptProcedure_get_NumArgs failed: 0x%08x.\n", hr); ok(count == 2, "Wrong NumArgs, got %d.\n", count); + hr = IScriptProcedure_get_HasReturnValue(proc, NULL); + ok(hr == E_POINTER, "IScriptProcedure_get_HasReturnValue returned: 0x%08x.\n", hr); + hr = IScriptProcedure_get_HasReturnValue(proc, &vbool); + ok(hr == S_OK, "IScriptProcedure_get_HasReturnValue failed: 0x%08x.\n", hr); + ok(vbool == VARIANT_TRUE, "HasReturnValue did not return True, got %x.\n", vbool); IScriptProcedure_Release(proc);
V_VT(&var) = VT_BSTR; @@ -3378,6 +3384,9 @@ static void test_IScriptControl_get_Procedures(void) hr = IScriptProcedure_get_NumArgs(proc, &count); ok(hr == S_OK, "IScriptProcedure_get_NumArgs failed: 0x%08x.\n", hr); ok(count == 1, "Wrong NumArgs, got %d.\n", count); + hr = IScriptProcedure_get_HasReturnValue(proc, &vbool); + ok(hr == S_OK, "IScriptProcedure_get_HasReturnValue failed: 0x%08x.\n", hr); + ok(vbool == VARIANT_TRUE, "HasReturnValue did not return True, got %x.\n", vbool); IScriptProcedure_Release(proc);
V_VT(&var) = VT_R8; @@ -3584,6 +3593,10 @@ static void test_IScriptControl_get_Procedures(void) ok(hr == S_OK, "get_NumArgs for %s failed: 0x%08x.\n", wine_dbgstr_w(custom_engine_funcs[i].name), hr); ok(count == custom_engine_funcs[i].num_args + custom_engine_funcs[i].num_opt_args, "NumArgs is not %d, got %d.\n", custom_engine_funcs[i].num_args + custom_engine_funcs[i].num_opt_args, count); + hr = IScriptProcedure_get_HasReturnValue(proc, &vbool); + ok(hr == S_OK, "get_HasReturnValue for %s failed: 0x%08x.\n", wine_dbgstr_w(custom_engine_funcs[i].name), hr); + ok(vbool == ((custom_engine_funcs[i].ret_type == VT_VOID) ? VARIANT_FALSE : VARIANT_TRUE), + "get_HasReturnValue for %s returned %x.\n", wine_dbgstr_w(custom_engine_funcs[i].name), vbool);
IScriptProcedure_Release(proc); }