https://bugs.winehq.org/show_bug.cgi?id=54221
--- Comment #9 from Jason Millard jsm174@gmail.com --- (In reply to Nikolay Sivov from comment #8)
We have some code in vbdisp.c that looks related and good start to figure out how this works.
Okay, I will dig in. This is where I'm at now:
static HRESULT Global_GetRef(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { BSTR str; HRESULT hres;
hres = to_string(arg, &str);
if(FAILED(hres)) return hres;
function_t **funcs = This->ctx->script_obj->global_funcs; size_t i, cnt = This->ctx->script_obj->global_funcs_cnt;
for(i = 0; i < cnt; i++) { if(!wcsicmp(funcs[i]->name, str)) { IDispatch* disp = (IDispatch*) &This->ctx->script_obj->IDispatchEx_iface;
DISPID dispid; hres = disp->lpVtbl->GetIDsOfNames(disp, 0, (LPOLESTR*)&funcs[i]->name, 1, 0, &dispid);
if(FAILED(hres)) return hres;
V_VT(res) = VT_DISPATCH; V_DISPATCH(res) = disp; IDispatch_AddRef(disp);
return hres; } }
return DISP_E_UNKNOWNNAME; }