ReactOS  0.4.14-dev-50-g13bb5e2
dispex.c File Reference
#include "mshtml_private.h"
Include dependency graph for dispex.c:

Go to the source code of this file.

Classes

struct  func_info_t
 
struct  dispex_data_t
 
struct  dynamic_prop_t
 
struct  func_disp_t
 
struct  func_obj_entry_t
 
struct  dispex_dynamic_data_t
 

Macros

#define MAX_ARGS   16
 
#define DYNPROP_DELETED   0x01
 
#define DISPID_DYNPROP_0   0x50000000
 
#define DISPID_DYNPROP_MAX   0x5fffffff
 
#define FDEX_VERSION_MASK   0xf0000000
 
#define XIID(iface)   &IID_ ## iface,
 
#define XDIID(iface)   &DIID_ ## iface,
 
#define BUILTIN_ARG_TYPES_SWITCH
 
#define BUILTIN_TYPES_SWITCH
 
#define CASE_VT(x, a, b)   case x: return TRUE
 
#define CASE_VT(vt, type, access)
 
#define CASE_VT(vt, type, access)
 
#define CASE_VT(vt, type, access)
 

Functions

static HRESULT load_typelib (void)
 
static HRESULT get_typeinfo (tid_t tid, ITypeInfo **typeinfo)
 
void release_typelib (void)
 
HRESULT get_htmldoc_classinfo (ITypeInfo **typeinfo)
 
static BOOL is_arg_type_supported (VARTYPE vt)
 
static void add_func_info (dispex_data_t *data, DWORD *size, tid_t tid, const FUNCDESC *desc, ITypeInfo *dti)
 
static int dispid_cmp (const void *p1, const void *p2)
 
static int func_name_cmp (const void *p1, const void *p2)
 
static dispex_data_tpreprocess_dispex_data (DispatchEx *This)
 
static int id_cmp (const void *p1, const void *p2)
 
HRESULT get_dispids (tid_t tid, DWORD *ret_size, DISPID **ret)
 
static dispex_data_tget_dispex_data (DispatchEx *This)
 
static BOOL is_custom_dispid (DISPID id)
 
static BOOL is_dynamic_dispid (DISPID id)
 
dispex_prop_type_t get_dispid_type (DISPID id)
 
static HRESULT variant_copy (VARIANT *dest, VARIANT *src)
 
static dispex_dynamic_data_tget_dynamic_data (DispatchEx *This)
 
static HRESULT get_dynamic_prop (DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret)
 
HRESULT dispex_get_dprop_ref (DispatchEx *This, const WCHAR *name, BOOL alloc, VARIANT **ret)
 
HRESULT dispex_get_dynid (DispatchEx *This, const WCHAR *name, DISPID *id)
 
static HRESULT dispex_value (DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
static HRESULT typeinfo_invoke (DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei)
 
static func_disp_timpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI Function_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Function_AddRef (IUnknown *iface)
 
static ULONG WINAPI Function_Release (IUnknown *iface)
 
static func_disp_timpl_from_DispatchEx (DispatchEx *iface)
 
static HRESULT function_value (DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
static func_disp_tcreate_func_disp (DispatchEx *obj, func_info_t *info)
 
static HRESULT invoke_disp_value (DispatchEx *This, IDispatch *func_disp, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
static HRESULT get_func_obj_entry (DispatchEx *This, func_info_t *func, func_obj_entry_t **ret)
 
static HRESULT get_builtin_func (dispex_data_t *data, DISPID id, func_info_t **ret)
 
static HRESULT get_builtin_id (DispatchEx *This, BSTR name, DWORD grfdex, DISPID *ret)
 
static HRESULT change_type (VARIANT *dst, VARIANT *src, VARTYPE vt, IServiceProvider *caller)
 
static HRESULT builtin_propget (DispatchEx *This, func_info_t *func, DISPPARAMS *dp, VARIANT *res)
 
static HRESULT builtin_propput (DispatchEx *This, func_info_t *func, DISPPARAMS *dp, IServiceProvider *caller)
 
static HRESULT invoke_builtin_function (DispatchEx *This, func_info_t *func, DISPPARAMS *dp, VARIANT *res, IServiceProvider *caller)
 
static HRESULT function_invoke (DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
static HRESULT invoke_builtin_prop (DispatchEx *This, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
HRESULT remove_attribute (DispatchEx *This, DISPID id, VARIANT_BOOL *success)
 
static DispatchEximpl_from_IDispatchEx (IDispatchEx *iface)
 
static HRESULT WINAPI DispatchEx_QueryInterface (IDispatchEx *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI DispatchEx_AddRef (IDispatchEx *iface)
 
static ULONG WINAPI DispatchEx_Release (IDispatchEx *iface)
 
static HRESULT WINAPI DispatchEx_GetTypeInfoCount (IDispatchEx *iface, UINT *pctinfo)
 
static HRESULT WINAPI DispatchEx_GetTypeInfo (IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI DispatchEx_GetIDsOfNames (IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI DispatchEx_Invoke (IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI DispatchEx_GetDispID (IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
 
static HRESULT WINAPI DispatchEx_InvokeEx (IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
 
static HRESULT WINAPI DispatchEx_DeleteMemberByName (IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
 
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID (IDispatchEx *iface, DISPID id)
 
static HRESULT WINAPI DispatchEx_GetMemberProperties (IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
 
static HRESULT WINAPI DispatchEx_GetMemberName (IDispatchEx *iface, DISPID id, BSTR *pbstrName)
 
static HRESULT WINAPI DispatchEx_GetNextDispID (IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
 
static HRESULT WINAPI DispatchEx_GetNameSpaceParent (IDispatchEx *iface, IUnknown **ppunk)
 
BOOL dispex_query_interface (DispatchEx *This, REFIID riid, void **ppv)
 
void dispex_traverse (DispatchEx *This, nsCycleCollectionTraversalCallback *cb)
 
void dispex_unlink (DispatchEx *This)
 
void release_dispex (DispatchEx *This)
 
void init_dispex (DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
 

Variables

static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg
 
static const WCHAR objectW [] = {'[','o','b','j','e','c','t',']',0}
 
static ITypeLibtypelib
 
static ITypeInfotypeinfos [LAST_tid]
 
static struct list dispex_data_list = LIST_INIT(dispex_data_list)
 
static REFIID tid_ids []
 
static const IUnknownVtbl FunctionUnkVtbl
 
static const dispex_static_data_vtbl_t function_dispex_vtbl
 
static const tid_t function_iface_tids [] = {0}
 
static dispex_static_data_t function_dispex
 
static IDispatchExVtbl DispatchExVtbl
 

Macro Definition Documentation

◆ BUILTIN_ARG_TYPES_SWITCH

#define BUILTIN_ARG_TYPES_SWITCH
Value:
CASE_VT(VT_I4, INT32, V_I4); \
CASE_VT(VT_R4, float, V_R4); \
CASE_VT(VT_BSTR, BSTR, V_BSTR); \
Definition: compat.h:1939
#define V_I2(A)
Definition: oleauto.h:245
OLECHAR * BSTR
Definition: compat.h:1934
short VARIANT_BOOL
Definition: compat.h:1931
#define V_I4(A)
Definition: oleauto.h:247
#define V_R4(A)
Definition: oleauto.h:260
#define V_BOOL(A)
Definition: oleauto.h:224
Definition: compat.h:1940
#define V_BSTR(A)
Definition: oleauto.h:226
#define CASE_VT(x, a, b)
signed int INT32
Definition: compat.h:1938
signed short INT16

Definition at line 188 of file dispex.c.

◆ BUILTIN_TYPES_SWITCH

#define BUILTIN_TYPES_SWITCH
Value:
CASE_VT(VT_VARIANT, VARIANT, *); \
CASE_VT(VT_PTR, void*, V_BYREF); \
CASE_VT(VT_UNKNOWN, IUnknown*, V_UNKNOWN); \
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define V_BYREF(A)
Definition: oleauto.h:228
#define BUILTIN_ARG_TYPES_SWITCH
Definition: dispex.c:188
#define V_UNKNOWN(A)
Definition: oleauto.h:281

Definition at line 196 of file dispex.c.

◆ CASE_VT [1/4]

#define CASE_VT (   x,
  a,
  b 
)    case x: return TRUE

◆ CASE_VT [2/4]

#define CASE_VT (   vt,
  type,
  access 
)
Value:
case vt: { \
type val; \
hres = ((HRESULT (WINAPI*)(IUnknown*,type*))((void**)iface->lpVtbl)[func->get_vtbl_off])(iface,&val); \
if(SUCCEEDED(hres)) \
access(res) = val; \
} \
break
GLenum func
Definition: glext.h:6028
#define HRESULT
Definition: msvc.h:9
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLfloat * val
Definition: glext.h:7180
HRESULT hres
Definition: protocol.c:465
#define WINAPI
Definition: msvc.h:8
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ CASE_VT [3/4]

#define CASE_VT (   vt,
  type,
  access 
)
Value:
case vt: \
hres = ((HRESULT (WINAPI*)(IUnknown*,type))((void**)iface->lpVtbl)[func->put_vtbl_off])(iface,access(v)); \
break
GLenum func
Definition: glext.h:6028
#define HRESULT
Definition: msvc.h:9
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define WINAPI
Definition: msvc.h:8
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
const GLdouble * v
Definition: gl.h:2040
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866

◆ CASE_VT [4/4]

#define CASE_VT (   vt,
  type,
  access 
)
Value:
case vt: \
V_BYREF(&ret_ref) = &access(&retv); \
break
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866

◆ DISPID_DYNPROP_0

#define DISPID_DYNPROP_0   0x50000000

Definition at line 85 of file dispex.c.

◆ DISPID_DYNPROP_MAX

#define DISPID_DYNPROP_MAX   0x5fffffff

Definition at line 86 of file dispex.c.

◆ DYNPROP_DELETED

#define DYNPROP_DELETED   0x01

Definition at line 63 of file dispex.c.

◆ FDEX_VERSION_MASK

#define FDEX_VERSION_MASK   0xf0000000

Definition at line 88 of file dispex.c.

◆ MAX_ARGS

#define MAX_ARGS   16

Definition at line 21 of file dispex.c.

◆ XDIID

#define XDIID (   iface)    &DIID_ ## iface,

◆ XIID

#define XIID (   iface)    &IID_ ## iface,

Function Documentation

◆ add_func_info()

static void add_func_info ( dispex_data_t data,
DWORD size,
tid_t  tid,
const FUNCDESC *  desc,
ITypeInfo dti 
)
static

Definition at line 213 of file dispex.c.

214 {
215  func_info_t *info;
216  HRESULT hres;
217 
218  for(info = data->funcs; info < data->funcs+data->func_cnt; info++) {
219  if(info->id == desc->memid) {
220  if(info->tid != tid)
221  return; /* Duplicated in other interface */
222  break;
223  }
224  }
225 
226  if(info == data->funcs+data->func_cnt) {
227  if(data->func_cnt == *size)
228  data->funcs = heap_realloc_zero(data->funcs, (*size <<= 1)*sizeof(func_info_t));
229 
230  info = data->funcs+data->func_cnt;
231  hres = ITypeInfo_GetDocumentation(dti, desc->memid, &info->name, NULL, NULL, NULL);
232  if(FAILED(hres))
233  return;
234 
235  data->func_cnt++;
236 
237  info->id = desc->memid;
238  info->tid = tid;
239  info->func_disp_idx = -1;
240  info->prop_vt = VT_EMPTY;
241  }
242 
243  if(desc->invkind & DISPATCH_METHOD) {
244  unsigned i;
245 
246  info->func_disp_idx = data->func_disp_cnt++;
247  info->argc = desc->cParams;
248 
249  assert(info->argc < MAX_ARGS);
250  assert(desc->funckind == FUNC_DISPATCH);
251 
252  info->arg_types = heap_alloc(sizeof(*info->arg_types) * info->argc);
253  if(!info->arg_types)
254  return; /* FIXME: real error instead of fallback */
255 
256  for(i=0; i < info->argc; i++)
257  info->arg_types[i] = desc->lprgelemdescParam[i].tdesc.vt;
258 
259  info->prop_vt = desc->elemdescFunc.tdesc.vt;
260  if(info->prop_vt != VT_VOID && !is_arg_type_supported(info->prop_vt)) {
261  TRACE("%s: return type %d\n", debugstr_w(info->name), info->prop_vt);
262  return; /* Fallback to ITypeInfo::Invoke */
263  }
264 
265  if(desc->cParamsOpt) {
266  TRACE("%s: optional params\n", debugstr_w(info->name));
267  return; /* Fallback to ITypeInfo::Invoke */
268  }
269 
270  for(i=0; i < info->argc; i++) {
271  if(!is_arg_type_supported(info->arg_types[i])) {
272  return; /* Fallback to ITypeInfo for unsupported arg types */
273  }
274 
275  if(desc->lprgelemdescParam[i].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) {
276  TRACE("%s param %d: default value\n", debugstr_w(info->name), i);
277  return; /* Fallback to ITypeInfo::Invoke */
278  }
279  }
280 
281  assert(info->argc <= MAX_ARGS);
282  assert(desc->callconv == CC_STDCALL);
283 
284  info->call_vtbl_off = desc->oVft/sizeof(void*);
285  }else if(desc->invkind & (DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYGET)) {
286  VARTYPE vt = VT_EMPTY;
287 
288  if(desc->invkind & DISPATCH_PROPERTYGET) {
289  vt = desc->elemdescFunc.tdesc.vt;
290  info->get_vtbl_off = desc->oVft/sizeof(void*);
291  }
292  if(desc->invkind & DISPATCH_PROPERTYPUT) {
293  assert(desc->cParams == 1);
294  vt = desc->lprgelemdescParam->tdesc.vt;
295  info->put_vtbl_off = desc->oVft/sizeof(void*);
296  }
297 
298  assert(info->prop_vt == VT_EMPTY || vt == info->prop_vt);
299  info->prop_vt = vt;
300  }
301 }
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
#define assert(x)
Definition: debug.h:53
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define DISPATCH_METHOD
Definition: oleauto.h:1006
struct _test_info info[]
Definition: SetCursorPos.c:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL is_arg_type_supported(VARTYPE vt)
Definition: dispex.c:203
#define MAX_ARGS
Definition: dispex.c:21
#define debugstr_w
Definition: kernel32.h:32
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static struct __wine_debug_functions funcs
Definition: debug.c:59
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned short VARTYPE
Definition: compat.h:1895
static TfClientId tid

Referenced by preprocess_dispex_data().

◆ builtin_propget()

static HRESULT builtin_propget ( DispatchEx This,
func_info_t func,
DISPPARAMS *  dp,
VARIANT res 
)
static

Definition at line 943 of file dispex.c.

944 {
945  IUnknown *iface;
946  HRESULT hres;
947 
948  if(dp && dp->cArgs) {
949  FIXME("cArgs %d\n", dp->cArgs);
950  return E_NOTIMPL;
951  }
952 
953  assert(func->get_vtbl_off);
954 
955  hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&iface);
956  if(SUCCEEDED(hres)) {
957  switch(func->prop_vt) {
958 #define CASE_VT(vt,type,access) \
959  case vt: { \
960  type val; \
961  hres = ((HRESULT (WINAPI*)(IUnknown*,type*))((void**)iface->lpVtbl)[func->get_vtbl_off])(iface,&val); \
962  if(SUCCEEDED(hres)) \
963  access(res) = val; \
964  } \
965  break
967 #undef CASE_VT
968  default:
969  FIXME("Unhandled vt %d\n", func->prop_vt);
970  hres = E_NOTIMPL;
971  }
972  IUnknown_Release(iface);
973  }
974 
975  if(FAILED(hres))
976  return hres;
977 
978  if(func->prop_vt != VT_VARIANT)
979  V_VT(res) = func->prop_vt == VT_PTR ? VT_DISPATCH : func->prop_vt;
980  return S_OK;
981 }
GLenum func
Definition: glext.h:6028
#define BUILTIN_TYPES_SWITCH
Definition: dispex.c:196
static REFIID tid_ids[]
Definition: dispex.c:94
#define assert(x)
Definition: debug.h:53
#define FIXME(fmt,...)
Definition: debug.h:110
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by invoke_builtin_prop().

◆ builtin_propput()

static HRESULT builtin_propput ( DispatchEx This,
func_info_t func,
DISPPARAMS *  dp,
IServiceProvider caller 
)
static

Definition at line 983 of file dispex.c.

984 {
985  VARIANT *v, tmpv;
986  IUnknown *iface;
987  HRESULT hres;
988 
989  if(dp->cArgs != 1 || (dp->cNamedArgs == 1 && *dp->rgdispidNamedArgs != DISPID_PROPERTYPUT)
990  || dp->cNamedArgs > 1) {
991  FIXME("invalid args\n");
992  return E_INVALIDARG;
993  }
994 
995  if(!func->put_vtbl_off) {
996  FIXME("No setter\n");
997  return E_FAIL;
998  }
999 
1000  v = dp->rgvarg;
1001  if(func->prop_vt != VT_VARIANT && V_VT(v) != func->prop_vt) {
1002  hres = change_type(&tmpv, v, func->prop_vt, caller);
1003  if(FAILED(hres))
1004  return hres;
1005  v = &tmpv;
1006  }
1007 
1008  hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&iface);
1009  if(SUCCEEDED(hres)) {
1010  switch(func->prop_vt) {
1011 #define CASE_VT(vt,type,access) \
1012  case vt: \
1013  hres = ((HRESULT (WINAPI*)(IUnknown*,type))((void**)iface->lpVtbl)[func->put_vtbl_off])(iface,access(v)); \
1014  break
1016 #undef CASE_VT
1017  default:
1018  FIXME("Unimplemented vt %d\n", func->prop_vt);
1019  hres = E_NOTIMPL;
1020  }
1021 
1022  IUnknown_Release(iface);
1023  }
1024 
1025  if(v == &tmpv)
1026  VariantClear(v);
1027  return hres;
1028 }
GLenum func
Definition: glext.h:6028
#define BUILTIN_TYPES_SWITCH
Definition: dispex.c:196
static REFIID tid_ids[]
Definition: dispex.c:94
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT change_type(VARIANT *dst, VARIANT *src, VARTYPE vt, IServiceProvider *caller)
Definition: dispex.c:914
const GLdouble * v
Definition: gl.h:2040
#define E_NOTIMPL
Definition: ddrawi.h:99
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by invoke_builtin_prop(), and remove_attribute().

◆ change_type()

static HRESULT change_type ( VARIANT dst,
VARIANT src,
VARTYPE  vt,
IServiceProvider caller 
)
static

Definition at line 914 of file dispex.c.

915 {
916  V_VT(dst) = VT_EMPTY;
917 
918  if(caller) {
919  IVariantChangeType *change_type = NULL;
920  HRESULT hres;
921 
922  hres = IServiceProvider_QueryService(caller, &SID_VariantConversion, &IID_IVariantChangeType, (void**)&change_type);
923  if(SUCCEEDED(hres)) {
924  hres = IVariantChangeType_ChangeType(change_type, dst, src, LOCALE_NEUTRAL, vt);
925  IVariantChangeType_Release(change_type);
926  return hres;
927  }
928  }
929 
930  switch(vt) {
931  case VT_BOOL:
932  if(V_VT(src) == VT_BSTR) {
933  V_VT(dst) = VT_BOOL;
934  V_BOOL(dst) = V_BSTR(src) && *V_BSTR(src) ? VARIANT_TRUE : VARIANT_FALSE;
935  return S_OK;
936  }
937  break;
938  }
939 
940  return VariantChangeType(dst, src, 0, vt);
941 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:965
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define V_BOOL(A)
Definition: oleauto.h:224
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT change_type(VARIANT *dst, VARIANT *src, VARTYPE vt, IServiceProvider *caller)
Definition: dispex.c:914
GLenum src
Definition: glext.h:6340
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
#define LOCALE_NEUTRAL
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by _call_change_type(), _change_type_fail(), builtin_propput(), invoke_builtin_function(), test_caller(), test_change_type(), and test_change_types().

◆ create_func_disp()

static func_disp_t* create_func_disp ( DispatchEx obj,
func_info_t info 
)
static

Definition at line 760 of file dispex.c.

761 {
762  func_disp_t *ret;
763 
764  ret = heap_alloc_zero(sizeof(func_disp_t));
765  if(!ret)
766  return NULL;
767 
768  ret->IUnknown_iface.lpVtbl = &FunctionUnkVtbl;
769  init_dispex(&ret->dispex, &ret->IUnknown_iface, &function_dispex);
770  ret->ref = 1;
771  ret->obj = obj;
772  ret->info = info;
773 
774  return ret;
775 }
static dispex_static_data_t function_dispex
Definition: dispex.c:753
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
struct _test_info info[]
Definition: SetCursorPos.c:19
smooth NULL
Definition: ftsmooth.c:416
int ret
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:940
static const IUnknownVtbl FunctionUnkVtbl
Definition: dispex.c:678

Referenced by get_func_obj_entry().

◆ DispatchEx_AddRef()

static ULONG WINAPI DispatchEx_AddRef ( IDispatchEx *  iface)
static

Definition at line 1332 of file dispex.c.

1333 {
1335 
1336  return IUnknown_AddRef(This->outer);
1337 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320

◆ DispatchEx_DeleteMemberByDispID()

static HRESULT WINAPI DispatchEx_DeleteMemberByDispID ( IDispatchEx *  iface,
DISPID  id 
)
static

Definition at line 1521 of file dispex.c.

1522 {
1524 
1525  TRACE("(%p)->(%x)\n", This, id);
1526 
1527  /* Not implemented by IE */
1528  return E_NOTIMPL;
1529 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_DeleteMemberByName()

static HRESULT WINAPI DispatchEx_DeleteMemberByName ( IDispatchEx *  iface,
BSTR  bstrName,
DWORD  grfdex 
)
static

Definition at line 1511 of file dispex.c.

1512 {
1514 
1515  TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
1516 
1517  /* Not implemented by IE */
1518  return E_NOTIMPL;
1519 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetDispID()

static HRESULT WINAPI DispatchEx_GetDispID ( IDispatchEx *  iface,
BSTR  bstrName,
DWORD  grfdex,
DISPID pid 
)
static

Definition at line 1405 of file dispex.c.

1406 {
1408  dynamic_prop_t *dprop;
1409  HRESULT hres;
1410 
1411  TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
1412 
1413  if(grfdex & ~(fdexNameCaseSensitive|fdexNameCaseInsensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK))
1414  FIXME("Unsupported grfdex %x\n", grfdex);
1415 
1416  hres = get_builtin_id(This, bstrName, grfdex, pid);
1417  if(hres != DISP_E_UNKNOWNNAME)
1418  return hres;
1419 
1420  hres = get_dynamic_prop(This, bstrName, grfdex, &dprop);
1421  if(FAILED(hres))
1422  return hres;
1423 
1424  *pid = DISPID_DYNPROP_0 + (dprop - This->dynamic_data->props);
1425  return S_OK;
1426 }
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define FDEX_VERSION_MASK
Definition: dispex.c:88
static HRESULT get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID *ret)
Definition: dispex.c:873
#define DISPID_DYNPROP_0
Definition: dispex.c:85
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret)
Definition: dispex.c:499
#define S_OK
Definition: intsafe.h:59

◆ DispatchEx_GetIDsOfNames()

static HRESULT WINAPI DispatchEx_GetIDsOfNames ( IDispatchEx *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 1372 of file dispex.c.

1375 {
1377  UINT i;
1378  HRESULT hres;
1379 
1380  TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1381  lcid, rgDispId);
1382 
1383  for(i=0; i < cNames; i++) {
1384  hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, rgszNames[i], 0, rgDispId+i);
1385  if(FAILED(hres))
1386  return hres;
1387  }
1388 
1389  return S_OK;
1390 }
REFIID riid
Definition: precomp.h:44
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50

◆ DispatchEx_GetMemberName()

static HRESULT WINAPI DispatchEx_GetMemberName ( IDispatchEx *  iface,
DISPID  id,
BSTR pbstrName 
)
static

Definition at line 1538 of file dispex.c.

1539 {
1542  func_info_t *func;
1543  HRESULT hres;
1544 
1545  TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
1546 
1547  if(is_dynamic_dispid(id)) {
1548  DWORD idx = id - DISPID_DYNPROP_0;
1549 
1550  if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx)
1551  return DISP_E_UNKNOWNNAME;
1552 
1553  *pbstrName = SysAllocString(This->dynamic_data->props[idx].name);
1554  if(!*pbstrName)
1555  return E_OUTOFMEMORY;
1556 
1557  return S_OK;
1558  }
1559 
1561  if(!data)
1562  return E_FAIL;
1563 
1564  hres = get_builtin_func(data, id, &func);
1565  if(FAILED(hres))
1566  return hres;
1567 
1568  *pbstrName = SysAllocString(func->name);
1569  if(!*pbstrName)
1570  return E_OUTOFMEMORY;
1571  return S_OK;
1572 }
GLenum func
Definition: glext.h:6028
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define DISPID_DYNPROP_0
Definition: dispex.c:85
unsigned int idx
Definition: utils.c:41
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static dispex_dynamic_data_t * get_dynamic_data(DispatchEx *This)
Definition: dispex.c:484
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static BOOL is_dynamic_dispid(DISPID id)
Definition: dispex.c:459
#define S_OK
Definition: intsafe.h:59
static dispex_data_t * get_dispex_data(DispatchEx *This)
Definition: dispex.c:439
static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **ret)
Definition: dispex.c:848

◆ DispatchEx_GetMemberProperties()

static HRESULT WINAPI DispatchEx_GetMemberProperties ( IDispatchEx *  iface,
DISPID  id,
DWORD  grfdexFetch,
DWORD pgrfdex 
)
static

Definition at line 1531 of file dispex.c.

1532 {
1534  FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
1535  return E_NOTIMPL;
1536 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetNameSpaceParent()

static HRESULT WINAPI DispatchEx_GetNameSpaceParent ( IDispatchEx *  iface,
IUnknown **  ppunk 
)
static

Definition at line 1631 of file dispex.c.

1632 {
1634  FIXME("(%p)->(%p)\n", This, ppunk);
1635  return E_NOTIMPL;
1636 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetNextDispID()

static HRESULT WINAPI DispatchEx_GetNextDispID ( IDispatchEx *  iface,
DWORD  grfdex,
DISPID  id,
DISPID pid 
)
static

Definition at line 1574 of file dispex.c.

1575 {
1578  func_info_t *func;
1579  HRESULT hres;
1580 
1581  TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
1582 
1583  if(is_dynamic_dispid(id)) {
1584  DWORD idx = id - DISPID_DYNPROP_0;
1585 
1586  if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx)
1587  return DISP_E_UNKNOWNNAME;
1588 
1589  while(++idx < This->dynamic_data->prop_cnt && This->dynamic_data->props[idx].flags & DYNPROP_DELETED);
1590 
1591  if(idx == This->dynamic_data->prop_cnt) {
1592  *pid = DISPID_STARTENUM;
1593  return S_FALSE;
1594  }
1595 
1597  return S_OK;
1598  }
1599 
1601  if(!data)
1602  return E_FAIL;
1603 
1604  if(id == DISPID_STARTENUM) {
1605  func = data->funcs;
1606  }else {
1607  hres = get_builtin_func(data, id, &func);
1608  if(FAILED(hres))
1609  return hres;
1610  func++;
1611  }
1612 
1613  while(func < data->funcs+data->func_cnt) {
1614  /* FIXME: Skip hidden properties */
1615  if(func->func_disp_idx == -1) {
1616  *pid = func->id;
1617  return S_OK;
1618  }
1619  func++;
1620  }
1621 
1622  if(get_dynamic_data(This) && This->dynamic_data->prop_cnt) {
1623  *pid = DISPID_DYNPROP_0;
1624  return S_OK;
1625  }
1626 
1627  *pid = DISPID_STARTENUM;
1628  return S_FALSE;
1629 }
GLenum func
Definition: glext.h:6028
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define E_FAIL
Definition: ddrawi.h:102
#define DISPID_DYNPROP_0
Definition: dispex.c:85
unsigned int idx
Definition: utils.c:41
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static dispex_dynamic_data_t * get_dynamic_data(DispatchEx *This)
Definition: dispex.c:484
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static BOOL is_dynamic_dispid(DISPID id)
Definition: dispex.c:459
#define S_OK
Definition: intsafe.h:59
static dispex_data_t * get_dispex_data(DispatchEx *This)
Definition: dispex.c:439
static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **ret)
Definition: dispex.c:848
#define DYNPROP_DELETED
Definition: dispex.c:63

◆ DispatchEx_GetTypeInfo()

static HRESULT WINAPI DispatchEx_GetTypeInfo ( IDispatchEx *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 1356 of file dispex.c.

1358 {
1360  HRESULT hres;
1361 
1362  TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
1363 
1364  hres = get_typeinfo(This->data->disp_tid, ppTInfo);
1365  if(FAILED(hres))
1366  return hres;
1367 
1368  ITypeInfo_AddRef(*ppTInfo);
1369  return S_OK;
1370 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
Definition: dispex.c:118

◆ DispatchEx_GetTypeInfoCount()

static HRESULT WINAPI DispatchEx_GetTypeInfoCount ( IDispatchEx *  iface,
UINT pctinfo 
)
static

Definition at line 1346 of file dispex.c.

1347 {
1349 
1350  TRACE("(%p)->(%p)\n", This, pctinfo);
1351 
1352  *pctinfo = 1;
1353  return S_OK;
1354 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ DispatchEx_Invoke()

static HRESULT WINAPI DispatchEx_Invoke ( IDispatchEx *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 1392 of file dispex.c.

1395 {
1397 
1398  TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1399  lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1400 
1401  return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, pDispParams,
1402  pVarResult, pExcepInfo, NULL);
1403 }
REFIID riid
Definition: precomp.h:44
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519

◆ DispatchEx_InvokeEx()

static HRESULT WINAPI DispatchEx_InvokeEx ( IDispatchEx *  iface,
DISPID  id,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pdp,
VARIANT pvarRes,
EXCEPINFO *  pei,
IServiceProvider pspCaller 
)
static

Definition at line 1428 of file dispex.c.

1430 {
1432  HRESULT hres;
1433 
1434  TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1435 
1438 
1439  switch(get_dispid_type(id)) {
1440  case DISPEXPROP_CUSTOM:
1441  if(!This->data->vtbl || !This->data->vtbl->invoke)
1442  return DISP_E_UNKNOWNNAME;
1443  return This->data->vtbl->invoke(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1444 
1445  case DISPEXPROP_DYNAMIC: {
1446  DWORD idx = id - DISPID_DYNPROP_0;
1447  dynamic_prop_t *prop;
1448 
1449  if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx)
1450  return DISP_E_UNKNOWNNAME;
1451 
1452  prop = This->dynamic_data->props+idx;
1453 
1454  switch(wFlags) {
1456  if(!pvarRes)
1457  return E_INVALIDARG;
1458  /* fall through */
1459  case DISPATCH_METHOD:
1460  if(V_VT(&prop->var) != VT_DISPATCH) {
1461  FIXME("invoke %s\n", debugstr_variant(&prop->var));
1462  return E_NOTIMPL;
1463  }
1464 
1465  return invoke_disp_value(This, V_DISPATCH(&prop->var), lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1466  case DISPATCH_PROPERTYGET:
1467  if(prop->flags & DYNPROP_DELETED)
1468  return DISP_E_UNKNOWNNAME;
1469  V_VT(pvarRes) = VT_EMPTY;
1470  return variant_copy(pvarRes, &prop->var);
1471  case DISPATCH_PROPERTYPUT:
1472  if(pdp->cArgs != 1 || (pdp->cNamedArgs == 1 && *pdp->rgdispidNamedArgs != DISPID_PROPERTYPUT)
1473  || pdp->cNamedArgs > 1) {
1474  FIXME("invalid args\n");
1475  return E_INVALIDARG;
1476  }
1477 
1478  TRACE("put %s\n", debugstr_variant(pdp->rgvarg));
1479  VariantClear(&prop->var);
1480  hres = variant_copy(&prop->var, pdp->rgvarg);
1481  if(FAILED(hres))
1482  return hres;
1483 
1484  prop->flags &= ~DYNPROP_DELETED;
1485  return S_OK;
1486  default:
1487  FIXME("unhandled wFlags %x\n", wFlags);
1488  return E_NOTIMPL;
1489  }
1490  }
1491  case DISPEXPROP_BUILTIN:
1492  if(wFlags == DISPATCH_CONSTRUCT) {
1493  if(id == DISPID_VALUE) {
1494  if(This->data->vtbl && This->data->vtbl->value) {
1495  return This->data->vtbl->value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1496  }
1497  FIXME("DISPATCH_CONSTRUCT flag but missing value function\n");
1498  return E_FAIL;
1499  }
1500  FIXME("DISPATCH_CONSTRUCT flag without DISPID_VALUE\n");
1501  return E_FAIL;
1502  }
1503 
1504  return invoke_builtin_prop(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1505  default:
1506  assert(0);
1507  return E_FAIL;
1508  }
1509 }
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
#define assert(x)
Definition: debug.h:53
#define E_FAIL
Definition: ddrawi.h:102
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define DISPID_DYNPROP_0
Definition: dispex.c:85
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned int idx
Definition: utils.c:41
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD flags
Definition: dispex.c:60
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:777
static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:1190
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static dispex_dynamic_data_t * get_dynamic_data(DispatchEx *This)
Definition: dispex.c:484
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
dispex_prop_type_t get_dispid_type(DISPID id)
Definition: dispex.c:464
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
VARIANT var
Definition: dispex.c:58
static HRESULT variant_copy(VARIANT *dest, VARIANT *src)
Definition: dispex.c:473
#define E_NOTIMPL
Definition: ddrawi.h:99
#define DYNPROP_DELETED
Definition: dispex.c:63

◆ DispatchEx_QueryInterface()

static HRESULT WINAPI DispatchEx_QueryInterface ( IDispatchEx *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1325 of file dispex.c.

1326 {
1328 
1329  return IUnknown_QueryInterface(This->outer, riid, ppv);
1330 }
REFIID riid
Definition: precomp.h:44
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ DispatchEx_Release()

static ULONG WINAPI DispatchEx_Release ( IDispatchEx *  iface)
static

Definition at line 1339 of file dispex.c.

1340 {
1342 
1343  return IUnknown_Release(This->outer);
1344 }
static DispatchEx * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:1320

◆ dispex_get_dprop_ref()

HRESULT dispex_get_dprop_ref ( DispatchEx This,
const WCHAR name,
BOOL  alloc,
VARIANT **  ret 
)

Definition at line 555 of file dispex.c.

556 {
557  dynamic_prop_t *prop;
558  HRESULT hres;
559 
560  hres = get_dynamic_prop(This, name, alloc ? fdexNameEnsure : 0, &prop);
561  if(FAILED(hres))
562  return hres;
563 
564  *ret = &prop->var;
565  return S_OK;
566 }
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret)
Definition: dispex.c:499
#define S_OK
Definition: intsafe.h:59
VARIANT var
Definition: dispex.c:58
#define alloc
Definition: rosglue.h:13
Definition: name.c:36

Referenced by get_event_handler(), HTMLElement3_get_disabled(), HTMLElement3_put_disabled(), HTMLElement_get_title(), HTMLElement_put_title(), HTMLStyle3_get_zoom(), HTMLStyle3_put_zoom(), remove_event_handler(), and set_event_handler().

◆ dispex_get_dynid()

HRESULT dispex_get_dynid ( DispatchEx This,
const WCHAR name,
DISPID id 
)

Definition at line 568 of file dispex.c.

569 {
570  dynamic_prop_t *prop;
571  HRESULT hres;
572 
573  hres = get_dynamic_prop(This, name, fdexNameEnsure, &prop);
574  if(FAILED(hres))
575  return hres;
576 
577  *id = DISPID_DYNPROP_0 + (prop - This->dynamic_data->props);
578  return S_OK;
579 }
#define DISPID_DYNPROP_0
Definition: dispex.c:85
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret)
Definition: dispex.c:499
#define S_OK
Definition: intsafe.h:59
Definition: name.c:36

Referenced by HTMLWindow_invoke().

◆ dispex_query_interface()

BOOL dispex_query_interface ( DispatchEx This,
REFIID  riid,
void **  ppv 
)

Definition at line 1656 of file dispex.c.

1657 {
1659  *ppv = &This->IDispatchEx_iface;
1660  else if(IsEqualGUID(&IID_IDispatchEx, riid))
1661  *ppv = &This->IDispatchEx_iface;
1662  else if(IsEqualGUID(&IID_IDispatchJS, riid))
1663  *ppv = NULL;
1664  else if(IsEqualGUID(&IID_UndocumentedScriptIface, riid))
1665  *ppv = NULL;
1666  else
1667  return FALSE;
1668 
1669  if(*ppv)
1670  IUnknown_AddRef((IUnknown*)*ppv);
1671  return TRUE;
1672 }
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IDispatch
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

Referenced by CustomDoc_QueryInterface(), Function_QueryInterface(), HTMLAttributeCollection_QueryInterface(), HTMLCurrentStyle_QueryInterface(), HTMLDOMAttribute_QueryInterface(), HTMLDOMChildrenCollection_QueryInterface(), HTMLDOMImplementation_QueryInterface(), HTMLDOMNode_QI(), HTMLElementCollection_QueryInterface(), HTMLEventObj_QueryInterface(), HTMLFiltersCollection_QueryInterface(), HTMLImageElementFactory_QueryInterface(), HTMLLocation_QueryInterface(), HTMLMimeTypesCollection_QueryInterface(), HTMLOptionElementFactory_QueryInterface(), HTMLPluginsCollection_QueryInterface(), HTMLRect_QueryInterface(), HTMLScreen_QueryInterface(), HTMLSelectionObject_QueryInterface(), HTMLStorage_QueryInterface(), HTMLStyle_QueryInterface(), HTMLStyleSheet_QueryInterface(), HTMLStyleSheetRulesCollection_QueryInterface(), HTMLStyleSheetsCollection_QueryInterface(), HTMLTxtRange_QueryInterface(), HTMLWindow2_QueryInterface(), HTMLXMLHttpRequest_QueryInterface(), HTMLXMLHttpRequestFactory_QueryInterface(), MXAttributes_QueryInterface(), mxwriter_QueryInterface(), OmHistory_QueryInterface(), OmNavigator_QueryInterface(), parseError_QueryInterface(), vbnamespacemanager_QueryInterface(), xslprocessor_QueryInterface(), and xsltemplate_QueryInterface().

◆ dispex_traverse()

void dispex_traverse ( DispatchEx This,
nsCycleCollectionTraversalCallback cb 
)

Definition at line 1674 of file dispex.c.

1675 {
1676  dynamic_prop_t *prop;
1677 
1678  if(!This->dynamic_data)
1679  return;
1680 
1681  for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) {
1682  if(V_VT(&prop->var) == VT_DISPATCH)
1683  note_cc_edge((nsISupports*)V_DISPATCH(&prop->var), "dispex_data", cb);
1684  }
1685 
1686  /* FIXME: Traverse func_disps */
1687 }
#define V_DISPATCH(A)
Definition: oleauto.h:239
static DWORD cb
Definition: integrity.c:41
#define V_VT(A)
Definition: oleauto.h:211
VARIANT var
Definition: dispex.c:58

Referenced by HTMLDOMNode_traverse().

◆ dispex_unlink()

void dispex_unlink ( DispatchEx This)

Definition at line 1689 of file dispex.c.

1690 {
1691  dynamic_prop_t *prop;
1692 
1693  if(!This->dynamic_data)
1694  return;
1695 
1696  for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) {
1697  if(V_VT(&prop->var) == VT_DISPATCH) {
1698  V_VT(&prop->var) = VT_EMPTY;
1699  IDispatch_Release(V_DISPATCH(&prop->var));
1700  }else {
1701  VariantClear(&prop->var);
1702  }
1703  }
1704 }
#define V_DISPATCH(A)
Definition: oleauto.h:239
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
VARIANT var
Definition: dispex.c:58

Referenced by HTMLDOMNode_unlink().

◆ dispex_value()

static HRESULT dispex_value ( DispatchEx This,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT res,
EXCEPINFO *  ei,
IServiceProvider caller 
)
static

Definition at line 581 of file dispex.c.

583 {
584  if(This->data->vtbl && This->data->vtbl->value)
585  return This->data->vtbl->value(This, lcid, flags, params, res, ei, caller);
586 
587  switch(flags) {
589  V_VT(res) = VT_BSTR;
591  if(!V_BSTR(res))
592  return E_OUTOFMEMORY;
593  break;
594  default:
595  FIXME("Unimplemented flags %x\n", flags);
596  return E_NOTIMPL;
597  }
598 
599  return S_OK;
600 }
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
static const WCHAR objectW[]
Definition: dispex.c:33
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum const GLfloat * params
Definition: glext.h:5645
#define FIXME(fmt,...)
Definition: debug.h:110
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
GLbitfield flags
Definition: glext.h:7161
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613

Referenced by invoke_builtin_prop().

◆ dispid_cmp()

static int dispid_cmp ( const void p1,
const void p2 
)
static

Definition at line 303 of file dispex.c.

304 {
305  return ((const func_info_t*)p1)->id - ((const func_info_t*)p2)->id;
306 }

Referenced by preprocess_dispex_data().

◆ func_name_cmp()

static int func_name_cmp ( const void p1,
const void p2 
)
static

Definition at line 308 of file dispex.c.

309 {
310  return strcmpiW((*(func_info_t* const*)p1)->name, (*(func_info_t* const*)p2)->name);
311 }
#define strcmpiW(s1, s2)
Definition: unicode.h:39
Definition: name.c:36

Referenced by preprocess_dispex_data().

◆ Function_AddRef()

static ULONG WINAPI Function_AddRef ( IUnknown iface)
static

Definition at line 652 of file dispex.c.

653 {
656 
657  TRACE("(%p) ref=%d\n", This, ref);
658 
659  return ref;
660 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static func_disp_t * impl_from_IUnknown(IUnknown *iface)
Definition: dispex.c:628
#define InterlockedIncrement
Definition: armddk.h:53

◆ function_invoke()

static HRESULT function_invoke ( DispatchEx This,
func_info_t func,
WORD  flags,
DISPPARAMS *  dp,
VARIANT res,
EXCEPINFO *  ei,
IServiceProvider caller 
)
static

Definition at line 1103 of file dispex.c.

1105 {
1106  HRESULT hres;
1107 
1108  switch(flags) {
1110  if(!res)
1111  return E_INVALIDARG;
1112  /* fall through */
1113  case DISPATCH_METHOD:
1114  if(This->dynamic_data && This->dynamic_data->func_disps
1115  && This->dynamic_data->func_disps[func->func_disp_idx].func_obj) {
1116  func_obj_entry_t *entry = This->dynamic_data->func_disps + func->func_disp_idx;
1117 
1118  if(V_VT(&entry->val) != VT_DISPATCH) {
1119  FIXME("calling %s not supported\n", debugstr_variant(&entry->val));
1120  return E_NOTIMPL;
1121  }
1122 
1123  if((IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface != V_DISPATCH(&entry->val)) {
1124  if(!V_DISPATCH(&entry->val)) {
1125  FIXME("Calling null\n");
1126  return E_FAIL;
1127  }
1128 
1129  hres = invoke_disp_value(This, V_DISPATCH(&entry->val), 0, flags, dp, res, ei, NULL);
1130  break;
1131  }
1132  }
1133 
1134  if(func->call_vtbl_off)
1135  hres = invoke_builtin_function(This, func, dp, res, caller);
1136  else
1137  hres = typeinfo_invoke(This, func, flags, dp, res, ei);
1138  break;
1139  case DISPATCH_PROPERTYGET: {
1141 
1142  if(func->id == DISPID_VALUE) {
1143  BSTR ret;
1144 
1146  if(!ret)
1147  return E_OUTOFMEMORY;
1148 
1149  V_VT(res) = VT_BSTR;
1150  V_BSTR(res) = ret;
1151  return S_OK;
1152  }
1153 
1155  if(FAILED(hres))
1156  return hres;
1157 
1158  V_VT(res) = VT_EMPTY;
1159  return VariantCopy(res, &entry->val);
1160  }
1161  case DISPATCH_PROPERTYPUT: {
1163 
1164  if(dp->cArgs != 1 || (dp->cNamedArgs == 1 && *dp->rgdispidNamedArgs != DISPID_PROPERTYPUT)
1165  || dp->cNamedArgs > 1) {
1166  FIXME("invalid args\n");
1167  return E_INVALIDARG;
1168  }
1169 
1170  /*
1171  * NOTE: Although we have IDispatchEx tests showing, that it's not allowed to set
1172  * function property using InvokeEx, it's possible to do that from jscript.
1173  * Native probably uses some undocumented interface in this case, but it should
1174  * be fine for us to allow IDispatchEx handle that.
1175  */
1177  if(FAILED(hres))
1178  return hres;
1179 
1180  return VariantCopy(&entry->val, dp->rgvarg);
1181  }
1182  default:
1183  FIXME("Unimplemented flags %x\n", flags);
1184  hres = E_NOTIMPL;
1185  }
1186 
1187  return hres;
1188 }
GLenum func
Definition: glext.h:6028
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
static const WCHAR objectW[]
Definition: dispex.c:33
OLECHAR * BSTR
Definition: compat.h:1934
#define E_FAIL
Definition: ddrawi.h:102
Definition: dispex.c:73
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT get_func_obj_entry(DispatchEx *This, func_info_t *func, func_obj_entry_t **ret)
Definition: dispex.c:818
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:777
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
int ret
#define V_VT(A)
Definition: oleauto.h:211
uint32_t entry
Definition: isohybrid.c:63
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613
static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei)
Definition: dispex.c:602
static HRESULT invoke_builtin_function(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, VARIANT *res, IServiceProvider *caller)
Definition: dispex.c:1030
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:751

Referenced by invoke_builtin_prop().

◆ Function_QueryInterface()

static HRESULT WINAPI Function_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 633 of file dispex.c.

634 {
636 
637  TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
638 
639  if(IsEqualGUID(&IID_IUnknown, riid)) {
640  *ppv = &This->IUnknown_iface;
641  }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
642  return *ppv ? S_OK : E_NOINTERFACE;
643  }else {
644  *ppv = NULL;
645  return E_NOINTERFACE;
646  }
647 
648  IUnknown_AddRef((IUnknown*)*ppv);
649  return S_OK;
650 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static func_disp_t * impl_from_IUnknown(IUnknown *iface)
Definition: dispex.c:628
#define S_OK
Definition: intsafe.h:59
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ Function_Release()

static ULONG WINAPI Function_Release ( IUnknown iface)
static

Definition at line 662 of file dispex.c.

663 {
666 
667  TRACE("(%p) ref=%d\n", This, ref);
668 
669  if(!ref) {
670  assert(!This->obj);
671  release_dispex(&This->dispex);
672  heap_free(This);
673  }
674 
675  return ref;
676 }
#define assert(x)
Definition: debug.h:53
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static func_disp_t * impl_from_IUnknown(IUnknown *iface)
Definition: dispex.c:628
#define InterlockedDecrement
Definition: armddk.h:52
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ function_value()

static HRESULT function_value ( DispatchEx dispex,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT res,
EXCEPINFO *  ei,
IServiceProvider caller 
)
static

Definition at line 689 of file dispex.c.

691 {
693  HRESULT hres;
694 
695  switch(flags) {
697  if(!res)
698  return E_INVALIDARG;
699  /* fall through */
700  case DISPATCH_METHOD:
701  if(!This->obj)
702  return E_UNEXPECTED;
703  hres = typeinfo_invoke(This->obj, This->info, flags, params, res, ei);
704  break;
705  case DISPATCH_PROPERTYGET: {
706  unsigned name_len;
707  WCHAR *ptr;
708  BSTR str;
709 
710  static const WCHAR func_prefixW[] =
711  {'\n','f','u','n','c','t','i','o','n',' '};
712  static const WCHAR func_suffixW[] =
713  {'(',')',' ','{','\n',' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n','}','\n'};
714 
715  /* FIXME: This probably should be more generic. Also we should try to get IID_IActiveScriptSite and SID_GetCaller. */
716  if(!caller)
717  return E_ACCESSDENIED;
718 
719  name_len = SysStringLen(This->info->name);
720  ptr = str = SysAllocStringLen(NULL, name_len + (sizeof(func_prefixW)+sizeof(func_suffixW))/sizeof(WCHAR));
721  if(!str)
722  return E_OUTOFMEMORY;
723 
724  memcpy(ptr, func_prefixW, sizeof(func_prefixW));
725  ptr += sizeof(func_prefixW)/sizeof(WCHAR);
726 
727  memcpy(ptr, This->info->name, name_len*sizeof(WCHAR));
728  ptr += name_len;
729 
730  memcpy(ptr, func_suffixW, sizeof(func_suffixW));
731 
732  V_VT(res) = VT_BSTR;
733  V_BSTR(res) = str;
734  return S_OK;
735  }
736  default:
737  FIXME("Unimplemented flags %x\n", flags);
738  hres = E_NOTIMPL;
739  }
740 
741  return hres;
742 }
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
static func_disp_t * impl_from_DispatchEx(DispatchEx *iface)
Definition: dispex.c:684
OLECHAR * BSTR
Definition: compat.h:1934
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum const GLfloat * params
Definition: glext.h:5645
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
#define V_VT(A)
Definition: oleauto.h:211
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:199
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_UNEXPECTED
Definition: winerror.h:2456
GLuint res
Definition: glext.h:9613
static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei)
Definition: dispex.c:602

◆ get_builtin_func()

static HRESULT get_builtin_func ( dispex_data_t data,
DISPID  id,
func_info_t **  ret 
)
static

Definition at line 848 of file dispex.c.

849 {
850  int min, max, n;
851 
852  min = 0;
853  max = data->func_cnt-1;
854 
855  while(min <= max) {
856  n = (min+max)/2;
857 
858  if(data->funcs[n].id == id) {
859  *ret = data->funcs+n;
860  return S_OK;
861  }
862 
863  if(data->funcs[n].id < id)
864  min = n+1;
865  else
866  max = n-1;
867  }
868 
869  WARN("invalid id %x\n", id);
870  return DISP_E_UNKNOWNNAME;
871 }
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
#define max(a, b)
Definition: svc.c:63
#define WARN(fmt,...)
Definition: debug.h:111
GLdouble n
Definition: glext.h:7729
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55

Referenced by DispatchEx_GetMemberName(), DispatchEx_GetNextDispID(), invoke_builtin_prop(), and remove_attribute().

◆ get_builtin_id()

static HRESULT get_builtin_id ( DispatchEx This,
BSTR  name,
DWORD  grfdex,
DISPID ret 
)
static

Definition at line 873 of file dispex.c.

874 {
876  int min, max, n, c;
877 
879  if(!data)
880  return E_FAIL;
881 
882  min = 0;
883  max = data->func_cnt-1;
884 
885  while(min <= max) {
886  n = (min+max)/2;
887 
888  c = strcmpiW(data->name_table[n]->name, name);
889  if(!c) {
890  if((grfdex & fdexNameCaseSensitive) && strcmpW(data->name_table[n]->name, name))
891  break;
892 
893  *ret = data->name_table[n]->id;
894  return S_OK;
895  }
896 
897  if(c > 0)
898  max = n-1;
899  else
900  min = n+1;
901  }
902 
903  if(This->data->vtbl && This->data->vtbl->get_dispid) {
904  HRESULT hres;
905 
906  hres = This->data->vtbl->get_dispid(This, name, grfdex, ret);
907  if(hres != DISP_E_UNKNOWNNAME)
908  return hres;
909  }
910 
911  return DISP_E_UNKNOWNNAME;
912 }
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
#define max(a, b)
Definition: svc.c:63
GLdouble n
Definition: glext.h:7729
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GLubyte * c
Definition: glext.h:8905
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define S_OK
Definition: intsafe.h:59
static dispex_data_t * get_dispex_data(DispatchEx *This)
Definition: dispex.c:439
#define min(a, b)
Definition: monoChain.cc:55
Definition: name.c:36
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
#define c
Definition: ke_i.h:80

Referenced by DispatchEx_GetDispID().

◆ get_dispex_data()

static dispex_data_t* get_dispex_data ( DispatchEx This)
static

Definition at line 439 of file dispex.c.

440 {
441  if(This->data->data)
442  return This->data->data;
443 
445 
446  if(!This->data->data)
447  This->data->data = preprocess_dispex_data(This);
448 
450 
451  return This->data->data;
452 }
static dispex_data_t * preprocess_dispex_data(DispatchEx *This)
Definition: dispex.c:313
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION cs_dispex_static_data
Definition: dispex.c:23

Referenced by DispatchEx_GetMemberName(), DispatchEx_GetNextDispID(), get_builtin_id(), invoke_builtin_prop(), and remove_attribute().

◆ get_dispid_type()

dispex_prop_type_t get_dispid_type ( DISPID  id)

Definition at line 464 of file dispex.c.

465 {
466  if(is_dynamic_dispid(id))
467  return DISPEXPROP_DYNAMIC;
468  if(is_custom_dispid(id))
469  return DISPEXPROP_CUSTOM;
470  return DISPEXPROP_BUILTIN;
471 }
static BOOL is_custom_dispid(DISPID id)
Definition: dispex.c:454
static BOOL is_dynamic_dispid(DISPID id)
Definition: dispex.c:459

Referenced by DispatchEx_InvokeEx(), HTMLDOMAttribute2_get_expando(), HTMLDOMAttribute_get_specified(), and remove_attribute().

◆ get_dispids()

HRESULT get_dispids ( tid_t  tid,
DWORD ret_size,
DISPID **  ret 
)

Definition at line 389 of file dispex.c.

390 {
391  unsigned i, func_cnt;
392  FUNCDESC *funcdesc;
393  ITypeInfo *ti;
394  TYPEATTR *attr;
395  DISPID *ids;
396  HRESULT hres;
397 
398  hres = get_typeinfo(tid, &ti);
399  if(FAILED(hres))
400  return hres;
401 
402  hres = ITypeInfo_GetTypeAttr(ti, &attr);
403  if(FAILED(hres)) {
404  ITypeInfo_Release(ti);
405  return hres;
406  }
407 
408  func_cnt = attr->cFuncs;
409  ITypeInfo_ReleaseTypeAttr(ti, attr);
410 
411  ids = heap_alloc(func_cnt*sizeof(DISPID));
412  if(!ids) {
413  ITypeInfo_Release(ti);
414  return E_OUTOFMEMORY;
415  }
416 
417  for(i=0; i < func_cnt; i++) {
418  hres = ITypeInfo_GetFuncDesc(ti, i, &funcdesc);
419  if(FAILED(hres))
420  break;
421 
422  ids[i] = funcdesc->memid;
423  ITypeInfo_ReleaseFuncDesc(ti, funcdesc);
424  }
425 
426  ITypeInfo_Release(ti);
427  if(FAILED(hres)) {
428  heap_free(ids);
429  return hres;
430  }
431 
432  qsort(ids, func_cnt, sizeof(DISPID), id_cmp);
433 
434  *ret_size = func_cnt;
435  *ret = ids;
436  return S_OK;
437 }
static int id_cmp(const void *p1, const void *p2)
Definition: dispex.c:384
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLuint * ids
Definition: glext.h:5907
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
Definition: cookie.c:170
int ret
__u8 attr
Definition: mkdosfs.c:359
#define S_OK
Definition: intsafe.h:59
static VARIANTARG static DISPID
Definition: ordinal.c:49
static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
Definition: dispex.c:118
static TfClientId tid
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by is_cp_event().

◆ get_dynamic_data()

static dispex_dynamic_data_t* get_dynamic_data ( DispatchEx This)
inlinestatic

Definition at line 484 of file dispex.c.

485 {
486  if(This->dynamic_data)
487  return This->dynamic_data;
488 
489  This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t));
490  if(!This->dynamic_data)
491  return NULL;
492 
493  if(This->data->vtbl && This->data->vtbl->populate_props)
494  This->data->vtbl->populate_props(This);
495 
496  return This->dynamic_data;
497 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by DispatchEx_GetMemberName(), DispatchEx_GetNextDispID(), DispatchEx_InvokeEx(), get_dynamic_prop(), and get_func_obj_entry().

◆ get_dynamic_prop()

static HRESULT get_dynamic_prop ( DispatchEx This,
const WCHAR name,
DWORD  flags,
dynamic_prop_t **  ret 
)
static

Definition at line 499 of file dispex.c.

500 {
501  const BOOL alloc = flags & fdexNameEnsure;
503  dynamic_prop_t *prop;
504 
506  if(!data)
507  return E_OUTOFMEMORY;
508 
509  for(prop = data->props; prop < data->props+data->prop_cnt; prop++) {
510  if(flags & fdexNameCaseInsensitive ? !strcmpiW(prop->name, name) : !strcmpW(prop->name, name)) {
511  if(prop->flags & DYNPROP_DELETED) {
512  if(!alloc)
513  return DISP_E_UNKNOWNNAME;
514  prop->flags &= ~DYNPROP_DELETED;
515  }
516  *ret = prop;
517  return S_OK;
518  }
519  }
520 
521  if(!alloc)
522  return DISP_E_UNKNOWNNAME;
523 
524  TRACE("creating dynamic prop %s\n", debugstr_w(name));
525 
526  if(!data->buf_size) {
527  data->props = heap_alloc(sizeof(dynamic_prop_t)*4);
528  if(!data->props)
529  return E_OUTOFMEMORY;
530  data->buf_size = 4;
531  }else if(data->buf_size == data->prop_cnt) {
532  dynamic_prop_t *new_props;
533 
534  new_props = heap_realloc(data->props, sizeof(dynamic_prop_t)*(data->buf_size<<1));
535  if(!new_props)
536  return E_OUTOFMEMORY;
537 
538  data->props = new_props;
539  data->buf_size <<= 1;
540  }
541 
542  prop = data->props + data->prop_cnt;
543 
544  prop->name = heap_strdupW(name);
545  if(!prop->name)
546  return E_OUTOFMEMORY;
547 
548  VariantInit(&prop->var);
549  prop->flags = 0;
550  data->prop_cnt++;
551  *ret = prop;
552  return S_OK;
553 }
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
#define debugstr_w
Definition: kernel32.h:32
DWORD flags
Definition: dispex.c:60
#define TRACE(s)
Definition: solgame.cpp:4
static dispex_dynamic_data_t * get_dynamic_data(DispatchEx *This)
Definition: dispex.c:484
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
int ret
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define S_OK
Definition: intsafe.h:59
VARIANT var
Definition: dispex.c:58
#define alloc
Definition: rosglue.h:13
Definition: name.c:36
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
static const WCHAR props[]
Definition: wbemdisp.c:288
LPWSTR name
Definition: dispex.c:59
#define DYNPROP_DELETED
Definition: dispex.c:63

Referenced by DispatchEx_GetDispID(), dispex_get_dprop_ref(), and dispex_get_dynid().

◆ get_func_obj_entry()

static HRESULT get_func_obj_entry ( DispatchEx This,
func_info_t func,
func_obj_entry_t **  ret 
)
static

Definition at line 818 of file dispex.c.

819 {
820  dispex_dynamic_data_t *dynamic_data;
822 
823  dynamic_data = get_dynamic_data(This);
824  if(!dynamic_data)
825  return E_OUTOFMEMORY;
826 
827  if(!dynamic_data->func_disps) {
828  dynamic_data->func_disps = heap_alloc_zero(This->data->data->func_disp_cnt * sizeof(*dynamic_data->func_disps));
829  if(!dynamic_data->func_disps)
830  return E_OUTOFMEMORY;
831  }
832 
833  entry = dynamic_data->func_disps + func->func_disp_idx;
834  if(!entry->func_obj) {
835  entry->func_obj = create_func_disp(This, func);
836  if(!entry->func_obj)
837  return E_OUTOFMEMORY;
838 
839  IDispatchEx_AddRef(&entry->func_obj->dispex.IDispatchEx_iface);
840  V_VT(&entry->val) = VT_DISPATCH;
841  V_DISPATCH(&entry->val) = (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface;
842  }
843 
844  *ret = entry;
845  return S_OK;
846 }
GLenum func
Definition: glext.h:6028
Definition: dispex.c:73
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static dispex_dynamic_data_t * get_dynamic_data(DispatchEx *This)
Definition: dispex.c:484
int ret
#define V_VT(A)
Definition: oleauto.h:211
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
static func_disp_t * create_func_disp(DispatchEx *obj, func_info_t *info)
Definition: dispex.c:760
func_obj_entry_t * func_disps
Definition: dispex.c:82

Referenced by function_invoke().

◆ get_htmldoc_classinfo()

HRESULT get_htmldoc_classinfo ( ITypeInfo **  typeinfo)

Definition at line 172 of file dispex.c.

173 {
174  HRESULT hres;
175 
176  if (!typelib)
177  hres = load_typelib();
178  if (!typelib)
179  return hres;
180 
181  hres = ITypeLib_GetTypeInfoOfGuid(typelib, &CLSID_HTMLDocument, typeinfo);
182  if(FAILED(hres))
183  ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
184  return hres;
185 }
static ITypeLib * typelib
Definition: dispex.c:90
static HRESULT load_typelib(void)
Definition: dispex.c:102
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by ProvideClassInfo_GetClassInfo().

◆ get_typeinfo()

static HRESULT get_typeinfo ( tid_t  tid,
ITypeInfo **  typeinfo 
)
static

Definition at line 118 of file dispex.c.

119 {
120  HRESULT hres;
121 
122  if (!typelib)
123  hres = load_typelib();
124  if (!typelib)
125  return hres;
126 
127  if(!typeinfos[tid]) {
128  ITypeInfo *ti;
129 
130  hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti);
131  if(FAILED(hres)) {
132  ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_mshtml_guid(tid_ids[tid]), hres);
133  return hres;
134  }
135 
137  ITypeInfo_Release(ti);
138  }
139 
140  *typeinfo = typeinfos[tid];
141  return S_OK;
142 }
static REFIID tid_ids[]
Definition: dispex.c:94
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
static ITypeLib * typelib
Definition: dispex.c:90
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
static ITypeInfo * typeinfos[LAST_tid]
Definition: dispex.c:91
static HRESULT load_typelib(void)
Definition: dispex.c:102
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static TfClientId tid

Referenced by DispatchEx_GetTypeInfo(), get_dispids(), preprocess_dispex_data(), and typeinfo_invoke().

◆ id_cmp()

static int id_cmp ( const void p1,
const void p2 
)
static

Definition at line 384 of file dispex.c.

385 {
386  return *(const DISPID*)p1 - *(const DISPID*)p2;
387 }
static VARIANTARG static DISPID
Definition: ordinal.c:49

Referenced by get_dispids().

◆ impl_from_DispatchEx()

static func_disp_t* impl_from_DispatchEx ( DispatchEx iface)
inlinestatic

Definition at line 684 of file dispex.c.

685 {
686  return CONTAINING_RECORD(iface, func_disp_t, dispex);
687 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by function_value().

◆ impl_from_IDispatchEx()

static DispatchEx* impl_from_IDispatchEx ( IDispatchEx *  iface)
inlinestatic

Definition at line 1320 of file dispex.c.

1321 {
1322  return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface);
1323 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by DispatchEx_AddRef(), DispatchEx_DeleteMemberByDispID(), DispatchEx_DeleteMemberByName(), DispatchEx_GetDispID(), DispatchEx_GetIDsOfNames(), DispatchEx_GetMemberName(), DispatchEx_GetMemberProperties(), DispatchEx_GetNameSpaceParent(), DispatchEx_GetNextDispID(), DispatchEx_GetTypeInfo(), DispatchEx_GetTypeInfoCount(), DispatchEx_Invoke(), DispatchEx_InvokeEx(), DispatchEx_QueryInterface(), and DispatchEx_Release().

◆ impl_from_IUnknown()

static func_disp_t* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 628 of file dispex.c.

629 {
630  return CONTAINING_RECORD(iface, func_disp_t, IUnknown_iface);
631 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by Function_AddRef(), Function_QueryInterface(), and Function_Release().

◆ init_dispex()

void init_dispex ( DispatchEx dispex,
IUnknown outer,
dispex_static_data_t data 
)

Definition at line 1737 of file dispex.c.

1738 {
1739  dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
1740  dispex->outer = outer;
1741  dispex->data = data;
1742  dispex->dynamic_data = NULL;
1743 }
smooth NULL
Definition: ftsmooth.c:416
IDispatchEx IDispatchEx_iface
dispex_static_data_t * data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:1638
dispex_dynamic_data_t * dynamic_data
IUnknown * outer

◆ invoke_builtin_function()

static HRESULT invoke_builtin_function ( DispatchEx This,
func_info_t func,
DISPPARAMS *  dp,
VARIANT res,
IServiceProvider caller 
)
static

Definition at line 1030 of file dispex.c.

1031 {
1032  VARIANT arg_buf[MAX_ARGS], *arg_ptrs[MAX_ARGS], *arg, retv, ret_ref, vhres;
1033  unsigned i, nconv = 0;
1034  IUnknown *iface;
1035  HRESULT hres;
1036 
1037  if(dp->cNamedArgs) {
1038  FIXME("Named arguments not supported\n");
1039  return E_NOTIMPL;
1040  }
1041 
1042  if(dp->cArgs != func->argc) {
1043  FIXME("Invalid argument count (expected %u, got %u)\n", func->argc, dp->cArgs);
1044  return E_INVALIDARG;
1045  }
1046 
1047  hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&iface);
1048  if(FAILED(hres))
1049  return hres;
1050 
1051  for(i=0; i < func->argc; i++) {
1052  arg = dp->rgvarg+dp->cArgs-i-1;
1053  if(func->arg_types[i] == V_VT(arg)) {
1054  arg_ptrs[i] = arg;
1055  }else {
1056  hres = change_type(arg_buf+nconv, arg, func->arg_types[i], caller);
1057  if(FAILED(hres))
1058  break;
1059  arg_ptrs[i] = arg_buf + nconv++;
1060  }
1061  }
1062 
1063  if(SUCCEEDED(hres)) {
1064  if(func->prop_vt == VT_VOID) {
1065  V_VT(&retv) = VT_EMPTY;
1066  }else {
1067  V_VT(&retv) = func->prop_vt;
1068  arg_ptrs[func->argc] = &ret_ref;
1069  V_VT(&ret_ref) = VT_BYREF|func->prop_vt;
1070 
1071  switch(func->prop_vt) {
1072 #define CASE_VT(vt,type,access) \
1073  case vt: \
1074  V_BYREF(&ret_ref) = &access(&retv); \
1075  break
1077 #undef CASE_VT
1078  default:
1079  assert(0);
1080  }
1081  }
1082 
1083  V_VT(&vhres) = VT_ERROR;
1084  hres = DispCallFunc(iface, func->call_vtbl_off*sizeof(void*), CC_STDCALL, VT_ERROR,
1085  func->argc + (func->prop_vt == VT_VOID ? 0 : 1), func->arg_types, arg_ptrs, &vhres);
1086  }
1087 
1088  while(nconv--)
1089  VariantClear(arg_buf+nconv);
1090  IUnknown_Release(iface);
1091  if(FAILED(hres))
1092  return hres;
1093  if(FAILED(V_ERROR(&vhres)))
1094  return V_ERROR(&vhres);
1095 
1096  if(res)
1097  *res = retv;
1098  else
1099  VariantClear(&retv);
1100  return V_ERROR(&vhres);
1101 }
GLenum func
Definition: glext.h:6028
#define BUILTIN_TYPES_SWITCH
Definition: dispex.c:196
static REFIID tid_ids[]
Definition: dispex.c:94
#define assert(x)
Definition: debug.h:53
void * arg
Definition: msvc.h:12
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MAX_ARGS
Definition: dispex.c:21
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT change_type(VARIANT *dst, VARIANT *src, VARTYPE vt, IServiceProvider *caller)
Definition: dispex.c:914
#define E_NOTIMPL
Definition: ddrawi.h:99
#define V_ERROR(A)
Definition: oleauto.h:241
GLuint res
Definition: glext.h:9613
HRESULT WINAPI DispCallFunc(void *pvInstance, ULONG_PTR oVft, CALLCONV cc, VARTYPE vtReturn, UINT cActuals, VARTYPE *prgvt, VARIANTARG **prgpvarg, VARIANT *pvargResult)
Definition: typelib.c:6760
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by function_invoke().

◆ invoke_builtin_prop()

static HRESULT invoke_builtin_prop ( DispatchEx This,
DISPID  id,
LCID  lcid,
WORD  flags,
DISPPARAMS *  dp,
VARIANT res,
EXCEPINFO *  ei,
IServiceProvider caller 
)
static

Definition at line 1190 of file dispex.c.

1192 {
1194  func_info_t *func;
1195  HRESULT hres;
1196 
1198  if(!data)
1199  return E_FAIL;
1200 
1201  hres = get_builtin_func(data, id, &func);
1202  if(id == DISPID_VALUE && hres == DISP_E_UNKNOWNNAME)
1203  return dispex_value(This, lcid, flags, dp, res, ei, caller);
1204  if(FAILED(hres))
1205  return hres;
1206 
1207  if(func->func_disp_idx != -1)
1208  return function_invoke(This, func, flags, dp, res, ei, caller);
1209 
1210  switch(flags) {
1211  case DISPATCH_PROPERTYPUT:
1212  if(res)
1213  V_VT(res) = VT_EMPTY;
1214  hres = builtin_propput(This, func, dp, caller);
1215  break;
1216  case DISPATCH_PROPERTYGET:
1217  hres = builtin_propget(This, func, dp, res);
1218  break;
1219  default:
1220  if(!func->get_vtbl_off) {
1221  hres = typeinfo_invoke(This, func, flags, dp, res, ei);
1222  }else {
1223  VARIANT v;
1224 
1226  if(FAILED(hres))
1227  return hres;
1228 
1229  if(flags != (DISPATCH_PROPERTYGET|DISPATCH_METHOD) || dp->cArgs) {
1230  if(V_VT(&v) != VT_DISPATCH) {
1231  FIXME("Not a function %s flags %08x\n", debugstr_variant(&v), flags);
1232  VariantClear(&v);
1233  return E_FAIL;
1234  }
1235 
1236  hres = invoke_disp_value(This, V_DISPATCH(&v), lcid, flags, dp, res, ei, caller);
1237  IDispatch_Release(V_DISPATCH(&v));
1238  }else if(res) {
1239  *res = v;
1240  }else {
1241  VariantClear(&v);
1242  }
1243  }
1244  }
1245 
1246  return hres;
1247 }
GLenum func
Definition: glext.h:6028
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:1103
static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, IServiceProvider *caller)
Definition: dispex.c:983
#define E_FAIL
Definition: ddrawi.h:102
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:777
static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:581
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static dispex_data_t * get_dispex_data(DispatchEx *This)
Definition: dispex.c:439
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613
static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **ret)
Definition: dispex.c:848
static HRESULT builtin_propget(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, VARIANT *res)
Definition: dispex.c:943
static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei)
Definition: dispex.c:602

Referenced by DispatchEx_InvokeEx().

◆ invoke_disp_value()

static HRESULT invoke_disp_value ( DispatchEx This,
IDispatch func_disp,
LCID  lcid,
WORD  flags,
DISPPARAMS *  dp,
VARIANT res,
EXCEPINFO *  ei,
IServiceProvider caller 
)
static

Definition at line 777 of file dispex.c.

779 {
780  DISPID named_arg = DISPID_THIS;
781  DISPPARAMS new_dp = {NULL, &named_arg, 0, 1};
782  IDispatchEx *dispex;
783  HRESULT hres;
784 
785  if(dp->cNamedArgs) {
786  FIXME("named args not supported\n");
787  return E_NOTIMPL;
788  }
789 
790  new_dp.rgvarg = heap_alloc((dp->cArgs+1)*sizeof(VARIANTARG));
791  if(!new_dp.rgvarg)
792  return E_OUTOFMEMORY;
793 
794  new_dp.cArgs = dp->cArgs+1;
795  memcpy(new_dp.rgvarg+1, dp->rgvarg, dp->cArgs*sizeof(VARIANTARG));
796 
797  V_VT(new_dp.rgvarg) = VT_DISPATCH;
798  V_DISPATCH(new_dp.rgvarg) = (IDispatch*)&This->IDispatchEx_iface;
799 
800  hres = IDispatch_QueryInterface(func_disp, &IID_IDispatchEx, (void**)&dispex);
801  TRACE(">>>\n");
802  if(SUCCEEDED(hres)) {
803  hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE, lcid, flags, &new_dp, res, ei, caller);
804  IDispatchEx_Release(dispex);
805  }else {
806  ULONG err = 0;
807  hres = IDispatch_Invoke(func_disp, DISPID_VALUE, &IID_NULL, lcid, flags, &new_dp, res, ei, &err);
808  }
809  if(SUCCEEDED(hres))
810  TRACE("<<< %s\n", debugstr_variant(res));
811  else
812  WARN("<<< %08x\n", hres);
813 
814  heap_free(new_dp.rgvarg);
815  return hres;
816 }
#define WARN(fmt,...)
Definition: debug.h:111
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define err(...)
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define DISPID_THIS
Definition: olectl.h:395
#define E_NOTIMPL
Definition: ddrawi.h:99
GLuint res
Definition: glext.h:9613
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by DispatchEx_InvokeEx(), function_invoke(), and invoke_builtin_prop().

◆ is_arg_type_supported()

static BOOL is_arg_type_supported ( VARTYPE  vt)
static

Definition at line 203 of file dispex.c.

204 {
205  switch(vt) {
206 #define CASE_VT(x,a,b) case x: return TRUE
208 #undef CASE_VT
209  }
210  return FALSE;
211 }
#define BUILTIN_ARG_TYPES_SWITCH
Definition: dispex.c:188
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85

Referenced by add_func_info().

◆ is_custom_dispid()

static BOOL is_custom_dispid ( DISPID  id)
inlinestatic

Definition at line 454 of file dispex.c.

455 {
457 }
#define MSHTML_DISPID_CUSTOM_MIN
#define MSHTML_DISPID_CUSTOM_MAX

Referenced by get_dispid_type().

◆ is_dynamic_dispid()

static BOOL is_dynamic_dispid ( DISPID  id)
inlinestatic

Definition at line 459 of file dispex.c.

460 {
461  return DISPID_DYNPROP_0 <= id && id <= DISPID_DYNPROP_MAX;
462 }
#define DISPID_DYNPROP_MAX
Definition: dispex.c:86
#define DISPID_DYNPROP_0
Definition: dispex.c:85

Referenced by DispatchEx_GetMemberName(), DispatchEx_GetNextDispID(), and get_dispid_type().

◆ load_typelib()

static HRESULT load_typelib ( void  )
static

Definition at line 102 of file dispex.c.

103 {
104  HRESULT hres;
105  ITypeLib *tl;
106 
107  hres = LoadRegTypeLib(&LIBID_MSHTML, 4, 0, LOCALE_SYSTEM_DEFAULT, &tl);
108  if(FAILED(hres)) {
109  ERR("LoadRegTypeLib failed: %08x\n", hres);
110  return hres;
111  }
112 
114  ITypeLib_Release(tl);
115  return hres;
116 }
static ITypeLib * typelib
Definition: dispex.c:90
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define LOCALE_SYSTEM_DEFAULT
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT WINAPI LoadRegTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor, LCID lcid, ITypeLib **ppTLib)
Definition: typelib.c:534

Referenced by get_htmldoc_classinfo(), and get_typeinfo().

◆ preprocess_dispex_data()

static dispex_data_t* preprocess_dispex_data ( DispatchEx This)
static

Definition at line 313 of file dispex.c.

314 {
315  const tid_t *tid = This->data->iface_tids;
316  FUNCDESC *funcdesc;
318  DWORD size = 16, i;
319  ITypeInfo *ti, *dti;
320  HRESULT hres;
321 
322  TRACE("(%p)\n", This);
323 
324  if(This->data->disp_tid) {
325  hres = get_typeinfo(This->data->disp_tid, &dti);
326  if(FAILED(hres)) {
327  ERR("Could not get disp type info: %08x\n", hres);
328  return NULL;
329  }
330  }
331 
332  data = heap_alloc(sizeof(dispex_data_t));
333  if (!data) {
334  ERR("Out of memory\n");
335  return NULL;
336  }
337  data->func_cnt = 0;
338  data->func_disp_cnt = 0;
339  data->funcs = heap_alloc_zero(size*sizeof(func_info_t));
340  if (!data->funcs) {
341  heap_free (data);
342  ERR("Out of memory\n");
343  return NULL;
344  }
346 
347  while(*tid) {
348  hres = get_typeinfo(*tid, &ti);
349  if(FAILED(hres))
350  break;
351 
352  i=7;
353  while(1) {
354  hres = ITypeInfo_GetFuncDesc(ti, i++, &funcdesc);
355  if(FAILED(hres))
356  break;
357 
358  add_func_info(data, &size, *tid, funcdesc, dti);
359  ITypeInfo_ReleaseFuncDesc(ti, funcdesc);
360  }
361 
362  tid++;
363  }
364 
365  if(!data->func_cnt) {
366  heap_free(data->funcs);
367  data->name_table = NULL;
368  data->funcs = NULL;
369  return data;
370  }
371 
372 
373  data->funcs = heap_realloc(data->funcs, data->func_cnt * sizeof(func_info_t));
374  qsort(data->funcs, data->func_cnt, sizeof(func_info_t), dispid_cmp);
375 
376  data->name_table = heap_alloc(data->func_cnt * sizeof(func_info_t*));
377  for(i=0; i < data->func_cnt; i++)
378  data->name_table[i] = data->funcs+i;
379  qsort(data->name_table, data->func_cnt, sizeof(func_info_t*), func_name_cmp);
380 
381  return data;
382 }
tid_t
Definition: ieframe.h:311
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
smooth NULL
Definition: ftsmooth.c:416
static int func_name_cmp(const void *p1, const void *p2)
Definition: dispex.c:308
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void add_func_info(dispex_data_t *data, DWORD *size, tid_t tid, const FUNCDESC *desc, ITypeInfo *dti)
Definition: dispex.c:213
static int dispid_cmp(const void *p1, const void *p2)
Definition: dispex.c:303
static struct list dispex_data_list
Definition: dispex.c:92
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
Definition: dispex.c:118
static TfClientId tid
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by get_dispex_data().

◆ release_dispex()

void release_dispex ( DispatchEx This)

Definition at line 1706 of file dispex.c.

1707 {
1708  dynamic_prop_t *prop;
1709 
1710  if(!This->dynamic_data)
1711  return;
1712 
1713  for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) {
1714  VariantClear(&prop->var);
1715  heap_free(prop->name);
1716  }
1717 
1718  heap_free(This->dynamic_data->props);
1719 
1720  if(This->dynamic_data->func_disps) {
1721  func_obj_entry_t *iter;
1722 
1723  for(iter = This->dynamic_data->func_disps; iter < This->dynamic_data->func_disps+This->data->data->func_disp_cnt; iter++) {
1724  if(iter->func_obj) {
1725  iter->func_obj->obj = NULL;
1726  IDispatchEx_Release(&iter->func_obj->dispex.IDispatchEx_iface);
1727  }
1728  VariantClear(&iter->val);
1729  }
1730 
1731  heap_free(This->dynamic_data->func_disps);
1732  }
1733 
1734  heap_free(This->dynamic_data);
1735 }
VARIANT val
Definition: dispex.c:75
Definition: dispex.c:73
smooth NULL
Definition: ftsmooth.c:416
IDispatchEx IDispatchEx_iface
func_disp_t * func_obj
Definition: dispex.c:74
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
VARIANT var
Definition: dispex.c:58
LPWSTR name
Definition: dispex.c:59
DispatchEx dispex
Definition: dispex.c:66
DispatchEx * obj
Definition: dispex.c:69
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by CustomDoc_Release(), Function_Release(), HTMLCurrentStyle_Release(), HTMLDOMAttribute_Release(), HTMLDOMImplementation_Release(), HTMLDOMNode_delete_cycle_collectable(), HTMLElementCollection_Release(), HTMLEventObj_Release(), HTMLLocation_Release(), HTMLMimeTypesCollection_Release(), HTMLOptionElementFactory_Release(), HTMLPluginsCollection_Release(), HTMLScreen_Release(), HTMLSelectionObject_Release(), HTMLStorage_Release(), HTMLStyle_Release(), HTMLStyleSheet_Release(), HTMLStyleSheetRulesCollection_Release(), HTMLStyleSheetsCollection_Release(), HTMLTxtRange_Release(), HTMLXMLHttpRequest_Release(), HTMLXMLHttpRequestFactory_Release(), OmHistory_Release(), OmNavigator_Release(), and release_inner_window().

◆ release_typelib()

void release_typelib ( void  )

Definition at line 144 of file dispex.c.

145 {
146  dispex_data_t *iter;
147  unsigned i;
148 
149  while(!list_empty(&dispex_data_list)) {
151  list_remove(&iter->entry);
152 
153  for(i=0; i < iter->func_cnt; i++)
154  SysFreeString(iter->funcs[i].name);
155 
156  heap_free(iter->funcs);
157  heap_free(iter->name_table);
158  heap_free(iter);
159  }
160 
161  if(!typelib)
162  return;
163 
164  for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
165  if(typeinfos[i])
166  ITypeInfo_Release(typeinfos[i]);
167 
168  ITypeLib_Release(typelib);
170 }
func_info_t ** name_table
Definition: dispex.c:51
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static ITypeLib * typelib
Definition: dispex.c:90
DWORD func_cnt
Definition: dispex.c:49
static ITypeInfo * typeinfos[LAST_tid]
Definition: dispex.c:91
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
BSTR name
Definition: dispex.c:37
func_info_t * funcs
Definition: dispex.c:50
uint32_t entry
Definition: isohybrid.c:63
static struct list dispex_data_list
Definition: dispex.c:92
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
struct list entry
Definition: dispex.c:54
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
#define LIST_ENTRY(type)
Definition: queue.h:175
static CRITICAL_SECTION cs_dispex_static_data
Definition: dispex.c:23
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ remove_attribute()

HRESULT remove_attribute ( DispatchEx This,
DISPID  id,
VARIANT_BOOL success 
)

Definition at line 1249 of file dispex.c.

1250 {
1251  switch(get_dispid_type(id)) {
1252  case DISPEXPROP_CUSTOM:
1253  FIXME("DISPEXPROP_CUSTOM not supported\n");
1254  return E_NOTIMPL;
1255 
1256  case DISPEXPROP_DYNAMIC: {
1257  DWORD idx = id - DISPID_DYNPROP_0;
1258  dynamic_prop_t *prop;
1259 
1260  prop = This->dynamic_data->props+idx;
1261  VariantClear(&prop->var);
1262  prop->flags |= DYNPROP_DELETED;
1263  *success = VARIANT_TRUE;
1264  return S_OK;
1265  }
1266  case DISPEXPROP_BUILTIN: {
1267  VARIANT var;
1268  DISPPARAMS dp = {&var,NULL,1,0};
1270  func_info_t *func;
1271  HRESULT hres;
1272 
1274  if(!data)
1275  return E_FAIL;
1276 
1277  hres = get_builtin_func(data, id, &func);
1278  if(FAILED(hres))
1279  return hres;
1280 
1281  /* For builtin functions, we set their value to the original function. */
1282  if(func->func_disp_idx != -1) {
1284 
1285  if(!This->dynamic_data || !This->dynamic_data->func_disps
1286  || !This->dynamic_data->func_disps[func->func_disp_idx].func_obj) {
1287  *success = VARIANT_FALSE;
1288  return S_OK;
1289  }
1290 
1291  entry = This->dynamic_data->func_disps + func->func_disp_idx;
1292  if(V_VT(&entry->val) == VT_DISPATCH
1293  && V_DISPATCH(&entry->val) == (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface) {
1294  *success = VARIANT_FALSE;
1295  return S_OK;
1296  }
1297 
1298  VariantClear(&entry->val);
1299  V_VT(&entry->val) = VT_DISPATCH;
1300  V_DISPATCH(&entry->val) = (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface;
1301  IDispatch_AddRef(V_DISPATCH(&entry->val));
1302  *success = VARIANT_TRUE;
1303  return S_OK;
1304  }
1305 
1306  V_VT(&var) = VT_EMPTY;
1307  hres = builtin_propput(This, func, &dp, NULL);
1308  if(FAILED(hres))
1309  return hres;
1310 
1311  *success = VARIANT_TRUE;
1312  return S_OK;
1313  }
1314  default:
1315  assert(0);
1316  return E_FAIL;
1317  }
1318 }
GLenum func
Definition: glext.h:6028
static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, IServiceProvider *caller)
Definition: dispex.c:983
#define assert(x)
Definition: debug.h:53
#define E_FAIL
Definition: ddrawi.h:102
Definition: dispex.c:73
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define DISPID_DYNPROP_0
Definition: dispex.c:85
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
DWORD flags
Definition: dispex.c:60
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define success(from, fromstr, to, tostr)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
uint32_t entry
Definition: isohybrid.c:63
dispex_prop_type_t get_dispid_type(DISPID id)
Definition: dispex.c:464
#define S_OK
Definition: intsafe.h:59
static dispex_data_t * get_dispex_data(DispatchEx *This)
Definition: dispex.c:439
VARIANT var
Definition: dispex.c:58
#define E_NOTIMPL
Definition: ddrawi.h:99
struct stdole::DISPPARAMS DISPPARAMS
static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **ret)
Definition: dispex.c:848
#define DYNPROP_DELETED
Definition: dispex.c:63

Referenced by HTMLElement_removeAttribute(), and HTMLStyle_removeAttribute().

◆ typeinfo_invoke()

static HRESULT typeinfo_invoke ( DispatchEx This,
func_info_t func,
WORD  flags,
DISPPARAMS *  dp,
VARIANT res,
EXCEPINFO *  ei 
)
static

Definition at line 602 of file dispex.c.

604 {
605  ITypeInfo *ti;
606  IUnknown *unk;
607  UINT argerr=0;
608  HRESULT hres;
609 
610  hres = get_typeinfo(func->tid, &ti);
611  if(FAILED(hres)) {
612  ERR("Could not get type info: %08x\n", hres);
613  return hres;
614  }
615 
616  hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&unk);
617  if(FAILED(hres)) {
618  ERR("Could not get iface %s: %08x\n", debugstr_mshtml_guid(tid_ids[func->tid]), hres);
619  return E_FAIL;
620  }
621 
622  hres = ITypeInfo_Invoke(ti, unk, func->id, flags, dp, res, ei, &argerr);
623 
624  IUnknown_Release(unk);
625  return hres;
626 }
GLenum func
Definition: glext.h:6028
static REFIID tid_ids[]
Definition: dispex.c:94
#define E_FAIL
Definition: ddrawi.h:102
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613
static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
Definition: dispex.c:118

Referenced by function_invoke(), function_value(), and invoke_builtin_prop().

◆ variant_copy()

static HRESULT variant_copy ( VARIANT dest,
VARIANT src 
)
static

Definition at line 473 of file dispex.c.

474 {
475  if(V_VT(src) == VT_BSTR && !V_BSTR(src)) {
476  V_VT(dest) = VT_BSTR;
477  V_BSTR(dest) = NULL;
478  return S_OK;
479  }
480 
481  return VariantCopy(dest, src);
482 }
smooth NULL
Definition: ftsmooth.c:416
#define V_VT(A)
Definition: oleauto.h:211
GLenum src
Definition: glext.h:6340
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
static char * dest
Definition: rtl.c:135
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:751

Referenced by DispatchEx_InvokeEx().

Variable Documentation

◆ cs_dispex_static_data

static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 }
static

Definition at line 23 of file dispex.c.

Referenced by get_dispex_data(), and release_typelib().

◆ cs_dispex_static_data_dbg

CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": dispex_static_data") }
}
#define DWORD_PTR
Definition: treelist.c:76
static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg
Definition: dispex.c:24
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
static CRITICAL_SECTION cs_dispex_static_data
Definition: dispex.c:23

Definition at line 24 of file dispex.c.

◆ DispatchExVtbl

IDispatchExVtbl DispatchExVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: dispex.c:1521
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: dispex.c:1356
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: dispex.c:1346
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: dispex.c:1405
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: dispex.c:1511
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: dispex.c:1631
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: dispex.c:1538
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: dispex.c:1392
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: dispex.c:1339
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: dispex.c:1531
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: dispex.c:1325
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: dispex.c:1428
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: dispex.c:1372
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: dispex.c:1332
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: dispex.c:1574

Definition at line 1638 of file dispex.c.

Referenced by init_dispex().

◆ dispex_data_list

struct list dispex_data_list = LIST_INIT(dispex_data_list)
static

Definition at line 92 of file dispex.c.

Referenced by preprocess_dispex_data(), and release_typelib().

◆ function_dispex

dispex_static_data_t function_dispex
static
Initial value:
= {
}
smooth NULL
Definition: ftsmooth.c:416
static const tid_t function_iface_tids[]
Definition: dispex.c:751
static const dispex_static_data_vtbl_t function_dispex_vtbl
Definition: dispex.c:744

Definition at line 753 of file dispex.c.

Referenced by create_func_disp().

◆ function_dispex_vtbl

const dispex_static_data_vtbl_t function_dispex_vtbl
static
Initial value:
= {
}
static HRESULT function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: dispex.c:689
smooth NULL
Definition: ftsmooth.c:416

Definition at line 744 of file dispex.c.

◆ function_iface_tids

const tid_t function_iface_tids[] = {0}
static

Definition at line 751 of file dispex.c.

◆ FunctionUnkVtbl

const IUnknownVtbl FunctionUnkVtbl
static
Initial value:
= {
}
static HRESULT WINAPI Function_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: dispex.c:633
static ULONG WINAPI Function_AddRef(IUnknown *iface)
Definition: dispex.c:652
static ULONG WINAPI Function_Release(IUnknown *iface)
Definition: dispex.c:662

Definition at line 678 of file dispex.c.

Referenced by create_func_disp().

◆ objectW

const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0}
static

Definition at line 33 of file dispex.c.

Referenced by dispex_value(), and function_invoke().

◆ tid_ids

REFIID tid_ids[]
static
Initial value:
= {
#define XIID(iface)
#define XDIID(iface)
}
#define TID_LIST
Definition: ieframe.h:306

Definition at line 94 of file dispex.c.

Referenced by builtin_propget(), builtin_propput(), get_typeinfo(), invoke_builtin_function(), and typeinfo_invoke().

◆ typeinfos

ITypeInfo* typeinfos[LAST_tid]
static

Definition at line 91 of file dispex.c.

Referenced by get_typeinfo(), and release_typelib().

◆ typelib

ITypeLib* typelib
static

Definition at line 90 of file dispex.c.

Referenced by get_htmldoc_classinfo(), get_typeinfo(), load_typelib(), and release_typelib().