From 89450e7cbdab1cfce5b8948b497ce8ab706f247d Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Fri, 30 Apr 2004 18:32:58 +0000 Subject: [PATCH] Implement VarDateFromUdateEx. --- dlls/oleaut32/oleaut32.spec | 2 +- dlls/oleaut32/variant.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/dlls/oleaut32/oleaut32.spec b/dlls/oleaut32/oleaut32.spec index 65f477bcef1..aad632ea049 100644 --- a/dlls/oleaut32/oleaut32.spec +++ b/dlls/oleaut32/oleaut32.spec @@ -311,7 +311,7 @@ 316 stdcall VarR4CmpR8(long double) 317 stdcall VarR8Round(double long ptr) 318 stdcall VarCat(ptr ptr ptr) -319 stub VarDateFromUdateEx # stdcall (ptr long long ptr) +319 stdcall VarDateFromUdateEx(ptr long long ptr) 320 stdcall -private DllRegisterServer() OLEAUT32_DllRegisterServer 321 stdcall -private DllUnregisterServer() OLEAUT32_DllUnregisterServer 322 stub GetRecordInfoFromGuids # stdcall (ptr long long long ptr ptr) diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index b0f76f940cf..86a4664e445 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -1292,12 +1292,13 @@ INT WINAPI VariantTimeToSystemTime(double dateIn, LPSYSTEMTIME lpSt) } /*********************************************************************** - * VarDateFromUdate [OLEAUT32.330] + * VarDateFromUdateEx [OLEAUT32.319] * * Convert an unpacked format date and time to a variant VT_DATE. * * PARAMS * pUdateIn [I] Unpacked format date and time to convert + * lcid [I] Locale identifier for the conversion * dwFlags [I] Flags controlling the conversion (VAR_ flags from "oleauto.h") * pDateOut [O] Destination for variant VT_DATE. * @@ -1305,17 +1306,20 @@ INT WINAPI VariantTimeToSystemTime(double dateIn, LPSYSTEMTIME lpSt) * Success: S_OK. *pDateOut contains the converted value. * Failure: E_INVALIDARG, if pUdateIn cannot be represented in VT_DATE format. */ -HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut) +HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DATE *pDateOut) { UDATE ud; double dateVal; - TRACE("(%p->%d/%d/%d %d:%d:%d:%d %d %d,0x%08lx,%p)\n", pUdateIn, + TRACE("(%p->%d/%d/%d %d:%d:%d:%d %d %d,0x%08lx,0x%08lx,%p)\n", pUdateIn, pUdateIn->st.wMonth, pUdateIn->st.wDay, pUdateIn->st.wYear, pUdateIn->st.wHour, pUdateIn->st.wMinute, pUdateIn->st.wSecond, pUdateIn->st.wMilliseconds, pUdateIn->st.wDayOfWeek, - pUdateIn->wDayOfYear, dwFlags, pDateOut); + pUdateIn->wDayOfYear, lcid, dwFlags, pDateOut); + if (lcid != MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)) + FIXME("lcid possibly not handled, treating as en-us\n"); + memcpy(&ud, pUdateIn, sizeof(ud)); if (dwFlags & VAR_VALIDDATE) @@ -1338,6 +1342,31 @@ HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut) return S_OK; } +/*********************************************************************** + * VarDateFromUdate [OLEAUT32.330] + * + * Convert an unpacked format date and time to a variant VT_DATE. + * + * PARAMS + * pUdateIn [I] Unpacked format date and time to convert + * dwFlags [I] Flags controlling the conversion (VAR_ flags from "oleauto.h") + * pDateOut [O] Destination for variant VT_DATE. + * + * RETURNS + * Success: S_OK. *pDateOut contains the converted value. + * Failure: E_INVALIDARG, if pUdateIn cannot be represented in VT_DATE format. + * + * NOTES + * This function uses the United States English locale for the conversion. Use + * VarDateFromUdateEx() for alternate locales. + */ +HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut) +{ + LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); + + return VarDateFromUdateEx(pUdateIn, lcid, dwFlags, pDateOut); +} + /*********************************************************************** * VarUdateFromDate [OLEAUT32.331] *