ReactOS 0.4.15-dev-7942-gd23573b
vbdisp.c File Reference
#include <assert.h>
#include "vbscript.h"
#include "wine/debug.h"
Include dependency graph for vbdisp.c:

Go to the source code of this file.

Classes

struct  _ident_map_t
 

Macros

#define FDEX_VERSION_MASK   0xf0000000
 
#define RPC_E_SERVER_UNAVAILABLE   0x800706ba
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (vbscript)
 
static BOOL is_func_id (vbdisp_t *This, DISPID id)
 
static BOOL get_func_id (vbdisp_t *This, const WCHAR *name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id)
 
HRESULT vbdisp_get_id (vbdisp_t *This, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id)
 
static HRESULT get_propput_arg (script_ctx_t *ctx, const DISPPARAMS *dp, WORD flags, VARIANT *v, BOOL *is_owned)
 
static HRESULT invoke_variant_prop (script_ctx_t *ctx, VARIANT *v, WORD flags, DISPPARAMS *dp, VARIANT *res)
 
static HRESULT invoke_vbdisp (vbdisp_t *This, DISPID id, DWORD flags, BOOL extern_caller, DISPPARAMS *params, VARIANT *res)
 
static BOOL run_terminator (vbdisp_t *This)
 
static void clean_props (vbdisp_t *This)
 
static vbdisp_timpl_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)
 
static vbdisp_tunsafe_impl_from_IDispatch (IDispatch *iface)
 
HRESULT create_vbdisp (const class_desc_t *desc, vbdisp_t **ret)
 
static DISPID ident_to_id (ScriptDisp *This, ident_map_t *ident)
 
static ident_map_tid_to_ident (ScriptDisp *This, DISPID id)
 
static ident_map_tadd_ident (ScriptDisp *This, const WCHAR *name)
 
static ScriptDispScriptDisp_from_IDispatchEx (IDispatchEx *iface)
 
static HRESULT WINAPI ScriptDisp_QueryInterface (IDispatchEx *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ScriptDisp_AddRef (IDispatchEx *iface)
 
static ULONG WINAPI ScriptDisp_Release (IDispatchEx *iface)
 
static HRESULT WINAPI ScriptDisp_GetTypeInfoCount (IDispatchEx *iface, UINT *pctinfo)
 
static HRESULT WINAPI ScriptDisp_GetTypeInfo (IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI ScriptDisp_GetIDsOfNames (IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI ScriptDisp_Invoke (IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI ScriptDisp_GetDispID (IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
 
static HRESULT WINAPI ScriptDisp_InvokeEx (IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
 
static HRESULT WINAPI ScriptDisp_DeleteMemberByName (IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
 
static HRESULT WINAPI ScriptDisp_DeleteMemberByDispID (IDispatchEx *iface, DISPID id)
 
static HRESULT WINAPI ScriptDisp_GetMemberProperties (IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
 
static HRESULT WINAPI ScriptDisp_GetMemberName (IDispatchEx *iface, DISPID id, BSTR *pbstrName)
 
static HRESULT WINAPI ScriptDisp_GetNextDispID (IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
 
static HRESULT WINAPI ScriptDisp_GetNameSpaceParent (IDispatchEx *iface, IUnknown **ppunk)
 
HRESULT create_script_disp (script_ctx_t *ctx, ScriptDisp **ret)
 
void collect_objects (script_ctx_t *ctx)
 
HRESULT disp_get_id (IDispatch *disp, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id)
 
HRESULT map_hres (HRESULT hres)
 
HRESULT disp_call (script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, VARIANT *retv)
 
HRESULT get_disp_value (script_ctx_t *ctx, IDispatch *disp, VARIANT *v)
 
HRESULT disp_propput (script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *dp)
 

Variables

static IDispatchExVtbl DispatchExVtbl
 
static IDispatchExVtbl ScriptDispVtbl
 

Macro Definition Documentation

◆ FDEX_VERSION_MASK

#define FDEX_VERSION_MASK   0xf0000000

Definition at line 27 of file vbdisp.c.

◆ RPC_E_SERVER_UNAVAILABLE

#define RPC_E_SERVER_UNAVAILABLE   0x800706ba

Definition at line 875 of file vbdisp.c.

Function Documentation

◆ add_ident()

static ident_map_t * add_ident ( ScriptDisp This,
const WCHAR name 
)
static

Definition at line 548 of file vbdisp.c.

549{
551
552 if(!This->ident_map_size) {
553 This->ident_map = heap_alloc(4 * sizeof(*This->ident_map));
554 if(!This->ident_map)
555 return NULL;
556 This->ident_map_size = 4;
557 }else if(This->ident_map_cnt == This->ident_map_size) {
558 ident_map_t *new_map;
559
560 new_map = heap_realloc(This->ident_map, 2*This->ident_map_size*sizeof(*new_map));
561 if(!new_map)
562 return NULL;
563 This->ident_map = new_map;
564 This->ident_map_size *= 2;
565 }
566
567 ret = This->ident_map + This->ident_map_cnt++;
568 ret->name = name;
569 return ret;
570}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define NULL
Definition: types.h:112
Definition: name.c:39
int ret

Referenced by ScriptDisp_GetDispID().

◆ clean_props()

static void clean_props ( vbdisp_t This)
static

Definition at line 253 of file vbdisp.c.

254{
255 unsigned i;
256
257 if(!This->desc)
258 return;
259
260 for(i=0; i < This->desc->array_cnt; i++) {
261 if(This->arrays[i]) {
262 SafeArrayDestroy(This->arrays[i]);
263 This->arrays[i] = NULL;
264 }
265 }
266
267 for(i=0; i < This->desc->prop_cnt; i++)
268 VariantClear(This->props+i);
269}
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
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
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648

Referenced by collect_objects(), and DispatchEx_Release().

◆ collect_objects()

void collect_objects ( script_ctx_t ctx)

Definition at line 835 of file vbdisp.c.

836{
837 vbdisp_t *iter, *iter2;
838
839 LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &ctx->objects, vbdisp_t, entry)
840 run_terminator(iter);
841
842 while(!list_empty(&ctx->objects)) {
843 iter = LIST_ENTRY(list_head(&ctx->objects), vbdisp_t, entry);
844
845 IDispatchEx_AddRef(&iter->IDispatchEx_iface);
846 clean_props(iter);
847 iter->desc = NULL;
848 list_remove(&iter->entry);
849 list_init(&iter->entry);
850 IDispatchEx_Release(&iter->IDispatchEx_iface);
851 }
852}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_init(struct list_entry *head)
Definition: list.h:51
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
IDispatchEx IDispatchEx_iface
Definition: vbscript.h:117
struct list entry
Definition: vbscript.h:121
const class_desc_t * desc
Definition: vbscript.h:123
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175
static void clean_props(vbdisp_t *This)
Definition: vbdisp.c:253
static BOOL run_terminator(vbdisp_t *This)
Definition: vbdisp.c:236

◆ create_script_disp()

HRESULT create_script_disp ( script_ctx_t ctx,
ScriptDisp **  ret 
)

Definition at line 819 of file vbdisp.c.

820{
822
823 script_disp = heap_alloc_zero(sizeof(*script_disp));
824 if(!script_disp)
825 return E_OUTOFMEMORY;
826
827 script_disp->IDispatchEx_iface.lpVtbl = &ScriptDispVtbl;
828 script_disp->ref = 1;
829 script_disp->ctx = ctx;
830
831 *ret = script_disp;
832 return S_OK;
833}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
static IDispatch * script_disp
Definition: run.c:178
static IDispatchExVtbl ScriptDispVtbl
Definition: vbdisp.c:801

Referenced by VBScript_SetScriptSite().

◆ create_vbdisp()

HRESULT create_vbdisp ( const class_desc_t desc,
vbdisp_t **  ret 
)

Definition at line 470 of file vbdisp.c.

471{
472 vbdisp_t *vbdisp;
473 HRESULT hres = S_OK;
474
475 vbdisp = heap_alloc_zero( FIELD_OFFSET( vbdisp_t, props[desc->prop_cnt] ));
476 if(!vbdisp)
477 return E_OUTOFMEMORY;
478
479 vbdisp->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
480 vbdisp->ref = 1;
481 vbdisp->desc = desc;
482
483 list_add_tail(&desc->ctx->objects, &vbdisp->entry);
484
485 if(desc->array_cnt) {
486 vbdisp->arrays = heap_alloc_zero(desc->array_cnt * sizeof(*vbdisp->arrays));
487 if(vbdisp->arrays) {
488 unsigned i, j;
489
490 for(i=0; i < desc->array_cnt; i++) {
491 if(!desc->array_descs[i].dim_cnt)
492 continue;
493
494 vbdisp->arrays[i] = SafeArrayCreate(VT_VARIANT, desc->array_descs[i].dim_cnt, desc->array_descs[i].bounds);
495 if(!vbdisp->arrays[i]) {
497 break;
498 }
499 }
500
501 if(SUCCEEDED(hres)) {
502 for(i=0, j=0; i < desc->prop_cnt; i++) {
503 if(desc->props[i].is_array) {
505 V_ARRAYREF(vbdisp->props+i) = vbdisp->arrays + j++;
506 }
507 }
508 }
509 }else {
511 }
512 }
513
514 if(SUCCEEDED(hres) && desc->class_initialize_id) {
515 DISPPARAMS dp = {0};
516 hres = exec_script(desc->ctx, FALSE, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET],
517 vbdisp, &dp, NULL);
518 }
519
520 if(FAILED(hres)) {
521 IDispatchEx_Release(&vbdisp->IDispatchEx_iface);
522 return hres;
523 }
524
525 *ret = vbdisp;
526 return S_OK;
527}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define FALSE
Definition: types.h:117
@ VT_BYREF
Definition: compat.h:2342
@ VT_ARRAY
Definition: compat.h:2341
@ VT_VARIANT
Definition: compat.h:2307
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
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 GLint GLint j
Definition: glfuncs.h:250
HRESULT exec_script(HTMLInnerWindow *, const WCHAR *, const WCHAR *, VARIANT *) DECLSPEC_HIDDEN
Definition: script.c:1245
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT hres
Definition: protocol.c:465
struct stdole::DISPPARAMS DISPPARAMS
#define V_ARRAYREF(A)
Definition: oleauto.h:223
#define V_VT(A)
Definition: oleauto.h:211
SAFEARRAY ** arrays
Definition: vbscript.h:124
LONG ref
Definition: vbscript.h:119
VARIANT props[1]
Definition: vbscript.h:125
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
static IDispatchExVtbl DispatchExVtbl
Definition: vbdisp.c:445
@ VBDISP_CALLGET
Definition: vbscript.h:72
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by interp_new(), and VBScriptParseProcedure_ParseProcedureText().

◆ disp_call()

HRESULT disp_call ( script_ctx_t ctx,
IDispatch disp,
DISPID  id,
DISPPARAMS *  dp,
VARIANT retv 
)

Definition at line 938 of file vbdisp.c.

939{
940 const WORD flags = DISPATCH_METHOD|(retv ? DISPATCH_PROPERTYGET : 0);
941 IDispatchEx *dispex;
942 vbdisp_t *vbdisp;
943 EXCEPINFO ei;
945
946 memset(&ei, 0, sizeof(ei));
947 if(retv)
948 V_VT(retv) = VT_EMPTY;
949
950 vbdisp = unsafe_impl_from_IDispatch(disp);
951 if(vbdisp && vbdisp->desc && vbdisp->desc->ctx == ctx)
952 return invoke_vbdisp(vbdisp, id, flags, FALSE, dp, retv);
953
954 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
955 if(FAILED(hres)) {
956 UINT err = 0;
957
958 TRACE("using IDispatch\n");
959 return IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, retv, &ei, &err);
960 }
961
962 hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, retv, &ei, NULL /* CALLER_FIXME */);
963 IDispatchEx_Release(dispex);
964 return hres;
965}
@ VT_EMPTY
Definition: compat.h:2295
unsigned short WORD
Definition: ntddk_ex.h:93
GLbitfield flags
Definition: glext.h:7161
struct stdole::EXCEPINFO EXCEPINFO
unsigned int UINT
Definition: ndis.h:50
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
#define IID_NULL
Definition: guiddef.h:98
#define err(...)
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
script_ctx_t * ctx
Definition: vbscript.h:98
static vbdisp_t * unsafe_impl_from_IDispatch(IDispatch *iface)
Definition: vbdisp.c:463
static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern_caller, DISPPARAMS *params, VARIANT *res)
Definition: vbdisp.c:164

Referenced by get_disp_value().

◆ disp_get_id()

HRESULT disp_get_id ( IDispatch disp,
BSTR  name,
vbdisp_invoke_type_t  invoke_type,
BOOL  search_private,
DISPID id 
)

Definition at line 854 of file vbdisp.c.

855{
856 IDispatchEx *dispex;
857 vbdisp_t *vbdisp;
859
860 vbdisp = unsafe_impl_from_IDispatch(disp);
861 if(vbdisp)
862 return vbdisp_get_id(vbdisp, name, invoke_type, search_private, id);
863
864 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
865 if(FAILED(hres)) {
866 TRACE("using IDispatch\n");
867 return IDispatch_GetIDsOfNames(disp, &IID_NULL, &name, 1, 0, id);
868 }
869
870 hres = IDispatchEx_GetDispID(dispex, name, fdexNameCaseInsensitive, id);
871 IDispatchEx_Release(dispex);
872 return hres;
873}
HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id)
Definition: vbdisp.c:59

◆ disp_propput()

HRESULT disp_propput ( script_ctx_t ctx,
IDispatch disp,
DISPID  id,
WORD  flags,
DISPPARAMS *  dp 
)

Definition at line 975 of file vbdisp.c.

976{
977 IDispatchEx *dispex;
978 vbdisp_t *vbdisp;
979 EXCEPINFO ei = {0};
981
982 vbdisp = unsafe_impl_from_IDispatch(disp);
983 if(vbdisp && vbdisp->desc && vbdisp->desc->ctx == ctx)
984 return invoke_vbdisp(vbdisp, id, flags, FALSE, dp, NULL);
985
986 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
987 if(SUCCEEDED(hres)) {
988 hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, NULL, &ei, NULL /* FIXME! */);
989 IDispatchEx_Release(dispex);
990 }else {
991 ULONG err = 0;
992
993 TRACE("using IDispatch\n");
994 hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, NULL, &ei, &err);
995 }
996
997 return hres;
998}
uint32_t ULONG
Definition: typedefs.h:59

◆ DispatchEx_AddRef()

static ULONG WINAPI DispatchEx_AddRef ( IDispatchEx iface)
static

Definition at line 299 of file vbdisp.c.

300{
303
304 TRACE("(%p) ref=%d\n", This, ref);
305
306 return ref;
307}
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60
Definition: send.c:48
static vbdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: vbdisp.c:271

◆ DispatchEx_DeleteMemberByDispID()

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

Definition at line 410 of file vbdisp.c.

411{
413 FIXME("(%p)->(%x)\n", This, id);
414 return E_NOTIMPL;
415}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_DeleteMemberByName()

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

Definition at line 403 of file vbdisp.c.

404{
406 FIXME("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
407 return E_NOTIMPL;
408}
#define debugstr_w
Definition: kernel32.h:32

◆ DispatchEx_GetDispID()

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

Definition at line 366 of file vbdisp.c.

367{
369
370 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
371
372 grfdex &= ~FDEX_VERSION_MASK;
373
374 if(!This->desc)
375 return E_UNEXPECTED;
376
377 /* Tests show that fdexNameCaseSensitive is ignored */
378
379 if(grfdex & ~(fdexNameEnsure|fdexNameCaseInsensitive|fdexNameCaseSensitive)) {
380 FIXME("unsupported flags %x\n", grfdex);
381 return E_NOTIMPL;
382 }
383
384 return vbdisp_get_id(This, bstrName, VBDISP_ANY, FALSE, pid);
385}
@ VBDISP_ANY
Definition: vbscript.h:75
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ DispatchEx_GetIDsOfNames()

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

Definition at line 344 of file vbdisp.c.

347{
349 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
350 lcid, rgDispId);
351 return E_NOTIMPL;
352}
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35

◆ DispatchEx_GetMemberName()

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

Definition at line 424 of file vbdisp.c.

425{
427 FIXME("(%p)->(%x %p)\n", This, id, pbstrName);
428 return E_NOTIMPL;
429}

◆ DispatchEx_GetMemberProperties()

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

Definition at line 417 of file vbdisp.c.

418{
420 FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
421 return E_NOTIMPL;
422}

◆ DispatchEx_GetNameSpaceParent()

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

Definition at line 438 of file vbdisp.c.

439{
441 FIXME("(%p)->(%p)\n", This, ppunk);
442 return E_NOTIMPL;
443}

◆ DispatchEx_GetNextDispID()

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

Definition at line 431 of file vbdisp.c.

432{
434 FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
435 return E_NOTIMPL;
436}

◆ DispatchEx_GetTypeInfo()

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

Definition at line 336 of file vbdisp.c.

338{
340 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
341 return E_NOTIMPL;
342}

◆ DispatchEx_GetTypeInfoCount()

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

Definition at line 326 of file vbdisp.c.

327{
329
330 TRACE("(%p)->(%p)\n", This, pctinfo);
331
332 *pctinfo = 1;
333 return S_OK;
334}

◆ 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 354 of file vbdisp.c.

357{
359
360 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
361 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
362
363 return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL);
364}
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

◆ 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 387 of file vbdisp.c.

389{
391
392 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
393
394 if(!This->desc)
395 return E_UNEXPECTED;
396
397 if(pvarRes)
398 V_VT(pvarRes) = VT_EMPTY;
399
400 return invoke_vbdisp(This, id, wFlags, TRUE, pdp, pvarRes);
401}
#define TRUE
Definition: types.h:120

◆ DispatchEx_QueryInterface()

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

Definition at line 276 of file vbdisp.c.

277{
279
281 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
282 *ppv = &This->IDispatchEx_iface;
283 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
284 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
285 *ppv = &This->IDispatchEx_iface;
286 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
287 TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
288 *ppv = &This->IDispatchEx_iface;
289 }else {
290 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
291 *ppv = NULL;
292 return E_NOINTERFACE;
293 }
294
295 IUnknown_AddRef((IUnknown*)*ppv);
296 return S_OK;
297}
const GUID IID_IUnknown
#define WARN(fmt,...)
Definition: debug.h:112
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IDispatch
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DispatchEx_Release()

static ULONG WINAPI DispatchEx_Release ( IDispatchEx iface)
static

Definition at line 309 of file vbdisp.c.

310{
313
314 TRACE("(%p) ref=%d\n", This, ref);
315
316 if(!ref && run_terminator(This)) {
318 list_remove(&This->entry);
319 heap_free(This->arrays);
321 }
322
323 return ref;
324}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52

◆ get_disp_value()

HRESULT get_disp_value ( script_ctx_t ctx,
IDispatch disp,
VARIANT v 
)

Definition at line 967 of file vbdisp.c.

968{
969 DISPPARAMS dp = {NULL};
970 if(!disp)
972 return disp_call(ctx, disp, DISPID_VALUE, &dp, v);
973}
#define VBSE_OBJECT_VARIABLE_NOT_SET
const GLdouble * v
Definition: gl.h:2040
HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, VARIANT *retv)
Definition: vbdisp.c:938
#define MAKE_VBSERROR(code)
Definition: vbscript.h:379

Referenced by assign_value(), get_propput_arg(), stack_assume_val(), and stack_pop_val().

◆ get_func_id()

static BOOL get_func_id ( vbdisp_t This,
const WCHAR name,
vbdisp_invoke_type_t  invoke_type,
BOOL  search_private,
DISPID id 
)
static

Definition at line 34 of file vbdisp.c.

35{
36 unsigned i;
37
38 for(i = invoke_type == VBDISP_ANY ? 0 : 1; i < This->desc->func_cnt; i++) {
39 if(invoke_type == VBDISP_ANY) {
40 if(!search_private && !This->desc->funcs[i].is_public)
41 continue;
42 if(!i && !This->desc->funcs[0].name) /* default value may not exist */
43 continue;
44 }else {
45 if(!This->desc->funcs[i].entries[invoke_type]
46 || (!search_private && !This->desc->funcs[i].entries[invoke_type]->is_public))
47 continue;
48 }
49
50 if(!wcsicmp(This->desc->funcs[i].name, name)) {
51 *id = i;
52 return TRUE;
53 }
54 }
55
56 return FALSE;
57}
#define wcsicmp
Definition: compat.h:15

Referenced by vbdisp_get_id().

◆ get_propput_arg()

static HRESULT get_propput_arg ( script_ctx_t ctx,
const DISPPARAMS *  dp,
WORD  flags,
VARIANT v,
BOOL is_owned 
)
static

Definition at line 80 of file vbdisp.c.

81{
82 unsigned i;
83
84 for(i=0; i < dp->cNamedArgs; i++) {
85 if(dp->rgdispidNamedArgs[i] == DISPID_PROPERTYPUT)
86 break;
87 }
88 if(i == dp->cNamedArgs) {
89 WARN("no value to set\n");
91 }
92
93 *v = dp->rgvarg[i];
94 if(V_VT(v) == (VT_VARIANT|VT_BYREF))
95 *v = *V_VARIANTREF(v);
96 *is_owned = FALSE;
97
98 if(V_VT(v) == VT_DISPATCH) {
101
103 if(FAILED(hres))
104 return hres;
105
106 *is_owned = TRUE;
107 }
108 }else if(!(flags & DISPATCH_PROPERTYPUT)) {
109 WARN("%s can't be assigned without DISPATCH_PROPERTYPUT flag\n", debugstr_variant(v));
110 return DISP_E_EXCEPTION;
111 }
112
113 return S_OK;
114}
@ VT_DISPATCH
Definition: compat.h:2304
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define V_VARIANTREF(A)
Definition: oleauto.h:283
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009
HRESULT get_disp_value(script_ctx_t *ctx, IDispatch *disp, VARIANT *v)
Definition: vbdisp.c:967
#define DISP_E_EXCEPTION
Definition: winerror.h:2518
#define DISP_E_PARAMNOTOPTIONAL
Definition: winerror.h:2524

Referenced by invoke_variant_prop(), and invoke_vbdisp().

◆ id_to_ident()

static ident_map_t * id_to_ident ( ScriptDisp This,
DISPID  id 
)
inlinestatic

Definition at line 543 of file vbdisp.c.

544{
545 return 0 < id && id <= This->ident_map_cnt ? This->ident_map+id-1 : NULL;
546}

Referenced by ScriptDisp_InvokeEx().

◆ ident_to_id()

static DISPID ident_to_id ( ScriptDisp This,
ident_map_t ident 
)
inlinestatic

Definition at line 538 of file vbdisp.c.

539{
540 return (ident-This->ident_map)+1;
541}
_In_ ULONG _In_ ULONG_PTR ident
Definition: winddi.h:3994

Referenced by ScriptDisp_GetDispID().

◆ impl_from_IDispatchEx()

◆ invoke_variant_prop()

static HRESULT invoke_variant_prop ( script_ctx_t ctx,
VARIANT v,
WORD  flags,
DISPPARAMS *  dp,
VARIANT res 
)
static

Definition at line 116 of file vbdisp.c.

117{
119
120 switch(flags) {
123 if(dp->cArgs) {
124 WARN("called with arguments\n");
125 return DISP_E_MEMBERNOTFOUND; /* That's what tests show */
126 }
127
129 break;
130
134 VARIANT put_val;
135 BOOL own_val;
136
137 hres = get_propput_arg(ctx, dp, flags, &put_val, &own_val);
138 if(FAILED(hres))
139 return hres;
140
141 if(arg_cnt(dp)) {
142 FIXME("Arguments not supported\n");
143 return E_NOTIMPL;
144 }
145
146 if(res)
147 V_VT(res) = VT_EMPTY;
148
149 if(own_val)
150 *v = put_val;
151 else
152 hres = VariantCopyInd(v, &put_val);
153 break;
154 }
155
156 default:
157 FIXME("unimplemented flags %x\n", flags);
158 return E_NOTIMPL;
159 }
160
161 return hres;
162}
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
static HRESULT get_propput_arg(script_ctx_t *ctx, const DISPPARAMS *dp, WORD flags, VARIANT *v, BOOL *is_owned)
Definition: vbdisp.c:80
static unsigned arg_cnt(const DISPPARAMS *dp)
Definition: vbscript.h:162
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512

Referenced by invoke_vbdisp(), and ScriptDisp_InvokeEx().

◆ invoke_vbdisp()

static HRESULT invoke_vbdisp ( vbdisp_t This,
DISPID  id,
DWORD  flags,
BOOL  extern_caller,
DISPPARAMS *  params,
VARIANT res 
)
static

Definition at line 164 of file vbdisp.c.

165{
166 if(id < 0)
168
169 if(is_func_id(This, id)) {
171
172 TRACE("%p->%s\n", This, debugstr_w(This->desc->funcs[id].name));
173
174 switch(flags) {
176 func = This->desc->funcs[id].entries[VBDISP_CALLGET];
177 if(!func || (func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)) {
178 WARN("no getter\n");
180 }
181
182 return exec_script(This->desc->ctx, extern_caller, func, This, params, res);
183
184 case DISPATCH_METHOD:
186 func = This->desc->funcs[id].entries[VBDISP_CALLGET];
187 if(!func) {
188 FIXME("no invoke/getter\n");
190 }
191
192 return exec_script(This->desc->ctx, extern_caller, func, This, params, res);
193
197 DISPPARAMS dp = {NULL, NULL, 1, 0};
198 BOOL needs_release;
199 VARIANT put_val;
201
202 if(arg_cnt(params)) {
203 FIXME("arguments not implemented\n");
204 return E_NOTIMPL;
205 }
206
207 hres = get_propput_arg(This->desc->ctx, params, flags, &put_val, &needs_release);
208 if(FAILED(hres))
209 return hres;
210
211 dp.rgvarg = &put_val;
212 func = This->desc->funcs[id].entries[V_VT(&put_val) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET];
213 if(!func) {
214 FIXME("no letter/setter\n");
216 }
217
218 hres = exec_script(This->desc->ctx, extern_caller, func, This, &dp, NULL);
219 if(needs_release)
220 VariantClear(&put_val);
221 return hres;
222 }
223 default:
224 FIXME("flags %x\n", flags);
226 }
227 }
228
229 if(id >= This->desc->prop_cnt + This->desc->func_cnt)
231
232 TRACE("%p->%s\n", This, debugstr_w(This->desc->props[id - This->desc->func_cnt].name));
233 return invoke_variant_prop(This->desc->ctx, This->props+(id-This->desc->func_cnt), flags, params, res);
234}
GLenum func
Definition: glext.h:6028
GLenum const GLfloat * params
Definition: glext.h:5645
GLuint id
Definition: glext.h:5910
static BOOL is_func_id(vbdisp_t *This, DISPID id)
Definition: vbdisp.c:29
static HRESULT invoke_variant_prop(script_ctx_t *ctx, VARIANT *v, WORD flags, DISPPARAMS *dp, VARIANT *res)
Definition: vbdisp.c:116
@ VBDISP_LET
Definition: vbscript.h:73
@ VBDISP_SET
Definition: vbscript.h:74
@ FUNC_PROPGET
Definition: vbscript.h:311
@ FUNC_DEFGET
Definition: vbscript.h:314

Referenced by disp_call(), disp_propput(), and DispatchEx_InvokeEx().

◆ is_func_id()

static BOOL is_func_id ( vbdisp_t This,
DISPID  id 
)
inlinestatic

Definition at line 29 of file vbdisp.c.

30{
31 return id < This->desc->func_cnt;
32}

Referenced by invoke_vbdisp().

◆ map_hres()

HRESULT map_hres ( HRESULT  hres)

Definition at line 877 of file vbdisp.c.

878{
880 return hres;
881
882 switch(hres) {
933 }
934
935 return hres;
936}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define VBSE_PATH_NOT_FOUND
#define VBSE_INVALID_DLL_FUNCTION_NAME
#define VBSE_ILLEGAL_FUNC_CALL
#define VBSE_ARRAY_LOCKED
#define VBSE_PATH_FILE_ACCESS
#define VBSE_OVERFLOW
#define VBSE_NOT_ENUM
#define VBSE_INVALID_TYPELIB_VARIABLE
#define VBSE_OLE_NO_PROP_OR_METHOD
#define VBSE_FUNC_ARITY_MISMATCH
#define VBSE_LOCALE_SETTING_NOT_SUPPORTED
#define VBSE_OLE_FILE_NOT_FOUND
#define VBSE_ACTION_NOT_SUPPORTED
#define VBSE_OUT_OF_BOUNDS
#define VBSE_FILE_NOT_FOUND
#define VBSE_PARAMETER_NOT_OPTIONAL
#define VBSE_CANT_CREATE_TMP_FILE
#define VBSE_OUT_OF_MEMORY
#define VBSE_TOO_MANY_FILES
#define VBSE_TYPE_MISMATCH
#define VBSE_OLE_NOT_SUPPORTED
#define VBSE_NAMED_ARGS_NOT_SUPPORTED
#define VBSE_NAMED_PARAM_NOT_FOUND
#define VBSE_DISK_FULL
#define VBSE_FILE_ALREADY_EXISTS
#define VBSE_CANT_CREATE_OBJECT
#define VBSE_SERVER_NOT_FOUND
#define VBSE_PERMISSION_DENIED
#define VBSE_IO_ERROR
#define RPC_E_SERVER_UNAVAILABLE
Definition: vbdisp.c:875
#define FACILITY_VBS
Definition: vbscript.h:378
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define STG_E_SHAREVIOLATION
Definition: winerror.h:2577
#define TYPE_E_CANTCREATETMPFILE
Definition: winerror.h:2551
#define DISP_E_PARAMNOTFOUND
Definition: winerror.h:2513
#define DISP_E_NONAMEDARGS
Definition: winerror.h:2516
#define DISP_E_ARRAYISLOCKED
Definition: winerror.h:2522
#define STG_E_INUSE
Definition: winerror.h:2588
#define STG_E_PATHNOTFOUND
Definition: winerror.h:2566
#define MK_E_UNAVAILABLE
Definition: winerror.h:2784
#define STG_E_TOOMANYOPENFILES
Definition: winerror.h:2567
#define TYPE_E_DLLFUNCTIONNOTFOUND
Definition: winerror.h:2543
#define STG_E_NOTCURRENT
Definition: winerror.h:2589
#define STG_E_CANTSAVE
Definition: winerror.h:2591
#define STG_E_LOCKVIOLATION
Definition: winerror.h:2578
#define STG_E_INVALIDNAME
Definition: winerror.h:2584
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define DISP_E_UNKNOWNINTERFACE
Definition: winerror.h:2511
#define DISP_E_OVERFLOW
Definition: winerror.h:2519
#define STG_E_READFAULT
Definition: winerror.h:2576
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
#define DISP_E_BADPARAMCOUNT
Definition: winerror.h:2523
#define STG_E_DISKISWRITEPROTECTED
Definition: winerror.h:2573
#define STG_E_FILEALREADYEXISTS
Definition: winerror.h:2579
#define CO_E_APPDIDNTREG
Definition: winerror.h:2817
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define TYPE_E_TYPEMISMATCH
Definition: winerror.h:2548
#define STG_E_FILENOTFOUND
Definition: winerror.h:2565
#define DISP_E_NOTACOLLECTION
Definition: winerror.h:2526
#define STG_E_ACCESSDENIED
Definition: winerror.h:2568
#define CO_E_APPNOTFOUND
Definition: winerror.h:2808
#define MK_E_CANTOPENFILE
Definition: winerror.h:2791
#define DISP_E_BADINDEX
Definition: winerror.h:2520
#define DISP_E_UNKNOWNLCID
Definition: winerror.h:2521
#define TYPE_E_IOERROR
Definition: winerror.h:2550
#define STG_E_MEDIUMFULL
Definition: winerror.h:2581
#define CO_E_SERVER_EXEC_FAILURE
Definition: winerror.h:2860
#define STG_E_WRITEFAULT
Definition: winerror.h:2575
#define MK_E_INVALIDEXTENSION
Definition: winerror.h:2787
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:2514
#define STG_E_NOMOREFILES
Definition: winerror.h:2572
#define TYPE_E_OUTOFBOUNDS
Definition: winerror.h:2549
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:2570
#define CO_E_CLASSSTRING
Definition: winerror.h:2806

◆ run_terminator()

static BOOL run_terminator ( vbdisp_t This)
static

Definition at line 236 of file vbdisp.c.

237{
238 DISPPARAMS dp = {0};
239
240 if(This->terminator_ran)
241 return TRUE;
242 This->terminator_ran = TRUE;
243
244 if(!This->desc->class_terminate_id)
245 return TRUE;
246
247 This->ref++;
248 exec_script(This->desc->ctx, FALSE, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
249 This, &dp, NULL);
250 return !--This->ref;
251}

Referenced by collect_objects(), and DispatchEx_Release().

◆ ScriptDisp_AddRef()

static ULONG WINAPI ScriptDisp_AddRef ( IDispatchEx iface)
static

Definition at line 600 of file vbdisp.c.

601{
604
605 TRACE("(%p) ref=%d\n", This, ref);
606
607 return ref;
608}
static ScriptDisp * ScriptDisp_from_IDispatchEx(IDispatchEx *iface)
Definition: vbdisp.c:572

◆ ScriptDisp_DeleteMemberByDispID()

static HRESULT WINAPI ScriptDisp_DeleteMemberByDispID ( IDispatchEx iface,
DISPID  id 
)
static

Definition at line 766 of file vbdisp.c.

767{
769 FIXME("(%p)->(%x)\n", This, id);
770 return E_NOTIMPL;
771}

◆ ScriptDisp_DeleteMemberByName()

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

Definition at line 759 of file vbdisp.c.

760{
762 FIXME("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
763 return E_NOTIMPL;
764}

◆ ScriptDisp_from_IDispatchEx()

◆ ScriptDisp_GetDispID()

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

Definition at line 675 of file vbdisp.c.

676{
681
682 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
683
684 if(!This->ctx)
685 return E_UNEXPECTED;
686
687 for(ident = This->ident_map; ident < This->ident_map+This->ident_map_cnt; ident++) {
688 if(!wcsicmp(ident->name, bstrName)) {
690 return S_OK;
691 }
692 }
693
694 for(var = This->ctx->global_vars; var; var = var->next) {
695 if(!wcsicmp(var->name, bstrName)) {
696 ident = add_ident(This, var->name);
697 if(!ident)
698 return E_OUTOFMEMORY;
699
700 ident->is_var = TRUE;
701 ident->u.var = var;
703 return S_OK;
704 }
705 }
706
707 for(func = This->ctx->global_funcs; func; func = func->next) {
708 if(!wcsicmp(func->name, bstrName)) {
709 ident = add_ident(This, func->name);
710 if(!ident)
711 return E_OUTOFMEMORY;
712
713 ident->is_var = FALSE;
714 ident->u.func = func;
716 return S_OK;
717 }
718 }
719
720 *pid = -1;
721 return DISP_E_UNKNOWNNAME;
722}
const char * var
Definition: shader.c:5666
static DISPID ident_to_id(ScriptDisp *This, ident_map_t *ident)
Definition: vbdisp.c:538
static ident_map_t * add_ident(ScriptDisp *This, const WCHAR *name)
Definition: vbdisp.c:548

◆ ScriptDisp_GetIDsOfNames()

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

Definition at line 644 of file vbdisp.c.

646{
648 UINT i;
650
651 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
652 lcid, rgDispId);
653
654 for(i=0; i < cNames; i++) {
655 hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, rgszNames[i], 0, rgDispId+i);
656 if(FAILED(hres))
657 return hres;
658 }
659
660 return S_OK;
661}

◆ ScriptDisp_GetMemberName()

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

Definition at line 780 of file vbdisp.c.

781{
783 FIXME("(%p)->(%x %p)\n", This, id, pbstrName);
784 return E_NOTIMPL;
785}

◆ ScriptDisp_GetMemberProperties()

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

Definition at line 773 of file vbdisp.c.

774{
776 FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
777 return E_NOTIMPL;
778}

◆ ScriptDisp_GetNameSpaceParent()

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

Definition at line 794 of file vbdisp.c.

795{
797 FIXME("(%p)->(%p)\n", This, ppunk);
798 return E_NOTIMPL;
799}

◆ ScriptDisp_GetNextDispID()

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

Definition at line 787 of file vbdisp.c.

788{
790 FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
791 return E_NOTIMPL;
792}

◆ ScriptDisp_GetTypeInfo()

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

Definition at line 636 of file vbdisp.c.

638{
640 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
641 return E_NOTIMPL;
642}

◆ ScriptDisp_GetTypeInfoCount()

static HRESULT WINAPI ScriptDisp_GetTypeInfoCount ( IDispatchEx iface,
UINT pctinfo 
)
static

Definition at line 626 of file vbdisp.c.

627{
629
630 TRACE("(%p)->(%p)\n", This, pctinfo);
631
632 *pctinfo = 1;
633 return S_OK;
634}

◆ ScriptDisp_Invoke()

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

Definition at line 663 of file vbdisp.c.

665{
667
668 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
669 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
670
671 return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags,
672 pDispParams, pVarResult, pExcepInfo, NULL);
673}

◆ ScriptDisp_InvokeEx()

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

Definition at line 724 of file vbdisp.c.

726{
730
731 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
732
733 ident = id_to_ident(This, id);
734 if(!ident)
736
737 if(ident->is_var) {
738 if(ident->u.var->is_const) {
739 FIXME("const not supported\n");
740 return E_NOTIMPL;
741 }
742
743 return invoke_variant_prop(This->ctx, &ident->u.var->v, wFlags, pdp, pvarRes);
744 }
745
746 switch(wFlags) {
747 case DISPATCH_METHOD:
749 hres = exec_script(This->ctx, TRUE, ident->u.func, NULL, pdp, pvarRes);
750 break;
751 default:
752 FIXME("Unsupported flags %x\n", wFlags);
753 hres = E_NOTIMPL;
754 }
755
756 return hres;
757}
static ident_map_t * id_to_ident(ScriptDisp *This, DISPID id)
Definition: vbdisp.c:543

◆ ScriptDisp_QueryInterface()

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

Definition at line 577 of file vbdisp.c.

578{
580
582 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
583 *ppv = &This->IDispatchEx_iface;
584 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
585 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
586 *ppv = &This->IDispatchEx_iface;
587 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
588 TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
589 *ppv = &This->IDispatchEx_iface;
590 }else {
591 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
592 *ppv = NULL;
593 return E_NOINTERFACE;
594 }
595
596 IUnknown_AddRef((IUnknown*)*ppv);
597 return S_OK;
598}

◆ ScriptDisp_Release()

static ULONG WINAPI ScriptDisp_Release ( IDispatchEx iface)
static

Definition at line 610 of file vbdisp.c.

611{
614
615 TRACE("(%p) ref=%d\n", This, ref);
616
617 if(!ref) {
618 assert(!This->ctx);
619 heap_free(This->ident_map);
621 }
622
623 return ref;
624}
#define assert(x)
Definition: debug.h:53

◆ unsafe_impl_from_IDispatch()

static vbdisp_t * unsafe_impl_from_IDispatch ( IDispatch iface)
inlinestatic

Definition at line 463 of file vbdisp.c.

464{
465 return iface->lpVtbl == (IDispatchVtbl*)&DispatchExVtbl
466 ? CONTAINING_RECORD((IDispatchEx *)iface, vbdisp_t, IDispatchEx_iface)
467 : NULL;
468}
struct _vbdisp_t vbdisp_t
Definition: vbscript.h:61

Referenced by disp_call(), disp_get_id(), and disp_propput().

◆ vbdisp_get_id()

HRESULT vbdisp_get_id ( vbdisp_t This,
BSTR  name,
vbdisp_invoke_type_t  invoke_type,
BOOL  search_private,
DISPID id 
)

Definition at line 59 of file vbdisp.c.

60{
61 unsigned i;
62
63 if(get_func_id(This, name, invoke_type, search_private, id))
64 return S_OK;
65
66 for(i=0; i < This->desc->prop_cnt; i++) {
67 if(!search_private && !This->desc->props[i].is_public)
68 continue;
69
70 if(!wcsicmp(This->desc->props[i].name, name)) {
71 *id = i + This->desc->func_cnt;
72 return S_OK;
73 }
74 }
75
76 *id = -1;
77 return DISP_E_UNKNOWNNAME;
78}
static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id)
Definition: vbdisp.c:34

Referenced by disp_get_id(), and DispatchEx_GetDispID().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( vbscript  )

Variable Documentation

◆ DispatchExVtbl

IDispatchExVtbl DispatchExVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: vbdisp.c:387
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: vbdisp.c:417
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: vbdisp.c:309
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: vbdisp.c:344
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: vbdisp.c:410
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: vbdisp.c:438
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: vbdisp.c:366
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: vbdisp.c:354
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: vbdisp.c:424
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: vbdisp.c:431
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: vbdisp.c:276
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: vbdisp.c:299
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: vbdisp.c:336
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: vbdisp.c:403
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: vbdisp.c:326

Definition at line 445 of file vbdisp.c.

Referenced by create_vbdisp(), and unsafe_impl_from_IDispatch().

◆ ScriptDispVtbl

IDispatchExVtbl ScriptDispVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ScriptDisp_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: vbdisp.c:766
static ULONG WINAPI ScriptDisp_AddRef(IDispatchEx *iface)
Definition: vbdisp.c:600
static ULONG WINAPI ScriptDisp_Release(IDispatchEx *iface)
Definition: vbdisp.c:610
static HRESULT WINAPI ScriptDisp_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: vbdisp.c:773
static HRESULT WINAPI ScriptDisp_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: vbdisp.c:577
static HRESULT WINAPI ScriptDisp_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: vbdisp.c:644
static HRESULT WINAPI ScriptDisp_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: vbdisp.c:626
static HRESULT WINAPI ScriptDisp_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: vbdisp.c:780
static HRESULT WINAPI ScriptDisp_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: vbdisp.c:787
static HRESULT WINAPI ScriptDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: vbdisp.c:663
static HRESULT WINAPI ScriptDisp_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: vbdisp.c:794
static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: vbdisp.c:675
static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: vbdisp.c:724
static HRESULT WINAPI ScriptDisp_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: vbdisp.c:759
static HRESULT WINAPI ScriptDisp_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: vbdisp.c:636

Definition at line 801 of file vbdisp.c.

Referenced by create_script_disp().