Commit 2083935c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added interp_assign_ident implementation.

parent 3c85122e
......@@ -217,10 +217,44 @@ static HRESULT interp_icallv(exec_ctx_t *ctx)
return do_icall(ctx, NULL);
}
static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, VARIANT *val, BOOL own_val)
{
ref_t ref;
HRESULT hres;
hres = lookup_identifier(ctx, name, &ref);
if(FAILED(hres))
return hres;
switch(ref.type) {
case REF_DISP:
hres = disp_propput(ctx->script, ref.u.d.disp, ref.u.d.id, val);
if(own_val)
VariantClear(val);
break;
case REF_NONE:
FIXME("%s not found\n", debugstr_w(name));
if(own_val)
VariantClear(val);
return DISP_E_UNKNOWNNAME;
}
return hres;
}
static HRESULT interp_assign_ident(exec_ctx_t *ctx)
{
FIXME("\n");
return E_NOTIMPL;
const BSTR arg = ctx->instr->arg1.bstr;
variant_val_t v;
HRESULT hres;
TRACE("%s\n", debugstr_w(arg));
hres = stack_pop_val(ctx, &v);
if(FAILED(hres))
return hres;
return assign_ident(ctx, arg, v.v, v.owned);
}
static HRESULT interp_ret(exec_ctx_t *ctx)
......
......@@ -246,3 +246,25 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp,
IDispatchEx_Release(dispex);
return hres;
}
HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, VARIANT *val)
{
DISPID propput_dispid = DISPID_PROPERTYPUT;
DISPPARAMS dp = {val, &propput_dispid, 1, 1};
IDispatchEx *dispex;
EXCEPINFO ei = {0};
HRESULT hres;
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
if(SUCCEEDED(hres)) {
hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL /* FIXME! */);
IDispatchEx_Release(dispex);
}else {
ULONG err = 0;
TRACE("using IDispatch\n");
hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, &err);
}
return hres;
}
......@@ -63,6 +63,7 @@ typedef struct {
HRESULT disp_get_id(IDispatch*,BSTR,DISPID*);
HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*);
HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*);
struct _script_ctx_t {
IActiveScriptSite *site;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment