From: Francis De Brabandere <francisdb@gmail.com> VarImp's right-Null switch was missing a VT_DATE case, so CDate(-1) Imp Null fell through to the main computation and returned VT_I4 0 instead of Null. Add the all-ones check using V_DATE. --- dlls/oleaut32/tests/vartest.c | 1 + dlls/oleaut32/variant.c | 1 + dlls/vbscript/tests/lang.vbs | 1 + 3 files changed, 3 insertions(+) diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index dc85f04c0ae..e5bbecbdd3f 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -9766,6 +9766,7 @@ static void test_VarImp(void) VARIMP(I2,-1,NULL,0,NULL,0); VARIMP(I4,-1,NULL,0,NULL,0); VARIMP(R8,-1.0,NULL,0,NULL,0); + VARIMP(DATE,-1.0,NULL,0,NULL,0); VARIMP(UI1,255,NULL,0,NULL,0); /* VT_CY stores values scaled by 10000 in .int64, so CY -1 has .int64 of diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index 3fbc7730926..c24b32fa9f0 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -5957,6 +5957,7 @@ HRESULT WINAPI VarImp(LPVARIANT left, LPVARIANT right, LPVARIANT result) case VT_BOOL: if (V_BOOL(left) == VARIANT_TRUE) resvt = VT_NULL; break; case VT_R4: if (V_R4(left) == -1.0) resvt = VT_NULL; break; case VT_R8: if (V_R8(left) == -1.0) resvt = VT_NULL; break; + case VT_DATE: if (V_DATE(left) == -1.0) resvt = VT_NULL; break; /* VT_CY stores values scaled by 10000, so -1 is -10000 in .int64. */ case VT_CY: if (V_CY(left).int64 == -10000) resvt = VT_NULL; break; case VT_DECIMAL: diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index a6184b825b8..229ffcdf78d 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -213,6 +213,7 @@ Call ok((True Or Null) = True, "True Or Null is not True") Call ok(isNull(False Or Null), "False Or Null is not Null") Call ok(isNull(CInt(5) Xor Null), "CInt(5) Xor Null is not Null") Call ok(isNull(CInt(5) Eqv Null), "CInt(5) Eqv Null is not Null") +Call ok(isNull(CDate(-1) Imp Null), "CDate(-1) Imp Null is not Null") Call ok((Not CLng(0)) = -1, "Not CLng(0) is not -1") ' VBScript-specific: for VT_UI1 Imp VT_NULL, native VBScript keeps UI1 -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10673