ReactOS 0.4.15-dev-8339-g4028de8
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
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30{
31 PVCHF_DEFAULT = 0x00000000,
32 PVCHF_NOVALUEPROP = 0x00000001,
33 PVCHF_ALPHABOOL = 0x00000002,
35 PVCHF_LOCALBOOL = 0x00000008,
36 PVCHF_NOHEXSTRING = 0x00000010,
37};
38
40
42{
43 PVCU_DEFAULT = 0x00000000,
44 PVCU_SECOND = 0x00000001,
45 PVCU_MINUTE = 0x00000002,
46 PVCU_HOUR = 0x00000003,
47 PVCU_DAY = 0x00000004,
48 PVCU_MONTH = 0x00000005,
49 PVCU_YEAR = 0x00000006,
50};
51
53
55{
56 PVCF_DEFAULT = 0x00000000,
58 PVCF_USESTRCMP = 0x00000002,
59 PVCF_USESTRCMPC = 0x00000004,
60 PVCF_USESTRCMPI = 0x00000008,
61 PVCF_USESTRCMPIC = 0x00000010,
62};
63
65
66HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
70HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
73HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
75INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
77
78HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
79HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
80HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
81HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
82HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
83HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
84HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
85HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
86HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
87HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
88PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
89
90HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
91
92#ifdef __cplusplus
93
94HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
95HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
96HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
97
98#ifndef NO_PROPVAR_INLINES
99
100inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
101{
102 ppropvar->vt = VT_BOOL;
103 ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
104 return S_OK;
105}
106
107inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
108{
110
111 hres = SHStrDupW(psz, &ppropvar->pwszVal);
112 if(SUCCEEDED(hres))
113 ppropvar->vt = VT_LPWSTR;
114 else
115 PropVariantInit(ppropvar);
116
117 return hres;
118}
119
120inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
121{
122 ppropvar->vt = VT_I8;
123 ppropvar->hVal.QuadPart = llVal;
124 return S_OK;
125}
126
127#endif /* NO_PROPVAR_INLINES */
128#endif /* __cplusplus */
129
130
131#ifdef __cplusplus
132}
133#endif
134
135#endif /* __WINE_PROPVARUTIL_H */
UINT32 uint
Definition: types.h:83
unsigned short VARTYPE
Definition: compat.h:2254
@ VT_LPWSTR
Definition: compat.h:2325
@ VT_I8
Definition: compat.h:2314
@ VT_BOOL
Definition: compat.h:2306
static REFPROPVARIANT propvarSrc
Definition: suminfo.c:85
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2012
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
const GUID * guid
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
HRESULT hres
Definition: protocol.c:465
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
REFCLSID clsid
Definition: msctf.c:82
unsigned int UINT
Definition: ndis.h:50
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
tagPROPVAR_COMPARE_FLAGS
Definition: propvarutil.h:55
@ PVCF_USESTRCMPC
Definition: propvarutil.h:59
@ PVCF_USESTRCMPI
Definition: propvarutil.h:60
@ PVCF_USESTRCMPIC
Definition: propvarutil.h:61
@ PVCF_DEFAULT
Definition: propvarutil.h:56
@ PVCF_TREATEMPTYASGREATERTHAN
Definition: propvarutil.h:57
@ PVCF_USESTRCMP
Definition: propvarutil.h:58
HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret)
Definition: propvar.c:186
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar)
Definition: propvar.c:608
PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
Definition: propvar.c:407
int PROPVAR_COMPARE_UNIT
Definition: propvarutil.h:52
int PROPVAR_CHANGE_FLAGS
Definition: propvarutil.h:39
HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid)
Definition: propvar.c:775
HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb)
Definition: propvar.c:306
HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret)
Definition: propvar.c:210
tagPROPVAR_COMPARE_UNIT
Definition: propvarutil.h:42
@ PVCU_DEFAULT
Definition: propvarutil.h:43
@ PVCU_MONTH
Definition: propvarutil.h:48
@ PVCU_HOUR
Definition: propvarutil.h:46
@ PVCU_YEAR
Definition: propvarutil.h:49
@ PVCU_MINUTE
Definition: propvarutil.h:45
@ PVCU_SECOND
Definition: propvarutil.h:44
@ PVCU_DAY
Definition: propvarutil.h:47
HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
Definition: propvar.c:640
HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
Definition: propvar.c:356
HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
Definition: propvar.c:428
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar)
Definition: propvar.c:626
HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
Definition: propvar.c:246
INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2, PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags)
Definition: propvar.c:814
HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret)
Definition: propvar.c:198
HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret)
Definition: propvar.c:162
HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch)
Definition: propvar.c:332
int PROPVAR_COMPARE_FLAGS
Definition: propvarutil.h:64
HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
Definition: propvar.c:234
tagPROPVAR_CHANGE_FLAGS
Definition: propvarutil.h:30
@ PVCHF_NOUSEROVERRIDE
Definition: propvarutil.h:34
@ PVCHF_DEFAULT
Definition: propvarutil.h:31
@ PVCHF_LOCALBOOL
Definition: propvarutil.h:35
@ PVCHF_ALPHABOOL
Definition: propvarutil.h:33
@ PVCHF_NOVALUEPROP
Definition: propvarutil.h:32
@ PVCHF_NOHEXSTRING
Definition: propvarutil.h:36
HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret)
Definition: propvar.c:222
HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid)
Definition: propvar.c:756
HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret)
Definition: propvar.c:174
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar)
Definition: propvar.c:653
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
Definition: propvar.c:592
#define REFCLSID
Definition: guiddef.h:117
Definition: scsiwmi.h:51
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
int64_t LONGLONG
Definition: typedefs.h:68
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
int ret
#define WINAPI
Definition: msvc.h:6
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185