wined3d: Use wined3d_mask_from_size() in stateblock_savedstates_set_all().
[wine.git] / include / propvarutil.h
blob55b64abbe4fc414da7b83ab58530c81666a93ab6
1 /*
2 * Copyright 2008 James Hawkins for CodeWeavers
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.
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.
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
19 #ifndef __WINE_PROPVARUTIL_H
20 #define __WINE_PROPVARUTIL_H
22 #include <shtypes.h>
23 #include <shlwapi.h>
25 #ifndef WINE_NTSTATUS_DECLARED
26 #define WINE_NTSTATUS_DECLARED
27 typedef LONG NTSTATUS;
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 enum tagPROPVAR_CHANGE_FLAGS
36 PVCHF_DEFAULT = 0x00000000,
37 PVCHF_NOVALUEPROP = 0x00000001,
38 PVCHF_ALPHABOOL = 0x00000002,
39 PVCHF_NOUSEROVERRIDE = 0x00000004,
40 PVCHF_LOCALBOOL = 0x00000008,
41 PVCHF_NOHEXSTRING = 0x00000010,
44 typedef int PROPVAR_CHANGE_FLAGS;
46 enum tagPROPVAR_COMPARE_UNIT
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,
57 typedef int PROPVAR_COMPARE_UNIT;
59 enum tagPROPVAR_COMPARE_FLAGS
61 PVCF_DEFAULT = 0x00000000,
62 PVCF_TREATEMPTYASGREATERTHAN = 0x00000001,
63 PVCF_USESTRCMP = 0x00000002,
64 PVCF_USESTRCMPC = 0x00000004,
65 PVCF_USESTRCMPI = 0x00000008,
66 PVCF_USESTRCMPIC = 0x00000010,
69 typedef int PROPVAR_COMPARE_FLAGS;
71 HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
72 PROPVAR_CHANGE_FLAGS flags, VARTYPE vt);
73 HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
74 HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
75 HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
76 HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
77 HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
78 HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
79 HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
80 INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
81 PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags);
82 HRESULT WINAPI InitPropVariantFromFileTime(const FILETIME *pftIn, PROPVARIANT *ppropvar);
84 HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
85 HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
86 HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
87 HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
88 HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
89 HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
90 HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
91 HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
92 HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
93 HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
94 PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
96 HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
98 #ifdef __cplusplus
100 HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
101 HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar);
102 HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar);
103 HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar);
104 HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar);
105 HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
106 HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar);
107 HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar);
108 HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
109 HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar);
110 BOOL IsPropVariantVector(REFPROPVARIANT propvar);
111 BOOL IsPropVariantString(REFPROPVARIANT propvar);
113 #ifndef NO_PROPVAR_INLINES
115 inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
117 ppropvar->vt = VT_BOOL;
118 ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
119 return S_OK;
122 inline HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar)
124 ppropvar->vt = VT_I2;
125 ppropvar->iVal = nVal;
126 return S_OK;
129 inline HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar)
131 ppropvar->vt = VT_UI2;
132 ppropvar->uiVal = uiVal;
133 return S_OK;
136 inline HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar)
138 ppropvar->vt = VT_I4;
139 ppropvar->lVal = lVal;
140 return S_OK;
143 inline HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar)
145 ppropvar->vt = VT_UI4;
146 ppropvar->ulVal = ulVal;
147 return S_OK;
150 inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
152 ppropvar->vt = VT_I8;
153 ppropvar->hVal.QuadPart = llVal;
154 return S_OK;
157 inline HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar)
159 ppropvar->vt = VT_UI8;
160 ppropvar->uhVal.QuadPart = ullVal;
161 return S_OK;
164 inline HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar)
166 ppropvar->vt = VT_R8;
167 ppropvar->dblVal = dblVal;
168 return S_OK;
171 inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
173 HRESULT hres;
175 hres = SHStrDupW(psz, &ppropvar->pwszVal);
176 if(SUCCEEDED(hres))
177 ppropvar->vt = VT_LPWSTR;
178 else
179 PropVariantInit(ppropvar);
181 return hres;
184 inline HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar)
186 #ifdef __cplusplus
187 return InitPropVariantFromBuffer(&guid, sizeof(GUID), ppropvar);
188 #else
189 return InitPropVariantFromBuffer(guid, sizeof(GUID), ppropvar);
190 #endif
193 inline BOOL IsPropVariantVector(REFPROPVARIANT propvar)
195 return (propvar.vt & (VT_ARRAY | VT_VECTOR));
198 inline BOOL IsPropVariantString(REFPROPVARIANT propvar)
200 return (PropVariantToStringWithDefault(propvar, NULL) != NULL);
203 #endif /* NO_PROPVAR_INLINES */
204 #endif /* __cplusplus */
207 #ifdef __cplusplus
209 #endif
211 #endif /* __WINE_PROPVARUTIL_H */