ReactOS 0.4.17-dev-357-ga8f14ff
interp.c
Go to the documentation of this file.
1/*
2 * Copyright 2011 Jacek Caban for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include <assert.h>
20
21#include "vbscript.h"
22
23#include "wine/debug.h"
24
26
27static DISPID propput_dispid = DISPID_PROPERTYPUT;
28
29typedef struct {
35
39
42
44
45 unsigned stack_size;
46 unsigned top;
48
51
53
54typedef enum {
62
63typedef struct {
65 union {
66 struct {
69 } d;
73 } u;
74} ref_t;
75
76typedef struct {
81
83{
84 while(var) {
85 if(!wcsicmp(var->name, name)) {
86 ref->type = var->is_const ? REF_CONST : REF_VAR;
87 ref->u.v = &var->v;
88 return TRUE;
89 }
90
91 var = var->next;
92 }
93
94 return FALSE;
95}
96
98{
99 dynamic_var_t **vars = script->global_vars;
100 size_t i, cnt = script->global_vars_cnt;
101
102 for(i = 0; i < cnt; i++) {
103 if(!wcsicmp(vars[i]->name, name)) {
104 ref->type = vars[i]->is_const ? REF_CONST : REF_VAR;
105 ref->u.v = &vars[i]->v;
106 return TRUE;
107 }
108 }
109
110 return FALSE;
111}
112
114{
115 function_t **funcs = script->global_funcs;
116 size_t i, cnt = script->global_funcs_cnt;
117
118 for(i = 0; i < cnt; i++) {
119 if(!wcsicmp(funcs[i]->name, name)) {
120 ref->type = REF_FUNC;
121 ref->u.f = funcs[i];
122 return TRUE;
123 }
124 }
125
126 return FALSE;
127}
128
130{
131 ScriptDisp *script_obj = ctx->script->script_obj;
133 unsigned i;
134 DISPID id;
136
137 if(invoke_type != VBDISP_CALLGET
138 && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
139 && !wcsicmp(name, ctx->func->name)) {
140 ref->type = REF_VAR;
141 ref->u.v = &ctx->ret_val;
142 return S_OK;
143 }
144
145 if(ctx->func->type != FUNC_GLOBAL) {
146 for(i=0; i < ctx->func->var_cnt; i++) {
147 if(!wcsicmp(ctx->func->vars[i].name, name)) {
148 ref->type = REF_VAR;
149 ref->u.v = ctx->vars+i;
150 return S_OK;
151 }
152 }
153
154 for(i=0; i < ctx->func->arg_cnt; i++) {
155 if(!wcsicmp(ctx->func->args[i].name, name)) {
156 ref->type = REF_VAR;
157 ref->u.v = ctx->args+i;
158 return S_OK;
159 }
160 }
161
162 if(lookup_dynamic_vars(ctx->dynamic_vars, name, ref))
163 return S_OK;
164
165 if(ctx->vbthis) {
166 /* FIXME: Bind such identifier while generating bytecode. */
167 for(i=0; i < ctx->vbthis->desc->prop_cnt; i++) {
168 if(!wcsicmp(ctx->vbthis->desc->props[i].name, name)) {
169 ref->type = REF_VAR;
170 ref->u.v = ctx->vbthis->props+i;
171 return S_OK;
172 }
173 }
174
175 hres = vbdisp_get_id(ctx->vbthis, name, invoke_type, TRUE, &id);
176 if(SUCCEEDED(hres)) {
177 ref->type = REF_DISP;
178 ref->u.d.disp = (IDispatch*)&ctx->vbthis->IDispatchEx_iface;
179 ref->u.d.id = id;
180 return S_OK;
181 }
182 }
183 }
184
185 if(ctx->code->named_item) {
186 if(lookup_global_vars(ctx->code->named_item->script_obj, name, ref))
187 return S_OK;
188 if(lookup_global_funcs(ctx->code->named_item->script_obj, name, ref))
189 return S_OK;
190 }
191
192 if(ctx->func->code_ctx->named_item && ctx->func->code_ctx->named_item->disp &&
193 !(ctx->func->code_ctx->named_item->flags & SCRIPTITEM_CODEONLY))
194 {
195 hres = disp_get_id(ctx->func->code_ctx->named_item->disp, name, invoke_type, TRUE, &id);
196 if(SUCCEEDED(hres)) {
197 ref->type = REF_DISP;
198 ref->u.d.disp = ctx->func->code_ctx->named_item->disp;
199 ref->u.d.id = id;
200 return S_OK;
201 }
202 }
203
204 if(lookup_global_vars(script_obj, name, ref))
205 return S_OK;
206 if(lookup_global_funcs(script_obj, name, ref))
207 return S_OK;
208
209 hres = get_builtin_id(ctx->script->global_obj, name, &id);
210 if(SUCCEEDED(hres)) {
211 ref->type = REF_DISP;
212 ref->u.d.disp = &ctx->script->global_obj->IDispatch_iface;
213 ref->u.d.id = id;
214 return S_OK;
215 }
216
217 item = lookup_named_item(ctx->script, name, SCRIPTITEM_ISVISIBLE);
218 if(item && item->disp) {
219 ref->type = REF_OBJ;
220 ref->u.obj = item->disp;
221 return S_OK;
222 }
223
224 LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
225 if((item->flags & SCRIPTITEM_GLOBALMEMBERS)) {
226 hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id);
227 if(SUCCEEDED(hres)) {
228 ref->type = REF_DISP;
229 ref->u.d.disp = item->disp;
230 ref->u.d.id = id;
231 return S_OK;
232 }
233 }
234 }
235
236 ref->type = REF_NONE;
237 return S_OK;
238}
239
241 BOOL is_const, VARIANT **out_var)
242{
243 ScriptDisp *script_obj = ctx->code->named_item ? ctx->code->named_item->script_obj : ctx->script->script_obj;
244 dynamic_var_t *new_var;
246 WCHAR *str;
247 unsigned size;
248
249 heap = ctx->func->type == FUNC_GLOBAL ? &script_obj->heap : &ctx->heap;
250
251 new_var = heap_pool_alloc(heap, sizeof(*new_var));
252 if(!new_var)
253 return E_OUTOFMEMORY;
254
255 size = (lstrlenW(name)+1)*sizeof(WCHAR);
257 if(!str)
258 return E_OUTOFMEMORY;
259 memcpy(str, name, size);
260 new_var->name = str;
261 new_var->is_const = is_const;
262 new_var->array = NULL;
263 V_VT(&new_var->v) = VT_EMPTY;
264
265 if(ctx->func->type == FUNC_GLOBAL) {
266 size_t cnt = script_obj->global_vars_cnt + 1;
267 if(cnt > script_obj->global_vars_size) {
268 dynamic_var_t **new_vars;
269 if(script_obj->global_vars)
270 new_vars = realloc(script_obj->global_vars, cnt * 2 * sizeof(*new_vars));
271 else
272 new_vars = malloc(cnt * 2 * sizeof(*new_vars));
273 if(!new_vars)
274 return E_OUTOFMEMORY;
275 script_obj->global_vars = new_vars;
276 script_obj->global_vars_size = cnt * 2;
277 }
278 script_obj->global_vars[script_obj->global_vars_cnt++] = new_var;
279 }else {
280 new_var->next = ctx->dynamic_vars;
281 ctx->dynamic_vars = new_var;
282 }
283
284 *out_var = &new_var->v;
285 return S_OK;
286}
287
288void clear_ei(EXCEPINFO *ei)
289{
290 SysFreeString(ei->bstrSource);
291 SysFreeString(ei->bstrDescription);
292 SysFreeString(ei->bstrHelpFile);
293 memset(ei, 0, sizeof(*ei));
294}
295
297{
298 if(ctx->error_loc_code) {
299 release_vbscode(ctx->error_loc_code);
300 ctx->error_loc_code = NULL;
301 }
302}
303
305{
306 assert(ctx->top);
307 return ctx->stack + --ctx->top;
308}
309
310static inline VARIANT *stack_top(exec_ctx_t *ctx, unsigned n)
311{
312 assert(ctx->top >= n);
313 return ctx->stack + (ctx->top-n-1);
314}
315
317{
318 if(ctx->stack_size == ctx->top) {
319 VARIANT *new_stack;
320
321 new_stack = realloc(ctx->stack, ctx->stack_size*2*sizeof(*ctx->stack));
322 if(!new_stack) {
324 return E_OUTOFMEMORY;
325 }
326
327 ctx->stack = new_stack;
328 ctx->stack_size *= 2;
329 }
330
331 ctx->stack[ctx->top++] = *v;
332 return S_OK;
333}
334
336{
337 VARIANT v;
338 V_VT(&v) = VT_NULL;
339 return stack_push(ctx, &v);
340}
341
342static void stack_popn(exec_ctx_t *ctx, unsigned n)
343{
344 while(n--)
346}
347
349{
350 VARIANT *v;
351
352 v = stack_pop(ctx);
353 if(V_VT(v) == (VT_BYREF|VT_VARIANT)) {
354 r->owned = FALSE;
355 r->v = V_VARIANTREF(v);
356 }else {
357 r->owned = TRUE;
358 r->v = v;
359 }
360}
361
362static inline void release_val(variant_val_t *v)
363{
364 if(v->owned)
365 VariantClear(v->v);
366}
367
369{
371
372 if(V_VT(r->v) == VT_DISPATCH) {
374
375 hres = get_disp_value(ctx->script, V_DISPATCH(r->v), &r->store);
376 if(r->owned && V_DISPATCH(r->v))
377 IDispatch_Release(V_DISPATCH(r->v));
378 if(FAILED(hres))
379 return hres;
380
381 r->owned = TRUE;
382 r->v = &r->store;
383 }
384
385 return S_OK;
386}
387
389{
390 VARIANT *v = stack_top(ctx, n);
392
393 if(V_VT(v) == (VT_BYREF|VT_VARIANT)) {
395
396 V_VT(v) = VT_EMPTY;
397 hres = VariantCopy(v, ref);
398 if(FAILED(hres))
399 return hres;
400 }
401
402 if(V_VT(v) == VT_DISPATCH) {
403 IDispatch *disp;
404
405 disp = V_DISPATCH(v);
406 hres = get_disp_value(ctx->script, disp, v);
407 if(disp)
408 IDispatch_Release(disp);
409 if(FAILED(hres))
410 return hres;
411 }
412
413 return S_OK;
414}
415
417{
420 VARIANT v;
421
423 if(FAILED(hres))
424 return hres;
425
426 if (V_VT(val.v) == VT_NULL)
427 {
428 *b = FALSE;
429 }
430 else
431 {
432 V_VT(&v) = VT_EMPTY;
434 *b = !!V_BOOL(&v);
435 }
436
438
439 return hres;
440}
441
443{
445
446 if(V_VT(v) == VT_DISPATCH) {
447 *ret = V_DISPATCH(v);
448 return S_OK;
449 }
450
451 if(V_VT(v) != (VT_VARIANT|VT_BYREF)) {
452 FIXME("not supported type: %s\n", debugstr_variant(v));
454 return E_FAIL;
455 }
456
457 v = V_BYREF(v);
458 if(V_VT(v) != VT_DISPATCH) {
459 FIXME("not disp %s\n", debugstr_variant(v));
460 return E_FAIL;
461 }
462
463 if(V_DISPATCH(v))
464 IDispatch_AddRef(V_DISPATCH(v));
465 *ret = V_DISPATCH(v);
466 return S_OK;
467}
468
470{
471 VARIANT *v = stack_top(ctx, n), *ref;
472
473 if(V_VT(v) != VT_DISPATCH && (disp || V_VT(v) != VT_UNKNOWN)) {
474 if(V_VT(v) != (VT_VARIANT|VT_BYREF)) {
475 FIXME("not supported type: %s\n", debugstr_variant(v));
476 return E_FAIL;
477 }
478
479 ref = V_VARIANTREF(v);
480 if(V_VT(ref) != VT_DISPATCH && (disp || V_VT(ref) != VT_UNKNOWN)) {
481 FIXME("not disp %s\n", debugstr_variant(ref));
482 return E_FAIL;
483 }
484
485 V_VT(v) = V_VT(ref);
487 if(V_UNKNOWN(v))
488 IUnknown_AddRef(V_UNKNOWN(v));
489 }
490
491 if(disp)
492 *disp = V_DISPATCH(v);
493 return S_OK;
494}
495
496static inline void instr_jmp(exec_ctx_t *ctx, unsigned addr)
497{
498 ctx->instr = ctx->code->instrs + addr;
499}
500
501static void vbstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, BOOL is_propput, DISPPARAMS *dp)
502{
503 dp->cNamedArgs = is_propput ? 1 : 0;
504 dp->cArgs = arg_cnt + dp->cNamedArgs;
505 dp->rgdispidNamedArgs = is_propput ? &propput_dispid : NULL;
506
507 if(arg_cnt) {
508 VARIANT tmp;
509 unsigned i;
510
511 assert(ctx->top >= arg_cnt);
512
513 for(i=1; i*2 <= arg_cnt; i++) {
514 tmp = ctx->stack[ctx->top-i];
515 ctx->stack[ctx->top-i] = ctx->stack[ctx->top-arg_cnt+i-1];
516 ctx->stack[ctx->top-arg_cnt+i-1] = tmp;
517 }
518
519 dp->rgvarg = ctx->stack + ctx->top-dp->cArgs;
520 }else {
521 dp->rgvarg = is_propput ? ctx->stack+ctx->top-1 : NULL;
522 }
523}
524
526{
527 unsigned i, argc = arg_cnt(dp);
528 LONG *indices;
530
531 if(!array) {
532 FIXME("NULL array\n");
533 return E_FAIL;
534 }
535
537 if(FAILED(hres))
538 return hres;
539
540 if(array->cDims != argc) {
541 FIXME("argc %d does not match cDims %d\n", dp->cArgs, array->cDims);
543 return E_FAIL;
544 }
545
546 indices = malloc(sizeof(*indices) * argc);
547 if(!indices) {
549 return E_OUTOFMEMORY;
550 }
551
552 for(i=0; i<argc; i++) {
553 hres = to_int(get_arg(dp, i), (int *)(indices+i));
554 if(FAILED(hres)) {
555 free(indices);
557 return hres;
558 }
559 }
560
563 free(indices);
564 return hres;
565}
566
568{
570 DISPPARAMS dp;
572
573 TRACE("%s\n", debugstr_variant(v));
574
575 if(V_VT(v) == (VT_VARIANT|VT_BYREF))
576 v = V_VARIANTREF(v);
577
578 switch(V_VT(v)) {
580 array = *V_ARRAYREF(v);
581 break;
582 case VT_ARRAY|VT_VARIANT:
583 array = V_ARRAY(v);
584 break;
585 case VT_DISPATCH:
587 hres = disp_call(ctx->script, V_DISPATCH(v), DISPID_VALUE, &dp, res);
588 break;
589 default:
590 FIXME("unsupported on %s\n", debugstr_variant(v));
591 return E_NOTIMPL;
592 }
593
594 if(array) {
595 if(!res) {
596 FIXME("no res\n");
597 return E_NOTIMPL;
598 }
599
601 hres = array_access(array, &dp, &v);
602 if(FAILED(hres))
603 return hres;
604
606 V_BYREF(res) = v;
607 }
608
610 return S_OK;
611}
612
613static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res, BSTR identifier, unsigned arg_cnt)
614{
615 DISPPARAMS dp;
616 ref_t ref;
618
619 TRACE("%s %u\n", debugstr_w(identifier), arg_cnt);
620
621 hres = lookup_identifier(ctx, identifier, VBDISP_CALLGET, &ref);
622 if(FAILED(hres))
623 return hres;
624
625 switch(ref.type) {
626 case REF_VAR:
627 case REF_CONST:
628 if(arg_cnt)
629 return variant_call(ctx, ref.u.v, arg_cnt, res);
630
631 if(!res) {
632 FIXME("REF_VAR no res\n");
633 return E_NOTIMPL;
634 }
635
637 V_BYREF(res) = V_VT(ref.u.v) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(ref.u.v) : ref.u.v;
638 break;
639 case REF_DISP:
641 hres = disp_call(ctx->script, ref.u.d.disp, ref.u.d.id, &dp, res);
642 if(FAILED(hres))
643 return hres;
644 break;
645 case REF_FUNC:
647 hres = exec_script(ctx->script, FALSE, ref.u.f, NULL, &dp, res);
648 if(FAILED(hres))
649 return hres;
650 break;
651 case REF_OBJ:
652 if(arg_cnt) {
653 FIXME("arguments on object\n");
654 return E_NOTIMPL;
655 }
656
657 if(res) {
658 IDispatch_AddRef(ref.u.obj);
660 V_DISPATCH(res) = ref.u.obj;
661 }
662 break;
663 case REF_NONE:
664 if(res && !ctx->func->code_ctx->option_explicit && arg_cnt == 0) {
665 VARIANT *new;
666 hres = add_dynamic_var(ctx, identifier, FALSE, &new);
667 if(FAILED(hres))
668 return hres;
670 V_BYREF(res) = new;
671 break;
672 }
673 FIXME("%s not found\n", debugstr_w(identifier));
674 return DISP_E_UNKNOWNNAME;
675 }
676
678 return S_OK;
679}
680
682{
683 BSTR identifier = ctx->instr->arg1.bstr;
684 const unsigned arg_cnt = ctx->instr->arg2.uint;
685 VARIANT v;
687
688 TRACE("\n");
689
690 hres = do_icall(ctx, &v, identifier, arg_cnt);
691 if(FAILED(hres))
692 return hres;
693
694 return stack_push(ctx, &v);
695}
696
698{
699 BSTR identifier = ctx->instr->arg1.bstr;
700 const unsigned arg_cnt = ctx->instr->arg2.uint;
701
702 TRACE("\n");
703
704 return do_icall(ctx, NULL, identifier, arg_cnt);
705}
706
708{
709 const unsigned arg_cnt = ctx->instr->arg1.uint;
710 VARIANT res, *v;
712
713 TRACE("\n");
714
715 v = stack_pop(ctx);
718 if(FAILED(hres))
719 return hres;
720
721 return stack_push(ctx, &res);
722}
723
725{
726 const unsigned arg_cnt = ctx->instr->arg1.uint;
727 VARIANT *v;
729
730 TRACE("\n");
731
732 v = stack_pop(ctx);
735 return hres;
736}
737
739{
740 const BSTR identifier = ctx->instr->arg1.bstr;
741 const unsigned arg_cnt = ctx->instr->arg2.uint;
742 IDispatch *obj;
743 DISPPARAMS dp;
744 DISPID id;
746
748 if(FAILED(hres))
749 return hres;
750
751 if(!obj) {
752 FIXME("NULL obj\n");
753 return E_FAIL;
754 }
755
757
758 hres = disp_get_id(obj, identifier, VBDISP_CALLGET, FALSE, &id);
759 if(SUCCEEDED(hres))
760 hres = disp_call(ctx->script, obj, id, &dp, res);
761 IDispatch_Release(obj);
762 if(FAILED(hres))
763 return hres;
764
766 return S_OK;
767}
768
770{
771 VARIANT res;
773
774 TRACE("\n");
775
776 hres = do_mcall(ctx, &res);
777 if(FAILED(hres))
778 return hres;
779
780 return stack_push(ctx, &res);
781}
782
784{
785 TRACE("\n");
786
787 return do_mcall(ctx, NULL);
788}
789
791{
792 BSTR identifier = ctx->instr->arg1.bstr;
793 VARIANT v;
795
796 TRACE("%s\n", debugstr_w(identifier));
797
798 if((ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
799 && !wcsicmp(identifier, ctx->func->name)) {
801 V_BYREF(&v) = &ctx->ret_val;
802 return stack_push(ctx, &v);
803 }
804
805 hres = do_icall(ctx, &v, identifier, 0);
806 if(FAILED(hres))
807 return hres;
808
809 return stack_push(ctx, &v);
810}
811
813{
816
817 V_VT(&value) = VT_EMPTY;
819 if(FAILED(hres))
820 return hres;
821
823 IDispatch *disp = V_DISPATCH(&value);
824
825 V_VT(&value) = VT_EMPTY;
826 hres = get_disp_value(ctx->script, disp, &value);
827 if(disp)
828 IDispatch_Release(disp);
829 if(FAILED(hres))
830 return hres;
831 }
832
834 *dst = value;
835 return S_OK;
836}
837
839{
840 ref_t ref;
842
844 if(FAILED(hres))
845 return hres;
846
847 switch(ref.type) {
848 case REF_VAR: {
849 VARIANT *v = ref.u.v;
850
851 if(V_VT(v) == (VT_VARIANT|VT_BYREF))
852 v = V_VARIANTREF(v);
853
854 if(arg_cnt(dp)) {
856
857 if(V_VT(v) == VT_DISPATCH) {
858 hres = disp_propput(ctx->script, V_DISPATCH(v), DISPID_VALUE, flags, dp);
859 break;
860 }
861
862 if(!(V_VT(v) & VT_ARRAY)) {
863 FIXME("array assign on type %d\n", V_VT(v));
864 return E_FAIL;
865 }
866
867 switch(V_VT(v)) {
869 array = *V_ARRAYREF(v);
870 break;
871 case VT_ARRAY|VT_VARIANT:
872 array = V_ARRAY(v);
873 break;
874 default:
875 FIXME("Unsupported array type %x\n", V_VT(v));
876 return E_NOTIMPL;
877 }
878
879 if(!array) {
880 FIXME("null array\n");
881 return E_FAIL;
882 }
883
884 hres = array_access(array, dp, &v);
885 if(FAILED(hres))
886 return hres;
887 }else if(V_VT(v) == (VT_ARRAY|VT_BYREF|VT_VARIANT)) {
888 FIXME("non-array assign\n");
889 return E_NOTIMPL;
890 }
891
892 hres = assign_value(ctx, v, dp->rgvarg, flags);
893 break;
894 }
895 case REF_DISP:
896 hres = disp_propput(ctx->script, ref.u.d.disp, ref.u.d.id, flags, dp);
897 break;
898 case REF_FUNC:
899 FIXME("functions not implemented\n");
900 return E_NOTIMPL;
901 case REF_OBJ:
902 FIXME("REF_OBJ\n");
903 return E_NOTIMPL;
904 case REF_CONST:
905 FIXME("REF_CONST\n");
906 return E_NOTIMPL;
907 case REF_NONE:
908 if(ctx->func->code_ctx->option_explicit) {
909 FIXME("throw exception\n");
910 hres = E_FAIL;
911 }else {
912 VARIANT *new_var;
913
914 if(arg_cnt(dp)) {
915 FIXME("arg_cnt %d not supported\n", arg_cnt(dp));
916 return E_NOTIMPL;
917 }
918
919 TRACE("creating variable %s\n", debugstr_w(name));
920 hres = add_dynamic_var(ctx, name, FALSE, &new_var);
921 if(SUCCEEDED(hres))
922 hres = assign_value(ctx, new_var, dp->rgvarg, flags);
923 }
924 }
925
926 return hres;
927}
928
930{
931 const BSTR arg = ctx->instr->arg1.bstr;
932 const unsigned arg_cnt = ctx->instr->arg2.uint;
933 DISPPARAMS dp;
935
936 TRACE("%s\n", debugstr_w(arg));
937
940 if(FAILED(hres))
941 return hres;
942
944 return S_OK;
945}
946
948{
949 const BSTR arg = ctx->instr->arg1.bstr;
950 const unsigned arg_cnt = ctx->instr->arg2.uint;
951 DISPPARAMS dp;
953
954 TRACE("%s %u\n", debugstr_w(arg), arg_cnt);
955
957 if(FAILED(hres))
958 return hres;
959
962 if(FAILED(hres))
963 return hres;
964
965 stack_popn(ctx, arg_cnt + 1);
966 return S_OK;
967}
968
970{
971 BSTR identifier = ctx->instr->arg1.bstr;
972 const unsigned arg_cnt = ctx->instr->arg2.uint;
973 IDispatch *obj;
974 DISPPARAMS dp;
975 DISPID id;
977
978 TRACE("%s\n", debugstr_w(identifier));
979
981 if(FAILED(hres))
982 return hres;
983
984 if(!obj) {
985 FIXME("NULL obj\n");
986 return E_FAIL;
987 }
988
989 hres = disp_get_id(obj, identifier, VBDISP_LET, FALSE, &id);
990 if(SUCCEEDED(hres)) {
992 hres = disp_propput(ctx->script, obj, id, DISPATCH_PROPERTYPUT, &dp);
993 }
994 if(FAILED(hres))
995 return hres;
996
998 return S_OK;
999}
1000
1002{
1003 BSTR identifier = ctx->instr->arg1.bstr;
1004 const unsigned arg_cnt = ctx->instr->arg2.uint;
1005 IDispatch *obj;
1006 DISPPARAMS dp;
1007 DISPID id;
1008 HRESULT hres;
1009
1010 TRACE("%s\n", debugstr_w(identifier));
1011
1013 if(FAILED(hres))
1014 return hres;
1015
1016 if(!obj) {
1017 FIXME("NULL obj\n");
1018 return E_FAIL;
1019 }
1020
1022 if(FAILED(hres))
1023 return hres;
1024
1025 hres = disp_get_id(obj, identifier, VBDISP_SET, FALSE, &id);
1026 if(SUCCEEDED(hres)) {
1027 vbstack_to_dp(ctx, arg_cnt, TRUE, &dp);
1028 hres = disp_propput(ctx->script, obj, id, DISPATCH_PROPERTYPUTREF, &dp);
1029 }
1030 if(FAILED(hres))
1031 return hres;
1032
1034 return S_OK;
1035}
1036
1038{
1039 BSTR arg = ctx->instr->arg1.bstr;
1040 VARIANT *v;
1041 ref_t ref;
1042 HRESULT hres;
1043
1044 TRACE("%s\n", debugstr_w(arg));
1045
1046 assert(ctx->func->type == FUNC_GLOBAL);
1047
1049 if(FAILED(hres))
1050 return hres;
1051
1052 if(ref.type != REF_NONE) {
1053 FIXME("%s already defined\n", debugstr_w(arg));
1054 return E_FAIL;
1055 }
1056
1058 if(FAILED(hres))
1059 return hres;
1060
1062 if(FAILED(hres))
1063 return hres;
1064
1065 *v = *stack_pop(ctx);
1066 return S_OK;
1067}
1068
1070{
1072 VARIANT v;
1073 HRESULT hres;
1074
1075 TRACE("\n");
1076
1078 if(FAILED(hres))
1079 return hres;
1080
1081 if(!val.owned) {
1082 V_VT(&v) = VT_EMPTY;
1083 hres = VariantCopy(&v, val.v);
1084 if(FAILED(hres))
1085 return hres;
1086 }
1087
1088 return stack_push(ctx, val.owned ? val.v : &v);
1089}
1090
1092{
1094 VARIANT v;
1095 HRESULT hres;
1096
1097 TRACE("\n");
1098
1100 if(FAILED(hres))
1101 return hres;
1102
1103 if (V_VT(val.v) == VT_BSTR) {
1104 V_VT(&v) = VT_EMPTY;
1105 hres = VariantChangeType(&v, val.v, 0, VT_R8);
1106 if(FAILED(hres))
1107 return hres;
1108 release_val(&val);
1109 return stack_push(ctx, &v);
1110 }
1111
1112 if(!val.owned) {
1113 V_VT(&v) = VT_EMPTY;
1114 hres = VariantCopy(&v, val.v);
1115 if(FAILED(hres))
1116 return hres;
1117 }
1118
1119 return stack_push(ctx, val.owned ? val.v : &v);
1120}
1121
1123{
1124 const unsigned n = ctx->instr->arg1.uint;
1125
1126 TRACE("%u\n", n);
1127
1128 stack_popn(ctx, n);
1129 return S_OK;
1130}
1131
1133{
1134 const unsigned n = ctx->instr->arg1.uint;
1135 VARIANT v;
1136 HRESULT hres;
1137
1138 TRACE("%#x\n", n);
1139
1140 if(n == ~0)
1141 return MAKE_VBSERROR(505);
1142 assert(n < ctx->top);
1143
1144 V_VT(&v) = VT_EMPTY;
1145 hres = VariantCopy(&v, ctx->stack + n);
1146 if(FAILED(hres))
1147 return hres;
1148
1149 return stack_push(ctx, &v);
1150}
1151
1153{
1154 VARIANT copy, *v = stack_top(ctx, 0);
1155 HRESULT hres;
1156
1157 TRACE("%s\n", debugstr_variant(v));
1158
1159 if(V_VT(v) != (VT_BYREF|VT_VARIANT))
1160 return S_OK;
1161
1162 V_VT(&copy) = VT_EMPTY;
1164 if(SUCCEEDED(hres))
1165 *v = copy;
1166 return hres;
1167}
1168
1170{
1171 const WCHAR *arg = ctx->instr->arg1.bstr;
1172 class_desc_t *class_desc = NULL;
1173 vbdisp_t *obj;
1174 VARIANT v;
1175 HRESULT hres;
1176
1177 TRACE("%s\n", debugstr_w(arg));
1178
1179 if(!wcsicmp(arg, L"regexp")) {
1180 V_VT(&v) = VT_DISPATCH;
1182 if(FAILED(hres))
1183 return hres;
1184
1185 return stack_push(ctx, &v);
1186 }
1187
1188 if(ctx->code->named_item)
1189 for(class_desc = ctx->code->named_item->script_obj->classes; class_desc; class_desc = class_desc->next)
1190 if(!wcsicmp(class_desc->name, arg))
1191 break;
1192 if(!class_desc)
1193 for(class_desc = ctx->script->script_obj->classes; class_desc; class_desc = class_desc->next)
1194 if(!wcsicmp(class_desc->name, arg))
1195 break;
1196 if(!class_desc) {
1197 FIXME("Class %s not found\n", debugstr_w(arg));
1198 return E_FAIL;
1199 }
1200
1201 hres = create_vbdisp(class_desc, &obj);
1202 if(FAILED(hres))
1203 return hres;
1204
1205 V_VT(&v) = VT_DISPATCH;
1206 V_DISPATCH(&v) = (IDispatch*)&obj->IDispatchEx_iface;
1207 return stack_push(ctx, &v);
1208}
1209
1211{
1212 ScriptDisp *script_obj = ctx->code->named_item ? ctx->code->named_item->script_obj : ctx->script->script_obj;
1213 const BSTR ident = ctx->instr->arg1.bstr;
1214 const unsigned array_id = ctx->instr->arg2.uint;
1215 const array_desc_t *array_desc;
1216 SAFEARRAY **array_ref;
1217 VARIANT *v;
1218 HRESULT hres;
1219
1220 TRACE("%s\n", debugstr_w(ident));
1221
1222 assert(array_id < ctx->func->array_cnt);
1223
1224 if(ctx->func->type == FUNC_GLOBAL) {
1225 unsigned i;
1226 for(i = 0; i < script_obj->global_vars_cnt; i++) {
1227 if(!wcsicmp(script_obj->global_vars[i]->name, ident))
1228 break;
1229 }
1230 assert(i < script_obj->global_vars_cnt);
1231 v = &script_obj->global_vars[i]->v;
1232 array_ref = &script_obj->global_vars[i]->array;
1233 }else {
1234 ref_t ref;
1235
1236 if(!ctx->arrays) {
1237 ctx->arrays = calloc(ctx->func->array_cnt, sizeof(SAFEARRAY*));
1238 if(!ctx->arrays)
1239 return E_OUTOFMEMORY;
1240 }
1241
1243 if(FAILED(hres)) {
1244 FIXME("lookup %s failed: %08lx\n", debugstr_w(ident), hres);
1245 return hres;
1246 }
1247
1248 if(ref.type != REF_VAR) {
1249 FIXME("got ref.type = %d\n", ref.type);
1250 return E_FAIL;
1251 }
1252
1253 v = ref.u.v;
1254 array_ref = ctx->arrays + array_id;
1255 }
1256
1257 if(*array_ref) {
1258 FIXME("Array already initialized\n");
1259 return E_FAIL;
1260 }
1261
1262 array_desc = ctx->func->array_descs + array_id;
1263 if(array_desc->dim_cnt) {
1264 *array_ref = SafeArrayCreate(VT_VARIANT, array_desc->dim_cnt, array_desc->bounds);
1265 if(!*array_ref)
1266 return E_OUTOFMEMORY;
1267 (*array_ref)->fFeatures |= (FADF_FIXEDSIZE | FADF_STATIC);
1268 }
1269
1271 V_ARRAYREF(v) = array_ref;
1272 return S_OK;
1273}
1274
1276{
1277 SAFEARRAYBOUND *bounds;
1278 unsigned i;
1279 int dim;
1280 HRESULT hres;
1281
1282 if(!(bounds = malloc(dim_cnt * sizeof(*bounds))))
1283 return E_OUTOFMEMORY;
1284
1285 for(i = 0; i < dim_cnt; i++) {
1286 hres = to_int(stack_top(ctx, dim_cnt - i - 1), &dim);
1287 if(FAILED(hres)) {
1288 free(bounds);
1289 return hres;
1290 }
1291
1292 bounds[i].cElements = dim + 1;
1293 bounds[i].lLbound = 0;
1294 }
1295
1296 stack_popn(ctx, dim_cnt);
1297 *ret = bounds;
1298 return S_OK;
1299}
1300
1302{
1303 BSTR identifier = ctx->instr->arg1.bstr;
1304 const unsigned dim_cnt = ctx->instr->arg2.uint;
1305 VARIANT *v;
1306 SAFEARRAYBOUND *bounds;
1308 ref_t ref;
1309 HRESULT hres;
1310
1311 TRACE("%s %u\n", debugstr_w(identifier), dim_cnt);
1312
1313 hres = lookup_identifier(ctx, identifier, VBDISP_LET, &ref);
1314 if(FAILED(hres)) {
1315 FIXME("lookup %s failed: %08lx\n", debugstr_w(identifier), hres);
1316 return hres;
1317 }
1318
1319 if(ref.type != REF_VAR) {
1320 FIXME("got ref.type = %d\n", ref.type);
1321 return E_FAIL;
1322 }
1323
1324 v = ref.u.v;
1325
1326 if(V_VT(v) == (VT_VARIANT|VT_BYREF)) {
1327 v = V_VARIANTREF(v);
1328 }
1329
1330 if(V_ISARRAY(v)) {
1332 if(sa->fFeatures & FADF_FIXEDSIZE)
1334 }
1335
1336 hres = array_bounds_from_stack(ctx, dim_cnt, &bounds);
1337 if(FAILED(hres))
1338 return hres;
1339
1340 array = SafeArrayCreate(VT_VARIANT, dim_cnt, bounds);
1341 free(bounds);
1342 if(!array)
1343 return E_OUTOFMEMORY;
1344
1345 VariantClear(v);
1347 V_ARRAY(v) = array;
1348
1349 return S_OK;
1350}
1351
1353{
1354 BSTR identifier = ctx->instr->arg1.bstr;
1355 const unsigned dim_cnt = ctx->instr->arg2.uint;
1356 unsigned i;
1357 VARIANT *v;
1358 SAFEARRAYBOUND *bounds;
1360 ref_t ref;
1361 HRESULT hres;
1362
1363 TRACE("%s %u\n", debugstr_w(identifier), dim_cnt);
1364
1365 hres = lookup_identifier(ctx, identifier, VBDISP_LET, &ref);
1366 if(FAILED(hres)) {
1367 FIXME("lookup %s failed: %08lx\n", debugstr_w(identifier), hres);
1368 return hres;
1369 }
1370
1371 if(ref.type != REF_VAR) {
1372 FIXME("got ref.type = %d\n", ref.type);
1373 return E_FAIL;
1374 }
1375
1376 v = ref.u.v;
1377
1378 if(V_VT(v) == (VT_VARIANT|VT_BYREF)) {
1379 v = V_VARIANTREF(v);
1380 }
1381
1382 if(!(V_VT(v) & VT_ARRAY)) {
1383 FIXME("ReDim Preserve not valid on type %d\n", V_VT(v));
1384 return E_FAIL;
1385 }
1386
1387 array = V_ISBYREF(v) ? *V_ARRAYREF(v) : V_ARRAY(v);
1388
1389 hres = array_bounds_from_stack(ctx, dim_cnt, &bounds);
1390 if(FAILED(hres))
1391 return hres;
1392
1393 if(array == NULL || array->cDims == 0) {
1394 /* can initially allocate the array */
1395 array = SafeArrayCreate(VT_VARIANT, dim_cnt, bounds);
1396 if(!array)
1398 else {
1399 VariantClear(v);
1401 V_ARRAY(v) = array;
1402 }
1403 } else if(array->cDims != dim_cnt) {
1404 /* can't otherwise change the number of dimensions */
1405 TRACE("Can't resize %s, cDims %d != %d\n", debugstr_w(identifier), array->cDims, dim_cnt);
1407 } else {
1408 /* can resize the last dimensions (if others match */
1409 for(i = 0; i+1 < dim_cnt; ++i) {
1410 if(array->rgsabound[array->cDims - 1 - i].cElements != bounds[i].cElements) {
1411 TRACE("Can't resize %s, bound[%d] %ld != %ld\n", debugstr_w(identifier), i, array->rgsabound[i].cElements, bounds[i].cElements);
1413 break;
1414 }
1415 }
1416 if(SUCCEEDED(hres))
1417 hres = SafeArrayRedim(array, &bounds[dim_cnt-1]);
1418 }
1419 free(bounds);
1420 return hres;
1421}
1422
1424{
1425 const BSTR ident = ctx->instr->arg2.bstr;
1426 BOOL gteq_zero;
1427 VARIANT zero;
1428 ref_t ref;
1429 HRESULT hres;
1430
1431 TRACE("%s\n", debugstr_w(ident));
1432
1433 V_VT(&zero) = VT_I2;
1434 V_I2(&zero) = 0;
1435 hres = VarCmp(stack_top(ctx, 0), &zero, ctx->script->lcid, 0);
1436 if(FAILED(hres))
1437 return hres;
1438
1439 gteq_zero = hres == VARCMP_GT || hres == VARCMP_EQ;
1440
1442 if(FAILED(hres))
1443 return hres;
1444
1445 if(ref.type != REF_VAR) {
1446 FIXME("%s is not REF_VAR\n", debugstr_w(ident));
1447 return E_FAIL;
1448 }
1449
1450 hres = VarCmp(ref.u.v, stack_top(ctx, 1), ctx->script->lcid, 0);
1451 if(FAILED(hres))
1452 return hres;
1453
1454 if(hres == VARCMP_EQ || hres == (gteq_zero ? VARCMP_LT : VARCMP_GT)) {
1455 ctx->instr++;
1456 }else {
1457 stack_popn(ctx, 2);
1458 instr_jmp(ctx, ctx->instr->arg1.uint);
1459 }
1460 return S_OK;
1461}
1462
1464{
1466 VARIANT *r;
1467 HRESULT hres;
1468
1469 TRACE("\n");
1470
1472 assert(V_VT(stack_top(ctx, 0)) == VT_EMPTY);
1473 r = stack_top(ctx, 0);
1474
1475 switch(V_VT(v.v)) {
1476 case VT_DISPATCH|VT_BYREF:
1477 case VT_DISPATCH: {
1478 IEnumVARIANT *iter;
1479 DISPPARAMS dp = {0};
1480 VARIANT iterv;
1481
1482 hres = disp_call(ctx->script, V_ISBYREF(v.v) ? *V_DISPATCHREF(v.v) : V_DISPATCH(v.v), DISPID_NEWENUM, &dp, &iterv);
1483 release_val(&v);
1484 if(FAILED(hres))
1485 return hres;
1486
1487 if(V_VT(&iterv) != VT_UNKNOWN && V_VT(&iterv) != VT_DISPATCH) {
1488 FIXME("Unsupported iterv %s\n", debugstr_variant(&iterv));
1489 VariantClear(&iterv);
1490 return hres;
1491 }
1492
1493 hres = IUnknown_QueryInterface(V_UNKNOWN(&iterv), &IID_IEnumVARIANT, (void**)&iter);
1494 IUnknown_Release(V_UNKNOWN(&iterv));
1495 if(FAILED(hres)) {
1496 FIXME("Could not get IEnumVARIANT iface: %08lx\n", hres);
1497 return hres;
1498 }
1499
1500 V_VT(r) = VT_UNKNOWN;
1501 V_UNKNOWN(r) = (IUnknown*)iter;
1502 break;
1503 }
1504 case VT_VARIANT|VT_ARRAY:
1506 IEnumVARIANT *iter;
1507
1508 hres = create_safearray_iter(V_ISBYREF(v.v) ? *V_ARRAYREF(v.v) : V_ARRAY(v.v), v.owned && !V_ISBYREF(v.v), &iter);
1509 if(FAILED(hres))
1510 return hres;
1511
1512 V_VT(r) = VT_UNKNOWN;
1513 V_UNKNOWN(r) = (IUnknown*)iter;
1514 break;
1515 }
1516 default:
1517 FIXME("Unsupported for %s\n", debugstr_variant(v.v));
1518 release_val(&v);
1519 return E_NOTIMPL;
1520 }
1521
1522 return S_OK;
1523}
1524
1526{
1527 const unsigned loop_end = ctx->instr->arg1.uint;
1528 const BSTR ident = ctx->instr->arg2.bstr;
1529 VARIANT v;
1530 DISPPARAMS dp = {&v, &propput_dispid, 1, 1};
1531 IEnumVARIANT *iter;
1532 BOOL do_continue;
1533 HRESULT hres;
1534
1535 TRACE("\n");
1536
1537 if(V_VT(stack_top(ctx, 0)) == VT_EMPTY) {
1538 FIXME("uninitialized\n");
1539 return E_FAIL;
1540 }
1541
1543 iter = (IEnumVARIANT*)V_UNKNOWN(stack_top(ctx, 0));
1544
1545 V_VT(&v) = VT_EMPTY;
1546 hres = IEnumVARIANT_Next(iter, 1, &v, NULL);
1547 if(FAILED(hres))
1548 return hres;
1549
1550 do_continue = hres == S_OK;
1552 VariantClear(&v);
1553 if(FAILED(hres))
1554 return hres;
1555
1556 if(do_continue) {
1557 ctx->instr++;
1558 }else {
1559 stack_popn(ctx, 1);
1560 instr_jmp(ctx, loop_end);
1561 }
1562 return S_OK;
1563}
1564
1566{
1567 const unsigned arg = ctx->instr->arg1.uint;
1568
1569 TRACE("%u\n", arg);
1570
1571 instr_jmp(ctx, arg);
1572 return S_OK;
1573}
1574
1576{
1577 const unsigned arg = ctx->instr->arg1.uint;
1578 HRESULT hres;
1579 BOOL b;
1580
1581 TRACE("%u\n", arg);
1582
1583 hres = stack_pop_bool(ctx, &b);
1584 if(FAILED(hres))
1585 return hres;
1586
1587 if(b)
1588 ctx->instr++;
1589 else
1590 instr_jmp(ctx, ctx->instr->arg1.uint);
1591 return S_OK;
1592}
1593
1595{
1596 const unsigned arg = ctx->instr->arg1.uint;
1597 HRESULT hres;
1598 BOOL b;
1599
1600 TRACE("%u\n", arg);
1601
1602 hres = stack_pop_bool(ctx, &b);
1603 if(FAILED(hres))
1604 return hres;
1605
1606 if(b)
1607 instr_jmp(ctx, ctx->instr->arg1.uint);
1608 else
1609 ctx->instr++;
1610 return S_OK;
1611}
1612
1614{
1615 TRACE("\n");
1616
1617 ctx->instr = NULL;
1618 return S_OK;
1619}
1620
1622{
1624 HRESULT hres;
1625
1626 TRACE("\n");
1627
1629
1630 if(val.owned) {
1631 VariantClear(&ctx->ret_val);
1632 ctx->ret_val = *val.v;
1633 }
1634 else {
1635 hres = VariantCopy(&ctx->ret_val, val.v);
1636 if(FAILED(hres))
1637 return hres;
1638 }
1639
1640 return S_OK;
1641}
1642
1644{
1645 WARN("\n");
1646
1647 /* NOTE: this should have effect in debugging mode (that we don't support yet) */
1648 return S_OK;
1649}
1650
1652{
1653 IDispatch *disp;
1654 VARIANT v;
1655
1656 TRACE("\n");
1657
1658 if(ctx->vbthis) {
1659 disp = (IDispatch*)&ctx->vbthis->IDispatchEx_iface;
1660 }else if(ctx->code->named_item) {
1661 disp = (ctx->code->named_item->flags & SCRIPTITEM_CODEONLY)
1662 ? (IDispatch*)&ctx->code->named_item->script_obj->IDispatchEx_iface
1663 : ctx->code->named_item->disp;
1664 }else {
1666 disp = NULL;
1667 LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
1668 if(!(item->flags & SCRIPTITEM_GLOBALMEMBERS)) continue;
1669 disp = item->disp;
1670 break;
1671 }
1672 if(!disp)
1673 disp = (IDispatch*)&ctx->script->script_obj->IDispatchEx_iface;
1674 }
1675
1676 IDispatch_AddRef(disp);
1677 V_VT(&v) = VT_DISPATCH;
1678 V_DISPATCH(&v) = disp;
1679 return stack_push(ctx, &v);
1680}
1681
1683{
1684 const VARIANT_BOOL arg = ctx->instr->arg1.lng;
1685 VARIANT v;
1686
1687 TRACE("%s\n", arg ? "true" : "false");
1688
1689 V_VT(&v) = VT_BOOL;
1690 V_BOOL(&v) = arg;
1691 return stack_push(ctx, &v);
1692}
1693
1695{
1696 const int err_mode = ctx->instr->arg1.uint;
1697
1698 TRACE("%d\n", err_mode);
1699
1700 ctx->resume_next = err_mode;
1701 clear_ei(&ctx->script->ei);
1702 return S_OK;
1703}
1704
1706{
1707 VARIANT v;
1708
1709 TRACE("\n");
1710
1711 V_VT(&v) = VT_BSTR;
1712 V_BSTR(&v) = SysAllocString(ctx->instr->arg1.str);
1713 if(!V_BSTR(&v))
1714 return E_OUTOFMEMORY;
1715
1716 return stack_push(ctx, &v);
1717}
1718
1720{
1721 const DATE *d = ctx->instr->arg1.date;
1722 VARIANT v;
1723
1724 TRACE("%lf\n",*d);
1725
1726 V_VT(&v) = VT_DATE;
1727 V_DATE(&v) = *d;
1728
1729 return stack_push(ctx, &v);
1730}
1731
1733{
1734 const LONG arg = ctx->instr->arg1.lng;
1735 VARIANT v;
1736
1737 TRACE("%ld\n", arg);
1738
1739 if(arg == (INT16)arg) {
1740 V_VT(&v) = VT_I2;
1741 V_I2(&v) = arg;
1742 }else {
1743 V_VT(&v) = VT_I4;
1744 V_I4(&v) = arg;
1745 }
1746 return stack_push(ctx, &v);
1747}
1748
1750{
1751 const DOUBLE *arg = ctx->instr->arg1.dbl;
1752 VARIANT v;
1753
1754 TRACE("%lf\n", *arg);
1755
1756 V_VT(&v) = VT_R8;
1757 V_R8(&v) = *arg;
1758 return stack_push(ctx, &v);
1759}
1760
1762{
1763 VARIANT v;
1764
1765 TRACE("\n");
1766
1767 V_VT(&v) = VT_EMPTY;
1768 return stack_push(ctx, &v);
1769}
1770
1772{
1773 TRACE("\n");
1774 return stack_push_null(ctx);
1775}
1776
1778{
1779 VARIANT v;
1780
1781 TRACE("\n");
1782
1783 V_VT(&v) = VT_DISPATCH;
1784 V_DISPATCH(&v) = NULL;
1785 return stack_push(ctx, &v);
1786}
1787
1789{
1790 const unsigned arg = ctx->instr->arg1.uint;
1791 VARIANT v;
1792
1793 TRACE("%d\n", arg);
1794
1795 V_VT(&v) = VT_ERROR;
1796 V_ERROR(&v) = arg;
1797 return stack_push(ctx, &v);
1798}
1799
1801{
1803 VARIANT v;
1804 HRESULT hres;
1805
1806 TRACE("\n");
1807
1809 if(FAILED(hres))
1810 return hres;
1811
1812 hres = VarNot(val.v, &v);
1813 release_val(&val);
1814 if(FAILED(hres))
1815 return hres;
1816
1817 return stack_push(ctx, &v);
1818}
1819
1821{
1822 variant_val_t r, l;
1823 VARIANT v;
1824 HRESULT hres;
1825
1826 TRACE("\n");
1827
1828 hres = stack_pop_val(ctx, &r);
1829 if(FAILED(hres))
1830 return hres;
1831
1832 hres = stack_pop_val(ctx, &l);
1833 if(SUCCEEDED(hres)) {
1834 hres = VarAnd(l.v, r.v, &v);
1835 release_val(&l);
1836 }
1837 release_val(&r);
1838 if(FAILED(hres))
1839 return hres;
1840
1841 return stack_push(ctx, &v);
1842}
1843
1845{
1846 variant_val_t r, l;
1847 VARIANT v;
1848 HRESULT hres;
1849
1850 TRACE("\n");
1851
1852 hres = stack_pop_val(ctx, &r);
1853 if(FAILED(hres))
1854 return hres;
1855
1856 hres = stack_pop_val(ctx, &l);
1857 if(SUCCEEDED(hres)) {
1858 hres = VarOr(l.v, r.v, &v);
1859 release_val(&l);
1860 }
1861 release_val(&r);
1862 if(FAILED(hres))
1863 return hres;
1864
1865 return stack_push(ctx, &v);
1866}
1867
1869{
1870 variant_val_t r, l;
1871 VARIANT v;
1872 HRESULT hres;
1873
1874 TRACE("\n");
1875
1876 hres = stack_pop_val(ctx, &r);
1877 if(FAILED(hres))
1878 return hres;
1879
1880 hres = stack_pop_val(ctx, &l);
1881 if(SUCCEEDED(hres)) {
1882 hres = VarXor(l.v, r.v, &v);
1883 release_val(&l);
1884 }
1885 release_val(&r);
1886 if(FAILED(hres))
1887 return hres;
1888
1889 return stack_push(ctx, &v);
1890}
1891
1893{
1894 variant_val_t r, l;
1895 VARIANT v;
1896 HRESULT hres;
1897
1898 TRACE("\n");
1899
1900 hres = stack_pop_val(ctx, &r);
1901 if(FAILED(hres))
1902 return hres;
1903
1904 hres = stack_pop_val(ctx, &l);
1905 if(SUCCEEDED(hres)) {
1906 hres = VarEqv(l.v, r.v, &v);
1907 release_val(&l);
1908 }
1909 release_val(&r);
1910 if(FAILED(hres))
1911 return hres;
1912
1913 return stack_push(ctx, &v);
1914}
1915
1917{
1918 variant_val_t r, l;
1919 VARIANT v;
1920 HRESULT hres;
1921
1922 TRACE("\n");
1923
1924 hres = stack_pop_val(ctx, &r);
1925 if(FAILED(hres))
1926 return hres;
1927
1928 hres = stack_pop_val(ctx, &l);
1929 if(SUCCEEDED(hres)) {
1930 hres = VarImp(l.v, r.v, &v);
1931 release_val(&l);
1932 }
1933 release_val(&r);
1934 if(FAILED(hres))
1935 return hres;
1936
1937 return stack_push(ctx, &v);
1938}
1939
1941{
1942 TRACE("%s %s\n", debugstr_variant(l), debugstr_variant(r));
1943
1944 /* FIXME: Fix comparing string to number */
1945
1946 return VarCmp(l, r, ctx->script->lcid, 0);
1947 }
1948
1950{
1951 variant_val_t l, r;
1952 HRESULT hres;
1953
1954 hres = stack_pop_val(ctx, &r);
1955 if(FAILED(hres))
1956 return hres;
1957
1958 hres = stack_pop_val(ctx, &l);
1959 if(SUCCEEDED(hres)) {
1960 hres = var_cmp(ctx, l.v, r.v);
1961 release_val(&l);
1962 }
1963
1964 release_val(&r);
1965 return hres;
1966}
1967
1969{
1970 VARIANT v;
1971 HRESULT hres;
1972
1973 TRACE("\n");
1974
1975 hres = cmp_oper(ctx);
1976 if(FAILED(hres))
1977 return hres;
1978 if(hres == VARCMP_NULL)
1979 return stack_push_null(ctx);
1980
1981 V_VT(&v) = VT_BOOL;
1982 V_BOOL(&v) = hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
1983 return stack_push(ctx, &v);
1984}
1985
1987{
1988 VARIANT v;
1989 HRESULT hres;
1990
1991 TRACE("\n");
1992
1993 hres = cmp_oper(ctx);
1994 if(FAILED(hres))
1995 return hres;
1996 if(hres == VARCMP_NULL)
1997 return stack_push_null(ctx);
1998
1999 V_VT(&v) = VT_BOOL;
2000 V_BOOL(&v) = hres != VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
2001 return stack_push(ctx, &v);
2002}
2003
2005{
2006 VARIANT v;
2007 HRESULT hres;
2008
2009 TRACE("\n");
2010
2011 hres = cmp_oper(ctx);
2012 if(FAILED(hres))
2013 return hres;
2014 if(hres == VARCMP_NULL)
2015 return stack_push_null(ctx);
2016
2017 V_VT(&v) = VT_BOOL;
2018 V_BOOL(&v) = hres == VARCMP_GT ? VARIANT_TRUE : VARIANT_FALSE;
2019 return stack_push(ctx, &v);
2020}
2021
2023{
2024 VARIANT v;
2025 HRESULT hres;
2026
2027 TRACE("\n");
2028
2029 hres = cmp_oper(ctx);
2030 if(FAILED(hres))
2031 return hres;
2032 if(hres == VARCMP_NULL)
2033 return stack_push_null(ctx);
2034
2035 V_VT(&v) = VT_BOOL;
2036 V_BOOL(&v) = hres == VARCMP_GT || hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
2037 return stack_push(ctx, &v);
2038}
2039
2041{
2042 VARIANT v;
2043 HRESULT hres;
2044
2045 TRACE("\n");
2046
2047 hres = cmp_oper(ctx);
2048 if(FAILED(hres))
2049 return hres;
2050 if(hres == VARCMP_NULL)
2051 return stack_push_null(ctx);
2052
2053 V_VT(&v) = VT_BOOL;
2054 V_BOOL(&v) = hres == VARCMP_LT ? VARIANT_TRUE : VARIANT_FALSE;
2055 return stack_push(ctx, &v);
2056}
2057
2059{
2060 VARIANT v;
2061 HRESULT hres;
2062
2063 TRACE("\n");
2064
2065 hres = cmp_oper(ctx);
2066 if(FAILED(hres))
2067 return hres;
2068 if(hres == VARCMP_NULL)
2069 return stack_push_null(ctx);
2070
2071 V_VT(&v) = VT_BOOL;
2072 V_BOOL(&v) = hres == VARCMP_LT || hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
2073 return stack_push(ctx, &v);
2074}
2075
2077{
2078 const unsigned arg = ctx->instr->arg1.uint;
2080 HRESULT hres;
2081
2082 TRACE("%d\n", arg);
2083
2084 hres = stack_pop_val(ctx, &v);
2085 if(FAILED(hres))
2086 return hres;
2087
2088 hres = var_cmp(ctx, stack_top(ctx, 0), v.v);
2089 release_val(&v);
2090 if(FAILED(hres))
2091 return hres;
2092
2093 if(hres == VARCMP_EQ) {
2094 stack_popn(ctx, 1);
2095 instr_jmp(ctx, arg);
2096 }else {
2097 ctx->instr++;
2098 }
2099
2100 return S_OK;
2101}
2102
2104{
2105 IUnknown *l = NULL, *r = NULL;
2107 HRESULT hres = S_OK;
2108
2109 TRACE("\n");
2110
2112 if(V_VT(v.v) != VT_DISPATCH && V_VT(v.v) != VT_UNKNOWN) {
2113 FIXME("Unhandled type %s\n", debugstr_variant(v.v));
2114 hres = E_NOTIMPL;
2115 }else if(V_UNKNOWN(v.v)) {
2116 hres = IUnknown_QueryInterface(V_UNKNOWN(v.v), &IID_IUnknown, (void**)&r);
2117 }
2118 if(v.owned) VariantClear(v.v);
2119 if(FAILED(hres))
2120 return hres;
2121
2123 if(V_VT(v.v) != VT_DISPATCH && V_VT(v.v) != VT_UNKNOWN) {
2124 FIXME("Unhandled type %s\n", debugstr_variant(v.v));
2125 hres = E_NOTIMPL;
2126 }else if(V_UNKNOWN(v.v)) {
2127 hres = IUnknown_QueryInterface(V_UNKNOWN(v.v), &IID_IUnknown, (void**)&l);
2128 }
2129 if(v.owned) VariantClear(v.v);
2130
2131 if(SUCCEEDED(hres)) {
2132 VARIANT res;
2133 V_VT(&res) = VT_BOOL;
2134 if(r == l)
2135 V_BOOL(&res) = VARIANT_TRUE;
2136 else if(!r || !l)
2137 V_BOOL(&res) = VARIANT_FALSE;
2138 else {
2140 hres = IUnknown_QueryInterface(l, &IID_IObjectIdentity, (void**)&identity);
2141 if(SUCCEEDED(hres)) {
2142 hres = IObjectIdentity_IsEqualObject(identity, r);
2143 IObjectIdentity_Release(identity);
2144 }
2145 V_BOOL(&res) = hres == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
2146 }
2147 hres = stack_push(ctx, &res);
2148 }
2149 if(r)
2150 IUnknown_Release(r);
2151 if(l)
2152 IUnknown_Release(l);
2153 return hres;
2154}
2155
2157{
2158 variant_val_t r, l;
2159 VARIANT v;
2160 HRESULT hres;
2161
2162 TRACE("\n");
2163
2164 hres = stack_pop_val(ctx, &r);
2165 if(FAILED(hres))
2166 return hres;
2167
2168 hres = stack_pop_val(ctx, &l);
2169 if(SUCCEEDED(hres)) {
2170 hres = VarCat(l.v, r.v, &v);
2171 release_val(&l);
2172 }
2173 release_val(&r);
2174 if(FAILED(hres))
2175 return hres;
2176
2177 return stack_push(ctx, &v);
2178}
2179
2181{
2182 variant_val_t r, l;
2183 VARIANT v;
2184 HRESULT hres;
2185
2186 TRACE("\n");
2187
2188 hres = stack_pop_val(ctx, &r);
2189 if(FAILED(hres))
2190 return hres;
2191
2192 hres = stack_pop_val(ctx, &l);
2193 if(SUCCEEDED(hres)) {
2194 hres = VarAdd(l.v, r.v, &v);
2195 release_val(&l);
2196 }
2197 release_val(&r);
2198 if(FAILED(hres))
2199 return hres;
2200
2201 return stack_push(ctx, &v);
2202}
2203
2205{
2206 variant_val_t r, l;
2207 VARIANT v;
2208 HRESULT hres;
2209
2210 TRACE("\n");
2211
2212 hres = stack_pop_val(ctx, &r);
2213 if(FAILED(hres))
2214 return hres;
2215
2216 hres = stack_pop_val(ctx, &l);
2217 if(SUCCEEDED(hres)) {
2218 hres = VarSub(l.v, r.v, &v);
2219 release_val(&l);
2220 }
2221 release_val(&r);
2222 if(FAILED(hres))
2223 return hres;
2224
2225 return stack_push(ctx, &v);
2226}
2227
2229{
2230 variant_val_t r, l;
2231 VARIANT v;
2232 HRESULT hres;
2233
2234 TRACE("\n");
2235
2236 hres = stack_pop_val(ctx, &r);
2237 if(FAILED(hres))
2238 return hres;
2239
2240 hres = stack_pop_val(ctx, &l);
2241 if(SUCCEEDED(hres)) {
2242 hres = VarMod(l.v, r.v, &v);
2243 release_val(&l);
2244 }
2245 release_val(&r);
2246 if(FAILED(hres))
2247 return hres;
2248
2249 return stack_push(ctx, &v);
2250}
2251
2253{
2254 variant_val_t r, l;
2255 VARIANT v;
2256 HRESULT hres;
2257
2258 TRACE("\n");
2259
2260 hres = stack_pop_val(ctx, &r);
2261 if(FAILED(hres))
2262 return hres;
2263
2264 hres = stack_pop_val(ctx, &l);
2265 if(SUCCEEDED(hres)) {
2266 hres = VarIdiv(l.v, r.v, &v);
2267 release_val(&l);
2268 }
2269 release_val(&r);
2270 if(FAILED(hres))
2271 return hres;
2272
2273 return stack_push(ctx, &v);
2274}
2275
2277{
2278 variant_val_t r, l;
2279 VARIANT v;
2280 HRESULT hres;
2281
2282 TRACE("\n");
2283
2284 hres = stack_pop_val(ctx, &r);
2285 if(FAILED(hres))
2286 return hres;
2287
2288 hres = stack_pop_val(ctx, &l);
2289 if(SUCCEEDED(hres)) {
2290 hres = VarDiv(l.v, r.v, &v);
2291 release_val(&l);
2292 }
2293 release_val(&r);
2294 if(FAILED(hres))
2295 return hres;
2296
2297 return stack_push(ctx, &v);
2298}
2299
2301{
2302 variant_val_t r, l;
2303 VARIANT v;
2304 HRESULT hres;
2305
2306 TRACE("\n");
2307
2308 hres = stack_pop_val(ctx, &r);
2309 if(FAILED(hres))
2310 return hres;
2311
2312 hres = stack_pop_val(ctx, &l);
2313 if(SUCCEEDED(hres)) {
2314 hres = VarMul(l.v, r.v, &v);
2315 release_val(&l);
2316 }
2317 release_val(&r);
2318 if(FAILED(hres))
2319 return hres;
2320
2321 return stack_push(ctx, &v);
2322}
2323
2325{
2326 variant_val_t r, l;
2327 VARIANT v;
2328 HRESULT hres;
2329
2330 TRACE("\n");
2331
2332 hres = stack_pop_val(ctx, &r);
2333 if(FAILED(hres))
2334 return hres;
2335
2336 hres = stack_pop_val(ctx, &l);
2337 if(SUCCEEDED(hres)) {
2338 hres = VarPow(l.v, r.v, &v);
2339 release_val(&l);
2340 }
2341 release_val(&r);
2342 if(FAILED(hres))
2343 return hres;
2344
2345 return stack_push(ctx, &v);
2346}
2347
2349{
2351 VARIANT v;
2352 HRESULT hres;
2353
2355 if(FAILED(hres))
2356 return hres;
2357
2358 hres = VarNeg(val.v, &v);
2359 release_val(&val);
2360 if(FAILED(hres))
2361 return hres;
2362
2363 return stack_push(ctx, &v);
2364}
2365
2367{
2368 const BSTR ident = ctx->instr->arg1.bstr;
2369 VARIANT v;
2370 ref_t ref;
2371 HRESULT hres;
2372
2373 TRACE("\n");
2374
2376 if(FAILED(hres))
2377 return hres;
2378
2379 if(ref.type != REF_VAR) {
2380 FIXME("ref.type is not REF_VAR\n");
2381 return E_FAIL;
2382 }
2383
2384 hres = VarAdd(stack_top(ctx, 0), ref.u.v, &v);
2385 if(FAILED(hres))
2386 return hres;
2387
2388 VariantClear(ref.u.v);
2389 *ref.u.v = v;
2390 return S_OK;
2391}
2392
2394{
2395 /* Nothing to do here, the OP is for unwinding only. */
2396 return S_OK;
2397}
2398
2399static const instr_func_t op_funcs[] = {
2400#define X(x,n,a,b) interp_ ## x,
2401OP_LIST
2402#undef X
2403};
2404
2405static const unsigned op_move[] = {
2406#define X(x,n,a,b) n,
2407OP_LIST
2408#undef X
2409};
2410
2412{
2413 VariantClear(&var->v);
2414 if(var->array)
2415 SafeArrayDestroy(var->array);
2416}
2417
2419{
2421 unsigned i;
2422
2423 VariantClear(&ctx->ret_val);
2424
2425 for(var = ctx->dynamic_vars; var; var = var->next)
2427
2428 if(ctx->vbthis)
2429 IDispatchEx_Release(&ctx->vbthis->IDispatchEx_iface);
2430
2431 if(ctx->args) {
2432 for(i=0; i < ctx->func->arg_cnt; i++)
2433 VariantClear(ctx->args+i);
2434 }
2435
2436 if(ctx->vars) {
2437 for(i=0; i < ctx->func->var_cnt; i++)
2438 VariantClear(ctx->vars+i);
2439 }
2440
2441 if(ctx->arrays) {
2442 for(i=0; i < ctx->func->array_cnt; i++) {
2443 if(ctx->arrays[i])
2444 SafeArrayDestroy(ctx->arrays[i]);
2445 }
2446 free(ctx->arrays);
2447 }
2448
2449 heap_pool_free(&ctx->heap);
2450 free(ctx->args);
2451 free(ctx->vars);
2452 free(ctx->stack);
2453}
2454
2455HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res)
2456{
2457 exec_ctx_t exec = {func->code_ctx};
2458 vbsop_t op;
2459 HRESULT hres = S_OK;
2460
2461 exec.code = func->code_ctx;
2462
2463 if(dp ? func->arg_cnt != arg_cnt(dp) : func->arg_cnt) {
2464 FIXME("wrong arg_cnt %d, expected %d\n", dp ? arg_cnt(dp) : 0, func->arg_cnt);
2465 return E_FAIL;
2466 }
2467
2468 heap_pool_init(&exec.heap);
2469
2470 TRACE("%s args=%u\n", debugstr_w(func->name),func->arg_cnt);
2471 if(func->arg_cnt) {
2472 VARIANT *v;
2473 unsigned i;
2474
2475 exec.args = calloc(func->arg_cnt, sizeof(VARIANT));
2476 if(!exec.args) {
2477 release_exec(&exec);
2478 return E_OUTOFMEMORY;
2479 }
2480
2481 for(i=0; i < func->arg_cnt; i++) {
2482 v = get_arg(dp, i);
2483 TRACE(" [%d] %s\n", i, debugstr_variant(v));
2484 if(V_VT(v) == (VT_VARIANT|VT_BYREF)) {
2485 if(func->args[i].by_ref)
2486 exec.args[i] = *v;
2487 else
2489 }else {
2490 hres = VariantCopyInd(exec.args+i, v);
2491 }
2492 if(FAILED(hres)) {
2493 release_exec(&exec);
2494 return hres;
2495 }
2496 }
2497 }else {
2498 exec.args = NULL;
2499 }
2500
2501 if(func->var_cnt) {
2502 exec.vars = calloc(func->var_cnt, sizeof(VARIANT));
2503 if(!exec.vars) {
2504 release_exec(&exec);
2505 return E_OUTOFMEMORY;
2506 }
2507 }else {
2508 exec.vars = NULL;
2509 }
2510
2511 exec.stack_size = 16;
2512 exec.top = 0;
2513 exec.stack = malloc(exec.stack_size * sizeof(VARIANT));
2514 if(!exec.stack) {
2515 release_exec(&exec);
2516 return E_OUTOFMEMORY;
2517 }
2518
2519 if(extern_caller)
2520 IActiveScriptSite_OnEnterScript(ctx->site);
2521
2522 if(vbthis) {
2523 IDispatchEx_AddRef(&vbthis->IDispatchEx_iface);
2524 exec.vbthis = vbthis;
2525 }
2526
2527 exec.instr = exec.code->instrs + func->code_off;
2528 exec.script = ctx;
2529 exec.func = func;
2530
2531 while(exec.instr) {
2532 op = exec.instr->op;
2533 hres = op_funcs[op](&exec);
2534 if(FAILED(hres)) {
2535 if(hres != SCRIPT_E_RECORDED) {
2536 /* SCRIPT_E_RECORDED means ctx->ei is already populated */
2537 clear_ei(&ctx->ei);
2538 ctx->ei.scode = hres;
2539 }
2540
2541 if(!ctx->ei.bstrDescription)
2542 map_vbs_exception(&ctx->ei);
2543
2544 if(exec.resume_next) {
2545 unsigned stack_off;
2546
2547 WARN("Failed %08lx in resume next mode\n", ctx->ei.scode);
2548
2549 /*
2550 * Unwinding here is simple. We need to find the next OP_catch, which contains
2551 * information about expected stack size and jump offset on error. Generated
2552 * bytecode needs to guarantee, that simple jump and stack adjustment will
2553 * guarantee proper execution continuation.
2554 */
2555 while((++exec.instr)->op != OP_catch);
2556
2557 TRACE("unwind jmp %d stack_off %d\n", exec.instr->arg1.uint, exec.instr->arg2.uint);
2558
2560 stack_off = exec.instr->arg2.uint;
2561 instr_jmp(&exec, exec.instr->arg1.uint);
2562
2563 if(exec.top > stack_off) {
2564 stack_popn(&exec, exec.top-stack_off);
2565 }else if(exec.top < stack_off) {
2566 VARIANT v;
2567
2568 V_VT(&v) = VT_EMPTY;
2569 while(exec.top < stack_off) {
2570 hres = stack_push(&exec, &v);
2571 if(FAILED(hres))
2572 break;
2573 }
2574 }
2575
2576 continue;
2577 }else {
2578 if(!ctx->error_loc_code) {
2579 grab_vbscode(exec.code);
2580 ctx->error_loc_code = exec.code;
2581 ctx->error_loc_offset = exec.instr->loc;
2582 }
2583 stack_popn(&exec, exec.top);
2584 break;
2585 }
2586 }
2587
2588 exec.instr += op_move[op];
2589 }
2590
2591 assert(!exec.top);
2592
2593 if(extern_caller) {
2594 if(FAILED(hres)) {
2595 if(!ctx->ei.scode)
2596 ctx->ei.scode = hres;
2597 hres = report_script_error(ctx, ctx->error_loc_code, ctx->error_loc_offset);
2599 }
2600 IActiveScriptSite_OnLeaveScript(ctx->site);
2601 }
2602
2603 if(SUCCEEDED(hres) && res) {
2604 *res = exec.ret_val;
2605 V_VT(&exec.ret_val) = VT_EMPTY;
2606 }
2607
2608 release_exec(&exec);
2609 return hres;
2610}
short INT16
Definition: actypes.h:130
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
r l[0]
Definition: byte_order.h:168
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT op
Definition: effect.c:236
double DATE
Definition: compat.h:2253
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_BYREF
Definition: compat.h:2342
@ VT_ERROR
Definition: compat.h:2305
@ VT_ARRAY
Definition: compat.h:2341
@ VT_R8
Definition: compat.h:2300
@ VT_VARIANT
Definition: compat.h:2307
@ VT_I4
Definition: compat.h:2298
@ VT_DATE
Definition: compat.h:2302
@ VT_BOOL
Definition: compat.h:2306
@ VT_I2
Definition: compat.h:2297
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
#define wcsicmp
Definition: compat.h:15
#define lstrlenW
Definition: compat.h:750
named_item_t * lookup_named_item(script_ctx_t *ctx, const WCHAR *item_name, unsigned flags)
Definition: jscript.c:162
static ULONG_PTR get_arg(int nr, DWORD flags, struct format_args *args)
Definition: format_msg.c:149
MonoAssembly int argc
Definition: metahost.c:107
#define assert(_expr)
Definition: assert.h:32
HRESULT WINAPI SafeArrayUnlock(SAFEARRAY *psa)
Definition: safearray.c:831
HRESULT WINAPI SafeArrayPtrOfIndex(SAFEARRAY *psa, LONG *rgIndices, void **ppvData)
Definition: safearray.c:1194
HRESULT WINAPI SafeArrayLock(SAFEARRAY *psa)
Definition: safearray.c:795
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound)
Definition: safearray.c:1456
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
HRESULT create_safearray_iter(SAFEARRAY *sa, BOOL owned, IEnumVARIANT **ev)
Definition: utils.c:167
HRESULT report_script_error(script_ctx_t *ctx, const vbscode_t *code, unsigned loc)
Definition: vbscript.c:558
#define VBSE_ARRAY_LOCKED
#define VBSE_OUT_OF_BOUNDS
static const char * debugstr_variant(const VARIANT *var)
Definition: dom.c:505
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name, BSTR name_bstr, DWORD flags, DISPID *id)
Definition: engine.c:599
#define OP_LIST
Definition: engine.h:21
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
const GLdouble * v
Definition: gl.h:2040
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
GLuint GLfloat * val
Definition: glext.h:7180
GLuint id
Definition: glext.h:5910
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 * u
Definition: glfuncs.h:240
static HRESULT interp_is(exec_ctx_t *ctx)
Definition: interp.c:2103
static HRESULT interp_or(exec_ctx_t *ctx)
Definition: interp.c:1844
static HRESULT interp_concat(exec_ctx_t *ctx)
Definition: interp.c:2156
static HRESULT interp_date(exec_ctx_t *ctx)
Definition: interp.c:1719
static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags)
Definition: interp.c:812
static HRESULT interp_set_member(exec_ctx_t *ctx)
Definition: interp.c:1001
static HRESULT interp_pop(exec_ctx_t *ctx)
Definition: interp.c:1122
static HRESULT interp_step(exec_ctx_t *ctx)
Definition: interp.c:1423
static VARIANT * stack_top(exec_ctx_t *ctx, unsigned n)
Definition: interp.c:310
static DISPID propput_dispid
Definition: interp.c:27
void clear_ei(EXCEPINFO *ei)
Definition: interp.c:288
static HRESULT interp_catch(exec_ctx_t *ctx)
Definition: interp.c:2393
static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n)
Definition: interp.c:388
static HRESULT interp_gt(exec_ctx_t *ctx)
Definition: interp.c:2004
static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, WORD flags, DISPPARAMS *dp)
Definition: interp.c:838
static HRESULT interp_icallv(exec_ctx_t *ctx)
Definition: interp.c:697
static HRESULT interp_not(exec_ctx_t *ctx)
Definition: interp.c:1800
static HRESULT array_bounds_from_stack(exec_ctx_t *ctx, unsigned dim_cnt, SAFEARRAYBOUND **ret)
Definition: interp.c:1275
HRESULT array_access(SAFEARRAY *array, DISPPARAMS *dp, VARIANT **ret)
Definition: interp.c:525
static HRESULT interp_nequal(exec_ctx_t *ctx)
Definition: interp.c:1986
static HRESULT interp_set_ident(exec_ctx_t *ctx)
Definition: interp.c:947
static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r)
Definition: interp.c:368
static HRESULT stack_pop_disp(exec_ctx_t *ctx, IDispatch **ret)
Definition: interp.c:442
static HRESULT interp_val(exec_ctx_t *ctx)
Definition: interp.c:1069
static HRESULT interp_lt(exec_ctx_t *ctx)
Definition: interp.c:2040
static HRESULT interp_bool(exec_ctx_t *ctx)
Definition: interp.c:1682
static HRESULT interp_dim(exec_ctx_t *ctx)
Definition: interp.c:1210
static HRESULT interp_enumnext(exec_ctx_t *ctx)
Definition: interp.c:1525
static HRESULT interp_vcallv(exec_ctx_t *ctx)
Definition: interp.c:724
static HRESULT interp_add(exec_ctx_t *ctx)
Definition: interp.c:2180
static HRESULT interp_ret(exec_ctx_t *ctx)
Definition: interp.c:1613
static HRESULT interp_exp(exec_ctx_t *ctx)
Definition: interp.c:2324
static void instr_jmp(exec_ctx_t *ctx, unsigned addr)
Definition: interp.c:496
static void stack_popn(exec_ctx_t *ctx, unsigned n)
Definition: interp.c:342
static HRESULT stack_push_null(exec_ctx_t *ctx)
Definition: interp.c:335
HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res)
Definition: interp.c:2455
static HRESULT interp_mod(exec_ctx_t *ctx)
Definition: interp.c:2228
static HRESULT interp_errmode(exec_ctx_t *ctx)
Definition: interp.c:1694
static void vbstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, BOOL is_propput, DISPPARAMS *dp)
Definition: interp.c:501
static HRESULT interp_retval(exec_ctx_t *ctx)
Definition: interp.c:1621
static HRESULT interp_empty(exec_ctx_t *ctx)
Definition: interp.c:1761
static HRESULT interp_xor(exec_ctx_t *ctx)
Definition: interp.c:1868
static HRESULT interp_deref(exec_ctx_t *ctx)
Definition: interp.c:1152
static HRESULT interp_lteq(exec_ctx_t *ctx)
Definition: interp.c:2058
static const unsigned op_move[]
Definition: interp.c:2405
static HRESULT interp_mcallv(exec_ctx_t *ctx)
Definition: interp.c:783
static HRESULT interp_null(exec_ctx_t *ctx)
Definition: interp.c:1771
static HRESULT do_mcall(exec_ctx_t *ctx, VARIANT *res)
Definition: interp.c:738
static HRESULT interp_idiv(exec_ctx_t *ctx)
Definition: interp.c:2252
static HRESULT interp_jmp_false(exec_ctx_t *ctx)
Definition: interp.c:1575
static HRESULT interp_eqv(exec_ctx_t *ctx)
Definition: interp.c:1892
static HRESULT interp_hres(exec_ctx_t *ctx)
Definition: interp.c:1788
static HRESULT interp_icall(exec_ctx_t *ctx)
Definition: interp.c:681
static HRESULT interp_double(exec_ctx_t *ctx)
Definition: interp.c:1749
static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_t invoke_type, ref_t *ref)
Definition: interp.c:129
static HRESULT interp_assign_member(exec_ctx_t *ctx)
Definition: interp.c:969
static HRESULT stack_assume_disp(exec_ctx_t *ctx, unsigned n, IDispatch **disp)
Definition: interp.c:469
static HRESULT interp_int(exec_ctx_t *ctx)
Definition: interp.c:1732
static HRESULT interp_jmp(exec_ctx_t *ctx)
Definition: interp.c:1565
static HRESULT interp_jmp_true(exec_ctx_t *ctx)
Definition: interp.c:1594
static BOOL lookup_dynamic_vars(dynamic_var_t *var, const WCHAR *name, ref_t *ref)
Definition: interp.c:82
static HRESULT interp_neg(exec_ctx_t *ctx)
Definition: interp.c:2348
static HRESULT interp_newenum(exec_ctx_t *ctx)
Definition: interp.c:1463
static void stack_pop_deref(exec_ctx_t *ctx, variant_val_t *r)
Definition: interp.c:348
static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res, BSTR identifier, unsigned arg_cnt)
Definition: interp.c:613
void release_dynamic_var(dynamic_var_t *var)
Definition: interp.c:2411
static HRESULT interp_redim(exec_ctx_t *ctx)
Definition: interp.c:1301
static HRESULT cmp_oper(exec_ctx_t *ctx)
Definition: interp.c:1949
static HRESULT interp_imp(exec_ctx_t *ctx)
Definition: interp.c:1916
static BOOL lookup_global_vars(ScriptDisp *script, const WCHAR *name, ref_t *ref)
Definition: interp.c:97
static HRESULT interp_gteq(exec_ctx_t *ctx)
Definition: interp.c:2022
static void release_val(variant_val_t *v)
Definition: interp.c:362
static HRESULT interp_vcall(exec_ctx_t *ctx)
Definition: interp.c:707
static HRESULT stack_pop_bool(exec_ctx_t *ctx, BOOL *b)
Definition: interp.c:416
static HRESULT interp_ident(exec_ctx_t *ctx)
Definition: interp.c:790
static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v)
Definition: interp.c:316
HRESULT(* instr_func_t)(exec_ctx_t *)
Definition: interp.c:52
static HRESULT interp_stack(exec_ctx_t *ctx)
Definition: interp.c:1132
static HRESULT interp_case(exec_ctx_t *ctx)
Definition: interp.c:2076
static HRESULT interp_redim_preserve(exec_ctx_t *ctx)
Definition: interp.c:1352
static const instr_func_t op_funcs[]
Definition: interp.c:2399
static HRESULT interp_and(exec_ctx_t *ctx)
Definition: interp.c:1820
static HRESULT interp_new(exec_ctx_t *ctx)
Definition: interp.c:1169
static HRESULT interp_equal(exec_ctx_t *ctx)
Definition: interp.c:1968
static HRESULT variant_call(exec_ctx_t *ctx, VARIANT *v, unsigned arg_cnt, VARIANT *res)
Definition: interp.c:567
ref_type_t
Definition: interp.c:54
@ REF_CONST
Definition: interp.c:59
@ REF_DISP
Definition: interp.c:56
@ REF_OBJ
Definition: interp.c:58
@ REF_NONE
Definition: interp.c:55
@ REF_VAR
Definition: interp.c:57
@ REF_FUNC
Definition: interp.c:60
static HRESULT interp_string(exec_ctx_t *ctx)
Definition: interp.c:1705
static HRESULT interp_mul(exec_ctx_t *ctx)
Definition: interp.c:2300
static BOOL lookup_global_funcs(ScriptDisp *script, const WCHAR *name, ref_t *ref)
Definition: interp.c:113
static HRESULT var_cmp(exec_ctx_t *ctx, VARIANT *l, VARIANT *r)
Definition: interp.c:1940
static HRESULT interp_me(exec_ctx_t *ctx)
Definition: interp.c:1651
static HRESULT interp_div(exec_ctx_t *ctx)
Definition: interp.c:2276
static HRESULT interp_stop(exec_ctx_t *ctx)
Definition: interp.c:1643
static VARIANT * stack_pop(exec_ctx_t *ctx)
Definition: interp.c:304
static HRESULT interp_sub(exec_ctx_t *ctx)
Definition: interp.c:2204
static HRESULT interp_assign_ident(exec_ctx_t *ctx)
Definition: interp.c:929
static void clear_error_loc(script_ctx_t *ctx)
Definition: interp.c:296
static HRESULT interp_numval(exec_ctx_t *ctx)
Definition: interp.c:1091
static HRESULT interp_incc(exec_ctx_t *ctx)
Definition: interp.c:2366
static void release_exec(exec_ctx_t *ctx)
Definition: interp.c:2418
static HRESULT interp_mcall(exec_ctx_t *ctx)
Definition: interp.c:769
static HRESULT interp_const(exec_ctx_t *ctx)
Definition: interp.c:1037
static HRESULT interp_nothing(exec_ctx_t *ctx)
Definition: interp.c:1777
static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name, BOOL is_const, VARIANT **out_var)
Definition: interp.c:240
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *ret)
Definition: dispex.c:2666
HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
Definition: dispex.c:2872
HRESULT create_regexp(script_ctx_t *, jsstr_t *, DWORD, jsdisp_t **)
Definition: jsregexp.c:626
void heap_pool_init(heap_pool_t *)
Definition: jsutils.c:66
void * heap_pool_alloc(heap_pool_t *, DWORD) __WINE_ALLOC_SIZE(2)
Definition: jsutils.c:72
void heap_pool_free(heap_pool_t *)
Definition: jsutils.c:164
#define d
Definition: ke_i.h:81
#define b
Definition: ke_i.h:79
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const char * var
Definition: shader.c:5666
HRESULT hres
Definition: protocol.c:465
static VARIANTARG static DISPID
Definition: ordinal.c:49
static HRESULT get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID *ret)
Definition: dispex.c:873
script
Definition: msipriv.h:383
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define VARCMP_LT
Definition: oleauto.h:657
#define V_ERROR(A)
Definition: oleauto.h:241
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_ARRAY(A)
Definition: oleauto.h:222
#define V_ARRAYREF(A)
Definition: oleauto.h:223
#define VARCMP_NULL
Definition: oleauto.h:660
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define VARCMP_EQ
Definition: oleauto.h:658
#define V_ISBYREF(A)
Definition: oleauto.h:217
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define VARCMP_GT
Definition: oleauto.h:659
#define V_VARIANTREF(A)
Definition: oleauto.h:283
#define V_VT(A)
Definition: oleauto.h:211
#define V_DISPATCHREF(A)
Definition: oleauto.h:240
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_BYREF(A)
Definition: oleauto.h:228
#define V_I4(A)
Definition: oleauto.h:247
#define V_ISARRAY(A)
Definition: oleauto.h:218
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define V_R8(A)
Definition: oleauto.h:262
#define V_DATE(A)
Definition: oleauto.h:231
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009
#define VARIANT_LOCALBOOL
Definition: oleauto.h:314
#define V_I2(A)
Definition: oleauto.h:245
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define calloc
Definition: rosglue.h:14
const WCHAR * str
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static struct __wine_debug_functions funcs
Definition: debug.c:48
#define memset(x, y, z)
Definition: compat.h:39
int zero
Definition: sehframes.cpp:29
#define TRACE(s)
Definition: solgame.cpp:4
heap_pool_t heap
Definition: vbscript.h:139
size_t global_vars_size
Definition: vbscript.h:130
dynamic_var_t ** global_vars
Definition: vbscript.h:128
size_t global_vars_cnt
Definition: vbscript.h:129
struct _class_desc_t * next
Definition: vbscript.h:101
const WCHAR * name
Definition: vbscript.h:85
VARIANT v
Definition: vbscript.h:118
SAFEARRAY * array
Definition: vbscript.h:121
const WCHAR * name
Definition: vbscript.h:119
struct _dynamic_var_t * next
Definition: vbscript.h:117
IDispatchEx IDispatchEx_iface
Definition: vbscript.h:105
instr_t * instrs
Definition: vbscript.h:360
unsigned dim_cnt
Definition: vbscript.h:67
SAFEARRAYBOUND * bounds
Definition: vbscript.h:68
Definition: undname.c:54
heap_pool_t heap
Definition: interp.c:41
VARIANT * args
Definition: interp.c:36
function_t * func
Definition: interp.c:33
script_ctx_t * script
Definition: interp.c:32
SAFEARRAY ** arrays
Definition: interp.c:38
VARIANT ret_val
Definition: interp.c:49
vbdisp_t * vbthis
Definition: interp.c:34
vbscode_t * code
Definition: interp.c:30
VARIANT * stack
Definition: interp.c:47
dynamic_var_t * dynamic_vars
Definition: interp.c:40
unsigned top
Definition: interp.c:46
VARIANT * vars
Definition: interp.c:37
unsigned stack_size
Definition: interp.c:45
instr_t * instr
Definition: interp.c:31
BOOL resume_next
Definition: interp.c:43
Definition: heap.c:86
instr_arg_t arg2
Definition: vbscript.h:323
instr_arg_t arg1
Definition: vbscript.h:322
jsop_t op
Definition: engine.h:133
unsigned loc
Definition: engine.h:134
Definition: name.c:39
Definition: interp.c:63
function_t * f
Definition: interp.c:71
IDispatch * obj
Definition: interp.c:72
ref_type_t type
Definition: interp.c:64
DISPID id
Definition: interp.c:68
VARIANT * v
Definition: interp.c:70
IDispatch * disp
Definition: interp.c:67
Definition: send.c:48
BOOL owned
Definition: interp.c:79
VARIANT store
Definition: interp.c:78
VARIANT * v
Definition: interp.c:77
double DOUBLE
Definition: typedefs.h:70
unsigned uint
Definition: engine.h:118
Definition: pdh_main.c:96
HRESULT WINAPI VarNot(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4909
HRESULT WINAPI VarMul(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:3343
HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:2893
HRESULT WINAPI VarXor(LPVARIANT pVarLeft, LPVARIANT pVarRight, LPVARIANT pVarOut)
Definition: variant.c:4546
HRESULT WINAPI VarDiv(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:3521
HRESULT WINAPI VarSub(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:3683
HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
Definition: variant.c:2515
HRESULT WINAPI VarOr(LPVARIANT pVarLeft, LPVARIANT pVarRight, LPVARIANT pVarOut)
Definition: variant.c:3951
HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:3130
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
HRESULT WINAPI VarImp(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:5693
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
HRESULT WINAPI VarIdiv(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:5183
HRESULT WINAPI VarMod(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:5337
HRESULT WINAPI VarEqv(LPVARIANT pVarLeft, LPVARIANT pVarRight, LPVARIANT pVarOut)
Definition: variant.c:4727
HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
Definition: variant.c:2712
HRESULT WINAPI VarNeg(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4781
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:748
HRESULT WINAPI VarPow(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:5579
HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
Definition: vbdisp.c:507
HRESULT get_disp_value(script_ctx_t *ctx, IDispatch *disp, VARIANT *v)
Definition: vbdisp.c:1710
HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id)
Definition: vbdisp.c:60
void map_vbs_exception(EXCEPINFO *ei)
Definition: vbdisp.c:1605
void release_vbscode(vbscode_t *code)
Definition: compile.c:1915
HRESULT to_int(VARIANT *v, int *ret)
Definition: global.c:419
static void grab_vbscode(vbscode_t *code)
Definition: vbscript.h:386
vbdisp_invoke_type_t
Definition: vbscript.h:59
@ VBDISP_LET
Definition: vbscript.h:61
@ VBDISP_SET
Definition: vbscript.h:62
@ VBDISP_CALLGET
Definition: vbscript.h:60
@ VBDISP_ANY
Definition: vbscript.h:63
vbsop_t
Definition: vbscript.h:303
static unsigned arg_cnt(const DISPPARAMS *dp)
Definition: vbscript.h:175
@ FUNC_PROPGET
Definition: vbscript.h:335
@ FUNC_GLOBAL
Definition: vbscript.h:332
@ FUNC_FUNCTION
Definition: vbscript.h:333
#define MAKE_VBSERROR(code)
Definition: vbscript.h:425
_In_ size_t cnt
Definition: wcstombs.cpp:43
_In_ ULONG _In_ ULONG_PTR ident
Definition: winddi.h:3994
void * arg
Definition: msvc.h:10
#define HRESULT
Definition: msvc.h:7
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:3618