From f2b8ccb7b0b22b7b5d661d908f8f8ee02f22647d Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Tue, 15 Mar 2022 07:30:59 -0700 Subject: [PATCH] propsys: Implement InitVariantFromFileTime. Signed-off-by: Daniel Lehman Signed-off-by: Alexandre Julliard --- dlls/propsys/propsys.spec | 2 +- dlls/propsys/propvar.c | 15 +++++++++++++++ include/propvarutil.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec index 35828057264..15749952e95 100644 --- a/dlls/propsys/propsys.spec +++ b/dlls/propsys/propsys.spec @@ -49,7 +49,7 @@ @ stub InitVariantFromBooleanArray @ stdcall InitVariantFromBuffer(ptr long ptr) @ stub InitVariantFromDoubleArray -@ stub InitVariantFromFileTime +@ stdcall InitVariantFromFileTime(ptr ptr) @ stub InitVariantFromFileTimeArray @ stdcall InitVariantFromGUIDAsString(ptr ptr) @ stub InitVariantFromInt16Array diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c index be27c5cb641..8f6c52f7aa7 100644 --- a/dlls/propsys/propvar.c +++ b/dlls/propsys/propvar.c @@ -672,6 +672,21 @@ HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar) return S_OK; } +HRESULT WINAPI InitVariantFromFileTime(const FILETIME *ft, VARIANT *var) +{ + 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) { DWORD ret; diff --git a/include/propvarutil.h b/include/propvarutil.h index 55b64abbe4f..36a670f56e6 100644 --- a/include/propvarutil.h +++ b/include/propvarutil.h @@ -71,6 +71,7 @@ typedef int PROPVAR_COMPARE_FLAGS; HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt); HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar); +HRESULT WINAPI InitVariantFromFileTime(const FILETIME *ft, VARIANT *var); HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar); HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar); HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);