vbscript: Added a helper for getting default IDispatch value.

This commit is contained in:
Jacek Caban 2015-03-05 15:49:02 +01:00 committed by Alexandre Julliard
parent 7561375ede
commit 0de7b95c37
3 changed files with 11 additions and 11 deletions

View file

@ -323,10 +323,9 @@ static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r)
stack_pop_deref(ctx, r);
if(V_VT(r->v) == VT_DISPATCH) {
DISPPARAMS dp = {0};
HRESULT hres;
hres = disp_call(ctx->script, V_DISPATCH(r->v), DISPID_VALUE, &dp, &r->store);
hres = get_disp_value(ctx->script, V_DISPATCH(r->v), &r->store);
if(r->owned)
IDispatch_Release(V_DISPATCH(r->v));
if(FAILED(hres))
@ -354,12 +353,10 @@ static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n)
}
if(V_VT(v) == VT_DISPATCH) {
DISPPARAMS dp = {0};
IDispatch *disp;
disp = V_DISPATCH(v);
V_VT(v) = VT_EMPTY;
hres = disp_call(ctx->script, disp, DISPID_VALUE, &dp, v);
hres = get_disp_value(ctx->script, disp, v);
IDispatch_Release(disp);
if(FAILED(hres))
return hres;
@ -706,10 +703,9 @@ static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD fl
return hres;
if(V_VT(dst) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) {
DISPPARAMS dp = {NULL};
VARIANT value;
hres = disp_call(ctx->script, V_DISPATCH(dst), DISPID_VALUE, &dp, &value);
hres = get_disp_value(ctx->script, V_DISPATCH(dst), &value);
IDispatch_Release(V_DISPATCH(dst));
if(FAILED(hres))
return hres;

View file

@ -105,15 +105,12 @@ static HRESULT get_propput_arg(script_ctx_t *ctx, const DISPPARAMS *dp, WORD fla
if(V_VT(v) == VT_DISPATCH) {
if(!(flags & DISPATCH_PROPERTYPUTREF)) {
DISPPARAMS val_dp = {NULL};
VARIANT value;
HRESULT hres;
hres = disp_call(ctx, V_DISPATCH(v), DISPID_VALUE, &val_dp, &value);
hres = get_disp_value(ctx, V_DISPATCH(v), v);
if(FAILED(hres))
return hres;
*v = value;
*is_owned = TRUE;
}
}else if(!(flags & DISPATCH_PROPERTYPUT)) {
@ -1102,6 +1099,12 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp,
return hres;
}
HRESULT get_disp_value(script_ctx_t *ctx, IDispatch *disp, VARIANT *v)
{
DISPPARAMS dp = {NULL};
return disp_call(ctx, disp, DISPID_VALUE, &dp, v);
}
HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *dp)
{
IDispatchEx *dispex;

View file

@ -149,6 +149,7 @@ HRESULT disp_get_id(IDispatch*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_
HRESULT vbdisp_get_id(vbdisp_t*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN;
HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,WORD,DISPPARAMS*) DECLSPEC_HIDDEN;
HRESULT get_disp_value(script_ctx_t*,IDispatch*,VARIANT*) DECLSPEC_HIDDEN;
void collect_objects(script_ctx_t*) DECLSPEC_HIDDEN;
HRESULT create_procedure_disp(script_ctx_t*,vbscode_t*,IDispatch**) DECLSPEC_HIDDEN;
HRESULT create_script_disp(script_ctx_t*,ScriptDisp**) DECLSPEC_HIDDEN;