vbscript: Fix handling zero and negative number arguments in err.raise.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49172
Signed-off-by: Robert Wilhelm <robert.wilhelm@gmx.net>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Robert Wilhelm 2020-09-25 16:46:21 +02:00 committed by Alexandre Julliard
parent 14d97c261b
commit 7d48c52816
2 changed files with 17 additions and 1 deletions

View File

@ -3148,7 +3148,7 @@ static HRESULT Err_Raise(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VA
hres = to_int(args, &code);
if(FAILED(hres))
return hres;
if(code > 0 && code > 0xffff)
if(code == 0 || code > 0xffff)
return E_INVALIDARG;
if(args_cnt >= 2)

View File

@ -1856,13 +1856,29 @@ end sub
sub testErrRaise()
on error resume next
call ok(err.number = 0, "err.number = " & err.number)
err.raise 0
call ok(err.number = 5, "err.number = " & err.number)
err.raise 1
call ok(err.number = 1, "err.number = " & err.number)
err.raise
call ok(err.number = 450, "err.number = " & err.number)
call testErrNumber(450)
err.raise &h8000
call ok(err.number = -32768, "err.number = " & err.number)
err.raise &hffff
call ok(err.number = -1, "err.number = " & err.number)
err.raise &h10000&
call ok(err.number = 5, "err.number = " & err.number)
err.raise -3000000000
call ok(err.number = 6, "err.number = " & err.number)
err.raise -1
call ok(err.number = -1, "err.number = " & err.number)
err.raise -20
call ok(err.number = -20, "err.number = " & err.number)
err.raise -&hfff0
call ok(err.number = 16, "err.number = " & err.number)
err.raise -&h8000
call ok(err.number = 32768, "err.number = " & err.number)
err.clear
call ok(getVT(err.source) = "VT_BSTR", "err.source = " & err.source)