ReactOS 0.4.15-dev-5666-gc548b97
vbscript.h File Reference
#include <stdarg.h>
#include <stdint.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "dispex.h"
#include "activscp.h"
#include "activdbg.h"
#include "vbscript_classes.h"
#include "vbscript_defs.h"
#include "wine/heap.h"
#include "wine/list.h"
Include dependency graph for vbscript.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  heap_pool_t
 
struct  named_item_t
 
struct  array_desc_t
 
struct  vbdisp_prop_desc_t
 
struct  vbdisp_funcprop_desc_t
 
struct  _class_desc_t
 
struct  _vbdisp_t
 
struct  ScriptDisp
 
struct  BuiltinDisp
 
struct  _dynamic_var_t
 
struct  _script_ctx_t
 
union  instr_arg_t
 
struct  instr_t
 
struct  arg_desc_t
 
struct  var_desc_t
 
struct  _function_t
 
struct  _vbscode_t
 

Macros

#define COBJMACROS
 
#define OP_LIST
 
#define X(x, n, a, b)   OP_##x,
 
#define FACILITY_VBS   0xa
 
#define MAKE_VBSERROR(code)   MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code)
 
#define VBSCRIPT_BUILD_VERSION   16978
 
#define VBSCRIPT_MAJOR_VERSION   5
 
#define VBSCRIPT_MINOR_VERSION   8
 

Typedefs

typedef struct _function_t function_t
 
typedef struct _vbscode_t vbscode_t
 
typedef struct _script_ctx_t script_ctx_t
 
typedef struct _vbdisp_t vbdisp_t
 
typedef struct named_item_t named_item_t
 
typedef struct _class_desc_t class_desc_t
 
typedef struct _ident_map_t ident_map_t
 
typedef struct _builtin_prop_t builtin_prop_t
 
typedef struct _dynamic_var_t dynamic_var_t
 

Enumerations

enum  vbdisp_invoke_type_t { VBDISP_CALLGET , VBDISP_LET , VBDISP_SET , VBDISP_ANY }
 
enum  instr_arg_type_t {
  ARG_NONE = 0 , ARG_ADDR , ARG_BSTR , ARG_DBL ,
  ARG_FUNC , ARG_INT , ARG_STR , ARG_UINT ,
  ARG_NONE = 0 , ARG_STR , ARG_BSTR , ARG_INT ,
  ARG_UINT , ARG_ADDR , ARG_DOUBLE
}
 
enum  vbsop_t { OP_LAST }
 
enum  function_type_t {
  FUNC_GLOBAL , FUNC_FUNCTION , FUNC_SUB , FUNC_PROPGET ,
  FUNC_PROPLET , FUNC_PROPSET , FUNC_DEFGET
}
 

Functions

void heap_pool_init (heap_pool_t *) DECLSPEC_HIDDEN
 
voidheap_pool_alloc (heap_pool_t *, size_t) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN
 
voidheap_pool_grow (heap_pool_t *, void *, DWORD, DWORD) DECLSPEC_HIDDEN
 
void heap_pool_clear (heap_pool_t *) DECLSPEC_HIDDEN
 
void heap_pool_free (heap_pool_t *) DECLSPEC_HIDDEN
 
heap_pool_theap_pool_mark (heap_pool_t *) DECLSPEC_HIDDEN
 
HRESULT create_vbdisp (const class_desc_t *, vbdisp_t **) DECLSPEC_HIDDEN
 
HRESULT disp_get_id (IDispatch *, BSTR, vbdisp_invoke_type_t, BOOL, DISPID *) DECLSPEC_HIDDEN
 
HRESULT vbdisp_get_id (vbdisp_t *, BSTR, vbdisp_invoke_type_t, BOOL, DISPID *) DECLSPEC_HIDDEN
 
HRESULT disp_call (script_ctx_t *, IDispatch *, DISPID, DISPPARAMS *, VARIANT *) DECLSPEC_HIDDEN
 
HRESULT disp_propput (script_ctx_t *, IDispatch *, DISPID, WORD, DISPPARAMS *) DECLSPEC_HIDDEN
 
HRESULT get_disp_value (script_ctx_t *, IDispatch *, VARIANT *) DECLSPEC_HIDDEN
 
void collect_objects (script_ctx_t *) DECLSPEC_HIDDEN
 
HRESULT create_script_disp (script_ctx_t *, ScriptDisp **) DECLSPEC_HIDDEN
 
HRESULT to_int (VARIANT *, int *) DECLSPEC_HIDDEN
 
static unsigned arg_cnt (const DISPPARAMS *dp)
 
static VARIANTget_arg (DISPPARAMS *dp, DWORD i)
 
HRESULT init_global (script_ctx_t *) DECLSPEC_HIDDEN
 
HRESULT init_err (script_ctx_t *) DECLSPEC_HIDDEN
 
IUnknowncreate_ax_site (script_ctx_t *) DECLSPEC_HIDDEN
 
void release_vbscode (vbscode_t *) DECLSPEC_HIDDEN
 
HRESULT compile_script (script_ctx_t *, const WCHAR *, const WCHAR *, DWORD, vbscode_t **) DECLSPEC_HIDDEN
 
HRESULT compile_procedure (script_ctx_t *, const WCHAR *, const WCHAR *, DWORD, class_desc_t **) DECLSPEC_HIDDEN
 
HRESULT exec_script (script_ctx_t *, BOOL, function_t *, vbdisp_t *, DISPPARAMS *, VARIANT *) DECLSPEC_HIDDEN
 
void release_dynamic_vars (dynamic_var_t *) DECLSPEC_HIDDEN
 
IDispatchlookup_named_item (script_ctx_t *, const WCHAR *, unsigned) DECLSPEC_HIDDEN
 
void clear_ei (EXCEPINFO *) DECLSPEC_HIDDEN
 
HRESULT report_script_error (script_ctx_t *) DECLSPEC_HIDDEN
 
void detach_global_objects (script_ctx_t *) DECLSPEC_HIDDEN
 
HRESULT get_builtin_id (BuiltinDisp *, const WCHAR *, DISPID *) DECLSPEC_HIDDEN
 
void release_regexp_typelib (void) DECLSPEC_HIDDEN
 
static BOOL is_int32 (double d)
 
HRESULT create_regexp (IDispatch **) DECLSPEC_HIDDEN
 
HRESULT map_hres (HRESULT) DECLSPEC_HIDDEN
 
HRESULT create_safearray_iter (SAFEARRAY *sa, IEnumVARIANT **ev) DECLSPEC_HIDDEN
 
HRESULT WINAPI VBScriptFactory_CreateInstance (IClassFactory *, IUnknown *, REFIID, void **) DECLSPEC_HIDDEN
 
HRESULT WINAPI VBScriptRegExpFactory_CreateInstance (IClassFactory *, IUnknown *, REFIID, void **) DECLSPEC_HIDDEN
 
BSTR get_vbscript_string (int) DECLSPEC_HIDDEN
 
BSTR get_vbscript_error_string (HRESULT) DECLSPEC_HIDDEN
 
static LPWSTR heap_strdupW (LPCWSTR str)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file vbscript.h.

◆ FACILITY_VBS

#define FACILITY_VBS   0xa

Definition at line 378 of file vbscript.h.

◆ MAKE_VBSERROR

#define MAKE_VBSERROR (   code)    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code)

Definition at line 379 of file vbscript.h.

◆ OP_LIST

#define OP_LIST

Definition at line 222 of file vbscript.h.

◆ VBSCRIPT_BUILD_VERSION

#define VBSCRIPT_BUILD_VERSION   16978

Definition at line 403 of file vbscript.h.

◆ VBSCRIPT_MAJOR_VERSION

#define VBSCRIPT_MAJOR_VERSION   5

Definition at line 404 of file vbscript.h.

◆ VBSCRIPT_MINOR_VERSION

#define VBSCRIPT_MINOR_VERSION   8

Definition at line 405 of file vbscript.h.

◆ X

#define X (   x,
  n,
  a,
  b 
)    OP_##x,

Definition at line 282 of file vbscript.h.

Typedef Documentation

◆ builtin_prop_t

Definition at line 141 of file vbscript.h.

◆ class_desc_t

◆ dynamic_var_t

◆ function_t

Definition at line 58 of file vbscript.h.

◆ ident_map_t

Definition at line 128 of file vbscript.h.

◆ named_item_t

◆ script_ctx_t

Definition at line 60 of file vbscript.h.

◆ vbdisp_t

Definition at line 61 of file vbscript.h.

◆ vbscode_t

Definition at line 59 of file vbscript.h.

Enumeration Type Documentation

◆ function_type_t

Enumerator
FUNC_GLOBAL 
FUNC_FUNCTION 
FUNC_SUB 
FUNC_PROPGET 
FUNC_PROPLET 
FUNC_PROPSET 
FUNC_DEFGET 

Definition at line 307 of file vbscript.h.

307 {
310 FUNC_SUB,
function_type_t
Definition: vbscript.h:307
@ FUNC_PROPLET
Definition: vbscript.h:312
@ FUNC_PROPSET
Definition: vbscript.h:313
@ FUNC_SUB
Definition: vbscript.h:310
@ FUNC_PROPGET
Definition: vbscript.h:311
@ FUNC_GLOBAL
Definition: vbscript.h:308
@ FUNC_DEFGET
Definition: vbscript.h:314
@ FUNC_FUNCTION
Definition: vbscript.h:309

◆ instr_arg_type_t

Enumerator
ARG_NONE 
ARG_ADDR 
ARG_BSTR 
ARG_DBL 
ARG_FUNC 
ARG_INT 
ARG_STR 
ARG_UINT 
ARG_NONE 
ARG_STR 
ARG_BSTR 
ARG_INT 
ARG_UINT 
ARG_ADDR 
ARG_DOUBLE 

Definition at line 212 of file vbscript.h.

212 {
213 ARG_NONE = 0,
214 ARG_STR,
215 ARG_BSTR,
216 ARG_INT,
217 ARG_UINT,
218 ARG_ADDR,
instr_arg_type_t
Definition: vbscript.h:212
@ ARG_INT
Definition: vbscript.h:216
@ ARG_ADDR
Definition: vbscript.h:218
@ ARG_BSTR
Definition: vbscript.h:215
@ ARG_NONE
Definition: vbscript.h:213
@ ARG_DOUBLE
Definition: vbscript.h:219
@ ARG_STR
Definition: vbscript.h:214
@ ARG_UINT
Definition: vbscript.h:217

◆ vbdisp_invoke_type_t

Enumerator
VBDISP_CALLGET 
VBDISP_LET 
VBDISP_SET 
VBDISP_ANY 

Definition at line 71 of file vbscript.h.

71 {
vbdisp_invoke_type_t
Definition: vbscript.h:71
@ VBDISP_LET
Definition: vbscript.h:73
@ VBDISP_SET
Definition: vbscript.h:74
@ VBDISP_CALLGET
Definition: vbscript.h:72
@ VBDISP_ANY
Definition: vbscript.h:75

◆ vbsop_t

Enumerator
OP_LAST 

Definition at line 281 of file vbscript.h.

281 {
282#define X(x,n,a,b) OP_##x,
284#undef X
285 OP_LAST
286} vbsop_t;
vbsop_t
Definition: vbscript.h:281
@ OP_LAST
Definition: vbscript.h:285
#define OP_LIST
Definition: vbscript.h:222

Function Documentation

◆ arg_cnt()

◆ clear_ei()

void clear_ei ( EXCEPINFO *  ei)

Definition at line 242 of file interp.c.

243{
244 SysFreeString(ei->bstrSource);
245 SysFreeString(ei->bstrDescription);
246 SysFreeString(ei->bstrHelpFile);
247 memset(ei, 0, sizeof(*ei));
248}
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define memset(x, y, z)
Definition: compat.h:39

Referenced by exec_script(), and interp_errmode().

◆ collect_objects()

void collect_objects ( script_ctx_t ctx)

Definition at line 835 of file vbdisp.c.

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

◆ compile_procedure()

HRESULT compile_procedure ( script_ctx_t script,
const WCHAR src,
const WCHAR delimiter,
DWORD  flags,
class_desc_t **  ret 
)

Definition at line 1930 of file compile.c.

1931{
1933 vbscode_t *code;
1934 HRESULT hres;
1935
1937 if(FAILED(hres))
1938 return hres;
1939
1940 if(!(desc = compiler_alloc_zero(code, sizeof(*desc))))
1941 return E_OUTOFMEMORY;
1942 if(!(desc->funcs = compiler_alloc_zero(code, sizeof(*desc->funcs))))
1943 return E_OUTOFMEMORY;
1944
1945 desc->ctx = script;
1946 desc->func_cnt = 1;
1947 desc->funcs->entries[VBDISP_CALLGET] = &code->main_code;
1948
1949 desc->next = script->procs;
1950 script->procs = desc;
1951
1952 *ret = desc;
1953 return S_OK;
1954}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum src
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT hres
Definition: protocol.c:465
const char * delimiter
Definition: string.c:1566
script
Definition: msipriv.h:383
Definition: inflate.c:139
HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, vbscode_t **ret)
Definition: compile.c:1828
static void * compiler_alloc_zero(vbscode_t *vbscode, size_t size)
Definition: compile.c:124
int ret

Referenced by VBScriptParseProcedure_ParseProcedureText().

◆ compile_script()

HRESULT compile_script ( script_ctx_t script,
const WCHAR src,
const WCHAR delimiter,
DWORD  flags,
vbscode_t **  ret 
)

Definition at line 1828 of file compile.c.

1829{
1830 function_t *new_func;
1831 function_decl_t *func_decl;
1832 class_decl_t *class_decl;
1834 vbscode_t *code;
1835 HRESULT hres;
1836
1837 if (!src) src = L"";
1838
1839 hres = parse_script(&ctx.parser, src, delimiter, flags);
1840 if(FAILED(hres))
1841 return compile_error(script, hres);
1842
1843 code = ctx.code = alloc_vbscode(&ctx, src);
1844 if(!ctx.code)
1846
1847 ctx.funcs = NULL;
1848 ctx.func_decls = NULL;
1849 ctx.global_vars = NULL;
1850 ctx.classes = NULL;
1851 ctx.labels = NULL;
1852 ctx.global_consts = NULL;
1853 ctx.stat_ctx = NULL;
1854 ctx.labels_cnt = ctx.labels_size = 0;
1855
1856 hres = compile_func(&ctx, ctx.parser.stats, &ctx.code->main_code);
1857 if(FAILED(hres)) {
1859 return compile_error(script, hres);
1860 }
1861
1862 ctx.global_consts = ctx.const_decls;
1863
1864 for(func_decl = ctx.func_decls; func_decl; func_decl = func_decl->next) {
1865 hres = create_function(&ctx, func_decl, &new_func);
1866 if(FAILED(hres)) {
1868 return compile_error(script, hres);
1869 }
1870
1871 new_func->next = ctx.funcs;
1872 ctx.funcs = new_func;
1873 }
1874
1875 for(class_decl = ctx.parser.class_decls; class_decl; class_decl = class_decl->next) {
1876 hres = compile_class(&ctx, class_decl);
1877 if(FAILED(hres)) {
1879 return compile_error(script, hres);
1880 }
1881 }
1882
1884 if(FAILED(hres)) {
1886 return compile_error(script, hres);
1887 }
1888
1889 if(ctx.global_vars) {
1891
1892 for(var = ctx.global_vars; var->next; var = var->next);
1893
1894 var->next = script->global_vars;
1895 script->global_vars = ctx.global_vars;
1896 }
1897
1898 if(ctx.funcs) {
1899 for(new_func = ctx.funcs; new_func->next; new_func = new_func->next);
1900
1901 new_func->next = script->global_funcs;
1902 script->global_funcs = ctx.funcs;
1903 }
1904
1905 if(ctx.classes) {
1906 class_desc_t *class = ctx.classes;
1907
1908 while(1) {
1909 class->ctx = script;
1910 if(!class->next)
1911 break;
1912 class = class->next;
1913 }
1914
1915 class->next = script->classes;
1916 script->classes = ctx.classes;
1917 }
1918
1919 if(TRACE_ON(vbscript_disas))
1920 dump_code(&ctx);
1921
1922 ctx.code = NULL;
1924
1925 list_add_tail(&script->code_list, &code->entry);
1926 *ret = code;
1927 return S_OK;
1928}
const WCHAR * class
Definition: main.c:68
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define TRACE_ON(x)
Definition: compat.h:75
HRESULT parse_script(parser_ctx_t *, const WCHAR *, const WCHAR *, DWORD) DECLSPEC_HIDDEN
const char * var
Definition: shader.c:5666
#define L(x)
Definition: ntvdm.h:50
static unsigned __int64 next
Definition: rand_nt.c:6
struct _class_decl_t * next
Definition: parse.h:187
script_ctx_t * ctx
Definition: vbscript.h:98
struct _function_decl_t * next
Definition: parse.h:174
function_t * next
Definition: vbscript.h:333
static void release_compiler(compile_ctx_t *ctx)
Definition: compile.c:1820
static vbscode_t * alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
Definition: compile.c:1787
static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
Definition: compile.c:1601
static HRESULT compile_error(script_ctx_t *ctx, HRESULT error)
Definition: compile.c:378
static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *func)
Definition: compile.c:1355
static HRESULT check_script_collisions(compile_ctx_t *ctx, script_ctx_t *script)
Definition: compile.c:1738
static void dump_code(compile_ctx_t *ctx)
Definition: compile.c:106
static HRESULT create_function(compile_ctx_t *ctx, function_decl_t *decl, function_t **ret)
Definition: compile.c:1482

◆ 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:65
static IServiceProviderVtbl AXSiteVtbl
Definition: jscript.c:317
static const WCHAR sp[]
Definition: suminfo.c:287
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by create_activex_object(), and set_object_site().

◆ create_regexp()

HRESULT create_regexp ( IDispatch **  ret)

Definition at line 1596 of file vbregexp.c.

1597{
1598 RegExp2 *regexp;
1599 HRESULT hres;
1600
1601 hres = init_regexp_typeinfo(RegExp2_tid);
1602 if(FAILED(hres))
1603 return hres;
1604
1605 regexp = heap_alloc_zero(sizeof(*regexp));
1606 if(!regexp)
1607 return E_OUTOFMEMORY;
1608
1609 regexp->IRegExp2_iface.lpVtbl = &RegExp2Vtbl;
1610 regexp->IRegExp_iface.lpVtbl = &RegExpVtbl;
1611 regexp->ref = 1;
1612 heap_pool_init(&regexp->pool);
1613
1614 *ret = (IDispatch*)&regexp->IRegExp2_iface;
1615 return S_OK;
1616}
void heap_pool_init(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:71
IRegExp IRegExp_iface
Definition: vbregexp.c:125
LONG ref
Definition: vbregexp.c:127
IRegExp2 IRegExp2_iface
Definition: vbregexp.c:124
heap_pool_t pool
Definition: vbregexp.c:131
static IRegExpVtbl RegExpVtbl
Definition: vbregexp.c:1577
static const IRegExp2Vtbl RegExp2Vtbl
Definition: vbregexp.c:1444
static HRESULT init_regexp_typeinfo(regexp_tid_t tid)
Definition: vbregexp.c:49

Referenced by VBScriptRegExpFactory_CreateInstance().

◆ create_safearray_iter()

HRESULT create_safearray_iter ( SAFEARRAY sa,
IEnumVARIANT **  ev 
)

Definition at line 163 of file utils.c.

164{
165 safearray_iter *iter;
167
168 if(sa && !(sa->fFeatures & FADF_VARIANT)) {
169 FIXME("enumeration not supported: %x\n", sa->fFeatures);
170 return E_NOTIMPL;
171 }
172
173 iter = heap_alloc(sizeof(*iter));
174 if(!iter)
175 return E_OUTOFMEMORY;
176
177 if(sa) {
179 if(FAILED(hres)) {
180 heap_free(iter);
181 return hres;
182 }
183 }
184
186 iter->ref = 1;
187 iter->sa = sa;
188 iter->i = 0;
189 iter->size = get_safearray_size(sa);
190
191 *ev = &iter->IEnumVARIANT_iface;
192 return S_OK;
193}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI SafeArrayLock(SAFEARRAY *psa)
Definition: safearray.c:795
static ULONG get_safearray_size(SAFEARRAY *sa)
Definition: utils.c:150
static const IEnumVARIANTVtbl safearray_iter_EnumVARIANTVtbl
Definition: utils.c:140
LONG ref
Definition: utils.c:28
ULONG size
Definition: utils.c:31
IEnumVARIANT IEnumVARIANT_iface
Definition: utils.c:26
SAFEARRAY * sa
Definition: utils.c:30
ULONG i
Definition: utils.c:31

Referenced by interp_newenum().

◆ create_script_disp()

HRESULT create_script_disp ( script_ctx_t ctx,
ScriptDisp **  ret 
)

Definition at line 819 of file vbdisp.c.

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

Referenced by VBScript_SetScriptSite().

◆ create_vbdisp()

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

Definition at line 470 of file vbdisp.c.

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

Referenced by interp_new(), and VBScriptParseProcedure_ParseProcedureText().

◆ detach_global_objects()

void detach_global_objects ( script_ctx_t ctx)

Definition at line 2855 of file global.c.

2856{
2857 if(ctx->err_obj) {
2858 ctx->err_obj->ctx = NULL;
2859 IDispatch_Release(&ctx->err_obj->IDispatch_iface);
2860 ctx->err_obj = NULL;
2861 }
2862
2863 if(ctx->global_obj) {
2864 ctx->global_obj->ctx = NULL;
2865 IDispatch_Release(&ctx->global_obj->IDispatch_iface);
2866 ctx->global_obj = NULL;
2867 }
2868}
CONTEXT ctx

Referenced by release_script().

◆ disp_call()

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

Definition at line 938 of file vbdisp.c.

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

Referenced by get_disp_value().

◆ disp_get_id()

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

Definition at line 854 of file vbdisp.c.

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

◆ disp_propput()

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

Definition at line 975 of file vbdisp.c.

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

◆ exec_script()

HRESULT exec_script ( script_ctx_t ctx,
BOOL  extern_caller,
function_t func,
vbdisp_t vbthis,
DISPPARAMS *  dp,
VARIANT res 
)

Definition at line 2086 of file interp.c.

2087{
2088 exec_ctx_t exec = {func->code_ctx};
2089 vbsop_t op;
2090 HRESULT hres = S_OK;
2091
2092 exec.code = func->code_ctx;
2093
2094 if(dp ? func->arg_cnt != arg_cnt(dp) : func->arg_cnt) {
2095 FIXME("wrong arg_cnt %d, expected %d\n", dp ? arg_cnt(dp) : 0, func->arg_cnt);
2096 return E_FAIL;
2097 }
2098
2099 heap_pool_init(&exec.heap);
2100
2101 if(func->arg_cnt) {
2102 VARIANT *v;
2103 unsigned i;
2104
2105 exec.args = heap_alloc_zero(func->arg_cnt * sizeof(VARIANT));
2106 if(!exec.args) {
2107 release_exec(&exec);
2108 return E_OUTOFMEMORY;
2109 }
2110
2111 for(i=0; i < func->arg_cnt; i++) {
2112 v = get_arg(dp, i);
2113 if(V_VT(v) == (VT_VARIANT|VT_BYREF)) {
2114 if(func->args[i].by_ref)
2115 exec.args[i] = *v;
2116 else
2118 }else {
2119 hres = VariantCopyInd(exec.args+i, v);
2120 }
2121 if(FAILED(hres)) {
2122 release_exec(&exec);
2123 return hres;
2124 }
2125 }
2126 }else {
2127 exec.args = NULL;
2128 }
2129
2130 if(func->var_cnt) {
2131 exec.vars = heap_alloc_zero(func->var_cnt * sizeof(VARIANT));
2132 if(!exec.vars) {
2133 release_exec(&exec);
2134 return E_OUTOFMEMORY;
2135 }
2136 }else {
2137 exec.vars = NULL;
2138 }
2139
2140 exec.stack_size = 16;
2141 exec.top = 0;
2142 exec.stack = heap_alloc(exec.stack_size * sizeof(VARIANT));
2143 if(!exec.stack) {
2144 release_exec(&exec);
2145 return E_OUTOFMEMORY;
2146 }
2147
2148 if(extern_caller)
2149 IActiveScriptSite_OnEnterScript(ctx->site);
2150
2151 if(vbthis) {
2152 exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface;
2153 exec.vbthis = vbthis;
2154 }else if (ctx->host_global) {
2155 exec.this_obj = ctx->host_global;
2156 }else {
2157 exec.this_obj = (IDispatch*)&ctx->script_obj->IDispatchEx_iface;
2158 }
2159 IDispatch_AddRef(exec.this_obj);
2160
2161 exec.instr = exec.code->instrs + func->code_off;
2162 exec.script = ctx;
2163 exec.func = func;
2164
2165 while(exec.instr) {
2166 op = exec.instr->op;
2167 hres = op_funcs[op](&exec);
2168 if(FAILED(hres)) {
2169 if(hres != SCRIPT_E_RECORDED) {
2170 clear_ei(&ctx->ei);
2171
2172 ctx->ei.scode = hres = map_hres(hres);
2173 ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR);
2174 ctx->ei.bstrDescription = get_vbscript_error_string(hres);
2175 }else {
2176 hres = ctx->ei.scode;
2177 }
2178
2179 if(exec.resume_next) {
2180 unsigned stack_off;
2181
2182 WARN("Failed %08x in resume next mode\n", hres);
2183
2184 /*
2185 * Unwinding here is simple. We need to find the next OP_catch, which contains
2186 * information about expected stack size and jump offset on error. Generated
2187 * bytecode needs to guarantee, that simple jump and stack adjustment will
2188 * guarantee proper execution continuation.
2189 */
2190 while((++exec.instr)->op != OP_catch);
2191
2192 TRACE("unwind jmp %d stack_off %d\n", exec.instr->arg1.uint, exec.instr->arg2.uint);
2193
2194 stack_off = exec.instr->arg2.uint;
2195 instr_jmp(&exec, exec.instr->arg1.uint);
2196
2197 if(exec.top > stack_off) {
2198 stack_popn(&exec, exec.top-stack_off);
2199 }else if(exec.top < stack_off) {
2200 VARIANT v;
2201
2202 V_VT(&v) = VT_EMPTY;
2203 while(exec.top < stack_off) {
2204 hres = stack_push(&exec, &v);
2205 if(FAILED(hres))
2206 break;
2207 }
2208 }
2209
2210 continue;
2211 }else {
2212 WARN("Failed %08x\n", hres);
2213 stack_popn(&exec, exec.top);
2214 break;
2215 }
2216 }
2217
2218 exec.instr += op_move[op];
2219 }
2220
2221 assert(!exec.top);
2222
2223 if(extern_caller) {
2224 IActiveScriptSite_OnLeaveScript(ctx->site);
2225 if(FAILED(hres)) {
2226 if(!ctx->ei.scode)
2227 ctx->ei.scode = hres;
2229 }
2230 }
2231
2232 if(SUCCEEDED(hres) && res) {
2233 *res = exec.ret_val;
2234 V_VT(&exec.ret_val) = VT_EMPTY;
2235 }
2236
2237 release_exec(&exec);
2238 return hres;
2239}
#define WARN(fmt,...)
Definition: debug.h:112
#define E_FAIL
Definition: ddrawi.h:102
UINT op
Definition: effect.c:236
static ULONG_PTR get_arg(int nr, DWORD flags, struct format_args *args)
Definition: format_msg.c:149
HRESULT report_script_error(script_ctx_t *ctx)
Definition: vbscript.c:315
#define VBS_RUNTIME_ERROR
#define assert(x)
Definition: debug.h:53
const GLdouble * v
Definition: gl.h:2040
GLenum func
Definition: glext.h:6028
GLuint res
Definition: glext.h:9613
void clear_ei(EXCEPINFO *ei)
Definition: interp.c:242
static void instr_jmp(exec_ctx_t *ctx, unsigned addr)
Definition: interp.c:447
static void stack_popn(exec_ctx_t *ctx, unsigned n)
Definition: interp.c:288
static const unsigned op_move[]
Definition: interp.c:2038
static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v)
Definition: interp.c:262
static const instr_func_t op_funcs[]
Definition: interp.c:2032
static void release_exec(exec_ctx_t *ctx)
Definition: interp.c:2052
HRESULT map_hres
Definition: sec_mgr.c:1753
#define V_VARIANTREF(A)
Definition: oleauto.h:283
instr_t * instrs
Definition: vbscript.h:337
heap_pool_t heap
Definition: interp.c:42
VARIANT * args
Definition: interp.c:37
function_t * func
Definition: interp.c:33
script_ctx_t * script
Definition: interp.c:32
VARIANT ret_val
Definition: interp.c:50
vbdisp_t * vbthis
Definition: interp.c:35
vbscode_t * code
Definition: interp.c:30
VARIANT * stack
Definition: interp.c:48
unsigned top
Definition: interp.c:47
VARIANT * vars
Definition: interp.c:38
unsigned stack_size
Definition: interp.c:46
instr_t * instr
Definition: interp.c:31
IDispatch * this_obj
Definition: interp.c:34
BOOL resume_next
Definition: interp.c:44
instr_arg_t arg2
Definition: vbscript.h:299
instr_arg_t arg1
Definition: vbscript.h:298
jsop_t op
Definition: engine.h:127
unsigned uint
Definition: engine.h:112
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
BSTR get_vbscript_error_string(HRESULT) DECLSPEC_HIDDEN
Definition: vbscript_main.c:45
static unsigned arg_cnt(const DISPPARAMS *dp)
Definition: vbscript.h:162
BSTR get_vbscript_string(int) DECLSPEC_HIDDEN
Definition: vbscript_main.c:38

Referenced by do_icall().

◆ get_arg()

static VARIANT * get_arg ( DISPPARAMS *  dp,
DWORD  i 
)
inlinestatic

Definition at line 167 of file vbscript.h.

168{
169 return dp->rgvarg + dp->cArgs-i-1;
170}

◆ get_builtin_id()

HRESULT get_builtin_id ( BuiltinDisp disp,
const WCHAR name,
DISPID id 
)

Definition at line 128 of file global.c.

129{
130 size_t min = 1, max = disp->member_cnt - 1, i;
131 int r;
132
133 while(min <= max) {
134 i = (min + max) / 2;
135 r = wcsicmp(disp->members[i].name, name);
136 if(!r) {
137 *id = i;
138 return S_OK;
139 }
140 if(r < 0)
141 min = i+1;
142 else
143 max = i-1;
144 }
145
147
148}
#define wcsicmp
Definition: compat.h:15
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define min(a, b)
Definition: monoChain.cc:55
size_t member_cnt
Definition: vbscript.h:146
const builtin_prop_t * members
Definition: vbscript.h:147
const WCHAR * name
Definition: global.c:56
#define max(a, b)
Definition: svc.c:63
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512

Referenced by Builtin_GetIDsOfNames().

◆ get_disp_value()

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

Definition at line 967 of file vbdisp.c.

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

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

◆ get_vbscript_error_string()

BSTR get_vbscript_error_string ( HRESULT  error)

Definition at line 45 of file vbscript_main.c.

46{
47 BSTR ret;
50 return ret;
51}
OLECHAR * BSTR
Definition: compat.h:2293
#define VBS_UNKNOWN_RUNTIME_ERROR
#define error(str)
Definition: mkdosfs.c:1605
#define FACILITY_VBS
Definition: vbscript.h:378
BSTR get_vbscript_string(int id)
Definition: vbscript_main.c:38
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define HRESULT_CODE(hr)
Definition: winerror.h:76

Referenced by compile_error(), Err_Raise(), and exec_script().

◆ get_vbscript_string()

BSTR get_vbscript_string ( int  id)

Definition at line 38 of file vbscript_main.c.

39{
40 WCHAR buf[512];
42 return SysAllocString(buf);
43}
#define ARRAY_SIZE(a)
Definition: main.h:24
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
static HINSTANCE vbscript_hinstance
Definition: vbscript_main.c:36
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by compile_error(), Err_Raise(), exec_script(), and get_vbscript_error_string().

◆ heap_pool_alloc()

void * heap_pool_alloc ( heap_pool_t heap,
size_t  size 
)

Definition at line 67 of file vbscript_main.c.

68{
69 struct list *list;
70 void *tmp;
71
72 size = (size+3)&~3;
73
74 if(!heap->block_cnt) {
75 if(!heap->blocks) {
76 heap->blocks = heap_alloc(sizeof(void*));
77 if(!heap->blocks)
78 return NULL;
79 }
80
81 tmp = heap_alloc(block_size(0));
82 if(!tmp)
83 return NULL;
84
85 heap->blocks[0] = tmp;
86 heap->block_cnt = 1;
87 }
88
89 if(heap->offset + size <= block_size(heap->last_block)) {
90 tmp = ((BYTE*)heap->blocks[heap->last_block])+heap->offset;
91 heap->offset += size;
92 return tmp;
93 }
94
95 if(size <= block_size(heap->last_block+1)) {
96 if(heap->last_block+1 == heap->block_cnt) {
97 tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
98 if(!tmp)
99 return NULL;
100
101 heap->blocks = tmp;
102 heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt));
103 if(!heap->blocks[heap->block_cnt])
104 return NULL;
105
106 heap->block_cnt++;
107 }
108
109 heap->last_block++;
110 heap->offset = size;
111 return heap->blocks[heap->last_block];
112 }
113
114 list = heap_alloc(size + sizeof(struct list));
115 if(!list)
116 return NULL;
117
118 list_add_head(&heap->custom_blocks, list);
119 return list+1;
120}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
Definition: list.h:37
GLsizeiptr size
Definition: glext.h:5919
#define list
Definition: rosglue.h:35
static HANDLE heap
Definition: heap.c:65
static DWORD block_size(DWORD block)
Definition: vbscript_main.c:56
unsigned char BYTE
Definition: xxhash.c:193

Referenced by heap_pool_grow().

◆ heap_pool_clear()

void heap_pool_clear ( heap_pool_t heap)

Definition at line 146 of file jsutils.c.

147{
148 struct list *tmp;
149
150 if(!heap)
151 return;
152
153 while((tmp = list_head(&heap->custom_blocks))) {
154 list_remove(tmp);
155 heap_free(tmp);
156 }
157
158 if(WARN_ON(heap)) {
159 DWORD i;
160
161 for(i=0; i < heap->block_cnt; i++)
163 }
164
165 heap->last_block = heap->offset = 0;
166 heap->mark = FALSE;
167}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ARENA_FREE_FILLER
Definition: jsutils.c:64
static DWORD block_size(DWORD block)
Definition: jsutils.c:66
#define WARN_ON(c)
Definition: module.h:255

Referenced by heap_pool_free().

◆ heap_pool_free()

void heap_pool_free ( heap_pool_t heap)

Definition at line 169 of file jsutils.c.

170{
171 DWORD i;
172
174
175 for(i=0; i < heap->block_cnt; i++)
176 heap_free(heap->blocks[i]);
177 heap_free(heap->blocks);
178
180}
void heap_pool_init(heap_pool_t *heap)
Definition: jsutils.c:71
void heap_pool_clear(heap_pool_t *heap)
Definition: jsutils.c:146

◆ heap_pool_grow()

void * heap_pool_grow ( heap_pool_t heap,
void mem,
DWORD  size,
DWORD  inc 
)

Definition at line 130 of file jsutils.c.

131{
132 void *ret;
133
134 if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size
135 && heap->offset+inc < block_size(heap->last_block)) {
136 heap->offset += inc;
137 return mem;
138 }
139
141 if(ret) /* FIXME: avoid copying for custom blocks */
142 memcpy(ret, mem, size);
143 return ret;
144}
void * heap_pool_alloc(heap_pool_t *heap, DWORD size)
Definition: jsutils.c:77
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: mem.c:156

◆ heap_pool_init()

void heap_pool_init ( heap_pool_t heap)

Definition at line 71 of file jsutils.c.

72{
73 memset(heap, 0, sizeof(*heap));
74 list_init(&heap->custom_blocks);
75}

Referenced by heap_pool_free().

◆ heap_pool_mark()

heap_pool_t * heap_pool_mark ( heap_pool_t heap)

Definition at line 182 of file jsutils.c.

183{
184 if(heap->mark)
185 return NULL;
186
187 heap->mark = TRUE;
188 return heap;
189}
#define TRUE
Definition: types.h:120

◆ heap_strdupW()

static LPWSTR heap_strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 387 of file vbscript.h.

388{
389 LPWSTR ret = NULL;
390
391 if(str) {
392 DWORD size;
393
394 size = (lstrlenW(str)+1)*sizeof(WCHAR);
396 if(ret)
397 memcpy(ret, str, size);
398 }
399
400 return ret;
401}
#define lstrlenW
Definition: compat.h:750
const WCHAR * str
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ init_err()

HRESULT init_err ( script_ctx_t )

◆ init_global()

HRESULT init_global ( script_ctx_t ctx)

Definition at line 1105 of file global.c.

1106{
1107 unsigned const_flags = ctx->version >= SCRIPTLANGUAGEVERSION_ES5 ? 0 : PROPF_WRITABLE;
1108 jsdisp_t *math, *object_prototype, *constr;
1109 HRESULT hres;
1110
1111 if(ctx->global)
1112 return S_OK;
1113
1114 hres = create_dispex(ctx, &JSGlobal_info, NULL, &ctx->global);
1115 if(FAILED(hres))
1116 return hres;
1117
1118 hres = create_object_prototype(ctx, &object_prototype);
1119 if(FAILED(hres))
1120 return hres;
1121
1122 hres = init_constructors(ctx, object_prototype);
1123 jsdisp_release(object_prototype);
1124 if(FAILED(hres))
1125 return hres;
1126
1127 hres = create_math(ctx, &math);
1128 if(FAILED(hres))
1129 return hres;
1130
1132 jsdisp_release(math);
1133 if(FAILED(hres))
1134 return hres;
1135
1136 if(ctx->version >= 2) {
1137 jsdisp_t *json;
1138
1139 hres = create_json(ctx, &json);
1140 if(FAILED(hres))
1141 return hres;
1142
1144 jsdisp_release(json);
1145 if(FAILED(hres))
1146 return hres;
1147 }
1148
1149 hres = create_activex_constr(ctx, &constr);
1150 if(FAILED(hres))
1151 return hres;
1152
1154 jsval_obj(constr));
1155 jsdisp_release(constr);
1156 if(FAILED(hres))
1157 return hres;
1158
1160 if(FAILED(hres))
1161 return hres;
1162
1163 hres = jsdisp_define_data_property(ctx->global, NaNW, const_flags, jsval_number(NAN));
1164 if(FAILED(hres))
1165 return hres;
1166
1168 return hres;
1169}
HRESULT create_activex_constr(script_ctx_t *ctx, jsdisp_t **ret)
Definition: activex.c:188
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
Definition: dispex.c:957
static const builtin_info_t JSGlobal_info
Definition: global.c:955
static const WCHAR ActiveXObjectW[]
Definition: global.c:52
static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
Definition: global.c:964
static const WCHAR NaNW[]
Definition: global.c:34
static const WCHAR MathW[]
Definition: global.c:71
static const WCHAR JSONW[]
Definition: global.c:72
static const WCHAR InfinityW[]
Definition: global.c:35
static const WCHAR undefinedW[]
Definition: global.c:78
#define PROPF_WRITABLE
Definition: jscript.h:101
HRESULT create_object_prototype(script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: object.c:726
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
#define SCRIPTLANGUAGEVERSION_ES5
Definition: jscript.h:52
HRESULT create_math(script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: math.c:533
HRESULT create_json(script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: json.c:837
static jsval_t jsval_undefined(void)
Definition: jsval.h:137
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
static jsval_t jsval_number(double n)
Definition: jsval.h:144
#define NAN
Definition: mesh.c:39
#define INFINITY
Definition: misc.c:36

Referenced by set_ctx_site(), and VBScriptFactory_CreateInstance().

◆ is_int32()

static BOOL is_int32 ( double  d)
inlinestatic

Definition at line 367 of file vbscript.h.

368{
369 return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d;
370}
#define INT32_MAX
Definition: stdint.h:82
#define INT32_MIN
Definition: stdint.h:77
#define d
Definition: ke_i.h:81
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80

◆ 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}
static ATOM item
Definition: dde.c:856
const GUID IID_IDispatch
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198

Referenced by lookup_identifier(), and VBScriptParse_ParseScriptText().

◆ map_hres()

HRESULT map_hres ( HRESULT  hres)

Definition at line 877 of file vbdisp.c.

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

◆ release_dynamic_vars()

void release_dynamic_vars ( dynamic_var_t var)

Definition at line 2044 of file interp.c.

2045{
2046 while(var) {
2047 VariantClear(&var->v);
2048 var = var->next;
2049 }
2050}
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648

Referenced by release_exec(), and release_script().

◆ release_regexp_typelib()

void release_regexp_typelib ( void  )

Definition at line 1634 of file vbregexp.c.

1635{
1636 DWORD i;
1637
1638 for(i=0; i<REGEXP_LAST_tid; i++) {
1639 if(typeinfos[i])
1640 ITypeInfo_Release(typeinfos[i]);
1641 }
1642 if(typelib)
1643 ITypeLib_Release(typelib);
1644}
static ITypeLib * typelib
Definition: vbregexp.c:46
static ITypeInfo * typeinfos[REGEXP_LAST_tid]
Definition: vbregexp.c:47
@ REGEXP_LAST_tid
Definition: vbregexp.c:37

Referenced by DllMain().

◆ release_vbscode()

void release_vbscode ( vbscode_t code)

Definition at line 1768 of file compile.c.

1769{
1770 unsigned i;
1771
1772 list_remove(&code->entry);
1773
1774 for(i=0; i < code->bstr_cnt; i++)
1775 SysFreeString(code->bstr_pool[i]);
1776
1777 if(code->context)
1778 IDispatch_Release(code->context);
1779 heap_pool_free(&code->heap);
1780
1781 heap_free(code->bstr_pool);
1782 heap_free(code->source);
1783 heap_free(code->instrs);
1784 heap_free(code);
1785}
void heap_pool_free(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:169

Referenced by alloc_vbscode(), destroy_script(), and release_compiler().

◆ 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}
static const IActiveScriptErrorVtbl VBScriptErrorVtbl
Definition: vbscript.c:306
GLuint64EXT * result
Definition: glext.h:11304

Referenced by compile_error(), and exec_script().

◆ to_int()

HRESULT to_int ( VARIANT v,
int ret 
)

Definition at line 410 of file global.c.

411{
412 VARIANT r;
414
415 V_VT(&r) = VT_EMPTY;
416 hres = VariantChangeType(&r, v, 0, VT_I4);
417 if(FAILED(hres))
418 return hres;
419
420 *ret = V_I4(&r);
421 return S_OK;
422}
@ VT_I4
Definition: compat.h:2298
#define V_I4(A)
Definition: oleauto.h:247
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962

Referenced by array_access(), Err_Raise(), Global_Chr(), Global_CLng(), Global_Hex(), Global_InStr(), Global_InStrRev(), Global_Left(), Global_Mid(), Global_MonthName(), Global_MsgBox(), Global_Oct(), Global_RGB(), Global_Right(), Global_Space(), Global_StrComp(), Global_UBound(), and Global_WeekdayName().

◆ vbdisp_get_id()

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

Definition at line 59 of file vbdisp.c.

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

Referenced by disp_get_id(), and DispatchEx_GetDispID().

◆ 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}
@ SCRIPTSTATE_UNINITIALIZED
Definition: activscp.idl:57
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
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT init_global(script_ctx_t *ctx)
Definition: global.c:1105
#define debugstr_guid
Definition: kernel32.h:35

◆ VBScriptRegExpFactory_CreateInstance()

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

Definition at line 1618 of file vbregexp.c.

1619{
1620 IDispatch *regexp;
1621 HRESULT hres;
1622
1623 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
1624
1625 hres = create_regexp(&regexp);
1626 if(FAILED(hres))
1627 return hres;
1628
1629 hres = IDispatch_QueryInterface(regexp, riid, ppv);
1630 IDispatch_Release(regexp);
1631 return hres;
1632}
HRESULT create_regexp(IDispatch **ret)
Definition: vbregexp.c:1596