ReactOS 0.4.16-dev-297-gc569aee
vbscript.c File Reference
#include <assert.h>
#include "vbscript.h"
#include "objsafe.h"
#include "wine/debug.h"
Include dependency graph for vbscript.c:

Go to the source code of this file.

Classes

struct  VBScript
 
struct  VBScriptError
 
struct  AXSite
 

Macros

#define CTXARG_T   DWORD
 
#define IActiveScriptDebugVtbl   IActiveScriptDebug32Vtbl
 
#define IActiveScriptParseVtbl   IActiveScriptParse32Vtbl
 
#define IActiveScriptParseProcedure2Vtbl   IActiveScriptParseProcedure2_32Vtbl
 
#define SUPPORTED_OPTIONS   (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (vbscript)
 
static void change_state (VBScript *This, SCRIPTSTATE state)
 
static BOOL is_started (VBScript *This)
 
static HRESULT exec_global_code (script_ctx_t *ctx, vbscode_t *code, VARIANT *res)
 
static void exec_queued_code (script_ctx_t *ctx)
 
IDispatchlookup_named_item (script_ctx_t *ctx, const WCHAR *name, unsigned flags)
 
static void release_script (script_ctx_t *ctx)
 
static void destroy_script (script_ctx_t *ctx)
 
static void decrease_state (VBScript *This, SCRIPTSTATE state)
 
static VBScriptErrorimpl_from_IActiveScriptError (IActiveScriptError *iface)
 
static HRESULT WINAPI VBScriptError_QueryInterface (IActiveScriptError *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VBScriptError_AddRef (IActiveScriptError *iface)
 
static ULONG WINAPI VBScriptError_Release (IActiveScriptError *iface)
 
static HRESULT WINAPI VBScriptError_GetExceptionInfo (IActiveScriptError *iface, EXCEPINFO *excepinfo)
 
static HRESULT WINAPI VBScriptError_GetSourcePosition (IActiveScriptError *iface, DWORD *source_context, ULONG *line, LONG *character)
 
static HRESULT WINAPI VBScriptError_GetSourceLineText (IActiveScriptError *iface, BSTR *source)
 
HRESULT report_script_error (script_ctx_t *ctx)
 
static VBScriptimpl_from_IActiveScript (IActiveScript *iface)
 
static HRESULT WINAPI VBScript_QueryInterface (IActiveScript *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VBScript_AddRef (IActiveScript *iface)
 
static ULONG WINAPI VBScript_Release (IActiveScript *iface)
 
static HRESULT WINAPI VBScript_SetScriptSite (IActiveScript *iface, IActiveScriptSite *pass)
 
static HRESULT WINAPI VBScript_GetScriptSite (IActiveScript *iface, REFIID riid, void **ppvObject)
 
static HRESULT WINAPI VBScript_SetScriptState (IActiveScript *iface, SCRIPTSTATE ss)
 
static HRESULT WINAPI VBScript_GetScriptState (IActiveScript *iface, SCRIPTSTATE *pssState)
 
static HRESULT WINAPI VBScript_Close (IActiveScript *iface)
 
static HRESULT WINAPI VBScript_AddNamedItem (IActiveScript *iface, LPCOLESTR pstrName, DWORD dwFlags)
 
static HRESULT WINAPI VBScript_AddTypeLib (IActiveScript *iface, REFGUID rguidTypeLib, DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
 
static HRESULT WINAPI VBScript_GetScriptDispatch (IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
 
static HRESULT WINAPI VBScript_GetCurrentScriptThreadID (IActiveScript *iface, SCRIPTTHREADID *pstridThread)
 
static HRESULT WINAPI VBScript_GetScriptThreadID (IActiveScript *iface, DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
 
static HRESULT WINAPI VBScript_GetScriptThreadState (IActiveScript *iface, SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
 
static HRESULT WINAPI VBScript_InterruptScriptThread (IActiveScript *iface, SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
 
static HRESULT WINAPI VBScript_Clone (IActiveScript *iface, IActiveScript **ppscript)
 
static VBScriptimpl_from_IActiveScriptDebug (IActiveScriptDebug *iface)
 
static HRESULT WINAPI VBScriptDebug_QueryInterface (IActiveScriptDebug *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VBScriptDebug_AddRef (IActiveScriptDebug *iface)
 
static ULONG WINAPI VBScriptDebug_Release (IActiveScriptDebug *iface)
 
static HRESULT WINAPI VBScriptDebug_GetScriptTextAttributes (IActiveScriptDebug *iface, LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr)
 
static HRESULT WINAPI VBScriptDebug_GetScriptletTextAttributes (IActiveScriptDebug *iface, LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr)
 
static HRESULT WINAPI VBScriptDebug_EnumCodeContextsOfPosition (IActiveScriptDebug *iface, CTXARG_T source, ULONG offset, ULONG len, IEnumDebugCodeContexts **ret)
 
static VBScriptimpl_from_IActiveScriptParse (IActiveScriptParse *iface)
 
static HRESULT WINAPI VBScriptParse_QueryInterface (IActiveScriptParse *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VBScriptParse_AddRef (IActiveScriptParse *iface)
 
static ULONG WINAPI VBScriptParse_Release (IActiveScriptParse *iface)
 
static HRESULT WINAPI VBScriptParse_InitNew (IActiveScriptParse *iface)
 
static HRESULT WINAPI VBScriptParse_AddScriptlet (IActiveScriptParse *iface, LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, BSTR *pbstrName, EXCEPINFO *pexcepinfo)
 
static HRESULT WINAPI VBScriptParse_ParseScriptText (IActiveScriptParse *iface, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
 
static VBScriptimpl_from_IActiveScriptParseProcedure2 (IActiveScriptParseProcedure2 *iface)
 
static HRESULT WINAPI VBScriptParseProcedure_QueryInterface (IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VBScriptParseProcedure_AddRef (IActiveScriptParseProcedure2 *iface)
 
static ULONG WINAPI VBScriptParseProcedure_Release (IActiveScriptParseProcedure2 *iface)
 
static HRESULT WINAPI VBScriptParseProcedure_ParseProcedureText (IActiveScriptParseProcedure2 *iface, LPCOLESTR pstrCode, LPCOLESTR pstrFormalParams, LPCOLESTR pstrProcedureName, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
 
static VBScriptimpl_from_IObjectSafety (IObjectSafety *iface)
 
static HRESULT WINAPI VBScriptSafety_QueryInterface (IObjectSafety *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VBScriptSafety_AddRef (IObjectSafety *iface)
 
static ULONG WINAPI VBScriptSafety_Release (IObjectSafety *iface)
 
static HRESULT WINAPI VBScriptSafety_GetInterfaceSafetyOptions (IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
 
static HRESULT WINAPI VBScriptSafety_SetInterfaceSafetyOptions (IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
 
HRESULT WINAPI VBScriptFactory_CreateInstance (IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
 
static AXSiteimpl_from_IServiceProvider (IServiceProvider *iface)
 
static HRESULT WINAPI AXSite_QueryInterface (IServiceProvider *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI AXSite_AddRef (IServiceProvider *iface)
 
static ULONG WINAPI AXSite_Release (IServiceProvider *iface)
 
static HRESULT WINAPI AXSite_QueryService (IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
 
IUnknowncreate_ax_site (script_ctx_t *ctx)
 

Variables

static const IActiveScriptErrorVtbl VBScriptErrorVtbl
 
static const IActiveScriptVtbl VBScriptVtbl
 
static const IActiveScriptDebugVtbl VBScriptDebugVtbl
 
static const IActiveScriptParseVtbl VBScriptParseVtbl
 
static const IActiveScriptParseProcedure2Vtbl VBScriptParseProcedureVtbl
 
static const IObjectSafetyVtbl VBScriptSafetyVtbl
 
static IServiceProviderVtbl AXSiteVtbl
 

Macro Definition Documentation

◆ CTXARG_T

#define CTXARG_T   DWORD

Definition at line 38 of file vbscript.c.

◆ IActiveScriptDebugVtbl

#define IActiveScriptDebugVtbl   IActiveScriptDebug32Vtbl

Definition at line 39 of file vbscript.c.

◆ IActiveScriptParseProcedure2Vtbl

#define IActiveScriptParseProcedure2Vtbl   IActiveScriptParseProcedure2_32Vtbl

Definition at line 41 of file vbscript.c.

◆ IActiveScriptParseVtbl

#define IActiveScriptParseVtbl   IActiveScriptParse32Vtbl

Definition at line 40 of file vbscript.c.

◆ SUPPORTED_OPTIONS

#define SUPPORTED_OPTIONS   (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER)

Definition at line 891 of file vbscript.c.

Function Documentation

◆ AXSite_AddRef()

static ULONG WINAPI AXSite_AddRef ( IServiceProvider iface)
static

Definition at line 1007 of file vbscript.c.

1008{
1011
1012 TRACE("(%p) ref=%d\n", This, ref);
1013
1014 return ref;
1015}
#define InterlockedIncrement
Definition: armddk.h:53
static AXSite * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: vbscript.c:982
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48

◆ AXSite_QueryInterface()

static HRESULT WINAPI AXSite_QueryInterface ( IServiceProvider iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 987 of file vbscript.c.

988{
990
992 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
993 *ppv = &This->IServiceProvider_iface;
994 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
995 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
996 *ppv = &This->IServiceProvider_iface;
997 }else {
998 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
999 *ppv = NULL;
1000 return E_NOINTERFACE;
1001 }
1002
1003 IUnknown_AddRef((IUnknown*)*ppv);
1004 return S_OK;
1005}
const GUID IID_IUnknown
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ AXSite_QueryService()

static HRESULT WINAPI AXSite_QueryService ( IServiceProvider iface,
REFGUID  guidService,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1030 of file vbscript.c.

1032{
1034
1035 TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
1036
1037 return IServiceProvider_QueryService(This->sp, guidService, riid, ppv);
1038}

◆ AXSite_Release()

static ULONG WINAPI AXSite_Release ( IServiceProvider iface)
static

Definition at line 1017 of file vbscript.c.

1018{
1021
1022 TRACE("(%p) ref=%d\n", This, ref);
1023
1024 if(!ref)
1025 heap_free(This);
1026
1027 return ref;
1028}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52

◆ change_state()

static void change_state ( VBScript This,
SCRIPTSTATE  state 
)
static

Definition at line 66 of file vbscript.c.

67{
68 if(This->state == state)
69 return;
70
71 This->state = state;
72 if(This->ctx->site)
73 IActiveScriptSite_OnStateChange(This->ctx->site, state);
74}
static int state
Definition: maze.c:121

Referenced by decrease_state(), VBScript_SetScriptSite(), VBScript_SetScriptState(), and VBScriptParse_InitNew().

◆ create_ax_site()

IUnknown * create_ax_site ( script_ctx_t ctx)

Definition at line 1047 of file vbscript.c.

1048{
1050 AXSite *ret;
1051 HRESULT hres;
1052
1053 hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
1054 if(FAILED(hres)) {
1055 ERR("Could not get IServiceProvider iface: %08x\n", hres);
1056 return NULL;
1057 }
1058
1059 ret = heap_alloc(sizeof(*ret));
1060 if(!ret) {
1061 IServiceProvider_Release(sp);
1062 return NULL;
1063 }
1064
1065 ret->IServiceProvider_iface.lpVtbl = &AXSiteVtbl;
1066 ret->ref = 1;
1067 ret->sp = sp;
1068
1069 return (IUnknown*)&ret->IServiceProvider_iface;
1070}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define ERR(fmt,...)
Definition: precomp.h:57
static IServiceProviderVtbl AXSiteVtbl
Definition: vbscript.c:1040
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
static const WCHAR sp[]
Definition: suminfo.c:287
int ret

◆ decrease_state()

static void decrease_state ( VBScript This,
SCRIPTSTATE  state 
)
static

Definition at line 195 of file vbscript.c.

196{
197 switch(This->state) {
201 return;
202 /* FALLTHROUGH */
205 if(This->state == SCRIPTSTATE_DISCONNECTED)
208 break;
209 /* FALLTHROUGH */
213 release_script(This->ctx);
214 This->thread_id = 0;
215 break;
217 break;
219 }
220}
@ SCRIPTSTATE_INITIALIZED
Definition: activscp.idl:62
@ SCRIPTSTATE_DISCONNECTED
Definition: activscp.idl:60
@ SCRIPTSTATE_STARTED
Definition: activscp.idl:58
@ SCRIPTSTATE_UNINITIALIZED
Definition: activscp.idl:57
@ SCRIPTSTATE_CLOSED
Definition: activscp.idl:61
@ SCRIPTSTATE_CONNECTED
Definition: activscp.idl:59
static void change_state(VBScript *This, SCRIPTSTATE state)
Definition: vbscript.c:66
static void release_script(script_ctx_t *ctx)
Definition: vbscript.c:131
#define DEFAULT_UNREACHABLE

Referenced by VBScript_Close(), VBScript_Release(), and VBScript_SetScriptState().

◆ destroy_script()

static void destroy_script ( script_ctx_t ctx)
static

Definition at line 186 of file vbscript.c.

187{
188 while(!list_empty(&ctx->code_list))
190
192 heap_free(ctx);
193}
static int list_empty(struct list_entry *head)
Definition: list.h:58
uint32_t entry
Definition: isohybrid.c:63
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175
void release_vbscode(vbscode_t *code)
Definition: compile.c:1768

Referenced by VBScript_Release().

◆ exec_global_code()

static HRESULT exec_global_code ( script_ctx_t ctx,
vbscode_t code,
VARIANT res 
)
static

Definition at line 83 of file vbscript.c.

84{
85 code->pending_exec = FALSE;
86 return exec_script(ctx, TRUE, &code->main_code, NULL, NULL, res);
87}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint res
Definition: glext.h:9613
HRESULT exec_script(HTMLInnerWindow *, const WCHAR *, const WCHAR *, VARIANT *) DECLSPEC_HIDDEN
Definition: script.c:1245
Definition: inflate.c:139

Referenced by exec_queued_code(), and VBScriptParse_ParseScriptText().

◆ exec_queued_code()

static void exec_queued_code ( script_ctx_t ctx)
static

Definition at line 89 of file vbscript.c.

90{
91 vbscode_t *iter;
92
93 LIST_FOR_EACH_ENTRY(iter, &ctx->code_list, vbscode_t, entry) {
94 if(iter->pending_exec)
96 }
97}
static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res)
Definition: vbscript.c:83
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
BOOL pending_exec
Definition: vbscript.h:342

Referenced by VBScript_SetScriptState().

◆ impl_from_IActiveScript()

◆ impl_from_IActiveScriptDebug()

static VBScript * impl_from_IActiveScriptDebug ( IActiveScriptDebug *  iface)
inlinestatic

◆ impl_from_IActiveScriptError()

static VBScriptError * impl_from_IActiveScriptError ( IActiveScriptError iface)
inlinestatic

◆ impl_from_IActiveScriptParse()

static VBScript * impl_from_IActiveScriptParse ( IActiveScriptParse *  iface)
inlinestatic

◆ impl_from_IActiveScriptParseProcedure2()

static VBScript * impl_from_IActiveScriptParseProcedure2 ( IActiveScriptParseProcedure2 *  iface)
inlinestatic

Definition at line 809 of file vbscript.c.

810{
811 return CONTAINING_RECORD(iface, VBScript, IActiveScriptParseProcedure2_iface);
812}

Referenced by VBScriptParseProcedure_AddRef(), VBScriptParseProcedure_ParseProcedureText(), VBScriptParseProcedure_QueryInterface(), and VBScriptParseProcedure_Release().

◆ impl_from_IObjectSafety()

static VBScript * impl_from_IObjectSafety ( IObjectSafety iface)
inlinestatic

◆ impl_from_IServiceProvider()

static AXSite * impl_from_IServiceProvider ( IServiceProvider iface)
inlinestatic

Definition at line 982 of file vbscript.c.

983{
984 return CONTAINING_RECORD(iface, AXSite, IServiceProvider_iface);
985}

Referenced by AXSite_AddRef(), AXSite_QueryInterface(), AXSite_QueryService(), and AXSite_Release().

◆ is_started()

static BOOL is_started ( VBScript This)
inlinestatic

Definition at line 76 of file vbscript.c.

77{
78 return This->state == SCRIPTSTATE_STARTED
79 || This->state == SCRIPTSTATE_CONNECTED
80 || This->state == SCRIPTSTATE_DISCONNECTED;
81}

Referenced by VBScriptParse_ParseScriptText().

◆ lookup_named_item()

IDispatch * lookup_named_item ( script_ctx_t ctx,
const WCHAR name,
unsigned  flags 
)

Definition at line 99 of file vbscript.c.

100{
103
104 LIST_FOR_EACH_ENTRY(item, &ctx->named_items, named_item_t, entry) {
105 if((item->flags & flags) == flags && !wcsicmp(item->name, name)) {
106 if(!item->disp) {
107 IUnknown *unk;
108
109 hres = IActiveScriptSite_GetItemInfo(ctx->site, item->name,
110 SCRIPTINFO_IUNKNOWN, &unk, NULL);
111 if(FAILED(hres)) {
112 WARN("GetItemInfo failed: %08x\n", hres);
113 continue;
114 }
115
116 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp);
117 IUnknown_Release(unk);
118 if(FAILED(hres)) {
119 WARN("object does not implement IDispatch\n");
120 continue;
121 }
122 }
123
124 return item->disp;
125 }
126 }
127
128 return NULL;
129}
#define WARN(fmt,...)
Definition: precomp.h:61
#define wcsicmp
Definition: compat.h:15
GLbitfield flags
Definition: glext.h:7161
static ATOM item
Definition: dde.c:856
const GUID IID_IDispatch
Definition: name.c:39

Referenced by lookup_identifier(), and VBScriptParse_ParseScriptText().

◆ release_script()

static void release_script ( script_ctx_t ctx)
static

Definition at line 131 of file vbscript.c.

132{
133 class_desc_t *class_desc;
134
136 clear_ei(&ctx->ei);
137
138 release_dynamic_vars(ctx->global_vars);
139 ctx->global_vars = NULL;
140
141 while(!list_empty(&ctx->named_items)) {
142 named_item_t *iter = LIST_ENTRY(list_head(&ctx->named_items), named_item_t, entry);
143
144 list_remove(&iter->entry);
145 if(iter->disp)
146 IDispatch_Release(iter->disp);
147 heap_free(iter->name);
148 heap_free(iter);
149 }
150
151 while(ctx->procs) {
152 class_desc = ctx->procs;
153 ctx->procs = class_desc->next;
154
155 heap_free(class_desc);
156 }
157
158 if(ctx->host_global) {
159 IDispatch_Release(ctx->host_global);
160 ctx->host_global = NULL;
161 }
162
163 if(ctx->secmgr) {
164 IInternetHostSecurityManager_Release(ctx->secmgr);
165 ctx->secmgr = NULL;
166 }
167
168 if(ctx->site) {
169 IActiveScriptSite_Release(ctx->site);
170 ctx->site = NULL;
171 }
172
173 if(ctx->script_obj) {
174 ScriptDisp *script_obj = ctx->script_obj;
175
176 ctx->script_obj = NULL;
177 script_obj->ctx = NULL;
178 IDispatchEx_Release(&script_obj->IDispatchEx_iface);
179 }
180
182 heap_pool_free(&ctx->heap);
183 heap_pool_init(&ctx->heap);
184}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static BOOL CALLBACK collect_objects(LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pvRef)
Definition: config.c:57
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
void release_dynamic_vars(dynamic_var_t *var)
Definition: interp.c:2044
void heap_pool_free(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:169
void heap_pool_init(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:71
script_ctx_t * ctx
Definition: vbscript.h:138
IDispatchEx IDispatchEx_iface
Definition: vbscript.h:131
struct _class_desc_t * next
Definition: vbscript.h:113
struct list entry
Definition: vbscript.h:68
LPWSTR name
Definition: jscript.h:365
IDispatch * disp
Definition: jscript.h:363
void detach_global_objects(script_ctx_t *ctx)
Definition: global.c:2855

Referenced by decrease_state(), and destroy_script().

◆ report_script_error()

HRESULT report_script_error ( script_ctx_t ctx)

Definition at line 315 of file vbscript.c.

316{
319
320 if(!(error = heap_alloc(sizeof(*error))))
321 return E_OUTOFMEMORY;
322 error->IActiveScriptError_iface.lpVtbl = &VBScriptErrorVtbl;
323
324 error->ref = 1;
325 error->ei = ctx->ei;
326 memset(&ctx->ei, 0, sizeof(ctx->ei));
327 result = error->ei.scode;
328
329 hres = IActiveScriptSite_OnScriptError(ctx->site, &error->IActiveScriptError_iface);
330 IActiveScriptError_Release(&error->IActiveScriptError_iface);
331 return hres == S_OK ? SCRIPT_E_REPORTED : result;
332}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IActiveScriptErrorVtbl VBScriptErrorVtbl
Definition: vbscript.c:306
GLuint64EXT * result
Definition: glext.h:11304
#define error(str)
Definition: mkdosfs.c:1605
#define memset(x, y, z)
Definition: compat.h:39

Referenced by compile_error(), and exec_script().

◆ VBScript_AddNamedItem()

static HRESULT WINAPI VBScript_AddNamedItem ( IActiveScript iface,
LPCOLESTR  pstrName,
DWORD  dwFlags 
)
static

Definition at line 510 of file vbscript.c.

511{
514 IDispatch *disp = NULL;
516
517 TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags);
518
519 if(This->thread_id != GetCurrentThreadId() || !This->ctx->site)
520 return E_UNEXPECTED;
521
522 if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) {
523 IUnknown *unk;
524
525 hres = IActiveScriptSite_GetItemInfo(This->ctx->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL);
526 if(FAILED(hres)) {
527 WARN("GetItemInfo failed: %08x\n", hres);
528 return hres;
529 }
530
531 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
532 IUnknown_Release(unk);
533 if(FAILED(hres)) {
534 WARN("object does not implement IDispatch\n");
535 return hres;
536 }
537
538 if(This->ctx->host_global)
539 IDispatch_Release(This->ctx->host_global);
540 IDispatch_AddRef(disp);
541 This->ctx->host_global = disp;
542 }
543
544 item = heap_alloc(sizeof(*item));
545 if(!item) {
546 if(disp)
547 IDispatch_Release(disp);
548 return E_OUTOFMEMORY;
549 }
550
551 item->disp = disp;
552 item->flags = dwFlags;
553 item->name = heap_strdupW(pstrName);
554 if(!item->name) {
555 if(disp)
556 IDispatch_Release(disp);
558 return E_OUTOFMEMORY;
559 }
560
561 list_add_tail(&This->ctx->named_items, &item->entry);
562 return S_OK;
563}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: edit.c:4312
static VBScript * impl_from_IActiveScript(IActiveScript *iface)
Definition: vbscript.c:334
#define debugstr_w
Definition: kernel32.h:32
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define E_UNEXPECTED
Definition: winerror.h:2456

◆ VBScript_AddRef()

static ULONG WINAPI VBScript_AddRef ( IActiveScript iface)
static

Definition at line 371 of file vbscript.c.

372{
375
376 TRACE("(%p) ref=%d\n", This, ref);
377
378 return ref;
379}

◆ VBScript_AddTypeLib()

static HRESULT WINAPI VBScript_AddTypeLib ( IActiveScript iface,
REFGUID  rguidTypeLib,
DWORD  dwMajor,
DWORD  dwMinor,
DWORD  dwFlags 
)
static

Definition at line 565 of file vbscript.c.

567{
569 FIXME("(%p)->()\n", This);
570 return E_NOTIMPL;
571}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ VBScript_Clone()

static HRESULT WINAPI VBScript_Clone ( IActiveScript iface,
IActiveScript **  ppscript 
)
static

Definition at line 624 of file vbscript.c.

625{
627 FIXME("(%p)->()\n", This);
628 return E_NOTIMPL;
629}

◆ VBScript_Close()

static HRESULT WINAPI VBScript_Close ( IActiveScript iface)
static

Definition at line 497 of file vbscript.c.

498{
500
501 TRACE("(%p)->()\n", This);
502
503 if(This->thread_id && This->thread_id != GetCurrentThreadId())
504 return E_UNEXPECTED;
505
507 return S_OK;
508}
static void decrease_state(VBScript *This, SCRIPTSTATE state)
Definition: vbscript.c:195

◆ VBScript_GetCurrentScriptThreadID()

static HRESULT WINAPI VBScript_GetCurrentScriptThreadID ( IActiveScript iface,
SCRIPTTHREADID pstridThread 
)
static

Definition at line 592 of file vbscript.c.

594{
596 FIXME("(%p)->()\n", This);
597 return E_NOTIMPL;
598}

◆ VBScript_GetScriptDispatch()

static HRESULT WINAPI VBScript_GetScriptDispatch ( IActiveScript iface,
LPCOLESTR  pstrItemName,
IDispatch **  ppdisp 
)
static

Definition at line 573 of file vbscript.c.

574{
576
577 TRACE("(%p)->(%p)\n", This, ppdisp);
578
579 if(!ppdisp)
580 return E_POINTER;
581
582 if(This->thread_id != GetCurrentThreadId() || !This->ctx->script_obj) {
583 *ppdisp = NULL;
584 return E_UNEXPECTED;
585 }
586
587 *ppdisp = (IDispatch*)&This->ctx->script_obj->IDispatchEx_iface;
588 IDispatch_AddRef(*ppdisp);
589 return S_OK;
590}
#define E_POINTER
Definition: winerror.h:2365

◆ VBScript_GetScriptSite()

static HRESULT WINAPI VBScript_GetScriptSite ( IActiveScript iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 430 of file vbscript.c.

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

◆ VBScript_GetScriptState()

static HRESULT WINAPI VBScript_GetScriptState ( IActiveScript iface,
SCRIPTSTATE pssState 
)
static

Definition at line 481 of file vbscript.c.

482{
484
485 TRACE("(%p)->(%p)\n", This, pssState);
486
487 if(!pssState)
488 return E_POINTER;
489
490 if(This->thread_id && This->thread_id != GetCurrentThreadId())
491 return E_UNEXPECTED;
492
493 *pssState = This->state;
494 return S_OK;
495}

◆ VBScript_GetScriptThreadID()

static HRESULT WINAPI VBScript_GetScriptThreadID ( IActiveScript iface,
DWORD  dwWin32ThreadId,
SCRIPTTHREADID pstidThread 
)
static

Definition at line 600 of file vbscript.c.

602{
604 FIXME("(%p)->()\n", This);
605 return E_NOTIMPL;
606}

◆ VBScript_GetScriptThreadState()

static HRESULT WINAPI VBScript_GetScriptThreadState ( IActiveScript iface,
SCRIPTTHREADID  stidThread,
SCRIPTTHREADSTATE pstsState 
)
static

Definition at line 608 of file vbscript.c.

610{
612 FIXME("(%p)->()\n", This);
613 return E_NOTIMPL;
614}

◆ VBScript_InterruptScriptThread()

static HRESULT WINAPI VBScript_InterruptScriptThread ( IActiveScript iface,
SCRIPTTHREADID  stidThread,
const EXCEPINFO *  pexcepinfo,
DWORD  dwFlags 
)
static

Definition at line 616 of file vbscript.c.

618{
620 FIXME("(%p)->()\n", This);
621 return E_NOTIMPL;
622}

◆ VBScript_QueryInterface()

static HRESULT WINAPI VBScript_QueryInterface ( IActiveScript iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 339 of file vbscript.c.

340{
342
344 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
345 *ppv = &This->IActiveScript_iface;
346 }else if(IsEqualGUID(riid, &IID_IActiveScript)) {
347 TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv);
348 *ppv = &This->IActiveScript_iface;
349 }else if(IsEqualGUID(riid, &IID_IActiveScriptDebug)) {
350 TRACE("(%p)->(IID_IActiveScriptDebug %p)\n", This, ppv);
351 *ppv = &This->IActiveScriptDebug_iface;
352 }else if(IsEqualGUID(riid, &IID_IActiveScriptParse)) {
353 TRACE("(%p)->(IID_IActiveScriptParse %p)\n", This, ppv);
354 *ppv = &This->IActiveScriptParse_iface;
355 }else if(IsEqualGUID(riid, &IID_IActiveScriptParseProcedure2)) {
356 TRACE("(%p)->(IID_IActiveScriptParseProcedure2 %p)\n", This, ppv);
357 *ppv = &This->IActiveScriptParseProcedure2_iface;
358 }else if(IsEqualGUID(riid, &IID_IObjectSafety)) {
359 TRACE("(%p)->(IID_IObjectSafety %p)\n", This, ppv);
360 *ppv = &This->IObjectSafety_iface;
361 }else {
362 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
363 *ppv = NULL;
364 return E_NOINTERFACE;
365 }
366
367 IUnknown_AddRef((IUnknown*)*ppv);
368 return S_OK;
369}

◆ VBScript_Release()

static ULONG WINAPI VBScript_Release ( IActiveScript iface)
static

Definition at line 381 of file vbscript.c.

382{
385
386 TRACE("(%p) ref=%d\n", iface, ref);
387
388 if(!ref) {
390 destroy_script(This->ctx);
392 }
393
394 return ref;
395}
static void destroy_script(script_ctx_t *ctx)
Definition: vbscript.c:186

◆ VBScript_SetScriptSite()

static HRESULT WINAPI VBScript_SetScriptSite ( IActiveScript iface,
IActiveScriptSite pass 
)
static

Definition at line 397 of file vbscript.c.

398{
400 LCID lcid;
402
403 TRACE("(%p)->(%p)\n", This, pass);
404
405 if(!pass)
406 return E_POINTER;
407
408 if(This->ctx->site)
409 return E_UNEXPECTED;
410
412 return E_UNEXPECTED;
413
414 hres = create_script_disp(This->ctx, &This->ctx->script_obj);
415 if(FAILED(hres))
416 return hres;
417
418 This->ctx->site = pass;
419 IActiveScriptSite_AddRef(This->ctx->site);
420
421 hres = IActiveScriptSite_GetLCID(This->ctx->site, &lcid);
422 if(hres == S_OK)
423 This->ctx->lcid = lcid;
424
425 if(This->is_initialized)
427 return S_OK;
428}
#define InterlockedCompareExchange
Definition: interlocked.h:104
DWORD LCID
Definition: nls.h:13
pass
Definition: typegen.h:25
HRESULT create_script_disp(script_ctx_t *ctx, ScriptDisp **ret)
Definition: vbdisp.c:819

◆ VBScript_SetScriptState()

static HRESULT WINAPI VBScript_SetScriptState ( IActiveScript iface,
SCRIPTSTATE  ss 
)
static

Definition at line 438 of file vbscript.c.

439{
441
442 TRACE("(%p)->(%d)\n", This, ss);
443
444 if(This->thread_id && GetCurrentThreadId() != This->thread_id)
445 return E_UNEXPECTED;
446
448 if(This->state == SCRIPTSTATE_CLOSED)
449 return E_UNEXPECTED;
450
452 return S_OK;
453 }
454
455 if(!This->is_initialized)
456 return E_UNEXPECTED;
457
458 switch(ss) {
460 case SCRIPTSTATE_CONNECTED: /* FIXME */
461 if(This->state == SCRIPTSTATE_CLOSED)
462 return E_UNEXPECTED;
463
465 break;
467 FIXME("unimplemented SCRIPTSTATE_INITIALIZED\n");
468 return S_OK;
470 FIXME("unimplemented SCRIPTSTATE_DISCONNECTED\n");
471 return S_OK;
472 default:
473 FIXME("unimplemented state %d\n", ss);
474 return E_NOTIMPL;
475 }
476
478 return S_OK;
479}
static void exec_queued_code(script_ctx_t *ctx)
Definition: vbscript.c:89
#define ss
Definition: i386-dis.c:441

◆ VBScriptDebug_AddRef()

static ULONG WINAPI VBScriptDebug_AddRef ( IActiveScriptDebug *  iface)
static

Definition at line 661 of file vbscript.c.

662{
664 return IActiveScript_AddRef(&This->IActiveScript_iface);
665}
static VBScript * impl_from_IActiveScriptDebug(IActiveScriptDebug *iface)
Definition: vbscript.c:650

◆ VBScriptDebug_EnumCodeContextsOfPosition()

static HRESULT WINAPI VBScriptDebug_EnumCodeContextsOfPosition ( IActiveScriptDebug *  iface,
CTXARG_T  source,
ULONG  offset,
ULONG  len,
IEnumDebugCodeContexts **  ret 
)
static

Definition at line 691 of file vbscript.c.

693{
695 FIXME("(%p)->(%s %u %u %p)\n", This, wine_dbgstr_longlong(source), offset, len, ret);
696 return E_NOTIMPL;
697}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
GLenum GLsizei len
Definition: glext.h:6722
GLintptr offset
Definition: glext.h:5920

◆ VBScriptDebug_GetScriptletTextAttributes()

static HRESULT WINAPI VBScriptDebug_GetScriptletTextAttributes ( IActiveScriptDebug *  iface,
LPCOLESTR  code,
ULONG  len,
LPCOLESTR  delimiter,
DWORD  flags,
SOURCE_TEXT_ATTR attr 
)
static

Definition at line 682 of file vbscript.c.

684{
686 FIXME("(%p)->(%s %u %s %#x %p)\n", This, debugstr_w(code), len,
688 return E_NOTIMPL;
689}
const char * delimiter
Definition: string.c:1566
Definition: cookie.c:202

◆ VBScriptDebug_GetScriptTextAttributes()

static HRESULT WINAPI VBScriptDebug_GetScriptTextAttributes ( IActiveScriptDebug *  iface,
LPCOLESTR  code,
ULONG  len,
LPCOLESTR  delimiter,
DWORD  flags,
SOURCE_TEXT_ATTR attr 
)
static

Definition at line 673 of file vbscript.c.

675{
677 FIXME("(%p)->(%s %u %s %#x %p)\n", This, debugstr_w(code), len,
679 return E_NOTIMPL;
680}

◆ VBScriptDebug_QueryInterface()

static HRESULT WINAPI VBScriptDebug_QueryInterface ( IActiveScriptDebug *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 655 of file vbscript.c.

656{
658 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
659}

◆ VBScriptDebug_Release()

static ULONG WINAPI VBScriptDebug_Release ( IActiveScriptDebug *  iface)
static

Definition at line 667 of file vbscript.c.

668{
670 return IActiveScript_Release(&This->IActiveScript_iface);
671}

◆ VBScriptError_AddRef()

static ULONG WINAPI VBScriptError_AddRef ( IActiveScriptError iface)
static

Definition at line 247 of file vbscript.c.

248{
251
252 TRACE("(%p) ref=%d\n", This, ref);
253
254 return ref;
255}
static VBScriptError * impl_from_IActiveScriptError(IActiveScriptError *iface)
Definition: vbscript.c:222

◆ VBScriptError_GetExceptionInfo()

static HRESULT WINAPI VBScriptError_GetExceptionInfo ( IActiveScriptError iface,
EXCEPINFO *  excepinfo 
)
static

Definition at line 271 of file vbscript.c.

272{
274
275 TRACE("(%p)->(%p)\n", This, excepinfo);
276
277 *excepinfo = This->ei;
278 excepinfo->bstrSource = SysAllocString(This->ei.bstrSource);
279 excepinfo->bstrDescription = SysAllocString(This->ei.bstrDescription);
280 excepinfo->bstrHelpFile = SysAllocString(This->ei.bstrHelpFile);
281 return S_OK;
282}
static EXCEPINFO excepinfo
Definition: automation.c:47
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

◆ VBScriptError_GetSourceLineText()

static HRESULT WINAPI VBScriptError_GetSourceLineText ( IActiveScriptError iface,
BSTR source 
)
static

Definition at line 299 of file vbscript.c.

300{
302 FIXME("(%p)->(%p)\n", This, source);
303 return E_NOTIMPL;
304}

◆ VBScriptError_GetSourcePosition()

static HRESULT WINAPI VBScriptError_GetSourcePosition ( IActiveScriptError iface,
DWORD source_context,
ULONG line,
LONG character 
)
static

Definition at line 284 of file vbscript.c.

285{
287
288 FIXME("(%p)->(%p %p %p)\n", This, source_context, line, character);
289
290 if(source_context)
291 *source_context = 0;
292 if(line)
293 *line = 0;
294 if(character)
295 *character = 0;
296 return S_OK;
297}
Definition: parser.c:49

◆ VBScriptError_QueryInterface()

static HRESULT WINAPI VBScriptError_QueryInterface ( IActiveScriptError iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 227 of file vbscript.c.

228{
230
232 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
233 *ppv = &This->IActiveScriptError_iface;
234 }else if(IsEqualGUID(riid, &IID_IActiveScriptError)) {
235 TRACE("(%p)->(IID_IActiveScriptError %p)\n", This, ppv);
236 *ppv = &This->IActiveScriptError_iface;
237 }else {
238 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
239 *ppv = NULL;
240 return E_NOINTERFACE;
241 }
242
243 IUnknown_AddRef((IUnknown*)*ppv);
244 return S_OK;
245}

◆ VBScriptError_Release()

static ULONG WINAPI VBScriptError_Release ( IActiveScriptError iface)
static

Definition at line 257 of file vbscript.c.

258{
261
262 TRACE("(%p) ref=%d\n", This, ref);
263
264 if(!ref) {
266 }
267
268 return ref;
269}

◆ VBScriptFactory_CreateInstance()

HRESULT WINAPI VBScriptFactory_CreateInstance ( IClassFactory iface,
IUnknown pUnkOuter,
REFIID  riid,
void **  ppv 
)

Definition at line 930 of file vbscript.c.

931{
933 VBScript *ret;
935
936 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
937
938 ret = heap_alloc_zero(sizeof(*ret));
939 if(!ret)
940 return E_OUTOFMEMORY;
941
942 ret->IActiveScript_iface.lpVtbl = &VBScriptVtbl;
943 ret->IActiveScriptDebug_iface.lpVtbl = &VBScriptDebugVtbl;
944 ret->IActiveScriptParse_iface.lpVtbl = &VBScriptParseVtbl;
945 ret->IActiveScriptParseProcedure2_iface.lpVtbl = &VBScriptParseProcedureVtbl;
946 ret->IObjectSafety_iface.lpVtbl = &VBScriptSafetyVtbl;
947
948 ret->ref = 1;
950
951 ctx = ret->ctx = heap_alloc_zero(sizeof(*ctx));
952 if(!ctx) {
953 heap_free(ret);
954 return E_OUTOFMEMORY;
955 }
956
957 ctx->safeopt = INTERFACE_USES_DISPEX;
958 heap_pool_init(&ctx->heap);
959 list_init(&ctx->objects);
960 list_init(&ctx->code_list);
961 list_init(&ctx->named_items);
962
964 if(FAILED(hres)) {
965 IActiveScript_Release(&ret->IActiveScript_iface);
966 return hres;
967 }
968
969 hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
970 IActiveScript_Release(&ret->IActiveScript_iface);
971 return hres;
972}
static void list_init(struct list_entry *head)
Definition: list.h:51
static const IActiveScriptParseProcedure2Vtbl VBScriptParseProcedureVtbl
Definition: vbscript.c:861
static const IActiveScriptDebugVtbl VBScriptDebugVtbl
Definition: vbscript.c:699
static const IObjectSafetyVtbl VBScriptSafetyVtbl
Definition: vbscript.c:922
static const IActiveScriptParseVtbl VBScriptParseVtbl
Definition: vbscript.c:800
static const IActiveScriptVtbl VBScriptVtbl
Definition: vbscript.c:631
HRESULT init_global(script_ctx_t *ctx)
Definition: global.c:1105

◆ VBScriptParse_AddRef()

static ULONG WINAPI VBScriptParse_AddRef ( IActiveScriptParse *  iface)
static

Definition at line 719 of file vbscript.c.

720{
722 return IActiveScript_AddRef(&This->IActiveScript_iface);
723}
static VBScript * impl_from_IActiveScriptParse(IActiveScriptParse *iface)
Definition: vbscript.c:708

◆ VBScriptParse_AddScriptlet()

static HRESULT WINAPI VBScriptParse_AddScriptlet ( IActiveScriptParse *  iface,
LPCOLESTR  pstrDefaultName,
LPCOLESTR  pstrCode,
LPCOLESTR  pstrItemName,
LPCOLESTR  pstrSubItemName,
LPCOLESTR  pstrEventName,
LPCOLESTR  pstrDelimiter,
CTXARG_T  dwSourceContextCookie,
ULONG  ulStartingLineNumber,
DWORD  dwFlags,
BSTR pbstrName,
EXCEPINFO *  pexcepinfo 
)
static

Definition at line 746 of file vbscript.c.

751{
753 FIXME("(%p)->(%s %s %s %s %s %s %s %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
754 debugstr_w(pstrCode), debugstr_w(pstrItemName), debugstr_w(pstrSubItemName),
755 debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), wine_dbgstr_longlong(dwSourceContextCookie),
756 ulStartingLineNumber, dwFlags, pbstrName, pexcepinfo);
757 return E_NOTIMPL;
758}

◆ VBScriptParse_InitNew()

static HRESULT WINAPI VBScriptParse_InitNew ( IActiveScriptParse *  iface)
static

Definition at line 731 of file vbscript.c.

732{
734
735 TRACE("(%p)\n", This);
736
737 if(This->is_initialized)
738 return E_UNEXPECTED;
739 This->is_initialized = TRUE;
740
741 if(This->ctx->site)
743 return S_OK;
744}

◆ VBScriptParse_ParseScriptText()

static HRESULT WINAPI VBScriptParse_ParseScriptText ( IActiveScriptParse *  iface,
LPCOLESTR  pstrCode,
LPCOLESTR  pstrItemName,
IUnknown punkContext,
LPCOLESTR  pstrDelimiter,
CTXARG_T  dwSourceContextCookie,
ULONG  ulStartingLine,
DWORD  dwFlags,
VARIANT pvarResult,
EXCEPINFO *  pexcepinfo 
)
static

Definition at line 760 of file vbscript.c.

764{
769
770 TRACE("(%p)->(%s %s %p %s %s %u %x %p %p)\n", This, debugstr_w(pstrCode),
771 debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
772 wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLine, dwFlags, pvarResult, pexcepinfo);
773
774 if(This->thread_id != GetCurrentThreadId() || This->state == SCRIPTSTATE_CLOSED)
775 return E_UNEXPECTED;
776
777 if(pstrItemName) {
778 context = lookup_named_item(This->ctx, pstrItemName, 0);
779 if(!context) {
780 WARN("Inknown context %s\n", debugstr_w(pstrItemName));
781 return E_INVALIDARG;
782 }
783 }
784
785 hres = compile_script(This->ctx, pstrCode, pstrDelimiter, dwFlags, &code);
786 if(FAILED(hres))
787 return hres;
788
789 if(context)
790 IDispatch_AddRef(code->context = context);
791
792 if(!(dwFlags & SCRIPTTEXT_ISEXPRESSION) && !is_started(This)) {
793 code->pending_exec = TRUE;
794 return S_OK;
795 }
796
797 return exec_global_code(This->ctx, code, pvarResult);
798}
#define E_INVALIDARG
Definition: ddrawi.h:101
static BOOL is_started(VBScript *This)
Definition: vbscript.c:76
IDispatch * lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flags)
Definition: vbscript.c:99
HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, const WCHAR *args, const WCHAR *delimiter, BOOL from_eval, BOOL use_decode, bytecode_t **ret)
Definition: compile.c:2461
Definition: http.c:7252

◆ VBScriptParse_QueryInterface()

static HRESULT WINAPI VBScriptParse_QueryInterface ( IActiveScriptParse *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 713 of file vbscript.c.

714{
716 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
717}

◆ VBScriptParse_Release()

static ULONG WINAPI VBScriptParse_Release ( IActiveScriptParse *  iface)
static

Definition at line 725 of file vbscript.c.

726{
728 return IActiveScript_Release(&This->IActiveScript_iface);
729}

◆ VBScriptParseProcedure_AddRef()

static ULONG WINAPI VBScriptParseProcedure_AddRef ( IActiveScriptParseProcedure2 *  iface)
static

Definition at line 820 of file vbscript.c.

821{
823 return IActiveScript_AddRef(&This->IActiveScript_iface);
824}
static VBScript * impl_from_IActiveScriptParseProcedure2(IActiveScriptParseProcedure2 *iface)
Definition: vbscript.c:809

◆ VBScriptParseProcedure_ParseProcedureText()

static HRESULT WINAPI VBScriptParseProcedure_ParseProcedureText ( IActiveScriptParseProcedure2 *  iface,
LPCOLESTR  pstrCode,
LPCOLESTR  pstrFormalParams,
LPCOLESTR  pstrProcedureName,
LPCOLESTR  pstrItemName,
IUnknown punkContext,
LPCOLESTR  pstrDelimiter,
CTXARG_T  dwSourceContextCookie,
ULONG  ulStartingLineNumber,
DWORD  dwFlags,
IDispatch **  ppdisp 
)
static

Definition at line 832 of file vbscript.c.

836{
839 vbdisp_t *vbdisp;
841
842 TRACE("(%p)->(%s %s %s %s %p %s %s %u %x %p)\n", This, debugstr_w(pstrCode), debugstr_w(pstrFormalParams),
843 debugstr_w(pstrProcedureName), debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
844 wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLineNumber, dwFlags, ppdisp);
845
846 if(This->thread_id != GetCurrentThreadId() || This->state == SCRIPTSTATE_CLOSED)
847 return E_UNEXPECTED;
848
849 hres = compile_procedure(This->ctx, pstrCode, pstrDelimiter, dwFlags, &desc);
850 if(FAILED(hres))
851 return hres;
852
853 hres = create_vbdisp(desc, &vbdisp);
854 if(FAILED(hres))
855 return hres;
856
857 *ppdisp = (IDispatch*)&vbdisp->IDispatchEx_iface;
858 return S_OK;
859}
static const WCHAR desc[]
Definition: protectdata.c:36
IDispatchEx IDispatchEx_iface
Definition: vbscript.h:117
HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
Definition: vbdisp.c:470
HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, class_desc_t **ret)
Definition: compile.c:1930

◆ VBScriptParseProcedure_QueryInterface()

static HRESULT WINAPI VBScriptParseProcedure_QueryInterface ( IActiveScriptParseProcedure2 *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 814 of file vbscript.c.

815{
817 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
818}

◆ VBScriptParseProcedure_Release()

static ULONG WINAPI VBScriptParseProcedure_Release ( IActiveScriptParseProcedure2 *  iface)
static

Definition at line 826 of file vbscript.c.

827{
829 return IActiveScript_Release(&This->IActiveScript_iface);
830}

◆ VBScriptSafety_AddRef()

static ULONG WINAPI VBScriptSafety_AddRef ( IObjectSafety iface)
static

Definition at line 879 of file vbscript.c.

880{
882 return IActiveScript_AddRef(&This->IActiveScript_iface);
883}
static VBScript * impl_from_IObjectSafety(IObjectSafety *iface)
Definition: vbscript.c:868

◆ VBScriptSafety_GetInterfaceSafetyOptions()

static HRESULT WINAPI VBScriptSafety_GetInterfaceSafetyOptions ( IObjectSafety iface,
REFIID  riid,
DWORD pdwSupportedOptions,
DWORD pdwEnabledOptions 
)
static

Definition at line 893 of file vbscript.c.

895{
897
898 TRACE("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), pdwSupportedOptions, pdwEnabledOptions);
899
900 if(!pdwSupportedOptions || !pdwEnabledOptions)
901 return E_POINTER;
902
903 *pdwSupportedOptions = SUPPORTED_OPTIONS;
904 *pdwEnabledOptions = This->ctx->safeopt;
905 return S_OK;
906}
#define SUPPORTED_OPTIONS
Definition: vbscript.c:891

◆ VBScriptSafety_QueryInterface()

static HRESULT WINAPI VBScriptSafety_QueryInterface ( IObjectSafety iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 873 of file vbscript.c.

874{
876 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
877}

◆ VBScriptSafety_Release()

static ULONG WINAPI VBScriptSafety_Release ( IObjectSafety iface)
static

Definition at line 885 of file vbscript.c.

886{
888 return IActiveScript_Release(&This->IActiveScript_iface);
889}

◆ VBScriptSafety_SetInterfaceSafetyOptions()

static HRESULT WINAPI VBScriptSafety_SetInterfaceSafetyOptions ( IObjectSafety iface,
REFIID  riid,
DWORD  dwOptionSetMask,
DWORD  dwEnabledOptions 
)
static

Definition at line 908 of file vbscript.c.

910{
912
913 TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
914
915 if(dwOptionSetMask & ~SUPPORTED_OPTIONS)
916 return E_FAIL;
917
918 This->ctx->safeopt = (dwEnabledOptions & dwOptionSetMask) | (This->ctx->safeopt & ~dwOptionSetMask) | INTERFACE_USES_DISPEX;
919 return S_OK;
920}
#define E_FAIL
Definition: ddrawi.h:102

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( vbscript  )

Variable Documentation

◆ AXSiteVtbl

IServiceProviderVtbl AXSiteVtbl
static
Initial value:
= {
}
static ULONG WINAPI AXSite_Release(IServiceProvider *iface)
Definition: vbscript.c:1017
static ULONG WINAPI AXSite_AddRef(IServiceProvider *iface)
Definition: vbscript.c:1007
static HRESULT WINAPI AXSite_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: vbscript.c:987
static HRESULT WINAPI AXSite_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: vbscript.c:1030

Definition at line 1040 of file vbscript.c.

Referenced by create_ax_site().

◆ VBScriptDebugVtbl

const IActiveScriptDebugVtbl VBScriptDebugVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VBScriptDebug_GetScriptletTextAttributes(IActiveScriptDebug *iface, LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr)
Definition: vbscript.c:682
static ULONG WINAPI VBScriptDebug_AddRef(IActiveScriptDebug *iface)
Definition: vbscript.c:661
static HRESULT WINAPI VBScriptDebug_EnumCodeContextsOfPosition(IActiveScriptDebug *iface, CTXARG_T source, ULONG offset, ULONG len, IEnumDebugCodeContexts **ret)
Definition: vbscript.c:691
static HRESULT WINAPI VBScriptDebug_QueryInterface(IActiveScriptDebug *iface, REFIID riid, void **ppv)
Definition: vbscript.c:655
static HRESULT WINAPI VBScriptDebug_GetScriptTextAttributes(IActiveScriptDebug *iface, LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr)
Definition: vbscript.c:673
static ULONG WINAPI VBScriptDebug_Release(IActiveScriptDebug *iface)
Definition: vbscript.c:667

Definition at line 699 of file vbscript.c.

Referenced by VBScriptFactory_CreateInstance().

◆ VBScriptErrorVtbl

const IActiveScriptErrorVtbl VBScriptErrorVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VBScriptError_QueryInterface(IActiveScriptError *iface, REFIID riid, void **ppv)
Definition: vbscript.c:227
static HRESULT WINAPI VBScriptError_GetExceptionInfo(IActiveScriptError *iface, EXCEPINFO *excepinfo)
Definition: vbscript.c:271
static HRESULT WINAPI VBScriptError_GetSourceLineText(IActiveScriptError *iface, BSTR *source)
Definition: vbscript.c:299
static ULONG WINAPI VBScriptError_AddRef(IActiveScriptError *iface)
Definition: vbscript.c:247
static ULONG WINAPI VBScriptError_Release(IActiveScriptError *iface)
Definition: vbscript.c:257
static HRESULT WINAPI VBScriptError_GetSourcePosition(IActiveScriptError *iface, DWORD *source_context, ULONG *line, LONG *character)
Definition: vbscript.c:284

Definition at line 306 of file vbscript.c.

Referenced by report_script_error().

◆ VBScriptParseProcedureVtbl

const IActiveScriptParseProcedure2Vtbl VBScriptParseProcedureVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VBScriptParseProcedure_ParseProcedureText(IActiveScriptParseProcedure2 *iface, LPCOLESTR pstrCode, LPCOLESTR pstrFormalParams, LPCOLESTR pstrProcedureName, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
Definition: vbscript.c:832
static ULONG WINAPI VBScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
Definition: vbscript.c:820
static ULONG WINAPI VBScriptParseProcedure_Release(IActiveScriptParseProcedure2 *iface)
Definition: vbscript.c:826
static HRESULT WINAPI VBScriptParseProcedure_QueryInterface(IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
Definition: vbscript.c:814

Definition at line 861 of file vbscript.c.

Referenced by VBScriptFactory_CreateInstance().

◆ VBScriptParseVtbl

const IActiveScriptParseVtbl VBScriptParseVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
Definition: vbscript.c:760
static ULONG WINAPI VBScriptParse_Release(IActiveScriptParse *iface)
Definition: vbscript.c:725
static HRESULT WINAPI VBScriptParse_QueryInterface(IActiveScriptParse *iface, REFIID riid, void **ppv)
Definition: vbscript.c:713
static HRESULT WINAPI VBScriptParse_AddScriptlet(IActiveScriptParse *iface, LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, BSTR *pbstrName, EXCEPINFO *pexcepinfo)
Definition: vbscript.c:746
static HRESULT WINAPI VBScriptParse_InitNew(IActiveScriptParse *iface)
Definition: vbscript.c:731
static ULONG WINAPI VBScriptParse_AddRef(IActiveScriptParse *iface)
Definition: vbscript.c:719

Definition at line 800 of file vbscript.c.

Referenced by VBScriptFactory_CreateInstance().

◆ VBScriptSafetyVtbl

const IObjectSafetyVtbl VBScriptSafetyVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VBScriptSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: vbscript.c:873
static HRESULT WINAPI VBScriptSafety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
Definition: vbscript.c:893
static ULONG WINAPI VBScriptSafety_Release(IObjectSafety *iface)
Definition: vbscript.c:885
static ULONG WINAPI VBScriptSafety_AddRef(IObjectSafety *iface)
Definition: vbscript.c:879
static HRESULT WINAPI VBScriptSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
Definition: vbscript.c:908

Definition at line 922 of file vbscript.c.

Referenced by VBScriptFactory_CreateInstance().

◆ VBScriptVtbl

const IActiveScriptVtbl VBScriptVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VBScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
Definition: vbscript.c:624
static HRESULT WINAPI VBScript_GetCurrentScriptThreadID(IActiveScript *iface, SCRIPTTHREADID *pstridThread)
Definition: vbscript.c:592
static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
Definition: vbscript.c:438
static HRESULT WINAPI VBScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
Definition: vbscript.c:481
static HRESULT WINAPI VBScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
Definition: vbscript.c:339
static HRESULT WINAPI VBScript_SetScriptSite(IActiveScript *iface, IActiveScriptSite *pass)
Definition: vbscript.c:397
static HRESULT WINAPI VBScript_GetScriptSite(IActiveScript *iface, REFIID riid, void **ppvObject)
Definition: vbscript.c:430
static HRESULT WINAPI VBScript_InterruptScriptThread(IActiveScript *iface, SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
Definition: vbscript.c:616
static HRESULT WINAPI VBScript_Close(IActiveScript *iface)
Definition: vbscript.c:497
static HRESULT WINAPI VBScript_GetScriptThreadState(IActiveScript *iface, SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
Definition: vbscript.c:608
static HRESULT WINAPI VBScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
Definition: vbscript.c:573
static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstrName, DWORD dwFlags)
Definition: vbscript.c:510
static HRESULT WINAPI VBScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTypeLib, DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
Definition: vbscript.c:565
static ULONG WINAPI VBScript_Release(IActiveScript *iface)
Definition: vbscript.c:381
static HRESULT WINAPI VBScript_GetScriptThreadID(IActiveScript *iface, DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
Definition: vbscript.c:600
static ULONG WINAPI VBScript_AddRef(IActiveScript *iface)
Definition: vbscript.c:371

Definition at line 631 of file vbscript.c.

Referenced by VBScriptFactory_CreateInstance().