diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 770ea5fed1f..1ac09cd4ae3 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -2007,6 +2007,8 @@ static void test_VarNot(void) { static const WCHAR szNum0[] = {'0','\0' }; static const WCHAR szNum1[] = {'1','\0' }; + static const WCHAR szFalse[] = { '#','F','A','L','S','E','#','\0' }; + static const WCHAR szTrue[] = { '#','T','R','U','E','#','\0' }; HRESULT hres; VARIANT v, exp, vDst; DECIMAL *pdec = &V_DECIMAL(&v); @@ -2102,6 +2104,8 @@ static void test_VarNot(void) ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) == szNum0, "VarNot(0): changed input\n"); VARNOT(BSTR,(BSTR)szNum1,I4,-2); ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) == szNum1, "VarNot(1): changed input\n"); + VARNOT(BSTR, (BSTR)szTrue, BOOL, VARIANT_FALSE); + VARNOT(BSTR, (BSTR)szFalse, BOOL, VARIANT_TRUE); V_VT(&v) = VT_DECIMAL; S(U(*pdec)).sign = DECIMAL_NEG; diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index 20df548d40c..2045eab4b1c 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -5026,6 +5026,19 @@ HRESULT WINAPI VarNot(LPVARIANT pVarIn, LPVARIANT pVarOut) pVarIn = &temp; } + if (V_VT(pVarIn) == VT_BSTR) + { + V_VT(&varIn) = VT_R8; + hRet = VarR8FromStr( V_BSTR(pVarIn), LOCALE_USER_DEFAULT, 0, &V_R8(&varIn) ); + if (FAILED(hRet)) + { + V_VT(&varIn) = VT_BOOL; + hRet = VarBoolFromStr( V_BSTR(pVarIn), LOCALE_USER_DEFAULT, VAR_LOCALBOOL, &V_BOOL(&varIn) ); + } + if (FAILED(hRet)) goto VarNot_Exit; + pVarIn = &varIn; + } + V_VT(pVarOut) = V_VT(pVarIn); switch (V_VT(pVarIn)) @@ -5066,12 +5079,6 @@ HRESULT WINAPI VarNot(LPVARIANT pVarIn, LPVARIANT pVarOut) V_I4(pVarOut) = ~V_I4(pVarOut); V_VT(pVarOut) = VT_I4; break; - case VT_BSTR: - hRet = VarR8FromStr(V_BSTR(pVarIn), LOCALE_USER_DEFAULT, 0, &V_R8(&varIn)); - if (FAILED(hRet)) - break; - pVarIn = &varIn; - /* Fall through ... */ case VT_DATE: case VT_R8: hRet = VarI4FromR8(V_R8(pVarIn), &V_I4(pVarOut));