From 890d79348a247af5ec043a63f32a6e933cae0d6b Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Tue, 15 Mar 2022 09:43:55 -0700 Subject: [PATCH 3/3] propsys: Implement InitVariantFromFileTime. Signed-off-by: Daniel Lehman --- dlls/propsys/propvar.c | 13 +++++++++++-- dlls/propsys/tests/propsys.c | 2 -- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c index 4106a82f126e..8f6c52f7aa78 100644 --- a/dlls/propsys/propvar.c +++ b/dlls/propsys/propvar.c @@ -674,8 +674,17 @@ HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar) HRESULT WINAPI InitVariantFromFileTime(const FILETIME *ft, VARIANT *var) { - FIXME("%p, %p\n", ft, var); - return E_NOTIMPL; + SYSTEMTIME st; + + TRACE("%p, %p\n", ft, var); + + VariantInit(var); + if (!FileTimeToSystemTime(ft, &st)) + return E_INVALIDARG; + if (!SystemTimeToVariantTime(&st, &V_DATE(var))) + return E_INVALIDARG; + V_VT(var) = VT_DATE; + return S_OK; } static inline DWORD PROPVAR_HexToNum(const WCHAR *hex) diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c index e31773a243a2..124b3405bcb3 100644 --- a/dlls/propsys/tests/propsys.c +++ b/dlls/propsys/tests/propsys.c @@ -2045,7 +2045,6 @@ static void test_InitVariantFromFileTime(void) InitVariantFromFileTime(NULL, &var); } - todo_wine { ft.dwHighDateTime = -1; ft.dwLowDateTime = -1; V_VT(&var) = 0xdead; @@ -2063,7 +2062,6 @@ static void test_InitVariantFromFileTime(void) FileTimeToSystemTime(&ft, &st); SystemTimeToVariantTime(&st, &d); ok(V_DATE(&var) == d, "got wrong value: %f, expected %f\n", V_DATE(&var), d); - } } START_TEST(propsys) -- 2.27.0