From 76e009056557db810afaa8af042b7248b879f7a0 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 27 Oct 2009 12:25:19 +0000 Subject: [PATCH] oledb32: Add a couple of conversions to DBTYPE_FILETIME. --- dlls/oledb32/convert.c | 14 ++++++++++++++ dlls/oledb32/tests/convert.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index e5443cb47dc..44d86bb83c8 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -128,6 +128,8 @@ static int get_length(DBTYPE type) return 8; case DBTYPE_BSTR: return sizeof(BSTR); + case DBTYPE_FILETIME: + return sizeof(FILETIME); case DBTYPE_WSTR: case DBTYPE_BYREF | DBTYPE_WSTR: return 0; @@ -281,6 +283,18 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, break; } + case DBTYPE_FILETIME: + { + FILETIME *d = dst; + switch(src_type) + { + case DBTYPE_EMPTY: d->dwLowDateTime = d->dwHighDateTime = 0; hr = S_OK; break; + case DBTYPE_FILETIME: *d = *(FILETIME*)src; hr = S_OK; break; + default: FIXME("Unimplemented conversion %04x -> FILETIME\n", src_type); return E_NOTIMPL; + } + break; + } + case DBTYPE_WSTR: { BSTR b; diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c index 6cd44f5d319..2095b9b5508 100644 --- a/dlls/oledb32/tests/convert.c +++ b/dlls/oledb32/tests/convert.c @@ -1111,6 +1111,34 @@ static void test_converttobyrefwstr(void) IDataConvert_Release(convert); } +static void test_converttofiletime(void) +{ + IDataConvert *convert; + HRESULT hr; + FILETIME dst; + BYTE src[20]; + DBSTATUS dst_status; + DBLENGTH dst_len; + + hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert); + if(FAILED(hr)) + { + win_skip("Unable to load oledb conversion library\n"); + return; + } + + memset(&dst, 0xcc, sizeof(dst)); + ((FILETIME *)src)->dwLowDateTime = 0x12345678; + ((FILETIME *)src)->dwHighDateTime = 0x9abcdef0; + hr = IDataConvert_DataConvert(convert, DBTYPE_FILETIME, DBTYPE_FILETIME, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == sizeof(dst), "got %d\n", dst_len); + ok(dst.dwLowDateTime == 0x12345678, "got %08x\n", dst.dwLowDateTime); + ok(dst.dwHighDateTime == 0x9abcdef0, "got %08x\n", dst.dwHighDateTime); + + IDataConvert_Release(convert); +} START_TEST(convert) { @@ -1122,5 +1150,6 @@ START_TEST(convert) test_converttobstr(); test_converttowstr(); test_converttobyrefwstr(); + test_converttofiletime(); OleUninitialize(); }