vbscript: Fix NULL IDispatch handling in get_disp_value.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
087adea7dc
commit
79f39c2a8c
|
@ -319,7 +319,7 @@ static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r)
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = get_disp_value(ctx->script, V_DISPATCH(r->v), &r->store);
|
hres = get_disp_value(ctx->script, V_DISPATCH(r->v), &r->store);
|
||||||
if(r->owned)
|
if(r->owned && V_DISPATCH(r->v))
|
||||||
IDispatch_Release(V_DISPATCH(r->v));
|
IDispatch_Release(V_DISPATCH(r->v));
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -350,7 +350,8 @@ static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n)
|
||||||
|
|
||||||
disp = V_DISPATCH(v);
|
disp = V_DISPATCH(v);
|
||||||
hres = get_disp_value(ctx->script, disp, v);
|
hres = get_disp_value(ctx->script, disp, v);
|
||||||
IDispatch_Release(disp);
|
if(disp)
|
||||||
|
IDispatch_Release(disp);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
@ -688,23 +689,27 @@ static HRESULT interp_mcallv(exec_ctx_t *ctx)
|
||||||
|
|
||||||
static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags)
|
static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags)
|
||||||
{
|
{
|
||||||
|
VARIANT value;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = VariantCopyInd(dst, src);
|
V_VT(&value) = VT_EMPTY;
|
||||||
|
hres = VariantCopyInd(&value, src);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
if(V_VT(dst) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) {
|
if(V_VT(&value) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) {
|
||||||
VARIANT value;
|
IDispatch *disp = V_DISPATCH(&value);
|
||||||
|
|
||||||
hres = get_disp_value(ctx->script, V_DISPATCH(dst), &value);
|
V_VT(&value) = VT_EMPTY;
|
||||||
IDispatch_Release(V_DISPATCH(dst));
|
hres = get_disp_value(ctx->script, disp, &value);
|
||||||
|
if(disp)
|
||||||
|
IDispatch_Release(disp);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
*dst = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VariantClear(dst);
|
||||||
|
*dst = value;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1354,6 +1354,28 @@ end class
|
||||||
set x = new RegExp
|
set x = new RegExp
|
||||||
Call ok(x.Global = false, "x.Global = " & x.Global)
|
Call ok(x.Global = false, "x.Global = " & x.Global)
|
||||||
|
|
||||||
|
sub test_nothing_errors
|
||||||
|
dim x
|
||||||
|
on error resume next
|
||||||
|
|
||||||
|
x = 1
|
||||||
|
err.clear
|
||||||
|
x = nothing
|
||||||
|
call ok(err.number = 91, "err.number = " & err.number)
|
||||||
|
call ok(x = 1, "x = " & x)
|
||||||
|
|
||||||
|
err.clear
|
||||||
|
x = not nothing
|
||||||
|
call ok(err.number = 91, "err.number = " & err.number)
|
||||||
|
call ok(x = 1, "x = " & x)
|
||||||
|
|
||||||
|
err.clear
|
||||||
|
x = "" & nothing
|
||||||
|
call ok(err.number = 91, "err.number = " & err.number)
|
||||||
|
call ok(x = 1, "x = " & x)
|
||||||
|
end sub
|
||||||
|
call test_nothing_errors()
|
||||||
|
|
||||||
sub test_identifiers
|
sub test_identifiers
|
||||||
' test keywords that can also be a declared identifier
|
' test keywords that can also be a declared identifier
|
||||||
Dim default
|
Dim default
|
||||||
|
|
|
@ -967,6 +967,8 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp,
|
||||||
HRESULT get_disp_value(script_ctx_t *ctx, IDispatch *disp, VARIANT *v)
|
HRESULT get_disp_value(script_ctx_t *ctx, IDispatch *disp, VARIANT *v)
|
||||||
{
|
{
|
||||||
DISPPARAMS dp = {NULL};
|
DISPPARAMS dp = {NULL};
|
||||||
|
if(!disp)
|
||||||
|
return MAKE_VBSERROR(VBSE_OBJECT_VARIABLE_NOT_SET);
|
||||||
return disp_call(ctx, disp, DISPID_VALUE, &dp, v);
|
return disp_call(ctx, disp, DISPID_VALUE, &dp, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ STRINGTABLE
|
||||||
VBSE_PERMISSION_DENIED "Permission denied"
|
VBSE_PERMISSION_DENIED "Permission denied"
|
||||||
VBSE_PATH_FILE_ACCESS "Path/File access error"
|
VBSE_PATH_FILE_ACCESS "Path/File access error"
|
||||||
VBSE_PATH_NOT_FOUND "Path not found"
|
VBSE_PATH_NOT_FOUND "Path not found"
|
||||||
|
VBSE_OBJECT_VARIABLE_NOT_SET "Object variable not set"
|
||||||
VBSE_ILLEGAL_NULL_USE "Invalid use of Null"
|
VBSE_ILLEGAL_NULL_USE "Invalid use of Null"
|
||||||
VBSE_CANT_CREATE_TMP_FILE "Can't create necessary temporary file"
|
VBSE_CANT_CREATE_TMP_FILE "Can't create necessary temporary file"
|
||||||
VBSE_CANT_CREATE_OBJECT "ActiveX component can't create object"
|
VBSE_CANT_CREATE_OBJECT "ActiveX component can't create object"
|
||||||
|
|
|
@ -250,6 +250,7 @@
|
||||||
#define VBSE_PERMISSION_DENIED 70
|
#define VBSE_PERMISSION_DENIED 70
|
||||||
#define VBSE_PATH_FILE_ACCESS 75
|
#define VBSE_PATH_FILE_ACCESS 75
|
||||||
#define VBSE_PATH_NOT_FOUND 76
|
#define VBSE_PATH_NOT_FOUND 76
|
||||||
|
#define VBSE_OBJECT_VARIABLE_NOT_SET 91
|
||||||
#define VBSE_ILLEGAL_NULL_USE 94
|
#define VBSE_ILLEGAL_NULL_USE 94
|
||||||
#define VBSE_CANT_CREATE_TMP_FILE 322
|
#define VBSE_CANT_CREATE_TMP_FILE 322
|
||||||
#define VBSE_CANT_CREATE_OBJECT 429
|
#define VBSE_CANT_CREATE_OBJECT 429
|
||||||
|
|
Loading…
Reference in New Issue