ReactOS  0.4.12-dev-934-g9a4676f
propvarutil.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 James Hawkins for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef __WINE_PROPVARUTIL_H
20 #define __WINE_PROPVARUTIL_H
21 
22 #include <shtypes.h>
23 #include <shlwapi.h>
24 
26 {
27  PVCHF_DEFAULT = 0x00000000,
28  PVCHF_NOVALUEPROP = 0x00000001,
29  PVCHF_ALPHABOOL = 0x00000002,
30  PVCHF_NOUSEROVERRIDE = 0x00000004,
31  PVCHF_LOCALBOOL = 0x00000008,
32  PVCHF_NOHEXSTRING = 0x00000010,
33 };
34 
36 
38 {
39  PVCU_DEFAULT = 0x00000000,
40  PVCU_SECOND = 0x00000001,
41  PVCU_MINUTE = 0x00000002,
42  PVCU_HOUR = 0x00000003,
43  PVCU_DAY = 0x00000004,
44  PVCU_MONTH = 0x00000005,
45  PVCU_YEAR = 0x00000006,
46 };
47 
49 
51 {
52  PVCF_DEFAULT = 0x00000000,
54  PVCF_USESTRCMP = 0x00000002,
55  PVCF_USESTRCMPC = 0x00000004,
56  PVCF_USESTRCMPI = 0x00000008,
57  PVCF_USESTRCMPIC = 0x00000010,
58 };
59 
61 
62 HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
66 HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
67 HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
69 HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
71 INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
73 
74 HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
75 HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
76 HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
77 HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
78 HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
79 HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
80 HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
81 PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
82 
83 HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
84 
85 #ifdef __cplusplus
86 
87 HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
88 HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
89 HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
90 
91 #ifndef NO_PROPVAR_INLINES
92 
93 inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
94 {
95  ppropvar->vt = VT_BOOL;
96  ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
97  return S_OK;
98 }
99 
100 inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
101 {
102  HRESULT hres;
103 
104  hres = SHStrDupW(psz, &ppropvar->pwszVal);
105  if(SUCCEEDED(hres))
106  ppropvar->vt = VT_LPWSTR;
107  else
108  PropVariantInit(ppropvar);
109 
110  return hres;
111 }
112 
113 inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
114 {
115  ppropvar->vt = VT_I8;
116  ppropvar->hVal.QuadPart = llVal;
117  return S_OK;
118 }
119 
120 #endif
121 #endif
122 
123 #endif /* __WINE_PROPVARUTIL_H */
const uint16_t * PCWSTR
Definition: typedefs.h:55
HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid)
Definition: propvar.c:689
Definition: compat.h:1948
Definition: scsiwmi.h:51
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
int PROPVAR_COMPARE_FLAGS
Definition: propvarutil.h:60
#define REFCLSID
Definition: guiddef.h:112
int PROPVAR_COMPARE_UNIT
Definition: propvarutil.h:48
HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret)
Definition: propvar.c:158
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2004
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
Definition: propvar.c:525
static REFPROPVARIANT propvarSrc
Definition: suminfo.c:85
int32_t INT
Definition: typedefs.h:56
int PROPVAR_CHANGE_FLAGS
Definition: propvarutil.h:35
tagPROPVAR_COMPARE_UNIT
Definition: propvarutil.h:37
const GUID * guid
PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
Definition: propvar.c:340
tagPROPVAR_COMPARE_FLAGS
Definition: propvarutil.h:50
HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
Definition: propvar.c:230
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar)
Definition: propvar.c:559
HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
Definition: propvar.c:573
HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
Definition: propvar.c:361
int64_t LONGLONG
Definition: typedefs.h:66
HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret)
Definition: propvar.c:194
HRESULT hres
Definition: protocol.c:465
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar)
Definition: propvar.c:541
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
uint64_t ULONGLONG
Definition: typedefs.h:65
HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid)
Definition: propvar.c:705
#define WINAPI
Definition: msvc.h:8
HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret)
Definition: propvar.c:182
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
static DWORD cb
Definition: integrity.c:41
HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
Definition: propvar.c:290
GLbitfield flags
Definition: glext.h:7161
int ret
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar)
Definition: propvar.c:586
HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret)
Definition: propvar.c:170
HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
Definition: propvar.c:218
#define S_OK
Definition: intsafe.h:59
unsigned short USHORT
Definition: pedump.c:61
INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags)
Definition: propvar.c:741
unsigned short VARTYPE
Definition: compat.h:1888
unsigned int UINT
Definition: ndis.h:50
HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret)
Definition: propvar.c:206
unsigned int ULONG
Definition: retypes.h:1
UINT32 uint
Definition: types.h:83
tagPROPVAR_CHANGE_FLAGS
Definition: propvarutil.h:25
#define SUCCEEDED(hr)
Definition: intsafe.h:57