Commit 4bb10ad3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added GetDispID support for properties.

parent ae57aa14
......@@ -399,6 +399,8 @@ Class TestClass
publicFunction = 4
End Function
Public publicProp2
Public Sub publicSub
End Sub
......
......@@ -160,7 +160,7 @@ static BOOL is_lang_english(void)
static void test_disp(IDispatch *disp)
{
DISPID id, public_func_id, public_sub_id;
DISPID id, public_prop_id, public_prop2_id, public_func_id, public_sub_id;
DISPID named_args[5] = {DISPID_PROPERTYPUT};
VARIANT v, args[5];
DISPPARAMS dp = {args, named_args};
......@@ -172,6 +172,22 @@ static void test_disp(IDispatch *disp)
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
str = a2bstr("publicProp");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_prop_id);
SysFreeString(str);
ok(hres == S_OK, "GetDispID(publicProp) failed: %08x\n", hres);
str = a2bstr("PUBLICPROP");
hres = IDispatchEx_GetDispID(dispex, str, 0, &id);
SysFreeString(str);
ok(hres == S_OK, "GetDispID(PUBLICPROP) failed: %08x\n", hres);
ok(public_prop_id == id, "id = %d\n", public_prop_id);
str = a2bstr("publicPROP2");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_prop2_id);
SysFreeString(str);
ok(hres == S_OK, "GetDispID(publicProp2) failed: %08x\n", hres);
str = a2bstr("publicFunction");
hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_func_id);
SysFreeString(str);
......
......@@ -46,11 +46,23 @@ static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, BOOL search_private,
return FALSE;
}
static HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, BOOL search_private, DISPID *id)
HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, BOOL search_private, DISPID *id)
{
unsigned i;
if(get_func_id(This, name, search_private, id))
return S_OK;
for(i=0; i < This->desc->prop_cnt; i++) {
if(!search_private && !This->desc->props[i].is_public)
continue;
if(!strcmpiW(This->desc->props[i].name, name)) {
*id = i + This->desc->func_cnt;
return S_OK;
}
}
*id = -1;
return DISP_E_UNKNOWNNAME;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment