From ad2f8bdd5c9b2470cf1e712ae0d2d20904517ea2 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 1 Jul 2011 14:15:21 +0200 Subject: [PATCH] propvarutil.h: Added InitPropVariantFromBoolean and InitPropVariantFromString implementations. --- include/propvarutil.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/propvarutil.h b/include/propvarutil.h index 2573d38d1a1..1764422050f 100644 --- a/include/propvarutil.h +++ b/include/propvarutil.h @@ -38,4 +38,35 @@ typedef int PROPVAR_CHANGE_FLAGS; HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt); + +#ifdef __cplusplus + +HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar); +HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar); + +#ifndef NO_PROPVAR_INLINES + +HRESULT inline InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_BOOL; + ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; +} + +HRESULT inline InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar) +{ + HRESULT hres; + + hres = SHStrDupW(psz, &ppropvar->pwszVal); + if(SUCCEEDED(hres)) + ppropvar->vt = VT_LPWSTR; + else + PropVariantInit(ppropvar); + + return hres; +} + +#endif +#endif + #endif /* __WINE_PROPVARUTIL_H */