HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **ret) { class_desc_t *desc; vbdisp_t *vbdisp; HRESULT hres; desc = heap_alloc_zero(sizeof(*desc)); if(!desc) return E_OUTOFMEMORY; desc->ctx = ctx; desc->builtin_prop_cnt = sizeof(procedure_props)/sizeof(*procedure_props); desc->builtin_props = procedure_props; desc->value_func = &code->main_code; hres = create_vbdisp(desc, &vbdisp); if(FAILED(hres)) { heap_free(desc); return hres; } desc->next = ctx->procs; ctx->procs = desc; *ret = (IDispatch*)&vbdisp->IDispatchEx_iface; return S_OK; }
HRESULT init_global(script_ctx_t *ctx) { HRESULT hres; ctx->global_desc.ctx = ctx; ctx->global_desc.builtin_prop_cnt = sizeof(global_props)/sizeof(*global_props); ctx->global_desc.builtin_props = global_props; hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo); if(FAILED(hres)) return hres; hres = create_vbdisp(&ctx->global_desc, &ctx->global_obj); if(FAILED(hres)) return hres; ctx->script_desc.ctx = ctx; hres = create_vbdisp(&ctx->script_desc, &ctx->script_obj); if(FAILED(hres)) return hres; return init_err(ctx); }