source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/propvarutil.h@ 1170

Last change on this file since 1170 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 6.8 KB
Line 
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#ifndef WINE_NTSTATUS_DECLARED
26#define WINE_NTSTATUS_DECLARED
27typedef LONG NTSTATUS;
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34enum tagPROPVAR_CHANGE_FLAGS
35{
36 PVCHF_DEFAULT = 0x00000000,
37 PVCHF_NOVALUEPROP = 0x00000001,
38 PVCHF_ALPHABOOL = 0x00000002,
39 PVCHF_NOUSEROVERRIDE = 0x00000004,
40 PVCHF_LOCALBOOL = 0x00000008,
41 PVCHF_NOHEXSTRING = 0x00000010,
42};
43
44typedef int PROPVAR_CHANGE_FLAGS;
45
46enum tagPROPVAR_COMPARE_UNIT
47{
48 PVCU_DEFAULT = 0x00000000,
49 PVCU_SECOND = 0x00000001,
50 PVCU_MINUTE = 0x00000002,
51 PVCU_HOUR = 0x00000003,
52 PVCU_DAY = 0x00000004,
53 PVCU_MONTH = 0x00000005,
54 PVCU_YEAR = 0x00000006,
55};
56
57typedef int PROPVAR_COMPARE_UNIT;
58
59enum tagPROPVAR_COMPARE_FLAGS
60{
61 PVCF_DEFAULT = 0x00000000,
62 PVCF_TREATEMPTYASGREATERTHAN = 0x00000001,
63 PVCF_USESTRCMP = 0x00000002,
64 PVCF_USESTRCMPC = 0x00000004,
65 PVCF_USESTRCMPI = 0x00000008,
66 PVCF_USESTRCMPIC = 0x00000010,
67};
68
69typedef int PROPVAR_COMPARE_FLAGS;
70
71HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
72 PROPVAR_CHANGE_FLAGS flags, VARTYPE vt);
73HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
74HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
75HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
76HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
77HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
78HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
79HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
80INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
81 PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags);
82HRESULT WINAPI InitPropVariantFromFileTime(const FILETIME *pftIn, PROPVARIANT *ppropvar);
83
84HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
85HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
86HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
87HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
88HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
89HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
90HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
91HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, WINBOOL *ret);
92HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
93HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
94PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
95
96HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
97
98#ifdef __cplusplus
99
100HRESULT InitPropVariantFromBoolean(WINBOOL fVal, PROPVARIANT *ppropvar);
101HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar);
102HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar);
103HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar);
104HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar);
105HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
106HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar);
107HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar);
108HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
109HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar);
110WINBOOL IsPropVariantVector(REFPROPVARIANT propvar);
111WINBOOL IsPropVariantString(REFPROPVARIANT propvar);
112
113#ifndef NO_PROPVAR_INLINES
114
115inline HRESULT InitPropVariantFromBoolean(WINBOOL fVal, PROPVARIANT *ppropvar)
116{
117 ppropvar->vt = VT_BOOL;
118 ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
119 return S_OK;
120}
121
122inline HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar)
123{
124 ppropvar->vt = VT_I2;
125 ppropvar->iVal = nVal;
126 return S_OK;
127}
128
129inline HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar)
130{
131 ppropvar->vt = VT_UI2;
132 ppropvar->uiVal = uiVal;
133 return S_OK;
134}
135
136inline HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar)
137{
138 ppropvar->vt = VT_I4;
139 ppropvar->lVal = lVal;
140 return S_OK;
141}
142
143inline HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar)
144{
145 ppropvar->vt = VT_UI4;
146 ppropvar->ulVal = ulVal;
147 return S_OK;
148}
149
150inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
151{
152 ppropvar->vt = VT_I8;
153 ppropvar->hVal.QuadPart = llVal;
154 return S_OK;
155}
156
157inline HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar)
158{
159 ppropvar->vt = VT_UI8;
160 ppropvar->uhVal.QuadPart = ullVal;
161 return S_OK;
162}
163
164inline HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar)
165{
166 ppropvar->vt = VT_R8;
167 ppropvar->dblVal = dblVal;
168 return S_OK;
169}
170
171inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
172{
173 HRESULT hres;
174
175 hres = SHStrDupW(psz, &ppropvar->pwszVal);
176 if(SUCCEEDED(hres))
177 ppropvar->vt = VT_LPWSTR;
178 else
179 PropVariantInit(ppropvar);
180
181 return hres;
182}
183
184inline HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar)
185{
186#ifdef __cplusplus
187 return InitPropVariantFromBuffer(&guid, sizeof(GUID), ppropvar);
188#else
189 return InitPropVariantFromBuffer(guid, sizeof(GUID), ppropvar);
190#endif
191}
192
193inline WINBOOL IsPropVariantVector(REFPROPVARIANT propvar)
194{
195 return (propvar.vt & (VT_ARRAY | VT_VECTOR));
196}
197
198inline WINBOOL IsPropVariantString(REFPROPVARIANT propvar)
199{
200 return (PropVariantToStringWithDefault(propvar, NULL) != NULL);
201}
202
203#endif /* NO_PROPVAR_INLINES */
204#endif /* __cplusplus */
205
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif /* __WINE_PROPVARUTIL_H */
Note: See TracBrowser for help on using the repository browser.