[v2 PATCH] oledb32: Coerce Variant to VT_DATE when converting data

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Jan 1 18:21:03 CST 2018


v2: Correct Parameters passed to VariantChangeType.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/oledb32/convert.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 267de1b..22609ae 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -475,10 +475,13 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
         }
         break;
         case DBTYPE_VARIANT:
-            if( V_VT((VARIANT*)src) == VT_DATE)
+        {
+            VariantInit(&tmp);
+
+            if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_DATE)) == S_OK)
             {
                 SYSTEMTIME st;
-                hr = (VariantTimeToSystemTime( V_DATE((VARIANT*)src), &st) ? S_OK : E_FAIL);
+                hr = (VariantTimeToSystemTime( V_DATE(&tmp), &st) ? S_OK : E_FAIL);
                 d->year = st.wYear;
                 d->month = st.wMonth;
                 d->day = st.wDay;
@@ -489,6 +492,7 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
                 return E_NOTIMPL;
             }
             break;
+        }
         default: FIXME("Unimplemented conversion %04x -> DBDATE\n", src_type); return  E_NOTIMPL;
         }
         break;
-- 
1.9.1




More information about the wine-devel mailing list