msscript.ocx: Implement IScriptModule::get_Name.

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-06-25 17:59:25 +03:00 committed by Alexandre Julliard
parent d3fde3b198
commit 045372cbe4
2 changed files with 17 additions and 10 deletions

View File

@ -738,9 +738,13 @@ static HRESULT WINAPI ScriptModule_get_Name(IScriptModule *iface, BSTR *pbstrNam
{
ScriptModule *This = impl_from_IScriptModule(iface);
FIXME("(%p)->(%p)\n", This, pbstrName);
TRACE("(%p)->(%p)\n", This, pbstrName);
return E_NOTIMPL;
if (!pbstrName) return E_POINTER;
if (!This->host) return E_FAIL;
*pbstrName = SysAllocString(This->name ? This->name : L"Global");
return *pbstrName ? S_OK : E_OUTOFMEMORY;
}
static HRESULT WINAPI ScriptModule_get_CodeObject(IScriptModule *iface, IDispatch **ppdispObject)

View File

@ -2391,10 +2391,11 @@ static void test_IScriptControl_get_Modules(void)
hr = IScriptModuleCollection_get_Item(mods, var, &mod);
ok(hr == S_OK, "IScriptModuleCollection_get_Item failed: 0x%08x.\n", hr);
hr = IScriptModule_get_Name(mod, NULL);
todo_wine ok(hr == E_POINTER, "IScriptModule_get_Name returned: 0x%08x.\n", hr);
ok(hr == E_POINTER, "IScriptModule_get_Name returned: 0x%08x.\n", hr);
hr = IScriptModule_get_Name(mod, &str);
todo_wine ok(hr == S_OK, "IScriptModule_get_Name failed: 0x%08x.\n", hr);
if (hr == S_OK) SysFreeString(str);
ok(hr == S_OK, "IScriptModule_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"Global"), "got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
str = SysAllocString(L"function add(a, b) { return a + b; }\n");
hr = IScriptModule_AddCode(mod, str);
todo_wine ok(hr == S_OK, "IScriptModule_AddCode failed: 0x%08x.\n", hr);
@ -2408,17 +2409,19 @@ static void test_IScriptControl_get_Modules(void)
ok(V_VT(&var) == VT_BSTR, "var type not BSTR, got %d.\n", V_VT(&var));
VariantClear(&var);
hr = IScriptModule_get_Name(mod, &str);
todo_wine ok(hr == S_OK, "IScriptModule_get_Name failed: 0x%08x.\n", hr);
ok(hr == S_OK, "IScriptModule_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"some other Module"), "got %s.\n", wine_dbgstr_w(str));
IScriptModule_Release(mod);
if (hr == S_OK) SysFreeString(str);
SysFreeString(str);
V_VT(&var) = VT_R8;
V_R8(&var) = 2.0;
hr = IScriptModuleCollection_get_Item(mods, var, &mod);
ok(hr == S_OK, "IScriptModuleCollection_get_Item failed: 0x%08x.\n", hr);
hr = IScriptModule_get_Name(mod, &str);
todo_wine ok(hr == S_OK, "IScriptModule_get_Name failed: 0x%08x.\n", hr);
if (hr == S_OK) SysFreeString(str);
ok(hr == S_OK, "IScriptModule_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"foobar"), "got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
str = SysAllocString(L"function sub(a, b) { return a - b; }\n");
hr = IScriptModule_AddCode(mod, str);
todo_wine ok(hr == S_OK, "IScriptModule_AddCode failed: 0x%08x.\n", hr);
@ -2451,7 +2454,7 @@ static void test_IScriptControl_get_Modules(void)
ok(hr == S_OK, "IScriptModuleCollection_get_Count failed: 0x%08x.\n", hr);
ok(count == 1, "count is not 1, got %d.\n", count);
hr = IScriptModule_get_Name(mod, &str);
todo_wine ok(hr == E_FAIL, "IScriptModule_get_Name returned: 0x%08x.\n", hr);
ok(hr == E_FAIL, "IScriptModule_get_Name returned: 0x%08x.\n", hr);
str = SysAllocString(L"function closed() { }\n");
hr = IScriptModule_AddCode(mod, str);
todo_wine ok(hr == E_FAIL, "IScriptModule_AddCode failed: 0x%08x.\n", hr);