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 | /*
|
---|
20 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __WINE_PROPVARUTIL_H
|
---|
29 | #define __WINE_PROPVARUTIL_H
|
---|
30 |
|
---|
31 | #include <shtypes.h>
|
---|
32 | #include <shlwapi.h>
|
---|
33 |
|
---|
34 | enum 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 |
|
---|
44 | typedef int PROPVAR_CHANGE_FLAGS;
|
---|
45 |
|
---|
46 | enum 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 |
|
---|
57 | typedef int PROPVAR_COMPARE_UNIT;
|
---|
58 |
|
---|
59 | enum 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 |
|
---|
69 | typedef int PROPVAR_COMPARE_FLAGS;
|
---|
70 |
|
---|
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 InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
|
---|
77 | HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
|
---|
78 | HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
|
---|
79 | INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2,
|
---|
80 | PROPVAR_COMPARE_UNIT uint, PROPVAR_COMPARE_FLAGS flags);
|
---|
81 |
|
---|
82 | HRESULT WINAPI PropVariantToInt16(REFPROPVARIANT propvarIn, SHORT *ret);
|
---|
83 | HRESULT WINAPI PropVariantToInt32(REFPROPVARIANT propvarIn, LONG *ret);
|
---|
84 | HRESULT WINAPI PropVariantToInt64(REFPROPVARIANT propvarIn, LONGLONG *ret);
|
---|
85 | HRESULT WINAPI PropVariantToUInt16(REFPROPVARIANT propvarIn, USHORT *ret);
|
---|
86 | HRESULT WINAPI PropVariantToUInt32(REFPROPVARIANT propvarIn, ULONG *ret);
|
---|
87 | HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret);
|
---|
88 |
|
---|
89 | #ifdef __cplusplus
|
---|
90 |
|
---|
91 | HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar);
|
---|
92 | HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar);
|
---|
93 | HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar);
|
---|
94 |
|
---|
95 | #ifndef NO_PROPVAR_INLINES
|
---|
96 |
|
---|
97 | inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar)
|
---|
98 | {
|
---|
99 | ppropvar->vt = VT_BOOL;
|
---|
100 | ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE;
|
---|
101 | return S_OK;
|
---|
102 | }
|
---|
103 |
|
---|
104 | inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
|
---|
105 | {
|
---|
106 | HRESULT hres;
|
---|
107 |
|
---|
108 | hres = SHStrDupW(psz, &ppropvar->pwszVal);
|
---|
109 | if(SUCCEEDED(hres))
|
---|
110 | ppropvar->vt = VT_LPWSTR;
|
---|
111 | else
|
---|
112 | PropVariantInit(ppropvar);
|
---|
113 |
|
---|
114 | return hres;
|
---|
115 | }
|
---|
116 |
|
---|
117 | inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar)
|
---|
118 | {
|
---|
119 | ppropvar->vt = VT_I8;
|
---|
120 | ppropvar->hVal.QuadPart = llVal;
|
---|
121 | return S_OK;
|
---|
122 | }
|
---|
123 |
|
---|
124 | #endif
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | #endif /* __WINE_PROPVARUTIL_H */
|
---|