2 * Copyright 2011 Jacek Caban for CodeWeavers
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.
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.
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
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
45 typedef HRESULT (*instr_func_t)(exec_ctx_t*);
74 static BOOL lookup_dynamic_vars(dynamic_var_t *var, const WCHAR *name, ref_t *ref)
77 if(!strcmpiW(var->name, name)) {
89 static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_t invoke_type, ref_t *ref)
97 static const WCHAR errW[] = {'e','r','r',0};
99 if(invoke_type == VBDISP_LET
100 && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET)
101 && !strcmpiW(name, ctx->func->name)) {
103 ref->u.v = &ctx->ret_val;
107 for(i=0; i < ctx->func->var_cnt; i++) {
108 if(!strcmpiW(ctx->func->vars[i].name, name)) {
110 ref->u.v = ctx->vars+i;
115 for(i=0; i < ctx->func->arg_cnt; i++) {
116 if(!strcmpiW(ctx->func->args[i].name, name)) {
118 ref->u.v = ctx->args+i;
123 hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id);
124 if(SUCCEEDED(hres)) {
125 ref->type = REF_DISP;
126 ref->u.d.disp = ctx->this_obj;
131 if(lookup_dynamic_vars(ctx->script->global_vars, name, ref))
134 for(func = ctx->script->global_funcs; func; func = func->next) {
135 if(!strcmpiW(func->name, name)) {
136 ref->type = REF_FUNC;
142 LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
143 if((item->flags & SCRIPTITEM_GLOBALMEMBERS) && item->disp != ctx->this_obj) {
144 hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id);
145 if(SUCCEEDED(hres)) {
146 ref->type = REF_DISP;
147 ref->u.d.disp = item->disp;
154 if(!strcmpiW(name, errW)) {
156 ref->u.obj = (IDispatch*)&ctx->script->err_obj->IDispatchEx_iface;
160 hres = vbdisp_get_id(ctx->script->global_obj, name, invoke_type, TRUE, &id);
161 if(SUCCEEDED(hres)) {
162 ref->type = REF_DISP;
163 ref->u.d.disp = (IDispatch*)&ctx->script->global_obj->IDispatchEx_iface;
168 if(!ctx->func->code_ctx->option_explicit)
169 FIXME("create an attempt to set\n");
171 ref->type = REF_NONE;
175 static inline VARIANT *stack_pop(exec_ctx_t *ctx)
178 return ctx->stack + --ctx->top;
181 static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v)
183 if(ctx->stack_size == ctx->top) {
186 new_stack = heap_realloc(ctx->stack, ctx->stack_size*2);
189 return E_OUTOFMEMORY;
192 ctx->stack = new_stack;
193 ctx->stack_size *= 2;
196 ctx->stack[ctx->top++] = *v;
200 static void stack_popn(exec_ctx_t *ctx, unsigned n)
203 VariantClear(stack_pop(ctx));
206 static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *v)
210 var = stack_pop(ctx);
212 if(V_VT(var) == (VT_BYREF|VT_VARIANT)) {
214 var = V_VARIANTREF(var);
219 if(V_VT(var) == VT_DISPATCH) {
223 hres = disp_call(ctx->script, V_DISPATCH(var), DISPID_VALUE, &dp, &v->store);
225 IDispatch_Release(V_DISPATCH(var));
238 static inline void release_val(variant_val_t *v)
244 static HRESULT stack_pop_disp(exec_ctx_t *ctx, IDispatch **ret)
246 VARIANT *v = stack_pop(ctx);
248 if(V_VT(v) == VT_DISPATCH) {
249 *ret = V_DISPATCH(v);
253 if(V_VT(v) != (VT_VARIANT|VT_BYREF)) {
254 FIXME("not supported type: %s\n", debugstr_variant(v));
260 if(V_VT(v) != VT_DISPATCH) {
261 FIXME("not disp %s\n", debugstr_variant(v));
266 IDispatch_AddRef(V_DISPATCH(v));
267 *ret = V_DISPATCH(v);
271 static inline void instr_jmp(exec_ctx_t *ctx, unsigned addr)
273 ctx->instr = ctx->code->instrs + addr;
276 static void vbstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, DISPPARAMS *dp)
279 dp->rgdispidNamedArgs = NULL;
286 assert(ctx->top >= arg_cnt);
288 for(i=1; i*2 <= arg_cnt; i++) {
289 tmp = ctx->stack[ctx->top-i];
290 ctx->stack[ctx->top-i] = ctx->stack[ctx->top-arg_cnt+i-1];
291 ctx->stack[ctx->top-arg_cnt+i-1] = tmp;
294 dp->rgvarg = ctx->stack + ctx->top-arg_cnt;
300 static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
302 BSTR identifier = ctx->instr->arg1.bstr;
303 const unsigned arg_cnt = ctx->instr->arg2.uint;
308 hres = lookup_identifier(ctx, identifier, VBDISP_CALLGET, &ref);
312 vbstack_to_dp(ctx, arg_cnt, &dp);
317 FIXME("REF_VAR no res\n");
322 FIXME("arguments not implemented\n");
326 V_VT(res) = VT_BYREF|VT_VARIANT;
327 V_BYREF(res) = V_VT(ref.u.v) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(ref.u.v) : ref.u.v;
330 hres = disp_call(ctx->script, ref.u.d.disp, ref.u.d.id, &dp, res);
335 hres = exec_script(ctx->script, ref.u.f, NULL, &dp, res);
341 FIXME("arguments on object\n");
346 IDispatch_AddRef(ref.u.obj);
347 V_VT(res) = VT_DISPATCH;
348 V_DISPATCH(res) = ref.u.obj;
352 FIXME("%s not found\n", debugstr_w(identifier));
353 return DISP_E_UNKNOWNNAME;
356 stack_popn(ctx, arg_cnt);
360 static HRESULT interp_icall(exec_ctx_t *ctx)
367 hres = do_icall(ctx, &v);
371 return stack_push(ctx, &v);
374 static HRESULT interp_icallv(exec_ctx_t *ctx)
377 return do_icall(ctx, NULL);
380 static HRESULT do_mcall(exec_ctx_t *ctx, VARIANT *res)
382 const BSTR identifier = ctx->instr->arg1.bstr;
383 const unsigned arg_cnt = ctx->instr->arg2.uint;
389 hres = stack_pop_disp(ctx, &obj);
398 vbstack_to_dp(ctx, arg_cnt, &dp);
400 hres = disp_get_id(obj, identifier, VBDISP_CALLGET, FALSE, &id);
402 hres = disp_call(ctx->script, obj, id, &dp, res);
403 IDispatch_Release(obj);
407 stack_popn(ctx, arg_cnt);
411 static HRESULT interp_mcall(exec_ctx_t *ctx)
418 hres = do_mcall(ctx, &res);
422 return stack_push(ctx, &res);
425 static HRESULT interp_mcallv(exec_ctx_t *ctx)
429 return do_mcall(ctx, NULL);
432 static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, VARIANT *val, BOOL own_val)
437 hres = lookup_identifier(ctx, name, VBDISP_LET, &ref);
443 VARIANT *v = ref.u.v;
445 if(V_VT(v) == (VT_VARIANT|VT_BYREF))
453 hres = VariantCopy(v, val);
458 hres = disp_propput(ctx->script, ref.u.d.disp, ref.u.d.id, val);
463 FIXME("functions not implemented\n");
469 FIXME("%s not found\n", debugstr_w(name));
472 return DISP_E_UNKNOWNNAME;
478 static HRESULT interp_assign_ident(exec_ctx_t *ctx)
480 const BSTR arg = ctx->instr->arg1.bstr;
484 TRACE("%s\n", debugstr_w(arg));
486 hres = stack_pop_val(ctx, &v);
490 return assign_ident(ctx, arg, v.v, v.owned);
493 static HRESULT interp_set_ident(exec_ctx_t *ctx)
495 const BSTR arg = ctx->instr->arg1.bstr;
500 TRACE("%s\n", debugstr_w(arg));
502 hres = stack_pop_disp(ctx, &disp);
506 V_VT(&v) = VT_DISPATCH;
507 V_DISPATCH(&v) = disp;
508 return assign_ident(ctx, ctx->instr->arg1.bstr, &v, TRUE);
511 static HRESULT interp_assign_member(exec_ctx_t *ctx)
513 BSTR identifier = ctx->instr->arg1.bstr;
519 TRACE("%s\n", debugstr_w(identifier));
521 hres = stack_pop_disp(ctx, &obj);
530 hres = stack_pop_val(ctx, &val);
532 IDispatch_Release(obj);
536 hres = disp_get_id(obj, identifier, VBDISP_LET, FALSE, &id);
538 hres = disp_propput(ctx->script, obj, id, val.v);
541 IDispatch_Release(obj);
545 static HRESULT interp_set_member(exec_ctx_t *ctx)
547 BSTR identifier = ctx->instr->arg1.bstr;
548 IDispatch *obj, *val;
552 TRACE("%s\n", debugstr_w(identifier));
554 hres = stack_pop_disp(ctx, &obj);
563 hres = stack_pop_disp(ctx, &val);
565 IDispatch_Release(obj);
569 hres = disp_get_id(obj, identifier, VBDISP_SET, FALSE, &id);
570 if(SUCCEEDED(hres)) {
573 V_VT(&v) = VT_DISPATCH;
574 V_DISPATCH(&v) = val;
575 hres = disp_propput(ctx->script, obj, id, &v);
579 IDispatch_Release(val);
580 IDispatch_Release(obj);
584 static HRESULT interp_new(exec_ctx_t *ctx)
586 const WCHAR *arg = ctx->instr->arg1.bstr;
587 class_desc_t *class_desc;
592 TRACE("%s\n", debugstr_w(arg));
594 for(class_desc = ctx->script->classes; class_desc; class_desc = class_desc->next) {
595 if(!strcmpiW(class_desc->name, arg))
599 FIXME("Class %s not found\n", debugstr_w(arg));
603 hres = create_vbdisp(class_desc, &obj);
607 V_VT(&v) = VT_DISPATCH;
608 V_DISPATCH(&v) = (IDispatch*)&obj->IDispatchEx_iface;
609 return stack_push(ctx, &v);
612 static HRESULT interp_jmp(exec_ctx_t *ctx)
614 const unsigned arg = ctx->instr->arg1.uint;
622 static HRESULT interp_jmp_false(exec_ctx_t *ctx)
624 const unsigned arg = ctx->instr->arg1.uint;
630 hres = stack_pop_val(ctx, &val);
634 if(V_VT(val.v) != VT_BOOL) {
635 FIXME("unsupported for %s\n", debugstr_variant(val.v));
643 instr_jmp(ctx, ctx->instr->arg1.uint);
647 static HRESULT interp_jmp_true(exec_ctx_t *ctx)
649 const unsigned arg = ctx->instr->arg1.uint;
655 hres = stack_pop_val(ctx, &val);
659 if(V_VT(val.v) != VT_BOOL) {
660 FIXME("unsupported for %s\n", debugstr_variant(val.v));
666 instr_jmp(ctx, ctx->instr->arg1.uint);
672 static HRESULT interp_ret(exec_ctx_t *ctx)
680 static HRESULT interp_stop(exec_ctx_t *ctx)
684 /* NOTE: this should have effect in debugging mode (that we don't support yet) */
688 static HRESULT interp_bool(exec_ctx_t *ctx)
690 const VARIANT_BOOL arg = ctx->instr->arg1.lng;
693 TRACE("%s\n", arg ? "true" : "false");
697 return stack_push(ctx, &v);
700 static HRESULT interp_string(exec_ctx_t *ctx)
707 V_BSTR(&v) = SysAllocString(ctx->instr->arg1.str);
709 return E_OUTOFMEMORY;
711 return stack_push(ctx, &v);
714 static HRESULT interp_long(exec_ctx_t *ctx)
716 const LONG arg = ctx->instr->arg1.lng;
723 return stack_push(ctx, &v);
726 static HRESULT interp_short(exec_ctx_t *ctx)
728 const LONG arg = ctx->instr->arg1.lng;
735 return stack_push(ctx, &v);
738 static HRESULT interp_double(exec_ctx_t *ctx)
740 const DOUBLE *arg = ctx->instr->arg1.dbl;
743 TRACE("%lf\n", *arg);
747 return stack_push(ctx, &v);
750 static HRESULT interp_empty(exec_ctx_t *ctx)
757 return stack_push(ctx, &v);
760 static HRESULT interp_null(exec_ctx_t *ctx)
767 return stack_push(ctx, &v);
770 static HRESULT interp_nothing(exec_ctx_t *ctx)
776 V_VT(&v) = VT_DISPATCH;
777 V_DISPATCH(&v) = NULL;
778 return stack_push(ctx, &v);
781 static HRESULT interp_not(exec_ctx_t *ctx)
789 hres = stack_pop_val(ctx, &val);
793 hres = VarNot(val.v, &v);
798 return stack_push(ctx, &v);
801 static HRESULT interp_and(exec_ctx_t *ctx)
809 hres = stack_pop_val(ctx, &r);
813 hres = stack_pop_val(ctx, &l);
814 if(SUCCEEDED(hres)) {
815 hres = VarAnd(l.v, r.v, &v);
822 return stack_push(ctx, &v);
825 static HRESULT interp_or(exec_ctx_t *ctx)
833 hres = stack_pop_val(ctx, &r);
837 hres = stack_pop_val(ctx, &l);
838 if(SUCCEEDED(hres)) {
839 hres = VarOr(l.v, r.v, &v);
846 return stack_push(ctx, &v);
849 static HRESULT interp_xor(exec_ctx_t *ctx)
857 hres = stack_pop_val(ctx, &r);
861 hres = stack_pop_val(ctx, &l);
862 if(SUCCEEDED(hres)) {
863 hres = VarXor(l.v, r.v, &v);
870 return stack_push(ctx, &v);
873 static HRESULT interp_eqv(exec_ctx_t *ctx)
881 hres = stack_pop_val(ctx, &r);
885 hres = stack_pop_val(ctx, &l);
886 if(SUCCEEDED(hres)) {
887 hres = VarEqv(l.v, r.v, &v);
894 return stack_push(ctx, &v);
897 static HRESULT interp_imp(exec_ctx_t *ctx)
905 hres = stack_pop_val(ctx, &r);
909 hres = stack_pop_val(ctx, &l);
910 if(SUCCEEDED(hres)) {
911 hres = VarImp(l.v, r.v, &v);
918 return stack_push(ctx, &v);
921 static HRESULT cmp_oper(exec_ctx_t *ctx)
926 hres = stack_pop_val(ctx, &r);
930 hres = stack_pop_val(ctx, &l);
931 if(SUCCEEDED(hres)) {
932 if(V_VT(l.v) == VT_NULL || V_VT(r.v) == VT_NULL) {
933 FIXME("comparing nulls is not implemented\n");
936 hres = VarCmp(l.v, r.v, ctx->script->lcid, 0);
945 static HRESULT interp_equal(exec_ctx_t *ctx)
952 hres = cmp_oper(ctx);
957 V_BOOL(&v) = hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
958 return stack_push(ctx, &v);
961 static HRESULT interp_nequal(exec_ctx_t *ctx)
968 hres = cmp_oper(ctx);
973 V_BOOL(&v) = hres != VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
974 return stack_push(ctx, &v);
977 static HRESULT interp_gt(exec_ctx_t *ctx)
984 hres = cmp_oper(ctx);
989 V_BOOL(&v) = hres == VARCMP_GT ? VARIANT_TRUE : VARIANT_FALSE;
990 return stack_push(ctx, &v);
993 static HRESULT interp_gteq(exec_ctx_t *ctx)
1000 hres = cmp_oper(ctx);
1005 V_BOOL(&v) = hres == VARCMP_GT || hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
1006 return stack_push(ctx, &v);
1009 static HRESULT interp_lt(exec_ctx_t *ctx)
1016 hres = cmp_oper(ctx);
1021 V_BOOL(&v) = hres == VARCMP_LT ? VARIANT_TRUE : VARIANT_FALSE;
1022 return stack_push(ctx, &v);
1025 static HRESULT interp_lteq(exec_ctx_t *ctx)
1032 hres = cmp_oper(ctx);
1037 V_BOOL(&v) = hres == VARCMP_LT || hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
1038 return stack_push(ctx, &v);
1041 static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, VARIANT_BOOL *ret)
1043 IObjectIdentity *identity;
1044 IUnknown *unk1, *unk2;
1047 if(disp1 == disp2) {
1048 *ret = VARIANT_TRUE;
1052 if(!disp1 || !disp2) {
1053 *ret = VARIANT_FALSE;
1057 hres = IDispatch_QueryInterface(disp1, &IID_IUnknown, (void**)&unk1);
1061 hres = IDispatch_QueryInterface(disp2, &IID_IUnknown, (void**)&unk2);
1063 IUnknown_Release(unk1);
1068 *ret = VARIANT_TRUE;
1070 hres = IUnknown_QueryInterface(unk1, &IID_IObjectIdentity, (void**)&identity);
1071 if(SUCCEEDED(hres)) {
1072 hres = IObjectIdentity_IsEqualObject(identity, unk2);
1073 IObjectIdentity_Release(identity);
1074 *ret = hres == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
1076 *ret = VARIANT_FALSE;
1080 IUnknown_Release(unk1);
1081 IUnknown_Release(unk2);
1085 static HRESULT interp_is(exec_ctx_t *ctx)
1093 hres = stack_pop_disp(ctx, &r);
1097 hres = stack_pop_disp(ctx, &l);
1098 if(SUCCEEDED(hres)) {
1100 hres = disp_cmp(l, r, &V_BOOL(&v));
1102 IDispatch_Release(l);
1105 IDispatch_Release(r);
1109 return stack_push(ctx, &v);
1112 static HRESULT interp_concat(exec_ctx_t *ctx)
1120 hres = stack_pop_val(ctx, &r);
1124 hres = stack_pop_val(ctx, &l);
1125 if(SUCCEEDED(hres)) {
1126 hres = VarCat(l.v, r.v, &v);
1133 return stack_push(ctx, &v);
1136 static HRESULT interp_add(exec_ctx_t *ctx)
1144 hres = stack_pop_val(ctx, &r);
1148 hres = stack_pop_val(ctx, &l);
1149 if(SUCCEEDED(hres)) {
1150 hres = VarAdd(l.v, r.v, &v);
1157 return stack_push(ctx, &v);
1160 static HRESULT interp_sub(exec_ctx_t *ctx)
1168 hres = stack_pop_val(ctx, &r);
1172 hres = stack_pop_val(ctx, &l);
1173 if(SUCCEEDED(hres)) {
1174 hres = VarSub(l.v, r.v, &v);
1181 return stack_push(ctx, &v);
1184 static HRESULT interp_mod(exec_ctx_t *ctx)
1192 hres = stack_pop_val(ctx, &r);
1196 hres = stack_pop_val(ctx, &l);
1197 if(SUCCEEDED(hres)) {
1198 hres = VarMod(l.v, r.v, &v);
1205 return stack_push(ctx, &v);
1208 static HRESULT interp_idiv(exec_ctx_t *ctx)
1216 hres = stack_pop_val(ctx, &r);
1220 hres = stack_pop_val(ctx, &l);
1221 if(SUCCEEDED(hres)) {
1222 hres = VarIdiv(l.v, r.v, &v);
1229 return stack_push(ctx, &v);
1232 static HRESULT interp_div(exec_ctx_t *ctx)
1240 hres = stack_pop_val(ctx, &r);
1244 hres = stack_pop_val(ctx, &l);
1245 if(SUCCEEDED(hres)) {
1246 hres = VarDiv(l.v, r.v, &v);
1253 return stack_push(ctx, &v);
1256 static HRESULT interp_mul(exec_ctx_t *ctx)
1264 hres = stack_pop_val(ctx, &r);
1268 hres = stack_pop_val(ctx, &l);
1269 if(SUCCEEDED(hres)) {
1270 hres = VarMul(l.v, r.v, &v);
1277 return stack_push(ctx, &v);
1280 static HRESULT interp_exp(exec_ctx_t *ctx)
1288 hres = stack_pop_val(ctx, &r);
1292 hres = stack_pop_val(ctx, &l);
1293 if(SUCCEEDED(hres)) {
1294 hres = VarPow(l.v, r.v, &v);
1301 return stack_push(ctx, &v);
1304 static HRESULT interp_neg(exec_ctx_t *ctx)
1310 hres = stack_pop_val(ctx, &val);
1314 hres = VarNeg(val.v, &v);
1319 return stack_push(ctx, &v);
1322 static const instr_func_t op_funcs[] = {
1323 #define X(x,n,a,b) interp_ ## x,
1328 static const unsigned op_move[] = {
1329 #define X(x,n,a,b) n,
1334 static void release_exec(exec_ctx_t *ctx)
1338 VariantClear(&ctx->ret_val);
1341 IDispatch_Release(ctx->this_obj);
1344 for(i=0; i < ctx->func->arg_cnt; i++)
1345 VariantClear(ctx->args+i);
1349 for(i=0; i < ctx->func->var_cnt; i++)
1350 VariantClear(ctx->vars+i);
1353 heap_free(ctx->args);
1354 heap_free(ctx->vars);
1355 heap_free(ctx->stack);
1358 HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DISPPARAMS *dp, VARIANT *res)
1360 exec_ctx_t exec = {func->code_ctx};
1362 HRESULT hres = S_OK;
1364 exec.code = func->code_ctx;
1366 if(dp ? func->arg_cnt != arg_cnt(dp) : func->arg_cnt) {
1367 FIXME("wrong arg_cnt %d, expected %d\n", dp ? arg_cnt(dp) : 0, func->arg_cnt);
1375 exec.args = heap_alloc_zero(func->arg_cnt * sizeof(VARIANT));
1377 release_exec(&exec);
1378 return E_OUTOFMEMORY;
1381 for(i=0; i < func->arg_cnt; i++) {
1383 if(V_VT(v) == (VT_VARIANT|VT_BYREF)) {
1384 if(func->args[i].by_ref)
1387 hres = VariantCopy(exec.args+i, V_VARIANTREF(v));
1389 hres = VariantCopy(exec.args+i, v);
1392 release_exec(&exec);
1401 exec.vars = heap_alloc_zero(func->var_cnt * sizeof(VARIANT));
1403 release_exec(&exec);
1404 return E_OUTOFMEMORY;
1410 exec.stack_size = 16;
1412 exec.stack = heap_alloc(exec.stack_size * sizeof(VARIANT));
1414 release_exec(&exec);
1415 return E_OUTOFMEMORY;
1419 exec.this_obj = this_obj;
1420 else if (ctx->host_global)
1421 exec.this_obj = ctx->host_global;
1423 exec.this_obj = (IDispatch*)&ctx->script_obj->IDispatchEx_iface;
1424 IDispatch_AddRef(exec.this_obj);
1426 exec.instr = exec.code->instrs + func->code_off;
1431 op = exec.instr->op;
1432 hres = op_funcs[op](&exec);
1434 FIXME("Failed %08x\n", hres);
1435 stack_popn(&exec, exec.top);
1439 exec.instr += op_move[op];
1443 if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)
1444 assert(V_VT(&exec.ret_val) == VT_EMPTY);
1446 if(SUCCEEDED(hres) && res) {
1447 *res = exec.ret_val;
1448 V_VT(&exec.ret_val) = VT_EMPTY;
1451 release_exec(&exec);