po: Update Lithuanian translation.
[wine.git] / include / propvarutil.h
blobfcc532fd623e819b4b392241fa820e8821452211
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 InitVariantFromFileTime(const FILETIME *ft, VARIANT *var);
75 HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
76 HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
77 HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
78 HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
79 HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
80 HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
81 INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
82 PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags);
83 HRESULT WINAPI InitPropVariantFromFileTime(const FILETIME *pftIn, PROPVARIANT *ppropvar);
85 HRESULT WINAPI PropVariantToDouble(REFPROPVARIANT propvarIn, double *ret);
86 HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
87 HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
88 HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
89 HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
90 HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
91 HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
92 HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret);
93 HRESULT WINAPI PropVariantToBuffer(REFPROPVARIANT propvarIn, void *ret, UINT cb);
94 HRESULT WINAPI PropVariantToString(REFPROPVARIANT propvarIn, PWSTR ret, UINT cch);
95 PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault);
96 PCWSTR WINAPI VariantToStringWithDefault(const VARIANT *pvar, LPCWSTR pszDefault);
98 HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret);
100 #ifdef __cplusplus
102 HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
103 HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar);
104 HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar);
105 HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar);
106 HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar);
107 HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
108 HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar);
109 HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar);
110 HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
111 HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar);
112 BOOL IsPropVariantVector(REFPROPVARIANT propvar);
113 BOOL IsPropVariantString(REFPROPVARIANT propvar);
115 #ifndef NO_PROPVAR_INLINES
117 inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
119 ppropvar->vt = VT_BOOL;
120 ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
121 return S_OK;
124 inline HRESULT InitPropVariantFromInt16(SHORT nVal, PROPVARIANT *ppropvar)
126 ppropvar->vt = VT_I2;
127 ppropvar->iVal = nVal;
128 return S_OK;
131 inline HRESULT InitPropVariantFromUInt16(USHORT uiVal, PROPVARIANT *ppropvar)
133 ppropvar->vt = VT_UI2;
134 ppropvar->uiVal = uiVal;
135 return S_OK;
138 inline HRESULT InitPropVariantFromInt32(LONG lVal, PROPVARIANT *ppropvar)
140 ppropvar->vt = VT_I4;
141 ppropvar->lVal = lVal;
142 return S_OK;
145 inline HRESULT InitPropVariantFromUInt32(ULONG ulVal, PROPVARIANT *ppropvar)
147 ppropvar->vt = VT_UI4;
148 ppropvar->ulVal = ulVal;
149 return S_OK;
152 inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
154 ppropvar->vt = VT_I8;
155 ppropvar->hVal.QuadPart = llVal;
156 return S_OK;
159 inline HRESULT InitPropVariantFromUInt64(ULONGLONG ullVal, PROPVARIANT *ppropvar)
161 ppropvar->vt = VT_UI8;
162 ppropvar->uhVal.QuadPart = ullVal;
163 return S_OK;
166 inline HRESULT InitPropVariantFromDouble(DOUBLE dblVal, PROPVARIANT *ppropvar)
168 ppropvar->vt = VT_R8;
169 ppropvar->dblVal = dblVal;
170 return S_OK;
173 inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
175 HRESULT hres;
177 hres = SHStrDupW(psz, &ppropvar->pwszVal);
178 if(SUCCEEDED(hres))
179 ppropvar->vt = VT_LPWSTR;
180 else
181 PropVariantInit(ppropvar);
183 return hres;
186 inline HRESULT InitPropVariantFromGUIDAsBuffer(REFGUID guid, PROPVARIANT *ppropvar)
188 #ifdef __cplusplus
189 return InitPropVariantFromBuffer(&guid, sizeof(GUID), ppropvar);
190 #else
191 return InitPropVariantFromBuffer(guid, sizeof(GUID), ppropvar);
192 #endif
195 inline BOOL IsPropVariantVector(REFPROPVARIANT propvar)
197 return (propvar.vt & (VT_ARRAY | VT_VECTOR));
200 inline BOOL IsPropVariantString(REFPROPVARIANT propvar)
202 return (PropVariantToStringWithDefault(propvar, NULL) != NULL);
205 #endif /* NO_PROPVAR_INLINES */
206 #endif /* __cplusplus */
209 #ifdef __cplusplus
211 #endif
213 #endif /* __WINE_PROPVARUTIL_H */