ReactOS 0.4.15-dev-8131-g4988de4
jscript.c File Reference
#include <assert.h>
#include "jscript.h"
#include "engine.h"
#include "objsafe.h"
#include "wine/debug.h"
Include dependency graph for jscript.c:

Go to the source code of this file.

Classes

class  JScript
 
struct  AXSite
 

Macros

#define CTXARG_T   DWORD
 
#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 (jscript)
 
void script_release (script_ctx_t *ctx)
 
static void change_state (JScript *This, SCRIPTSTATE state)
 
static BOOL is_started (script_ctx_t *ctx)
 
static HRESULT exec_global_code (JScript *This, bytecode_t *code)
 
static void clear_script_queue (JScript *This)
 
static void exec_queued_code (JScript *This)
 
static HRESULT set_ctx_site (JScript *This)
 
static void decrease_state (JScript *This, SCRIPTSTATE state)
 
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)
 
static JScriptimpl_from_IActiveScript (IActiveScript *iface)
 
static HRESULT WINAPI JScript_QueryInterface (IActiveScript *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI JScript_AddRef (IActiveScript *iface)
 
static ULONG WINAPI JScript_Release (IActiveScript *iface)
 
static HRESULT WINAPI JScript_SetScriptSite (IActiveScript *iface, IActiveScriptSite *pass)
 
static HRESULT WINAPI JScript_GetScriptSite (IActiveScript *iface, REFIID riid, void **ppvObject)
 
static HRESULT WINAPI JScript_SetScriptState (IActiveScript *iface, SCRIPTSTATE ss)
 
static HRESULT WINAPI JScript_GetScriptState (IActiveScript *iface, SCRIPTSTATE *pssState)
 
static HRESULT WINAPI JScript_Close (IActiveScript *iface)
 
static HRESULT WINAPI JScript_AddNamedItem (IActiveScript *iface, LPCOLESTR pstrName, DWORD dwFlags)
 
static HRESULT WINAPI JScript_AddTypeLib (IActiveScript *iface, REFGUID rguidTypeLib, DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
 
static HRESULT WINAPI JScript_GetScriptDispatch (IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
 
static HRESULT WINAPI JScript_GetCurrentScriptThreadID (IActiveScript *iface, SCRIPTTHREADID *pstridThread)
 
static HRESULT WINAPI JScript_GetScriptThreadID (IActiveScript *iface, DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
 
static HRESULT WINAPI JScript_GetScriptThreadState (IActiveScript *iface, SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
 
static HRESULT WINAPI JScript_InterruptScriptThread (IActiveScript *iface, SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
 
static HRESULT WINAPI JScript_Clone (IActiveScript *iface, IActiveScript **ppscript)
 
static JScriptimpl_from_IActiveScriptParse (IActiveScriptParse *iface)
 
static HRESULT WINAPI JScriptParse_QueryInterface (IActiveScriptParse *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI JScriptParse_AddRef (IActiveScriptParse *iface)
 
static ULONG WINAPI JScriptParse_Release (IActiveScriptParse *iface)
 
static HRESULT WINAPI JScriptParse_InitNew (IActiveScriptParse *iface)
 
static HRESULT WINAPI JScriptParse_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 JScriptParse_ParseScriptText (IActiveScriptParse *iface, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
 
static JScriptimpl_from_IActiveScriptParseProcedure2 (IActiveScriptParseProcedure2 *iface)
 
static HRESULT WINAPI JScriptParseProcedure_QueryInterface (IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI JScriptParseProcedure_AddRef (IActiveScriptParseProcedure2 *iface)
 
static ULONG WINAPI JScriptParseProcedure_Release (IActiveScriptParseProcedure2 *iface)
 
static HRESULT WINAPI JScriptParseProcedure_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 JScriptimpl_from_IActiveScriptProperty (IActiveScriptProperty *iface)
 
static HRESULT WINAPI JScriptProperty_QueryInterface (IActiveScriptProperty *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI JScriptProperty_AddRef (IActiveScriptProperty *iface)
 
static ULONG WINAPI JScriptProperty_Release (IActiveScriptProperty *iface)
 
static HRESULT WINAPI JScriptProperty_GetProperty (IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
 
static HRESULT WINAPI JScriptProperty_SetProperty (IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
 
static JScriptimpl_from_IObjectSafety (IObjectSafety *iface)
 
static HRESULT WINAPI JScriptSafety_QueryInterface (IObjectSafety *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI JScriptSafety_AddRef (IObjectSafety *iface)
 
static ULONG WINAPI JScriptSafety_Release (IObjectSafety *iface)
 
static HRESULT WINAPI JScriptSafety_GetInterfaceSafetyOptions (IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
 
static HRESULT WINAPI JScriptSafety_SetInterfaceSafetyOptions (IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
 
static JScriptimpl_from_IVariantChangeType (IVariantChangeType *iface)
 
static HRESULT WINAPI VariantChangeType_QueryInterface (IVariantChangeType *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI VariantChangeType_AddRef (IVariantChangeType *iface)
 
static ULONG WINAPI VariantChangeType_Release (IVariantChangeType *iface)
 
static HRESULT WINAPI VariantChangeType_ChangeType (IVariantChangeType *iface, VARIANT *dst, VARIANT *src, LCID lcid, VARTYPE vt)
 
HRESULT create_jscript_object (BOOL is_encode, REFIID riid, void **ppv)
 

Variables

static IServiceProviderVtbl AXSiteVtbl
 
static const IActiveScriptVtbl JScriptVtbl
 
static const IActiveScriptParseVtbl JScriptParseVtbl
 
static const IActiveScriptParseProcedure2Vtbl JScriptParseProcedureVtbl
 
static const IActiveScriptPropertyVtbl JScriptPropertyVtbl
 
static const IObjectSafetyVtbl JScriptSafetyVtbl
 
static const IVariantChangeTypeVtbl VariantChangeTypeVtbl
 

Macro Definition Documentation

◆ CTXARG_T

#define CTXARG_T   DWORD

Definition at line 37 of file jscript.c.

◆ IActiveScriptParseProcedure2Vtbl

#define IActiveScriptParseProcedure2Vtbl   IActiveScriptParseProcedure2_32Vtbl

Definition at line 39 of file jscript.c.

◆ IActiveScriptParseVtbl

#define IActiveScriptParseVtbl   IActiveScriptParse32Vtbl

Definition at line 38 of file jscript.c.

◆ SUPPORTED_OPTIONS

#define SUPPORTED_OPTIONS   (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER)

Definition at line 975 of file jscript.c.

Function Documentation

◆ AXSite_AddRef()

static ULONG WINAPI AXSite_AddRef ( IServiceProvider iface)
static

Definition at line 276 of file jscript.c.

277{
280
281 TRACE("(%p) ref=%d\n", This, ref);
282
283 return ref;
284}
#define InterlockedIncrement
Definition: armddk.h:53
static AXSite * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: jscript.c:251
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 256 of file jscript.c.

257{
259
261 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
262 *ppv = &This->IServiceProvider_iface;
263 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
264 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
265 *ppv = &This->IServiceProvider_iface;
266 }else {
267 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
268 *ppv = NULL;
269 return E_NOINTERFACE;
270 }
271
272 IUnknown_AddRef((IUnknown*)*ppv);
273 return S_OK;
274}
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 304 of file jscript.c.

306{
308
309 TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
310
311 if(!This->sp)
312 return E_NOINTERFACE;
313
314 return IServiceProvider_QueryService(This->sp, guidService, riid, ppv);
315}

◆ AXSite_Release()

static ULONG WINAPI AXSite_Release ( IServiceProvider iface)
static

Definition at line 286 of file jscript.c.

287{
290
291 TRACE("(%p) ref=%d\n", This, ref);
292
293 if(!ref)
294 {
295 if(This->sp)
296 IServiceProvider_Release(This->sp);
297
299 }
300
301 return ref;
302}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52

◆ change_state()

static void change_state ( JScript This,
SCRIPTSTATE  state 
)
static

Definition at line 88 of file jscript.c.

89{
90 if(This->ctx->state == state)
91 return;
92
93 This->ctx->state = state;
94 if(This->site)
95 IActiveScriptSite_OnStateChange(This->site, state);
96}
static int state
Definition: maze.c:121

Referenced by decrease_state(), JScript_SetScriptState(), and set_ctx_site().

◆ clear_script_queue()

static void clear_script_queue ( JScript This)
static

Definition at line 118 of file jscript.c.

119{
120 bytecode_t *iter, *iter2;
121
122 if(!This->queue_head)
123 return;
124
125 iter = This->queue_head;
126 while(iter) {
127 iter2 = iter->next;
128 iter->next = NULL;
129 release_bytecode(iter);
130 iter = iter2;
131 }
132
133 This->queue_head = This->queue_tail = NULL;
134}
void release_bytecode(bytecode_t *code)
Definition: compile.c:2226
struct _bytecode_t * next
Definition: engine.h:190

Referenced by decrease_state(), and exec_queued_code().

◆ create_ax_site()

IUnknown * create_ax_site ( script_ctx_t ctx)

Definition at line 324 of file jscript.c.

325{
327 AXSite *ret;
329
330 hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
331 if(FAILED(hres)) {
332 TRACE("Could not get IServiceProvider iface: %08x\n", hres);
333 }
334
335 ret = heap_alloc(sizeof(AXSite));
336 if(!ret) {
337 IServiceProvider_Release(sp);
338 return NULL;
339 }
340
341 ret->IServiceProvider_iface.lpVtbl = &AXSiteVtbl;
342 ret->ref = 1;
343 ret->sp = sp;
344
345 return (IUnknown*)&ret->IServiceProvider_iface;
346}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static IServiceProviderVtbl AXSiteVtbl
Definition: jscript.c:317
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
static const WCHAR sp[]
Definition: suminfo.c:287
int ret

Referenced by create_activex_object(), and set_object_site().

◆ create_jscript_object()

HRESULT create_jscript_object ( BOOL  is_encode,
REFIID  riid,
void **  ppv 
)

Definition at line 1072 of file jscript.c.

1073{
1074 JScript *ret;
1075 HRESULT hres;
1076
1077 ret = heap_alloc_zero(sizeof(*ret));
1078 if(!ret)
1079 return E_OUTOFMEMORY;
1080
1081 lock_module();
1082
1083 ret->IActiveScript_iface.lpVtbl = &JScriptVtbl;
1084 ret->IActiveScriptParse_iface.lpVtbl = &JScriptParseVtbl;
1085 ret->IActiveScriptParseProcedure2_iface.lpVtbl = &JScriptParseProcedureVtbl;
1086 ret->IActiveScriptProperty_iface.lpVtbl = &JScriptPropertyVtbl;
1087 ret->IObjectSafety_iface.lpVtbl = &JScriptSafetyVtbl;
1088 ret->IVariantChangeType_iface.lpVtbl = &VariantChangeTypeVtbl;
1089 ret->ref = 1;
1090 ret->safeopt = INTERFACE_USES_DISPEX;
1091 ret->is_encode = is_encode;
1092
1093 hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
1094 IActiveScript_Release(&ret->IActiveScript_iface);
1095 return hres;
1096}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IActiveScriptParseProcedure2Vtbl JScriptParseProcedureVtbl
Definition: jscript.c:877
static const IActiveScriptParseVtbl JScriptParseVtbl
Definition: jscript.c:813
static const IVariantChangeTypeVtbl VariantChangeTypeVtbl
Definition: jscript.c:1065
static const IActiveScriptVtbl JScriptVtbl
Definition: jscript.c:655
static const IObjectSafetyVtbl JScriptSafetyVtbl
Definition: jscript.c:1007
static const IActiveScriptPropertyVtbl JScriptPropertyVtbl
Definition: jscript.c:944
static void lock_module(void)
Definition: ieframe.h:335

Referenced by JScriptEncodeFactory_CreateInstance(), and JScriptFactory_CreateInstance().

◆ decrease_state()

static void decrease_state ( JScript This,
SCRIPTSTATE  state 
)
static

Definition at line 163 of file jscript.c.

164{
165 if(This->ctx) {
166 switch(This->ctx->state) {
170 return;
171 /* FALLTHROUGH */
175
176 if(This->ctx->state == SCRIPTSTATE_DISCONNECTED)
179 return;
180 /* FALLTHROUGH */
182 if(This->ctx->host_global) {
183 IDispatch_Release(This->ctx->host_global);
184 This->ctx->host_global = NULL;
185 }
186
187 if(This->ctx->named_items) {
188 named_item_t *iter, *iter2;
189
190 iter = This->ctx->named_items;
191 while(iter) {
192 iter2 = iter->next;
193
194 if(iter->disp)
195 IDispatch_Release(iter->disp);
196 heap_free(iter->name);
197 heap_free(iter);
198 iter = iter2;
199 }
200
201 This->ctx->named_items = NULL;
202 }
203
204 if(This->ctx->secmgr) {
205 IInternetHostSecurityManager_Release(This->ctx->secmgr);
206 This->ctx->secmgr = NULL;
207 }
208
209 if(This->ctx->site) {
210 IActiveScriptSite_Release(This->ctx->site);
211 This->ctx->site = NULL;
212 }
213
214 if(This->ctx->global) {
215 jsdisp_release(This->ctx->global);
216 This->ctx->global = NULL;
217 }
218 /* FALLTHROUGH */
221 break;
222 default:
223 assert(0);
224 }
225
227 }else if(state == SCRIPTSTATE_UNINITIALIZED) {
228 if(This->site)
229 IActiveScriptSite_OnStateChange(This->site, state);
230 }else {
231 FIXME("NULL ctx\n");
232 }
233
235 This->thread_id = 0;
236
237 if(This->site) {
238 IActiveScriptSite_Release(This->site);
239 This->site = NULL;
240 }
241}
@ 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_CONNECTED
Definition: activscp.idl:59
#define FIXME(fmt,...)
Definition: debug.h:114
static void clear_script_queue(JScript *This)
Definition: jscript.c:118
static void change_state(JScript *This, SCRIPTSTATE state)
Definition: jscript.c:88
#define assert(x)
Definition: debug.h:53
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
struct named_item_t * next
Definition: jscript.h:367
LPWSTR name
Definition: jscript.h:365
IDispatch * disp
Definition: jscript.h:363

Referenced by JScript_Close(), and JScript_SetScriptState().

◆ exec_global_code()

static HRESULT exec_global_code ( JScript This,
bytecode_t code 
)
static

Definition at line 105 of file jscript.c.

106{
108
109 IActiveScriptSite_OnEnterScript(This->site);
110
111 clear_ei(This->ctx);
112 hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, NULL);
113
114 IActiveScriptSite_OnLeaveScript(This->site);
115 return hres;
116}
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope, IDispatch *this_obj, jsdisp_t *function_instance, jsdisp_t *variable_obj, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: engine.c:2958
#define EXEC_GLOBAL
Definition: engine.h:248
Definition: inflate.c:139

Referenced by exec_queued_code(), and JScriptParse_ParseScriptText().

◆ exec_queued_code()

static void exec_queued_code ( JScript This)
static

Definition at line 136 of file jscript.c.

137{
138 bytecode_t *iter;
139
140 for(iter = This->queue_head; iter; iter = iter->next)
141 exec_global_code(This, iter);
142
144}
static HRESULT exec_global_code(JScript *This, bytecode_t *code)
Definition: jscript.c:105

Referenced by JScript_SetScriptState().

◆ impl_from_IActiveScript()

◆ impl_from_IActiveScriptParse()

static JScript * impl_from_IActiveScriptParse ( IActiveScriptParse *  iface)
inlinestatic

◆ impl_from_IActiveScriptParseProcedure2()

static JScript * impl_from_IActiveScriptParseProcedure2 ( IActiveScriptParseProcedure2 *  iface)
inlinestatic

Definition at line 822 of file jscript.c.

823{
824 return CONTAINING_RECORD(iface, JScript, IActiveScriptParseProcedure2_iface);
825}

Referenced by JScriptParseProcedure_AddRef(), JScriptParseProcedure_ParseProcedureText(), JScriptParseProcedure_QueryInterface(), and JScriptParseProcedure_Release().

◆ impl_from_IActiveScriptProperty()

static JScript * impl_from_IActiveScriptProperty ( IActiveScriptProperty iface)
inlinestatic

Definition at line 884 of file jscript.c.

885{
886 return CONTAINING_RECORD(iface, JScript, IActiveScriptProperty_iface);
887}

Referenced by JScriptProperty_AddRef(), JScriptProperty_GetProperty(), JScriptProperty_QueryInterface(), JScriptProperty_Release(), and JScriptProperty_SetProperty().

◆ impl_from_IObjectSafety()

static JScript * impl_from_IObjectSafety ( IObjectSafety iface)
inlinestatic

◆ impl_from_IServiceProvider()

static AXSite * impl_from_IServiceProvider ( IServiceProvider iface)
inlinestatic

Definition at line 251 of file jscript.c.

252{
253 return CONTAINING_RECORD(iface, AXSite, IServiceProvider_iface);
254}

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

◆ impl_from_IVariantChangeType()

static JScript * impl_from_IVariantChangeType ( IVariantChangeType iface)
inlinestatic

Definition at line 1015 of file jscript.c.

1016{
1017 return CONTAINING_RECORD(iface, JScript, IVariantChangeType_iface);
1018}

Referenced by VariantChangeType_AddRef(), VariantChangeType_ChangeType(), VariantChangeType_QueryInterface(), and VariantChangeType_Release().

◆ is_started()

static BOOL is_started ( script_ctx_t ctx)
inlinestatic

Definition at line 98 of file jscript.c.

99{
100 return ctx->state == SCRIPTSTATE_STARTED
101 || ctx->state == SCRIPTSTATE_CONNECTED
102 || ctx->state == SCRIPTSTATE_DISCONNECTED;
103}

Referenced by JScriptParse_ParseScriptText().

◆ JScript_AddNamedItem()

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

Definition at line 530 of file jscript.c.

532{
535 IDispatch *disp = NULL;
537
538 TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags);
539
540 if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED)
541 return E_UNEXPECTED;
542
543 if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) {
544 IUnknown *unk;
545
546 hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL);
547 if(FAILED(hres)) {
548 WARN("GetItemInfo failed: %08x\n", hres);
549 return hres;
550 }
551
552 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
553 IUnknown_Release(unk);
554 if(FAILED(hres)) {
555 WARN("object does not implement IDispatch\n");
556 return hres;
557 }
558
559 if(This->ctx->host_global)
560 IDispatch_Release(This->ctx->host_global);
561 IDispatch_AddRef(disp);
562 This->ctx->host_global = disp;
563 }
564
565 item = heap_alloc(sizeof(*item));
566 if(!item) {
567 if(disp)
568 IDispatch_Release(disp);
569 return E_OUTOFMEMORY;
570 }
571
572 item->disp = disp;
573 item->flags = dwFlags;
574 item->name = heap_strdupW(pstrName);
575 if(!item->name) {
576 if(disp)
577 IDispatch_Release(disp);
579 return E_OUTOFMEMORY;
580 }
581
582 item->next = This->ctx->named_items;
583 This->ctx->named_items = item;
584
585 return S_OK;
586}
@ SCRIPTSTATE_CLOSED
Definition: activscp.idl:61
#define WARN(fmt,...)
Definition: debug.h:115
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
static JScript * impl_from_IActiveScript(IActiveScript *iface)
Definition: jscript.c:348
#define debugstr_w
Definition: kernel32.h:32
static ATOM item
Definition: dde.c:856
const GUID IID_IDispatch
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

◆ JScript_AddRef()

static ULONG WINAPI JScript_AddRef ( IActiveScript iface)
static

Definition at line 394 of file jscript.c.

395{
398
399 TRACE("(%p) ref=%d\n", This, ref);
400
401 return ref;
402}

◆ JScript_AddTypeLib()

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

Definition at line 588 of file jscript.c.

590{
592 FIXME("(%p)->()\n", This);
593 return E_NOTIMPL;
594}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ JScript_Clone()

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

Definition at line 648 of file jscript.c.

649{
651 FIXME("(%p)->()\n", This);
652 return E_NOTIMPL;
653}

◆ JScript_Close()

static HRESULT WINAPI JScript_Close ( IActiveScript iface)
static

Definition at line 517 of file jscript.c.

518{
520
521 TRACE("(%p)->()\n", This);
522
523 if(This->thread_id && This->thread_id != GetCurrentThreadId())
524 return E_UNEXPECTED;
525
527 return S_OK;
528}
static void decrease_state(JScript *This, SCRIPTSTATE state)
Definition: jscript.c:163

◆ JScript_GetCurrentScriptThreadID()

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

Definition at line 616 of file jscript.c.

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

◆ JScript_GetScriptDispatch()

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

Definition at line 596 of file jscript.c.

598{
600
601 TRACE("(%p)->(%p)\n", This, ppdisp);
602
603 if(!ppdisp)
604 return E_POINTER;
605
606 if(This->thread_id != GetCurrentThreadId() || !This->ctx->global) {
607 *ppdisp = NULL;
608 return E_UNEXPECTED;
609 }
610
611 *ppdisp = to_disp(This->ctx->global);
612 IDispatch_AddRef(*ppdisp);
613 return S_OK;
614}
static IDispatch * to_disp(jsdisp_t *jsdisp)
Definition: jscript.h:245
#define E_POINTER
Definition: winerror.h:2365

◆ JScript_GetScriptSite()

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

Definition at line 453 of file jscript.c.

455{
457 FIXME("(%p)->()\n", This);
458 return E_NOTIMPL;
459}

◆ JScript_GetScriptState()

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

Definition at line 501 of file jscript.c.

502{
504
505 TRACE("(%p)->(%p)\n", This, pssState);
506
507 if(!pssState)
508 return E_POINTER;
509
510 if(This->thread_id && This->thread_id != GetCurrentThreadId())
511 return E_UNEXPECTED;
512
513 *pssState = This->ctx ? This->ctx->state : SCRIPTSTATE_UNINITIALIZED;
514 return S_OK;
515}

◆ JScript_GetScriptThreadID()

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

Definition at line 624 of file jscript.c.

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

◆ JScript_GetScriptThreadState()

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

Definition at line 632 of file jscript.c.

634{
636 FIXME("(%p)->()\n", This);
637 return E_NOTIMPL;
638}

◆ JScript_InterruptScriptThread()

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

Definition at line 640 of file jscript.c.

642{
644 FIXME("(%p)->()\n", This);
645 return E_NOTIMPL;
646}

◆ JScript_QueryInterface()

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

Definition at line 353 of file jscript.c.

354{
356
357 *ppv = NULL;
358
360 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
361 *ppv = &This->IActiveScript_iface;
362 }else if(IsEqualGUID(riid, &IID_IActiveScript)) {
363 TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv);
364 *ppv = &This->IActiveScript_iface;
365 }else if(IsEqualGUID(riid, &IID_IActiveScriptParse)) {
366 TRACE("(%p)->(IID_IActiveScriptParse %p)\n", This, ppv);
367 *ppv = &This->IActiveScriptParse_iface;
368 }else if(IsEqualGUID(riid, &IID_IActiveScriptParseProcedure)) {
369 TRACE("(%p)->(IID_IActiveScriptParseProcedure %p)\n", This, ppv);
370 *ppv = &This->IActiveScriptParseProcedure2_iface;
371 }else if(IsEqualGUID(riid, &IID_IActiveScriptParseProcedure2)) {
372 TRACE("(%p)->(IID_IActiveScriptParseProcedure2 %p)\n", This, ppv);
373 *ppv = &This->IActiveScriptParseProcedure2_iface;
374 }else if(IsEqualGUID(riid, &IID_IActiveScriptProperty)) {
375 TRACE("(%p)->(IID_IActiveScriptProperty %p)\n", This, ppv);
376 *ppv = &This->IActiveScriptProperty_iface;
377 }else if(IsEqualGUID(riid, &IID_IObjectSafety)) {
378 TRACE("(%p)->(IID_IObjectSafety %p)\n", This, ppv);
379 *ppv = &This->IObjectSafety_iface;
380 }else if(IsEqualGUID(riid, &IID_IVariantChangeType)) {
381 TRACE("(%p)->(IID_IVariantChangeType %p)\n", This, ppv);
382 *ppv = &This->IVariantChangeType_iface;
383 }
384
385 if(*ppv) {
386 IUnknown_AddRef((IUnknown*)*ppv);
387 return S_OK;
388 }
389
390 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
391 return E_NOINTERFACE;
392}

◆ JScript_Release()

static ULONG WINAPI JScript_Release ( IActiveScript iface)
static

Definition at line 404 of file jscript.c.

405{
408
409 TRACE("(%p) ref=%d\n", iface, ref);
410
411 if(!ref) {
412 if(This->ctx && This->ctx->state != SCRIPTSTATE_CLOSED)
413 IActiveScript_Close(&This->IActiveScript_iface);
414 if(This->ctx) {
415 This->ctx->active_script = NULL;
416 script_release(This->ctx);
417 }
420 }
421
422 return ref;
423}
void script_release(script_ctx_t *ctx)
Definition: jscript.c:67
static void unlock_module(void)
Definition: ieframe.h:339

◆ JScript_SetScriptSite()

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

Definition at line 425 of file jscript.c.

427{
429 LCID lcid;
431
432 TRACE("(%p)->(%p)\n", This, pass);
433
434 if(!pass)
435 return E_POINTER;
436
437 if(This->site)
438 return E_UNEXPECTED;
439
441 return E_UNEXPECTED;
442
443 This->site = pass;
444 IActiveScriptSite_AddRef(This->site);
445
446 hres = IActiveScriptSite_GetLCID(This->site, &lcid);
447 if(hres == S_OK)
448 This->lcid = lcid;
449
450 return This->ctx ? set_ctx_site(This) : S_OK;
451}
static HRESULT set_ctx_site(JScript *This)
Definition: jscript.c:146
#define InterlockedCompareExchange
Definition: interlocked.h:104
DWORD LCID
Definition: nls.h:13
pass
Definition: typegen.h:25

◆ JScript_SetScriptState()

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

Definition at line 461 of file jscript.c.

462{
464
465 TRACE("(%p)->(%d)\n", This, ss);
466
467 if(This->thread_id && GetCurrentThreadId() != This->thread_id)
468 return E_UNEXPECTED;
469
471 if(This->ctx && This->ctx->state == SCRIPTSTATE_CLOSED)
472 return E_UNEXPECTED;
473
475 return S_OK;
476 }
477
478 if(!This->ctx)
479 return E_UNEXPECTED;
480
481 switch(ss) {
483 case SCRIPTSTATE_CONNECTED: /* FIXME */
484 if(This->ctx->state == SCRIPTSTATE_CLOSED)
485 return E_UNEXPECTED;
486
488 break;
490 FIXME("unimplemented SCRIPTSTATE_INITIALIZED\n");
491 return S_OK;
492 default:
493 FIXME("unimplemented state %d\n", ss);
494 return E_NOTIMPL;
495 }
496
498 return S_OK;
499}
static void exec_queued_code(JScript *This)
Definition: jscript.c:136
#define ss
Definition: i386-dis.c:441

◆ JScriptParse_AddRef()

static ULONG WINAPI JScriptParse_AddRef ( IActiveScriptParse *  iface)
static

Definition at line 685 of file jscript.c.

686{
688 return IActiveScript_AddRef(&This->IActiveScript_iface);
689}
static JScript * impl_from_IActiveScriptParse(IActiveScriptParse *iface)
Definition: jscript.c:674

◆ JScriptParse_AddScriptlet()

static HRESULT WINAPI JScriptParse_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 739 of file jscript.c.

744{
746 FIXME("(%p)->(%s %s %s %s %s %s %s %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
747 debugstr_w(pstrCode), debugstr_w(pstrItemName), debugstr_w(pstrSubItemName),
748 debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), wine_dbgstr_longlong(dwSourceContextCookie),
749 ulStartingLineNumber, dwFlags, pbstrName, pexcepinfo);
750 return E_NOTIMPL;
751}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

◆ JScriptParse_InitNew()

static HRESULT WINAPI JScriptParse_InitNew ( IActiveScriptParse *  iface)
static

Definition at line 697 of file jscript.c.

698{
702
703 TRACE("(%p)\n", This);
704
705 if(This->ctx)
706 return E_UNEXPECTED;
707
708 ctx = heap_alloc_zero(sizeof(script_ctx_t));
709 if(!ctx)
710 return E_OUTOFMEMORY;
711
712 ctx->ref = 1;
714 ctx->active_script = &This->IActiveScript_iface;
715 ctx->safeopt = This->safeopt;
716 ctx->version = This->version;
717 ctx->html_mode = This->html_mode;
718 ctx->ei.val = jsval_undefined();
719 ctx->acc = jsval_undefined();
720 heap_pool_init(&ctx->tmp_heap);
721
723 if(FAILED(hres)) {
724 heap_free(ctx);
725 return hres;
726 }
727
728 ctx->last_match = jsstr_empty();
729
731 if(ctx) {
733 return E_UNEXPECTED;
734 }
735
736 return This->site ? set_ctx_site(This) : S_OK;
737}
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
void heap_pool_init(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:71
HRESULT create_jscaller(script_ctx_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:1047
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
static jsval_t jsval_undefined(void)
Definition: jsval.h:137

◆ JScriptParse_ParseScriptText()

static HRESULT WINAPI JScriptParse_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 753 of file jscript.c.

757{
761
762 TRACE("(%p)->(%s %s %p %s %s %u %x %p %p)\n", This, debugstr_w(pstrCode),
763 debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
764 wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLine, dwFlags, pvarResult, pexcepinfo);
765
766 if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
767 return E_UNEXPECTED;
768
769 hres = compile_script(This->ctx, pstrCode, NULL, pstrDelimiter, (dwFlags & SCRIPTTEXT_ISEXPRESSION) != 0,
770 This->is_encode, &code);
771 if(FAILED(hres))
772 return hres;
773
774 if(dwFlags & SCRIPTTEXT_ISEXPRESSION) {
775 jsval_t r;
776
777 IActiveScriptSite_OnEnterScript(This->site);
778
779 clear_ei(This->ctx);
780 hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, &r);
781 if(SUCCEEDED(hres)) {
782 if(pvarResult)
783 hres = jsval_to_variant(r, pvarResult);
785 }
786
787 IActiveScriptSite_OnLeaveScript(This->site);
788 return hres;
789 }
790
791 /*
792 * Although pvarResult is not really used without SCRIPTTEXT_ISEXPRESSION flag, if it's not NULL,
793 * script is executed immediately, even if it's not in started state yet.
794 */
795 if(!pvarResult && !is_started(This->ctx)) {
796 if(This->queue_tail)
797 This->queue_tail = This->queue_tail->next = code;
798 else
799 This->queue_head = This->queue_tail = code;
800 return S_OK;
801 }
802
805 if(FAILED(hres))
806 return hres;
807
808 if(pvarResult)
809 V_VT(pvarResult) = VT_EMPTY;
810 return S_OK;
811}
@ VT_EMPTY
Definition: compat.h:2295
static BOOL is_started(script_ctx_t *ctx)
Definition: jscript.c:98
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define SUCCEEDED(hr)
Definition: intsafe.h:50
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
void jsval_release(jsval_t val)
Definition: jsutils.c:191
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
Definition: jsutils.c:347
#define V_VT(A)
Definition: oleauto.h:211
Definition: jsval.h:54

◆ JScriptParse_QueryInterface()

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

Definition at line 679 of file jscript.c.

680{
682 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
683}

◆ JScriptParse_Release()

static ULONG WINAPI JScriptParse_Release ( IActiveScriptParse *  iface)
static

Definition at line 691 of file jscript.c.

692{
694 return IActiveScript_Release(&This->IActiveScript_iface);
695}

◆ JScriptParseProcedure_AddRef()

static ULONG WINAPI JScriptParseProcedure_AddRef ( IActiveScriptParseProcedure2 *  iface)
static

Definition at line 833 of file jscript.c.

834{
836 return IActiveScript_AddRef(&This->IActiveScript_iface);
837}
static JScript * impl_from_IActiveScriptParseProcedure2(IActiveScriptParseProcedure2 *iface)
Definition: jscript.c:822

◆ JScriptParseProcedure_ParseProcedureText()

static HRESULT WINAPI JScriptParseProcedure_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 845 of file jscript.c.

849{
852 jsdisp_t *dispex;
854
855 TRACE("(%p)->(%s %s %s %s %p %s %s %u %x %p)\n", This, debugstr_w(pstrCode), debugstr_w(pstrFormalParams),
856 debugstr_w(pstrProcedureName), debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
857 wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLineNumber, dwFlags, ppdisp);
858
859 if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
860 return E_UNEXPECTED;
861
862 hres = compile_script(This->ctx, pstrCode, pstrFormalParams, pstrDelimiter, FALSE, This->is_encode, &code);
863 if(FAILED(hres)) {
864 WARN("Parse failed %08x\n", hres);
865 return hres;
866 }
867
868 hres = create_source_function(This->ctx, code, &code->global_code, NULL, &dispex);
870 if(FAILED(hres))
871 return hres;
872
873 *ppdisp = to_disp(dispex);
874 return S_OK;
875}
#define FALSE
Definition: types.h:117
HRESULT create_source_function(script_ctx_t *, bytecode_t *, function_code_t *, scope_chain_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: function.c:767

◆ JScriptParseProcedure_QueryInterface()

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

Definition at line 827 of file jscript.c.

828{
830 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
831}

◆ JScriptParseProcedure_Release()

static ULONG WINAPI JScriptParseProcedure_Release ( IActiveScriptParseProcedure2 *  iface)
static

Definition at line 839 of file jscript.c.

840{
842 return IActiveScript_Release(&This->IActiveScript_iface);
843}

◆ JScriptProperty_AddRef()

static ULONG WINAPI JScriptProperty_AddRef ( IActiveScriptProperty iface)
static

Definition at line 895 of file jscript.c.

896{
898 return IActiveScript_AddRef(&This->IActiveScript_iface);
899}
static JScript * impl_from_IActiveScriptProperty(IActiveScriptProperty *iface)
Definition: jscript.c:884

◆ JScriptProperty_GetProperty()

static HRESULT WINAPI JScriptProperty_GetProperty ( IActiveScriptProperty iface,
DWORD  dwProperty,
VARIANT pvarIndex,
VARIANT pvarValue 
)
static

Definition at line 907 of file jscript.c.

909{
911 FIXME("(%p)->(%x %p %p)\n", This, dwProperty, pvarIndex, pvarValue);
912 return E_NOTIMPL;
913}

◆ JScriptProperty_QueryInterface()

static HRESULT WINAPI JScriptProperty_QueryInterface ( IActiveScriptProperty iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 889 of file jscript.c.

890{
892 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
893}

◆ JScriptProperty_Release()

static ULONG WINAPI JScriptProperty_Release ( IActiveScriptProperty iface)
static

Definition at line 901 of file jscript.c.

902{
904 return IActiveScript_Release(&This->IActiveScript_iface);
905}

◆ JScriptProperty_SetProperty()

static HRESULT WINAPI JScriptProperty_SetProperty ( IActiveScriptProperty iface,
DWORD  dwProperty,
VARIANT pvarIndex,
VARIANT pvarValue 
)
static

Definition at line 915 of file jscript.c.

917{
919
920 TRACE("(%p)->(%x %s %s)\n", This, dwProperty, debugstr_variant(pvarIndex), debugstr_variant(pvarValue));
921
922 if(pvarIndex)
923 FIXME("unsupported pvarIndex\n");
924
925 switch(dwProperty) {
926 case SCRIPTPROP_INVOKEVERSIONING:
927 if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0
928 || (V_I4(pvarValue) > 15 && !(V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML))) {
929 WARN("invalid value %s\n", debugstr_variant(pvarValue));
930 return E_INVALIDARG;
931 }
932
933 This->version = V_I4(pvarValue) & 0x1ff;
934 This->html_mode = (V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML) != 0;
935 break;
936 default:
937 FIXME("Unimplemented property %x\n", dwProperty);
938 return E_NOTIMPL;
939 }
940
941 return S_OK;
942}
#define E_INVALIDARG
Definition: ddrawi.h:101
@ VT_I4
Definition: compat.h:2298
#define SCRIPTLANGUAGEVERSION_HTML
Definition: jscript.h:47
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define V_I4(A)
Definition: oleauto.h:247

◆ JScriptSafety_AddRef()

static ULONG WINAPI JScriptSafety_AddRef ( IObjectSafety iface)
static

Definition at line 963 of file jscript.c.

964{
966 return IActiveScript_AddRef(&This->IActiveScript_iface);
967}
static JScript * impl_from_IObjectSafety(IObjectSafety *iface)
Definition: jscript.c:952

◆ JScriptSafety_GetInterfaceSafetyOptions()

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

Definition at line 977 of file jscript.c.

979{
981
982 TRACE("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), pdwSupportedOptions, pdwEnabledOptions);
983
984 if(!pdwSupportedOptions || !pdwEnabledOptions)
985 return E_POINTER;
986
987 *pdwSupportedOptions = SUPPORTED_OPTIONS;
988 *pdwEnabledOptions = This->safeopt;
989
990 return S_OK;
991}
#define SUPPORTED_OPTIONS
Definition: jscript.c:975

◆ JScriptSafety_QueryInterface()

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

Definition at line 957 of file jscript.c.

958{
960 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
961}

◆ JScriptSafety_Release()

static ULONG WINAPI JScriptSafety_Release ( IObjectSafety iface)
static

Definition at line 969 of file jscript.c.

970{
972 return IActiveScript_Release(&This->IActiveScript_iface);
973}

◆ JScriptSafety_SetInterfaceSafetyOptions()

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

Definition at line 993 of file jscript.c.

995{
997
998 TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
999
1000 if(dwOptionSetMask & ~SUPPORTED_OPTIONS)
1001 return E_FAIL;
1002
1003 This->safeopt = (dwEnabledOptions & dwOptionSetMask) | (This->safeopt & ~dwOptionSetMask) | INTERFACE_USES_DISPEX;
1004 return S_OK;
1005}
#define E_FAIL
Definition: ddrawi.h:102

◆ script_release()

void script_release ( script_ctx_t ctx)

Definition at line 67 of file jscript.c.

68{
69 if(--ctx->ref)
70 return;
71
72 jsval_release(ctx->acc);
74 if(ctx->cc)
75 release_cc(ctx->cc);
76 heap_pool_free(&ctx->tmp_heap);
77 if(ctx->last_match)
78 jsstr_release(ctx->last_match);
79 assert(!ctx->stack_top);
80 heap_free(ctx->stack);
81
82 ctx->jscaller->ctx = NULL;
83 IServiceProvider_Release(&ctx->jscaller->IServiceProvider_iface);
84
86}
void heap_pool_free(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:169
void release_cc(cc_ctx_t *) DECLSPEC_HIDDEN
Definition: lex.c:817
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
CONTEXT ctx

Referenced by JScript_Release(), JScriptParse_InitNew(), and jsdisp_free().

◆ set_ctx_site()

static HRESULT set_ctx_site ( JScript This)
static

Definition at line 146 of file jscript.c.

147{
149
150 This->ctx->lcid = This->lcid;
151
152 hres = init_global(This->ctx);
153 if(FAILED(hres))
154 return hres;
155
156 IActiveScriptSite_AddRef(This->site);
157 This->ctx->site = This->site;
158
160 return S_OK;
161}
HRESULT init_global(script_ctx_t *ctx)
Definition: global.c:1105

Referenced by JScript_SetScriptSite(), and JScriptParse_InitNew().

◆ VariantChangeType_AddRef()

static ULONG WINAPI VariantChangeType_AddRef ( IVariantChangeType iface)
static

Definition at line 1026 of file jscript.c.

1027{
1029 return IActiveScript_AddRef(&This->IActiveScript_iface);
1030}
static JScript * impl_from_IVariantChangeType(IVariantChangeType *iface)
Definition: jscript.c:1015

◆ VariantChangeType_ChangeType()

static HRESULT WINAPI VariantChangeType_ChangeType ( IVariantChangeType iface,
VARIANT dst,
VARIANT src,
LCID  lcid,
VARTYPE  vt 
)
static

Definition at line 1038 of file jscript.c.

1039{
1041 VARIANT res;
1042 HRESULT hres;
1043
1044 TRACE("(%p)->(%p %p%s %x %d)\n", This, dst, src, debugstr_variant(src), lcid, vt);
1045
1046 if(!This->ctx) {
1047 FIXME("Object uninitialized\n");
1048 return E_UNEXPECTED;
1049 }
1050
1051 hres = variant_change_type(This->ctx, &res, src, vt);
1052 if(FAILED(hres))
1053 return hres;
1054
1056 if(FAILED(hres)) {
1057 VariantClear(&res);
1058 return hres;
1059 }
1060
1061 *dst = res;
1062 return S_OK;
1063}
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
HRESULT variant_change_type(script_ctx_t *, VARIANT *, VARIANT *, VARTYPE) DECLSPEC_HIDDEN
Definition: jsutils.c:881
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648

◆ VariantChangeType_QueryInterface()

static HRESULT WINAPI VariantChangeType_QueryInterface ( IVariantChangeType iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1020 of file jscript.c.

1021{
1023 return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
1024}

◆ VariantChangeType_Release()

static ULONG WINAPI VariantChangeType_Release ( IVariantChangeType iface)
static

Definition at line 1032 of file jscript.c.

1033{
1035 return IActiveScript_Release(&This->IActiveScript_iface);
1036}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( jscript  )

Variable Documentation

◆ AXSiteVtbl

IServiceProviderVtbl AXSiteVtbl
static
Initial value:
= {
}
static ULONG WINAPI AXSite_Release(IServiceProvider *iface)
Definition: jscript.c:286
static ULONG WINAPI AXSite_AddRef(IServiceProvider *iface)
Definition: jscript.c:276
static HRESULT WINAPI AXSite_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: jscript.c:256
static HRESULT WINAPI AXSite_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: jscript.c:304

Definition at line 317 of file jscript.c.

Referenced by create_ax_site().

◆ JScriptParseProcedureVtbl

const IActiveScriptParseProcedure2Vtbl JScriptParseProcedureVtbl
static
Initial value:
= {
}
static HRESULT WINAPI JScriptParseProcedure_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: jscript.c:845
static HRESULT WINAPI JScriptParseProcedure_QueryInterface(IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
Definition: jscript.c:827
static ULONG WINAPI JScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
Definition: jscript.c:833
static ULONG WINAPI JScriptParseProcedure_Release(IActiveScriptParseProcedure2 *iface)
Definition: jscript.c:839

Definition at line 877 of file jscript.c.

Referenced by create_jscript_object().

◆ JScriptParseVtbl

const IActiveScriptParseVtbl JScriptParseVtbl
static
Initial value:
= {
}
static ULONG WINAPI JScriptParse_Release(IActiveScriptParse *iface)
Definition: jscript.c:691
static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
Definition: jscript.c:697
static HRESULT WINAPI JScriptParse_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: jscript.c:739
static HRESULT WINAPI JScriptParse_QueryInterface(IActiveScriptParse *iface, REFIID riid, void **ppv)
Definition: jscript.c:679
static ULONG WINAPI JScriptParse_AddRef(IActiveScriptParse *iface)
Definition: jscript.c:685
static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
Definition: jscript.c:753

Definition at line 813 of file jscript.c.

Referenced by create_jscript_object().

◆ JScriptPropertyVtbl

const IActiveScriptPropertyVtbl JScriptPropertyVtbl
static
Initial value:
= {
}
static HRESULT WINAPI JScriptProperty_SetProperty(IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
Definition: jscript.c:915
static HRESULT WINAPI JScriptProperty_GetProperty(IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
Definition: jscript.c:907
static ULONG WINAPI JScriptProperty_AddRef(IActiveScriptProperty *iface)
Definition: jscript.c:895
static HRESULT WINAPI JScriptProperty_QueryInterface(IActiveScriptProperty *iface, REFIID riid, void **ppv)
Definition: jscript.c:889
static ULONG WINAPI JScriptProperty_Release(IActiveScriptProperty *iface)
Definition: jscript.c:901

Definition at line 944 of file jscript.c.

Referenced by create_jscript_object().

◆ JScriptSafetyVtbl

const IObjectSafetyVtbl JScriptSafetyVtbl
static
Initial value:
= {
}
static ULONG WINAPI JScriptSafety_AddRef(IObjectSafety *iface)
Definition: jscript.c:963
static HRESULT WINAPI JScriptSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: jscript.c:957
static HRESULT WINAPI JScriptSafety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
Definition: jscript.c:977
static HRESULT WINAPI JScriptSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
Definition: jscript.c:993
static ULONG WINAPI JScriptSafety_Release(IObjectSafety *iface)
Definition: jscript.c:969

Definition at line 1007 of file jscript.c.

Referenced by create_jscript_object().

◆ JScriptVtbl

const IActiveScriptVtbl JScriptVtbl
static
Initial value:
= {
}
static HRESULT WINAPI JScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
Definition: jscript.c:461
static HRESULT WINAPI JScript_GetCurrentScriptThreadID(IActiveScript *iface, SCRIPTTHREADID *pstridThread)
Definition: jscript.c:616
static ULONG WINAPI JScript_AddRef(IActiveScript *iface)
Definition: jscript.c:394
static ULONG WINAPI JScript_Release(IActiveScript *iface)
Definition: jscript.c:404
static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstrName, DWORD dwFlags)
Definition: jscript.c:530
static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, IActiveScriptSite *pass)
Definition: jscript.c:425
static HRESULT WINAPI JScript_Close(IActiveScript *iface)
Definition: jscript.c:517
static HRESULT WINAPI JScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
Definition: jscript.c:648
static HRESULT WINAPI JScript_GetScriptThreadState(IActiveScript *iface, SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
Definition: jscript.c:632
static HRESULT WINAPI JScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTypeLib, DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
Definition: jscript.c:588
static HRESULT WINAPI JScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
Definition: jscript.c:501
static HRESULT WINAPI JScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
Definition: jscript.c:596
static HRESULT WINAPI JScript_GetScriptSite(IActiveScript *iface, REFIID riid, void **ppvObject)
Definition: jscript.c:453
static HRESULT WINAPI JScript_InterruptScriptThread(IActiveScript *iface, SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
Definition: jscript.c:640
static HRESULT WINAPI JScript_GetScriptThreadID(IActiveScript *iface, DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
Definition: jscript.c:624
static HRESULT WINAPI JScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
Definition: jscript.c:353

Definition at line 655 of file jscript.c.

Referenced by create_jscript_object().

◆ VariantChangeTypeVtbl

const IVariantChangeTypeVtbl VariantChangeTypeVtbl
static
Initial value:
= {
}
static HRESULT WINAPI VariantChangeType_ChangeType(IVariantChangeType *iface, VARIANT *dst, VARIANT *src, LCID lcid, VARTYPE vt)
Definition: jscript.c:1038
static ULONG WINAPI VariantChangeType_Release(IVariantChangeType *iface)
Definition: jscript.c:1032
static ULONG WINAPI VariantChangeType_AddRef(IVariantChangeType *iface)
Definition: jscript.c:1026
static HRESULT WINAPI VariantChangeType_QueryInterface(IVariantChangeType *iface, REFIID riid, void **ppv)
Definition: jscript.c:1020

Definition at line 1065 of file jscript.c.

Referenced by create_jscript_object().