static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) { DispatchEx *This = impl_from_IDispatchEx(iface); dispex_data_t *data; func_info_t *func; HRESULT hres; TRACE("(%p)->(%x %p)\n", This, id, pbstrName); if(is_dynamic_dispid(id)) { DWORD idx = id - DISPID_DYNPROP_0; if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx) return DISP_E_UNKNOWNNAME; *pbstrName = SysAllocString(This->dynamic_data->props[idx].name); if(!*pbstrName) return E_OUTOFMEMORY; return S_OK; } data = get_dispex_data(This); if(!data) return E_FAIL; hres = get_builtin_func(data, id, &func); if(FAILED(hres)) return hres; *pbstrName = SysAllocString(func->name); if(!*pbstrName) return E_OUTOFMEMORY; return S_OK; }
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { vbdisp_t *This = impl_from_IDispatchEx(iface); FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { vbdisp_t *This = impl_from_IDispatchEx(iface); FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("(%p)->(%p)\n", This, pctinfo); *pctinfo = 1; return S_OK; }
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface) { vbdisp_t *This = impl_from_IDispatchEx(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; }
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { vbdisp_t *This = impl_from_IDispatchEx(iface); FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); return get_typeinfo(This->data->disp_tid, ppTInfo); }
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex); /* Not implemented by IE */ return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("(%p)->(%x)\n", This, id); /* Not implemented by IE */ return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) { DispatchEx *This = impl_from_IDispatchEx(iface); dispex_data_t *data; func_info_t *func; HRESULT hres; TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid); if(is_dynamic_dispid(id)) { DWORD idx = id - DISPID_DYNPROP_0; if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx) return DISP_E_UNKNOWNNAME; while(++idx < This->dynamic_data->prop_cnt && This->dynamic_data->props[idx].flags & DYNPROP_DELETED); if(idx == This->dynamic_data->prop_cnt) { *pid = DISPID_STARTENUM; return S_FALSE; } *pid = DISPID_DYNPROP_0+idx; return S_OK; } data = get_dispex_data(This); if(!data) return E_FAIL; if(id == DISPID_STARTENUM) { func = data->funcs; }else { hres = get_builtin_func(data, id, &func); if(FAILED(hres)) return hres; func++; } while(func < data->funcs+data->func_cnt) { /* FIXME: Skip hidden properties */ if(func->func_disp_idx == -1) { *pid = func->id; return S_OK; } func++; } if(get_dynamic_data(This) && This->dynamic_data->prop_cnt) { *pid = DISPID_DYNPROP_0; return S_OK; } *pid = DISPID_STARTENUM; return S_FALSE; }
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL); }
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) { vbdisp_t *This = impl_from_IDispatchEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); if(!ref && run_terminator(This)) { clean_props(This); list_remove(&This->entry); heap_free(This); } return ref; }
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { DispatchEx *This = impl_from_IDispatchEx(iface); HRESULT hres; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); hres = get_typeinfo(This->data->disp_tid, ppTInfo); if(FAILED(hres)) return hres; ITypeInfo_AddRef(*ppTInfo); return S_OK; }
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { vbdisp_t *This = impl_from_IDispatchEx(iface); TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); if(!This->desc) return E_UNEXPECTED; if(grfdex & ~(fdexNameEnsure|fdexNameCaseInsensitive)) { FIXME("unsupported flags %x\n", grfdex); return E_NOTIMPL; } return vbdisp_get_id(This, bstrName, VBDISP_ANY, FALSE, pid); }
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { DispatchEx *This = impl_from_IDispatchEx(iface); dispex_data_t *data; int min, max, n, c; TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit)) FIXME("Unsupported grfdex %x\n", grfdex); data = get_dispex_data(This); if(!data) return E_FAIL; min = 0; max = data->func_cnt-1; while(min <= max) { n = (min+max)/2; c = strcmpiW(data->name_table[n]->name, bstrName); if(!c) { if((grfdex & fdexNameCaseSensitive) && strcmpW(data->name_table[n]->name, bstrName)) break; *pid = data->name_table[n]->id; return S_OK; } if(c > 0) max = n-1; else min = n+1; } if(This->data->vtbl && This->data->vtbl->get_dispid) { HRESULT hres; hres = This->data->vtbl->get_dispid(This->outer, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; } TRACE("not found %s\n", debugstr_w(bstrName)); return DISP_E_UNKNOWNNAME; }
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { DispatchEx *This = impl_from_IDispatchEx(iface); UINT i; HRESULT hres; TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); for(i=0; i < cNames; i++) { hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, rgszNames[i], 0, rgDispId+i); if(FAILED(hres)) return hres; } return S_OK; }
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) { vbdisp_t *This = impl_from_IDispatchEx(iface); if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = &This->IDispatchEx_iface; }else if(IsEqualGUID(&IID_IDispatch, riid)) { TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); *ppv = &This->IDispatchEx_iface; }else if(IsEqualGUID(&IID_IDispatchEx, riid)) { TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv); *ppv = &This->IDispatchEx_iface; }else { WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); *ppv = NULL; return E_NOINTERFACE; } IUnknown_AddRef((IUnknown*)*ppv); return S_OK; }
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { DispatchEx *This = impl_from_IDispatchEx(iface); dynamic_prop_t *dprop; HRESULT hres; TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); if(grfdex & ~(fdexNameCaseSensitive|fdexNameCaseInsensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK)) FIXME("Unsupported grfdex %x\n", grfdex); hres = get_builtin_id(This, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; hres = get_dynamic_prop(This, bstrName, grfdex, &dprop); if(FAILED(hres)) return hres; *pid = DISPID_DYNPROP_0 + (dprop - This->dynamic_data->props); return S_OK; }
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { DispatchEx *This = impl_from_IDispatchEx(iface); IUnknown *unk; ITypeInfo *ti; dispex_data_t *data; UINT argerr=0; int min, max, n; HRESULT hres; TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); if(is_custom_dispid(id) && This->data->vtbl && This->data->vtbl->invoke) return This->data->vtbl->invoke(This->outer, id, lcid, wFlags, pdp, pvarRes, pei); if(wFlags == DISPATCH_CONSTRUCT) { FIXME("DISPATCH_CONSTRUCT not implemented\n"); return E_NOTIMPL; } if(is_dynamic_dispid(id)) { DWORD idx = id - DISPID_DYNPROP_0; VARIANT *var; if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx) return DISP_E_UNKNOWNNAME; var = &This->dynamic_data->props[idx].var; switch(wFlags) { case INVOKE_PROPERTYGET: return VariantCopy(pvarRes, var); case INVOKE_PROPERTYPUT: VariantClear(var); return VariantCopy(var, pdp->rgvarg); default: FIXME("unhandled wFlags %x\n", wFlags); return E_NOTIMPL; } } data = get_dispex_data(This); if(!data) return E_FAIL; min = 0; max = data->func_cnt-1; while(min <= max) { n = (min+max)/2; if(data->funcs[n].id == id) break; if(data->funcs[n].id < id) min = n+1; else max = n-1; } if(min > max) { WARN("invalid id %x\n", id); return DISP_E_UNKNOWNNAME; } hres = get_typeinfo(data->funcs[n].tid, &ti); if(FAILED(hres)) { ERR("Could not get type info: %08x\n", hres); return hres; } hres = IUnknown_QueryInterface(This->outer, tid_ids[data->funcs[n].tid], (void**)&unk); if(FAILED(hres)) { ERR("Could not get iface: %08x\n", hres); return E_FAIL; } hres = ITypeInfo_Invoke(ti, unk, id, wFlags, pdp, pvarRes, pei, &argerr); ITypeInfo_Release(ti); IUnknown_Release(unk); return hres; }
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { DispatchEx *This = impl_from_IDispatchEx(iface); dispex_data_t *data; int min, max, n, c; TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit)) FIXME("Unsupported grfdex %x\n", grfdex); data = get_dispex_data(This); if(!data) return E_FAIL; min = 0; max = data->func_cnt-1; while(min <= max) { n = (min+max)/2; c = strcmpiW(data->name_table[n]->name, bstrName); if(!c) { if((grfdex & fdexNameCaseSensitive) && strcmpW(data->name_table[n]->name, bstrName)) break; *pid = data->name_table[n]->id; return S_OK; } if(c > 0) max = n-1; else min = n+1; } if(This->dynamic_data) { unsigned i; for(i=0; i < This->dynamic_data->prop_cnt; i++) { if(!strcmpW(This->dynamic_data->props[i].name, bstrName)) { *pid = DISPID_DYNPROP_0 + i; return S_OK; } } } if(This->data->vtbl && This->data->vtbl->get_dispid) { HRESULT hres; hres = This->data->vtbl->get_dispid(This->outer, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; } if(grfdex & fdexNameEnsure) { dispex_dynamic_data_t *dynamic_data; TRACE("creating dynamic prop %s\n", debugstr_w(bstrName)); if(This->dynamic_data) { dynamic_data = This->dynamic_data; }else { dynamic_data = This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t)); if(!dynamic_data) return E_OUTOFMEMORY; } if(!dynamic_data->buf_size) { dynamic_data->props = heap_alloc(sizeof(dynamic_prop_t)*4); if(!dynamic_data->props) return E_OUTOFMEMORY; dynamic_data->buf_size = 4; }else if(dynamic_data->buf_size == dynamic_data->prop_cnt) { dynamic_prop_t *new_props; new_props = heap_realloc(dynamic_data->props, sizeof(dynamic_prop_t)*(dynamic_data->buf_size<<1)); if(!new_props) return E_OUTOFMEMORY; dynamic_data->props = new_props; dynamic_data->buf_size <<= 1; } dynamic_data->props[dynamic_data->prop_cnt].name = heap_strdupW(bstrName); VariantInit(&dynamic_data->props[dynamic_data->prop_cnt].var); *pid = DISPID_DYNPROP_0 + dynamic_data->prop_cnt++; return S_OK; } TRACE("not found %s\n", debugstr_w(bstrName)); return DISP_E_UNKNOWNNAME; }
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) { DispatchEx *This = impl_from_IDispatchEx(iface); return IUnknown_Release(This->outer); }
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { DispatchEx *This = impl_from_IDispatchEx(iface); HRESULT hres; TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); if(wFlags == (DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF)) wFlags = DISPATCH_PROPERTYPUT; switch(get_dispid_type(id)) { case DISPEXPROP_CUSTOM: if(!This->data->vtbl || !This->data->vtbl->invoke) return DISP_E_UNKNOWNNAME; return This->data->vtbl->invoke(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); case DISPEXPROP_DYNAMIC: { DWORD idx = id - DISPID_DYNPROP_0; dynamic_prop_t *prop; if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx) return DISP_E_UNKNOWNNAME; prop = This->dynamic_data->props+idx; switch(wFlags) { case DISPATCH_METHOD|DISPATCH_PROPERTYGET: if(!pvarRes) return E_INVALIDARG; /* fall through */ case DISPATCH_METHOD: if(V_VT(&prop->var) != VT_DISPATCH) { FIXME("invoke %s\n", debugstr_variant(&prop->var)); return E_NOTIMPL; } return invoke_disp_value(This, V_DISPATCH(&prop->var), lcid, wFlags, pdp, pvarRes, pei, pspCaller); case DISPATCH_PROPERTYGET: if(prop->flags & DYNPROP_DELETED) return DISP_E_UNKNOWNNAME; V_VT(pvarRes) = VT_EMPTY; return variant_copy(pvarRes, &prop->var); case DISPATCH_PROPERTYPUT: if(pdp->cArgs != 1 || (pdp->cNamedArgs == 1 && *pdp->rgdispidNamedArgs != DISPID_PROPERTYPUT) || pdp->cNamedArgs > 1) { FIXME("invalid args\n"); return E_INVALIDARG; } TRACE("put %s\n", debugstr_variant(pdp->rgvarg)); VariantClear(&prop->var); hres = variant_copy(&prop->var, pdp->rgvarg); if(FAILED(hres)) return hres; prop->flags &= ~DYNPROP_DELETED; return S_OK; default: FIXME("unhandled wFlags %x\n", wFlags); return E_NOTIMPL; } } case DISPEXPROP_BUILTIN: if(wFlags == DISPATCH_CONSTRUCT) { if(id == DISPID_VALUE) { if(This->data->vtbl && This->data->vtbl->value) { return This->data->vtbl->value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller); } FIXME("DISPATCH_CONSTRUCT flag but missing value function\n"); return E_FAIL; } FIXME("DISPATCH_CONSTRUCT flag without DISPID_VALUE\n"); return E_FAIL; } return invoke_builtin_prop(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); default: assert(0); return E_FAIL; } }
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) { DispatchEx *This = impl_from_IDispatchEx(iface); FIXME("(%p)->(%p)\n", This, ppunk); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) { vbdisp_t *This = impl_from_IDispatchEx(iface); FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE(" Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, grfdex, id, pid); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("Not implemented in native msxml3 (%p)->(%x %p)\n", This, id, pbstrName); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) { DispatchEx *This = impl_from_IDispatchEx(iface); return IUnknown_QueryInterface(This->outer, riid, ppv); }
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) { DispatchEx *This = impl_from_IDispatchEx(iface); TRACE("Not implemented in native msxml3 (%p)->(%p)\n", This, ppunk); return E_NOTIMPL; }
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) { DispatchEx *This = impl_from_IDispatchEx(iface); FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex); return E_NOTIMPL; }