msscript.ocx: Implement ScriptProcedure::get_NumArgs.

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:
Gabriel Ivăncescu 2020-08-12 17:13:43 +03:00 committed by Alexandre Julliard
parent 28228b3914
commit f8de2787ef
2 changed files with 22 additions and 2 deletions

View file

@ -97,6 +97,7 @@ typedef struct {
struct list entry;
BSTR name;
USHORT num_args;
} ScriptProcedure;
struct ScriptProcedureCollection {
@ -888,9 +889,12 @@ static HRESULT WINAPI ScriptProcedure_get_NumArgs(IScriptProcedure *iface, LONG
{
ScriptProcedure *This = impl_from_IScriptProcedure(iface);
FIXME("(%p)->(%p)\n", This, pcArgs);
TRACE("(%p)->(%p)\n", This, pcArgs);
return E_NOTIMPL;
if (!pcArgs) return E_POINTER;
*pcArgs = This->num_args;
return S_OK;
}
static HRESULT WINAPI ScriptProcedure_get_HasReturnValue(IScriptProcedure *iface, VARIANT_BOOL *pfHasReturnValue)
@ -957,6 +961,7 @@ static HRESULT get_script_procedure(ScriptProcedureCollection *procedures, IType
proc->ref = 1;
proc->hash = hash;
proc->name = str;
proc->num_args = desc->cParams + desc->cParamsOpt;
list_add_tail(proc_list, &proc->entry);
*procedure = &proc->IScriptProcedure_iface;

View file

@ -3358,6 +3358,11 @@ static void test_IScriptControl_get_Procedures(void)
ok(hr == S_OK, "IScriptProcedure_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"add"), "Wrong name, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, NULL);
ok(hr == E_POINTER, "IScriptProcedure_get_NumArgs returned: 0x%08x.\n", hr);
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);
IScriptProcedure_Release(proc);
V_VT(&var) = VT_BSTR;
@ -3370,6 +3375,9 @@ static void test_IScriptControl_get_Procedures(void)
ok(hr == S_OK, "IScriptProcedure_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"nop"), "Wrong name, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
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);
IScriptProcedure_Release(proc);
V_VT(&var) = VT_R8;
@ -3380,6 +3388,9 @@ static void test_IScriptControl_get_Procedures(void)
ok(hr == S_OK, "IScriptProcedure_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"muladd"), "Wrong name, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, &count);
ok(hr == S_OK, "IScriptProcedure_get_NumArgs failed: 0x%08x.\n", hr);
ok(count == 3, "Wrong NumArgs, got %d.\n", count);
IScriptProcedure_Release(proc);
IScriptProcedureCollection_Release(procs);
@ -3569,6 +3580,10 @@ static void test_IScriptControl_get_Procedures(void)
ok(!lstrcmpW(str, custom_engine_funcs[i].name), "Name is not %s, got %s.\n",
wine_dbgstr_w(custom_engine_funcs[i].name), wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, &count);
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);
IScriptProcedure_Release(proc);
}