From 4f52e32205fc3cc3f09adf6d7ff961c36e3b1f4d Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Fri, 9 Jul 2021 19:12:42 +0530 Subject: [PATCH] include: Add some function declarations in propvarutil.h. Signed-off-by: Biswapriyo Nath Signed-off-by: Alexandre Julliard --- include/propvarutil.h | 77 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/include/propvarutil.h b/include/propvarutil.h index e0a21faf8c7..972cf48a019 100644 --- a/include/propvarutil.h +++ b/include/propvarutil.h @@ -74,6 +74,7 @@ HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid); HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid); INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags); +HRESULT WINAPI InitPropVariantFromFileTime(const FILETIME *pftIn, PROPVARIANT *ppropvar); HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret); HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret); @@ -92,8 +93,17 @@ HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret); #ifdef __cplusplus HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar); -HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar); HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar); +BOOL IsPropVariantVector(REFPROPVARIANT propvar); +BOOL IsPropVariantString(REFPROPVARIANT propvar); #ifndef NO_PROPVAR_INLINES @@ -104,6 +114,55 @@ inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar) return S_OK; } +inline HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_I2; + ppropvar->iVal = nVal; + return S_OK; +} + +inline HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_UI2; + ppropvar->uiVal = uiVal; + return S_OK; +} + +inline HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_I4; + ppropvar->lVal = lVal; + return S_OK; +} + +inline HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_UI4; + ppropvar->ulVal = ulVal; + return S_OK; +} + +inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_I8; + ppropvar->hVal.QuadPart = llVal; + return S_OK; +} + +inline HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_UI8; + ppropvar->uhVal.QuadPart = ullVal; + return S_OK; +} + +inline HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_R8; + ppropvar->dblVal = dblVal; + return S_OK; +} + inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar) { HRESULT hres; @@ -117,11 +176,19 @@ inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar) return hres; } -inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar) +inline HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar) { - ppropvar->vt = VT_I8; - ppropvar->hVal.QuadPart = llVal; - return S_OK; + return InitPropVariantFromBuffer(guid, sizeof(GUID), ppropvar); +} + +inline BOOL IsPropVariantVector(REFPROPVARIANT propvar) +{ + return (propvar.vt & (VT_ARRAY | VT_VECTOR)); +} + +inline BOOL IsPropVariantString(REFPROPVARIANT propvar) +{ + return (PropVariantToStringWithDefault(propvar, NULL) != NULL); } #endif /* NO_PROPVAR_INLINES */