27 #define FDEX_VERSION_MASK 0xf0000000 28 #define GOLDEN_RATIO 0x9E3779B9U 62 return prop -
This->props;
92 max =
This->builtin_info->props_cnt-1;
108 return This->builtin_info->props +
i;
138 if(
This->buf_size !=
This->prop_cnt)
147 for(
i=0;
i<
This->buf_size;
i++) {
148 This->props[
i].bucket_head = 0;
149 This->props[
i].bucket_next = 0;
152 for(
i=1;
i<
This->prop_cnt;
i++) {
156 props->bucket_next =
This->props[bucket].bucket_head;
157 This->props[bucket].bucket_head =
i;
171 prop = &
This->props[
This->prop_cnt];
181 This->props[bucket].bucket_head =
This->prop_cnt++;
200 unsigned bucket,
pos, prev = 0;
204 pos =
This->props[bucket].bucket_head;
208 This->props[prev].bucket_next =
This->props[
pos].bucket_next;
209 This->props[
pos].bucket_next =
This->props[bucket].bucket_head;
210 This->props[bucket].bucket_head =
pos;
238 if(
This->builtin_info->idx_length) {
244 if(!*
ptr && idx < This->builtin_info->idx_length(
This)) {
274 if(
This->prototype) {
281 del->u.ref = prop -
This->prototype->props;
328 for(
i=0;
i < dp->cNamedArgs;
i++) {
333 WARN(
"This is not VT_DISPATCH\n");
338 TRACE(
"no this passed\n");
349 cnt = dp->cArgs - dp->cNamedArgs;
359 for(
i = 0;
i < cnt;
i++) {
421 FIXME(
"Invoking PROP_IDX not yet supported\n");
499 prototype_iter = prototype_iter->
prototype;
500 prop_iter = prototype_iter->
props + prop_iter->
u.
ref;
510 TRACE(
"getter with no setter\n");
528 TRACE(
"no setter\n");
533 if(!
This->builtin_info->idx_put) {
534 TRACE(
"no put_idx\n");
549 if(
This->builtin_info->on_put)
571 for(iter =
This->prototype->props; iter < This->prototype->props+
This->prototype->prop_cnt; iter++) {
581 prop->
u.
ref = iter -
This->prototype->props;
604 *
ppv = &
This->IDispatchEx_iface;
607 *
ppv = &
This->IDispatchEx_iface;
610 *
ppv = &
This->IDispatchEx_iface;
652 FIXME(
"(%p)->(%u %u %p)\n",
This, iTInfo, lcid, ppTInfo);
667 for(
i=0;
i < cNames;
i++) {
668 hres = IDispatchEx_GetDispID(&
This->IDispatchEx_iface, rgszNames[
i], 0, rgDispId+
i);
683 lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
685 return IDispatchEx_InvokeEx(&
This->IDispatchEx_iface, dispIdMember, lcid,
wFlags,
686 pDispParams, pVarResult, pExcepInfo,
NULL);
695 if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit|
FDEX_VERSION_MASK)) {
696 FIXME(
"Unsupported grfdex %x\n", grfdex);
710 TRACE(
"(%p)->(%x %x %x %p %p %p %p)\n",
This,
id, lcid,
wFlags, pdp, pvarRes, pei, pspCaller);
717 TRACE(
"invalid id\n");
728 case DISPATCH_CONSTRUCT: {
759 for(
i=0;
i < pdp->cNamedArgs;
i++) {
760 if(pdp->rgdispidNamedArgs[
i] == DISPID_PROPERTYPUT)
764 if(
i == pdp->cNamedArgs) {
765 TRACE(
"no value to set\n");
783 *pei =
This->ctx->ei.ei;
801 FIXME(
"not supported on accessor property\n");
814 if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit|
FDEX_VERSION_MASK))
815 FIXME(
"Unsupported grfdex %x\n", grfdex);
821 TRACE(
"not found\n");
838 WARN(
"invalid id\n");
848 FIXME(
"(%p)->(%x %x %p)\n",
This,
id, grfdexFetch, pgrfdex);
857 TRACE(
"(%p)->(%x %p)\n",
This,
id, pbstrName);
879 *
pid = DISPID_STARTENUM;
921 TRACE(
"%p (%p)\n", dispex, prototype);
982 for(prop =
obj->props; prop < obj->
props+
obj->prop_cnt; prop++) {
1003 if(
obj->builtin_info->destructor)
1004 obj->builtin_info->destructor(
obj);
1014 TRACE(
"(%p) ref=%d\n", jsdisp,
ref);
1022 TRACE(
"(%p) ref=%d\n", jsdisp,
ref);
1036 static const WCHAR prototypeW[] = {
'p',
'r',
'o',
't',
'o',
't',
'y',
'p',
'e',0};
1044 ERR(
"Could not get prototype\n");
1072 if(
flags & fdexNameEnsure)
1101 WARN(
"Not a function\n");
1138 IDispatchEx *dispex;
1148 FIXME(
"disp_call(propput) on builtin object\n");
1172 dp.rgdispidNamedArgs =
NULL;
1188 if(dp.rgvarg !=
buf)
1196 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1199 &
ctx->jscaller->IServiceProvider_iface);
1200 IDispatchEx_Release(dispex);
1204 if(
flags == DISPATCH_CONSTRUCT) {
1205 WARN(
"IDispatch cannot be constructor\n");
1209 TRACE(
"using IDispatch\n");
1215 if(dp.rgvarg !=
buf)
1232 IDispatchEx *dispex;
1253 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1255 TRACE(
"using IDispatch\n");
1265 dp.rgdispidNamedArgs = &this_id;
1269 dp.rgdispidNamedArgs =
NULL;
1276 IDispatchEx_Release(dispex);
1288 if(dp.rgvarg !=
buf)
1291 IDispatchEx_Release(dispex);
1303 hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE,
ctx->lcid,
flags, &dp,
r ? &retv :
NULL, &
ctx->ei.ei,
1304 &
ctx->jscaller->IServiceProvider_iface);
1305 IDispatchEx_Release(dispex);
1309 if(
flags == DISPATCH_CONSTRUCT) {
1310 WARN(
"IDispatch cannot be constructor\n");
1319 if(dp.rgvarg !=
buf)
1353 static const WCHAR formatW[] = {
'%',
'd',0};
1376 DISPID dispid = DISPID_PROPERTYPUT;
1380 IDispatchEx *dispex;
1390 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1393 &
ctx->jscaller->IServiceProvider_iface);
1394 IDispatchEx_Release(dispex);
1398 TRACE(
"using IDispatch\n");
1431 static const WCHAR formatW[] = {
'%',
'd',0};
1461 IDispatchEx *dispex;
1475 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1477 hres = IDispatchEx_InvokeEx(dispex,
id,
ctx->lcid, INVOKE_PROPERTYGET, &dp, &
var, &
ctx->ei.ei,
1478 &
ctx->jscaller->IServiceProvider_iface);
1479 IDispatchEx_Release(dispex);
1483 TRACE(
"using IDispatch\n");
1496 static const WCHAR formatW[] = {
'%',
'd',0};
1513 IDispatchEx *dispex;
1531 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1537 hres = IDispatchEx_DeleteMemberByDispID(dispex,
id);
1538 IDispatchEx_Release(dispex);
1551 if(
id == DISPID_STARTENUM && !own_only) {
1557 if(
id + 1 < 0 ||
id+1 >=
obj->prop_cnt)
1560 for(iter = &
obj->props[
id + 1]; iter < obj->
props +
obj->prop_cnt; iter++) {
1576 IDispatchEx *dispex;
1609 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1611 hres = IDispatchEx_DeleteMemberByName(dispex, bstr,
make_grfdex(
ctx, fdexNameCaseSensitive));
1614 IDispatchEx_Release(dispex);
1618 hres = IDispatch_GetIDsOfNames(disp, &
IID_NULL, &bstr, 1, 0, &
id);
1648 switch(prop->
type) {
1691 if(
desc->explicit_getter ||
desc->explicit_setter) {
1699 if(
desc->explicit_value) {
1740 if(
desc->explicit_value) {
1749 FIXME(
"redefinition of property type %d\n", prop->
type);
1753 if(
desc->explicit_value) {
1765 }
else if(
desc->explicit_getter ||
desc->explicit_setter) {
1779 if(
desc->explicit_getter) {
1787 if(
desc->explicit_setter) {
#define FDEX_VERSION_MASK
#define DISP_E_UNKNOWNNAME
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
static const WCHAR * jsstr_flatten(jsstr_t *str)
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
void jsval_release(jsval_t val)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
static IDispatchExVtbl DispatchExVtbl
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static DISPID propput_dispid
#define DISPATCH_PROPERTYGET
HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
static void set_disp(vdisp_t *vdisp, IDispatch *disp)
static void vdisp_release(vdisp_t *vdisp)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
#define JS_E_FUNCTION_EXPECTED
struct _dispex_prop_t::@417::@418 accessor
static const builtin_info_t dispex_info
HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT convert_params(const DISPPARAMS *dp, jsval_t *buf, unsigned *argc, jsval_t **ret)
static IDispatch * get_object(jsval_t v)
HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_only, property_desc_t *desc)
GLdouble GLdouble GLdouble r
static HRESULT resize_props(jsdisp_t *This)
WINE_DEFAULT_DEBUG_CHANNEL(jscript)
static const builtin_prop_t * find_builtin_prop(jsdisp_t *This, const WCHAR *name)
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
const builtin_info_t * builtin_info
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
#define DISP_E_MEMBERNOTFOUND
static dispex_prop_t * alloc_prop(jsdisp_t *This, const WCHAR *name, prop_type_t type, DWORD flags)
HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
#define PROPF_VERSION_SHIFT
static IDispatch * get_this(DISPPARAMS *dp)
static unsigned jsstr_length(jsstr_t *str)
static dispex_prop_t * alloc_protref(jsdisp_t *This, const WCHAR *name, DWORD ref)
static const WCHAR prototypeW[]
static HRESULT fill_protrefs(jsdisp_t *This)
void clear_ei(script_ctx_t *ctx)
#define eq(received, expected, label, type)
static void * heap_realloc(void *mem, size_t len)
jsdisp_t * to_jsdisp(IDispatch *disp)
static void * heap_alloc(size_t len)
GLfloat GLfloat GLfloat GLfloat h
HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
GLsizei GLsizei GLuint * obj
static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
GLenum GLuint GLenum GLsizei const GLchar * buf
static unsigned string_hash(const WCHAR *name)
#define DISPATCH_JSCRIPT_INTERNAL_MASK
IDispatchEx IDispatchEx_iface
HRESULT jsval_copy(jsval_t v, jsval_t *r)
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
static const WCHAR desc[]
static WCHAR * heap_strdupW(const WCHAR *str)
static DWORD get_flags(jsdisp_t *This, dispex_prop_t *prop)
static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *ret)
union _dispex_prop_t::@417 u
HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val)
HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
#define PROPF_VERSION_MASK
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
static const WCHAR version[]
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
void script_release(script_ctx_t *ctx)
BSTR WINAPI SysAllocString(LPCOLESTR str)
#define JS_E_NONWRITABLE_MODIFIED
static BOOL is_object_instance(jsval_t v)
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
#define DISPATCH_PROPERTYPUT
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)
static DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller)
HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
static void set_jsdisp(vdisp_t *vdisp, jsdisp_t *jsdisp)
HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret)
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
GLboolean GLboolean GLboolean b
HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc)
static unsigned get_props_idx(jsdisp_t *This, unsigned hash)
HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
builtin_prop_t value_prop
HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx)
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, DWORD create_flags, dispex_prop_t **ret)
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
#define DISP_E_PARAMNOTOPTIONAL
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *id)
GLsizei const GLfloat * value
HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret)
void jsdisp_free(jsdisp_t *obj)
#define DISPATCH_PROPERTYPUTREF
static IDispatch * to_disp(jsdisp_t *jsdisp)
_In_ DWORD _Out_ _In_ WORD wFlags
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static VOID del(LPHIST_ENTRY item)
struct stdole::EXCEPINFO EXCEPINFO
static jsval_t jsval_undefined(void)
static VARIANTARG static DISPID
static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
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
HRESULT builtin_set_const(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
static dispex_prop_t * get_prop(jsdisp_t *This, DISPID id)
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
static void jsdisp_release(jsdisp_t *jsdisp)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static void script_addref(script_ctx_t *ctx)
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
static jsval_t jsval_obj(jsdisp_t *obj)
HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, jsval_t val)
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
jsdisp_t * as_jsdisp(IDispatch *disp)
static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
static const WCHAR props[]
struct stdole::DISPPARAMS DISPPARAMS
#define JS_E_NONCONFIGURABLE_REDEFINED
HRESULT(* idx_get)(jsdisp_t *, unsigned, jsval_t *)
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
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_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
GLuint GLuint GLsizei GLenum type
static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, jsval_t *r)
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
#define PROPF_CONFIGURABLE
static DISPID prop_to_id(jsdisp_t *This, dispex_prop_t *prop)
HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL *ret)
HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
static BOOL heap_free(void *mem)
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
GLuint const GLchar * name