scrobj: Add GetDispID implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-09-25 19:23:06 +02:00 committed by Alexandre Julliard
parent b3b78b4226
commit dd2fcd6afa
2 changed files with 20 additions and 10 deletions

View File

@ -1046,8 +1046,26 @@ static HRESULT WINAPI scriptlet_Invoke(IDispatchEx *iface, DISPID dispIdMember,
static HRESULT WINAPI scriptlet_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
{
struct scriptlet_instance *This = impl_from_IDispatchEx(iface);
FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
return E_NOTIMPL;
unsigned i;
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
if (grfdex & ~(fdexNameCaseInsensitive|fdexNameCaseSensitive))
FIXME("Unsupported grfdex %x\n", grfdex);
for (i = 0; i < This->member_cnt; i++)
{
if (grfdex & fdexNameCaseInsensitive)
{
if (wcsicmp(This->members[i].name, bstrName)) continue;
}
else if (wcscmp(This->members[i].name, bstrName)) continue;
*pid = i + 1;
return S_OK;
}
WARN("Unknown property %s\n", debugstr_w(bstrName));
return DISP_E_UNKNOWNNAME;
}
static HRESULT WINAPI scriptlet_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *pdp,

View File

@ -848,45 +848,37 @@ static void test_create_object(void)
str = SysAllocString(L"vbAddOne");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &vb_add_one_id);
todo_wine
ok(hres == S_OK, "Could not get vkAddOne id: %08x\n", hres);
SysFreeString(str);
str = SysAllocString(L"jsAddTwo");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &js_add_two_id);
todo_wine
ok(hres == S_OK, "Could not get jsAddTwo id: %08x\n", hres);
SysFreeString(str);
str = SysAllocString(L"wtTest");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &wt_test_id);
todo_wine
ok(hres == S_OK, "Could not get wtTest id: %08x\n", hres);
SysFreeString(str);
str = SysAllocString(L"gsProp");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &wt_gsprop_id);
todo_wine
ok(hres == S_OK, "Could not get wtTest id: %08x\n", hres);
SysFreeString(str);
str = SysAllocString(L"vbaddone");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &id);
todo_wine
ok(hres == DISP_E_UNKNOWNNAME, "invalid case returned: %08x\n", hres);
SysFreeString(str);
str = SysAllocString(L"vbaddone");
hres = IDispatchEx_GetDispID(dispex, str, 0, &id);
todo_wine
ok(hres == DISP_E_UNKNOWNNAME, "invalid case returned: %08x\n", hres);
SysFreeString(str);
str = SysAllocString(L"vbaddone");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &id);
todo_wine
ok(hres == S_OK, "case insensitive returned: %08x\n", hres);
todo_wine
ok(id == vb_add_one_id, "id = %u, expected %u\n", id, vb_add_one_id);
SysFreeString(str);