Hi,
Part 7 of oleaut32 updates.
Cheers,
Jon
License: X11
Changelog:
Jon Griffiths <jon_p_griffiths@yahoo.com>
+dlls/oleaut32/bool.c dlls/oleaut32/oleaut32.spec
dlls/oleaut32/variant.c
Implement the boolean low-level calls
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
diff -u wine-diff/dlls/oleaut32/Makefile.in wine-develop/dlls/oleaut32/Makefile.in
--- wine-diff/dlls/oleaut32/Makefile.in 2003-10-06 19:28:11.000000000 +0100
+++ wine-develop/dlls/oleaut32/Makefile.in 2003-10-06 20:41:51.000000000 +0100
@@ -15,6 +15,7 @@
SPEC_SRCS16 = $(ALTNAMES:.dll=.spec)
C_SRCS = \
+ bool.c \
connpt.c \
cy.c \
dispatch.c \
Only in wine-develop/dlls/oleaut32: oaidl_p.o
Only in wine-develop/dlls/oleaut32: ole2disp.o
Only in wine-develop/dlls/oleaut32: ole2disp.spec.c
Only in wine-develop/dlls/oleaut32: ole2disp.spec.o
Only in wine-develop/dlls/oleaut32: oleaut32.dll.dbg.c
Only in wine-develop/dlls/oleaut32: oleaut32.dll.dbg.o
Only in wine-develop/dlls/oleaut32: oleaut32.dll.so
Only in wine-develop/dlls/oleaut32: oleaut32.dll.tmp.o
diff -u wine-diff/dlls/oleaut32/oleaut32.spec wine-develop/dlls/oleaut32/oleaut32.spec
--- wine-diff/dlls/oleaut32/oleaut32.spec 2003-10-06 20:40:20.000000000 +0100
+++ wine-develop/dlls/oleaut32/oleaut32.spec 2003-10-06 20:53:41.000000000 +0100
@@ -123,7 +123,7 @@
123 stdcall VarBoolFromDate(double ptr)
124 stdcall VarBoolFromCy(long long ptr)
125 stdcall VarBoolFromStr(wstr long long ptr)
-126 stub VarBoolFromDisp
+126 stdcall VarBoolFromDisp(ptr long ptr)
127 stdcall VarFormatCurrency(ptr long long long long long ptr)
128 stub VarWeekdayName # stdcall (long long long long ptr)
129 stub VarMonthName # stdcall (long long long ptr)
@@ -231,7 +231,7 @@
233 stdcall VarBoolFromI1(long ptr)
234 stdcall VarBoolFromUI2(long ptr)
235 stdcall VarBoolFromUI4(long ptr)
-236 stub VarBoolFromDec
+236 stdcall VarBoolFromDec(ptr ptr)
237 stdcall VarUI1FromI1(long ptr)
238 stdcall VarUI1FromUI2(long ptr)
239 stdcall VarUI1FromUI4(long ptr)
@@ -350,8 +350,8 @@
367 stdcall VarCyFromUI8(long long ptr)
368 stub VarBstrFromI8
369 stub VarBstrFromUI8
-370 stub VarBoolFromI8
-371 stub VarBoolFromUI8
+370 stdcall VarBoolFromI8(long long ptr)
+371 stdcall VarBoolFromUI8(long long ptr)
372 stdcall VarUI1FromI8(long long ptr)
373 stdcall VarUI1FromUI8(long long ptr)
374 stdcall VarDecFromI8(long long ptr)
diff -u wine-diff/dlls/oleaut32/variant.c wine-develop/dlls/oleaut32/variant.c
--- wine-diff/dlls/oleaut32/variant.c 2003-10-06 20:40:53.000000000 +0100
+++ wine-develop/dlls/oleaut32/variant.c 2003-10-06 20:52:26.000000000 +0100
@@ -2508,177 +2508,6 @@
return E_INVALIDARG;
}
-/******************************************************************************
- * VarBoolFromUI1 [OLEAUT32.118]
- */
-HRESULT WINAPI VarBoolFromUI1(BYTE bIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %d, %p ), stub\n", bIn, pboolOut );
-
- if( bIn == 0 )
- {
- *pboolOut = VARIANT_FALSE;
- }
- else
- {
- *pboolOut = VARIANT_TRUE;
- }
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromI2 [OLEAUT32.119]
- */
-HRESULT WINAPI VarBoolFromI2(short sIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %d, %p ), stub\n", sIn, pboolOut );
-
- *pboolOut = (sIn) ? VARIANT_TRUE : VARIANT_FALSE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromI4 [OLEAUT32.120]
- */
-HRESULT WINAPI VarBoolFromI4(LONG lIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %ld, %p ), stub\n", lIn, pboolOut );
-
- *pboolOut = (lIn) ? VARIANT_TRUE : VARIANT_FALSE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromR4 [OLEAUT32.121]
- */
-HRESULT WINAPI VarBoolFromR4(FLOAT fltIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %f, %p ), stub\n", fltIn, pboolOut );
-
- *pboolOut = (fltIn == 0.0) ? VARIANT_FALSE : VARIANT_TRUE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromR8 [OLEAUT32.122]
- */
-HRESULT WINAPI VarBoolFromR8(double dblIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %f, %p ), stub\n", dblIn, pboolOut );
-
- *pboolOut = (dblIn == 0.0) ? VARIANT_FALSE : VARIANT_TRUE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromDate [OLEAUT32.123]
- */
-HRESULT WINAPI VarBoolFromDate(DATE dateIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %f, %p ), stub\n", dateIn, pboolOut );
-
- *pboolOut = (dateIn == 0.0) ? VARIANT_FALSE : VARIANT_TRUE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromStr [OLEAUT32.125]
- */
-HRESULT WINAPI VarBoolFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, VARIANT_BOOL* pboolOut)
-{
- static const WCHAR szTrue[] = { 'T','r','u','e','\0' };
- static const WCHAR szFalse[] = { 'F','a','l','s','e','\0' };
- HRESULT ret = S_OK;
-
- TRACE("( %p, %ld, %ld, %p ), stub\n", strIn, lcid, dwFlags, pboolOut );
-
- if( strIn == NULL || strlenW( strIn ) == 0 )
- {
- ret = DISP_E_TYPEMISMATCH;
- }
-
- if( ret == S_OK )
- {
- if( strcmpiW( (LPCWSTR)strIn, szTrue ) == 0 )
- {
- *pboolOut = VARIANT_TRUE;
- }
- else if( strcmpiW( (LPCWSTR)strIn, szFalse ) == 0 )
- {
- *pboolOut = VARIANT_FALSE;
- }
- else
- {
- /* Try converting the string to a floating point number.
- */
- double dValue = 0.0;
- HRESULT res = VarR8FromStr( strIn, lcid, dwFlags, &dValue );
- if( res != S_OK )
- {
- ret = DISP_E_TYPEMISMATCH;
- }
- else
- *pboolOut = (dValue == 0.0) ?
- VARIANT_FALSE : VARIANT_TRUE;
- }
- }
-
- return ret;
-}
-
-/******************************************************************************
- * VarBoolFromI1 [OLEAUT32.233]
- */
-HRESULT WINAPI VarBoolFromI1(signed char cIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %c, %p ), stub\n", cIn, pboolOut );
-
- *pboolOut = (cIn == 0) ? VARIANT_FALSE : VARIANT_TRUE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromUI2 [OLEAUT32.234]
- */
-HRESULT WINAPI VarBoolFromUI2(USHORT uiIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %d, %p ), stub\n", uiIn, pboolOut );
-
- *pboolOut = (uiIn == 0) ? VARIANT_FALSE : VARIANT_TRUE;
-
- return S_OK;
-}
-
-/******************************************************************************
- * VarBoolFromUI4 [OLEAUT32.235]
- */
-HRESULT WINAPI VarBoolFromUI4(ULONG ulIn, VARIANT_BOOL* pboolOut)
-{
- TRACE("( %ld, %p ), stub\n", ulIn, pboolOut );
-
- *pboolOut = (ulIn == 0) ? VARIANT_FALSE : VARIANT_TRUE;
-
- return S_OK;
-}
-
-/**********************************************************************
- * VarBoolFromCy [OLEAUT32.124]
- * Convert currency to boolean
- */
-HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL* pboolOut) {
- if (cyIn.s.Hi || cyIn.s.Lo) *pboolOut = -1;
- else *pboolOut = 0;
-
- return S_OK;
-}
-
/**********************************************************************
* DosDateTimeToVariantTime [OLEAUT32.14]
* Convert dos representation of time to the date and time representation
--- wine-diff/dlls/oleaut32/bool.c 1970-01-01 01:00:00.000000000 +0100
+++ wine-develop/dlls/oleaut32/bool.c 2003-10-06 20:56:52.000000000 +0100
@@ -0,0 +1,549 @@
+/*
+ * Variant VT_BOOL (Boolean) Functions
+ *
+ * Copyright 2003 Jon Griffiths
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#include "wine/debug.h"
+#include "wine/unicode.h"
+#include "winbase.h"
+#include "variant.h"
+
+/* Localised text for variant conversions */
+
+static const WCHAR szEnglishStrings[] =
+{
+ 'T','r','u','e','\0',
+ 'F','a','l','s','e','\0',
+ 'O','n','\0',
+ 'O','f','f','\0',
+ 'Y','e','s','\0',
+ 'N','o','\0'
+};
+
+static const WCHAR szFrenchStrings[] =
+{
+ 'V','r','a','i','\0',
+ 'F','a','u','x','\0',
+ 'A','c','t','i','f','\0',
+ 'I','n','a','c','t','i','f','\0',
+ 'O','u','i','\0',
+ 'N','o','n','\0'
+};
+
+static const WCHAR szCzechStrings[] =
+{
+ 'P','r','a','v','d','a','\0',
+ 'N','e','p','r','a','v','d','a','\0',
+ 'Z','a','p','n','u','t','o','\0',
+ 'V','y','p','n','u','t','o','\0',
+ 'A','n','o','\0',
+ 'N','e','\0'
+};
+
+static const WCHAR szSwedishStrings[] =
+{
+ 'S','a','n','t','\0',
+ 'F','a','l','s','k','t','\0',
+ 'J','a','\0',
+ 'N','e','j','\0',
+ 'P','Õ','\0',
+ 'A','v','\0'
+};
+
+static const WCHAR szGermanStrings[] =
+{
+ 'W','a','h','r','\0',
+ 'F','a','l','s','c','h','\0',
+ 'J','a','\0',
+ 'N','e','i','n','\0',
+ 'E','i','n','\0',
+ 'A','u','s','\0'
+};
+
+static const WCHAR szDanishStrings[] =
+{
+ 'S','a','n','d','\0',
+ 'F','a','l','s','k','\0',
+ 'J','a','\0',
+ 'N','e','j','\0',
+ 'T','i','l','\0',
+ 'F','r','a','\0'
+};
+
+static const WCHAR szSpanishStrings[] =
+{
+ 'V','e','r','d','a','d','e','r','o','\0',
+ 'F','a','l','s','o','\0',
+ 'S',0xed,'\0', /* Si */
+ 'N','o','\0',
+ 'A','c','t','i','v','a','d','o','\0',
+ 'D','e','s','a','c','t','i','v','a','d','o','\0'
+};
+
+static const WCHAR szFinnishStrings[] =
+{
+ 'T','o','s','i','\0',
+ 'E','p','õ','t','o','s','i','\0',
+ 'K','y','l','l','õ','\0',
+ 'N','o','\0',
+ 'K','õ','y','t',0xf6,'s','s','õ','\0',
+ 'E','i',' ','k','õ','y','t',0xf6,'s','s','õ','\0'
+};
+
+static const WCHAR szHungarianStrings[] =
+{
+ 'I','g','a','z','\0',
+ 'H','a','m','i','s','\0',
+ 'I','g','e','n','\0',
+ 'N','e','m','\0',
+ 'B','e','\0',
+ 'K','i','\0'
+};
+
+static const WCHAR szItalianStrings[] =
+{
+ 'V','e','r','o','\0',
+ 'F','a','l','s','o','\0',
+ 'S','ý','\0',
+ 'N','o','\0',
+ 'O','n','\0',
+ 'O','f','f','\0'
+};
+
+static const WCHAR szDutchStrings[] =
+{
+ 'W','a','a','r','\0',
+ 'O','n','w','a','a','r','\0',
+ 'J','a','\0',
+ 'N','e','e','\0',
+ 'A','a','n','\0',
+ 'U','i','t','\0'
+};
+
+static const WCHAR szNorseStrings[] =
+{
+ 'S','a','n','n','\0',
+ 'U','s','a','n','n','\0',
+ 'J','a','\0',
+ 'N','e','i','\0',
+ 'P','Õ','\0',
+ 'A','v','\0'
+};
+
+static const WCHAR szPolishStrings[] =
+{
+ 'P','r','a','w','d','a','\0',
+ 'F','a','B'|0x100,'s','z','\0',
+ 'T','a','k','\0',
+ 'N','i','e','\0',
+ 'W','B'|0x100,'\0',
+ 'W','y','B'|0x100,'\0'
+};
+
+/*
+ * FIXME:
+ * Greek, Hebrew, Japanese, Korean, Portuguese, Russian,
+ * Turkish, Slovenian (at least) are localised in XP Home.
+ * I expect Chinese/Thai are localised in Asian Editions also.
+ */
+
+/* The list of localised text data */
+const VARIANT_TEXT VARIANT_LocalisedTextList[NUM_LOCALISED_LANGS] =
+{
+ { szCzechStrings, LANG_CZECH, 7, 16, 24, 32, 36 },
+ { szDanishStrings, LANG_DANISH, 5, 11, 14, 18, 22 },
+ { szGermanStrings, LANG_GERMAN, 5, 12, 15, 20, 24 },
+ { szEnglishStrings, LANG_ENGLISH, 5, 11, 14, 18, 22 },
+ { szSpanishStrings, LANG_SPANISH, 10, 16, 19, 22, 31 },
+ { szFinnishStrings, LANG_FINNISH, 5, 13, 19, 22, 31 },
+ { szFrenchStrings, LANG_FRENCH, 5, 10, 16, 24, 28 },
+ { szHungarianStrings,LANG_HUNGARIAN, 5, 11, 16, 20, 23 },
+ { szItalianStrings, LANG_ITALIAN, 5, 11, 14, 17, 20 },
+ { szDutchStrings, LANG_DUTCH, 5, 12, 15, 19, 24 },
+ { szNorseStrings, LANG_NORWEGIAN, 5, 11, 14, 18, 21 },
+ { szPolishStrings, LANG_POLISH, 7, 13, 17, 21, 24 },
+ { szSwedishStrings, LANG_SWEDISH, 5, 12, 15, 19, 22 }
+};
+
+/* Get the localised text strings for a language id */
+const VARIANT_TEXT *VARIANT_GetLocalisedText(LANGID langId)
+{
+ int i;
+
+ for (i = 0; i < NUM_LOCALISED_LANGS; i++)
+ {
+ if (langId == VARIANT_LocalisedTextList[i].langId)
+ return &VARIANT_LocalisedTextList[i];
+ }
+ return NULL;
+}
+
+/************************************************************************
+ * VarBoolFromUI1 (OLEAUT32.118)
+ *
+ * Convert a VT_UI1 to a VT_BOOL.
+ *
+ * PARAMS
+ * bIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromUI1(BYTE bIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromUI1(bIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromI2 (OLEAUT32.119)
+ *
+ * Convert a VT_I2 to a VT_BOOL.
+ *
+ * PARAMS
+ * sIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromI2(SHORT sIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromI2(sIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromI4 (OLEAUT32.120)
+ *
+ * Convert a VT_I4 to a VT_BOOL.
+ *
+ * PARAMS
+ * sIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromI4(LONG lIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromI4(lIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromR4 (OLEAUT32.121)
+ *
+ * Convert a VT_R4 to a VT_BOOL.
+ *
+ * PARAMS
+ * fltIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromR4(FLOAT fltIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromR4(fltIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromR8 (OLEAUT32.122)
+ *
+ * Convert a VT_R8 to a VT_BOOL.
+ *
+ * PARAMS
+ * dblIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromR8(double dblIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromR8(dblIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromDate (OLEAUT32.123)
+ *
+ * Convert a VT_DATE to a VT_BOOL.
+ *
+ * PARAMS
+ * dateIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromDate(DATE dateIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromDate(dateIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromCy (OLEAUT32.124)
+ *
+ * Convert a VT_CY to a VT_BOOL.
+ *
+ * PARAMS
+ * cyIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromCy(cyIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromStr (OLEAUT32.125)
+ *
+ * Convert a VT_BSTR to a VT_BOOL.
+ *
+ * PARAMS
+ * strIn [I] Source
+ * lcid [I] LCID for the conversion
+ * dwFlags [I] VAR_ flags from "oleauto.h"
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: E_INVALIDARG, if strIn or pBoolOut is invalid.
+ * DISP_E_TYPEMISMATCH, if the type cannot be converted
+ *
+ * NOTES
+ * - strIn will be recognised if it contains "#TRUE#" or "#FALSE#". Additionaly,
+ * it may contain (in any case mapping) the text "true" or "false".
+ * - If dwFlags includes VARIANT_LOCALBOOL, then the text may also match the
+ * localised text of "True" or "False" in the language specified by lcid.
+ * - If none of these matches occur, the string is treated as a numeric string
+ * and the boolean pBoolOut will be set according to whether the number is zero
+ * or not. The dwFlags parameter is passed to VarR8FromStr() for this conversion.
+ * - If the text is not numeric and does not match any of the above, then
+ * DISP_E_TYPEMISMATCH is returned.
+ */
+HRESULT WINAPI VarBoolFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, VARIANT_BOOL *pBoolOut)
+{
+ /* Any VB/VBA programmers out there should recognise these strings... */
+ static const WCHAR szFalse[] = { '#','F','A','L','S','E','#','\0' };
+ static const WCHAR szTrue[] = { '#','T','R','U','E','#','\0' };
+ const VARIANT_TEXT* pBools;
+ LANGID langId = LANG_ENGLISH;
+ HRESULT hRes = S_OK;
+
+ if (!strIn || !pBoolOut)
+ return E_INVALIDARG;
+
+ /* Check if we should be comparing against localised text */
+ if (dwFlags & VARIANT_LOCALBOOL)
+ {
+ /* Convert our LCID into a usable value */
+ lcid = ConvertDefaultLocale(lcid);
+
+ langId = PRIMARYLANGID(lcid);
+
+ if (langId == LANG_NEUTRAL)
+ langId = LANG_ENGLISH;
+
+ /* Note: Native oleaut32 always copies strIn and maps halfwidth characters.
+ * I don't think this is needed unless any of the localised text strings
+ * contain characters that can be so mapped. In the event that this is
+ * true for a given language (possibly some Asian languages), then strIn
+ * should be mapped here _only_ if langId is an Id for which this can occur.
+ */
+ }
+
+ /* Note that if we are not comparing against localised strings, langId
+ * will have its default value of LANG_ENGLISH. This allows us to mimic
+ * the native behaviour of always checking against English strings.
+ */
+VarBoolFromStr_CheckLocalised:
+ pBools = VARIANT_GetLocalisedText(langId);
+
+ if (pBools)
+ {
+ /* Compare against localised strings, ignoring case */
+ if (!strcmpiW(strIn, pBools->szText))
+ {
+ *pBoolOut = VARIANT_TRUE; /* Matched localised 'true' text */
+ return hRes;
+ }
+ if (!strcmpiW(strIn, pBools->szText + pBools->iOffsetFalse))
+ {
+ *pBoolOut = VARIANT_FALSE; /* Matched localised 'false' text */
+ return hRes;
+ }
+ }
+
+ if (langId != LANG_ENGLISH)
+ {
+ /* We have checked the localised text, now check English */
+ langId = LANG_ENGLISH;
+ goto VarBoolFromStr_CheckLocalised;
+ }
+
+ /* All checks against localised text have failed, try #TRUE#/#FALSE# */
+ if (!strcmpW(strIn, szFalse))
+ *pBoolOut = VARIANT_FALSE;
+ else if (!strcmpW(strIn, szTrue))
+ *pBoolOut = VARIANT_TRUE;
+ else
+ {
+ double d;
+
+ /* If this string is a number, convert it as one */
+ hRes = _VarR8FromStr(strIn, lcid, dwFlags, &d);
+ if (SUCCEEDED(hRes))
+ hRes = _VarBoolFromR8(d, pBoolOut);
+ }
+ return hRes;
+}
+
+/************************************************************************
+ * VarBoolFromDisp (OLEAUT32.126)
+ *
+ * Convert a VT_DISPATCH to a VT_BOOL.
+ *
+ * PARAMS
+ * pdispIn [I] Source
+ * lcid [I] LCID for conversion
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: E_INVALIDARG, if the source value is invalid
+ * DISP_E_OVERFLOW, if the value will not fit in the destination
+ * DISP_E_TYPEMISMATCH, if the type cannot be converted
+ */
+HRESULT WINAPI VarBoolFromDisp(IDispatch* pdispIn, LCID lcid, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromDisp(pdispIn, lcid, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromI1 (OLEAUT32.233)
+ *
+ * Convert a VT_I1 to a VT_BOOL.
+ *
+ * PARAMS
+ * cIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromI1(signed char cIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromI1(cIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromUI2 (OLEAUT32.234)
+ *
+ * Convert a VT_UI2 to a VT_BOOL.
+ *
+ * PARAMS
+ * usIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromUI2(USHORT usIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromUI2(usIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromUI4 (OLEAUT32.235)
+ *
+ * Convert a VT_UI4 to a VT_BOOL.
+ *
+ * PARAMS
+ * ulIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromUI4(ULONG ulIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromUI4(ulIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromDec (OLEAUT32.236)
+ *
+ * Convert a VT_DECIMAL to a VT_BOOL.
+ *
+ * PARAMS
+ * pDecIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: E_INVALIDARG, if pDecIn is invalid.
+ */
+HRESULT WINAPI VarBoolFromDec(DECIMAL* pDecIn, VARIANT_BOOL *pBoolOut)
+{
+ if (DEC_SCALE(pDecIn) > DEC_MAX_SCALE || (DEC_SIGN(pDecIn) & ~DECIMAL_NEG))
+ return E_INVALIDARG;
+
+ if (DEC_HI32(pDecIn) || DEC_MID32(pDecIn) || DEC_LO32(pDecIn))
+ *pBoolOut = VARIANT_TRUE;
+ else
+ *pBoolOut = VARIANT_FALSE;
+ return S_OK;
+}
+
+/************************************************************************
+ * VarBoolFromI8 (OLEAUT32.370)
+ *
+ * Convert a VT_I8 to a VT_BOOL.
+ *
+ * PARAMS
+ * ullIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromI8(LONG64 llIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromI8(llIn, pBoolOut);
+}
+
+/************************************************************************
+ * VarBoolFromUI8 (OLEAUT32.371)
+ *
+ * Convert a VT_UI8 to a VT_BOOL.
+ *
+ * PARAMS
+ * ullIn [I] Source
+ * pBoolOut [O] Destination
+ *
+ * RETURNS
+ * S_OK.
+ */
+HRESULT WINAPI VarBoolFromUI8(ULONG64 ullIn, VARIANT_BOOL *pBoolOut)
+{
+ return _VarBoolFromUI8(ullIn, pBoolOut);
+}