xref: /reactos/sdk/include/psdk/oleauto.h (revision 1431ca4c)
1 /*
2  * Copyright (C) the Wine project
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_OLEAUTO_H
20 #define __WINE_OLEAUTO_H
21 
22 #include <oaidl.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 DEFINE_OLEGUID(IID_StdOle, 0x00020430,0,0);
29 
30 #define STDOLE_MAJORVERNUM  1
31 #define STDOLE_MINORVERNUM  0
32 #define STDOLE_LCID         0
33 
34 #define STDOLE2_MAJORVERNUM 2
35 #define STDOLE2_MINORVERNUM 0
36 #define STDOLE2_LCID        0
37 
38 ULONG WINAPI OaBuildVersion(void);
39 
40 /* BSTR functions */
41 BSTR WINAPI SysAllocString(_In_opt_z_ const OLECHAR*);
42 BSTR WINAPI SysAllocStringByteLen(_In_opt_z_ LPCSTR, _In_ UINT);
43 
44 _Ret_writes_maybenull_z_(ui + 1)
45 BSTR
46 WINAPI
47 SysAllocStringLen(
48   _In_reads_opt_(ui) const OLECHAR*,
49   UINT ui);
50 
51 void WINAPI SysFreeString(_In_opt_ BSTR);
52 
53 INT
54 WINAPI
55 SysReAllocString(
56   _Inout_ _At_(*pbstr, _Pre_z_ _Post_z_ _Post_readable_size_(_String_length_(psz) + 1)) LPBSTR pbstr,
57   _In_opt_z_ const OLECHAR *psz);
58 
59 _Check_return_
60 int
61 WINAPI
62 SysReAllocStringLen(
63   _Inout_ _At_(*pbstr, _Pre_z_ _Post_z_ _Post_readable_size_(len + 1)) BSTR *pbstr,
64   _In_opt_z_ const OLECHAR*,
65   _In_ UINT len);
66 
67 _Post_equal_to_(_String_length_(bstr) * sizeof(OLECHAR))
68 UINT
69 WINAPI
70 SysStringByteLen(
71   _In_opt_ BSTR bstr);
72 
73 _Post_equal_to_(pbstr == NULL ? 0 : _String_length_(pbstr))
74 UINT
75 WINAPI
76 SysStringLen(
77   _In_opt_ BSTR pbstr);
78 
79 /* IErrorInfo helpers */
80 HRESULT WINAPI SetErrorInfo(_In_ ULONG, _In_opt_ IErrorInfo*);
81 _Check_return_ HRESULT WINAPI GetErrorInfo(_In_ ULONG, _Outptr_ IErrorInfo**);
82 _Check_return_ HRESULT WINAPI CreateErrorInfo(_Outptr_ ICreateErrorInfo**);
83 
84 /* SafeArray functions */
85 
86 SAFEARRAY*
87 WINAPI
88 SafeArrayCreate(
89   _In_ VARTYPE,
90   _In_ UINT,
91   _In_ SAFEARRAYBOUND*);
92 
93 SAFEARRAY*
94 WINAPI
95 SafeArrayCreateEx(
96   _In_ VARTYPE,
97   _In_ UINT,
98   _In_ SAFEARRAYBOUND*,
99   _In_ LPVOID);
100 
101 SAFEARRAY*
102 WINAPI
103 SafeArrayCreateVector(
104   _In_ VARTYPE,
105   _In_ LONG,
106   _In_ ULONG);
107 
108 SAFEARRAY*
109 WINAPI
110 SafeArrayCreateVectorEx(
111   _In_ VARTYPE,
112   _In_ LONG,
113   _In_ ULONG,
114   _In_ LPVOID);
115 
116 HRESULT WINAPI SafeArrayAllocDescriptor(_In_ UINT, _Outptr_ SAFEARRAY**);
117 
118 HRESULT
119 WINAPI
120 SafeArrayAllocDescriptorEx(
121   _In_ VARTYPE,
122   _In_ UINT,
123   _Outptr_ SAFEARRAY**);
124 
125 HRESULT WINAPI SafeArrayAllocData(_In_ SAFEARRAY*);
126 HRESULT WINAPI SafeArrayDestroyDescriptor(_In_ SAFEARRAY*);
127 
128 _Check_return_
129 HRESULT
130 WINAPI
131 SafeArrayPutElement(
132   _In_ SAFEARRAY*,
133   LONG*,
134   _In_ void*);
135 
136 HRESULT WINAPI SafeArrayGetElement(_In_ SAFEARRAY*, LONG*, _Out_ void*);
137 HRESULT WINAPI SafeArrayLock(_In_ SAFEARRAY*);
138 HRESULT WINAPI SafeArrayUnlock(_In_ SAFEARRAY*);
139 HRESULT WINAPI SafeArrayGetUBound(_In_ SAFEARRAY*, _In_ UINT, _Out_ LONG*);
140 HRESULT WINAPI SafeArrayGetLBound(_In_ SAFEARRAY*, _In_ UINT, _Out_ LONG*);
141 UINT    WINAPI SafeArrayGetDim(_In_ SAFEARRAY*);
142 UINT    WINAPI SafeArrayGetElemsize(_In_ SAFEARRAY*);
143 HRESULT WINAPI SafeArrayGetVartype(_In_ SAFEARRAY*, _Out_ VARTYPE*);
144 HRESULT WINAPI SafeArrayAccessData(_In_ SAFEARRAY*, void**);
145 HRESULT WINAPI SafeArrayUnaccessData(_In_ SAFEARRAY*);
146 
147 HRESULT
148 WINAPI
149 SafeArrayPtrOfIndex(
150   _In_ SAFEARRAY *psa,
151   _In_reads_(psa->cDims) LONG*,
152   _Outptr_result_bytebuffer_(psa->cbElements) void **);
153 
154 _Check_return_
155 HRESULT
156 WINAPI
157 SafeArrayCopyData(
158   _In_ SAFEARRAY*,
159   _In_ SAFEARRAY*);
160 
161 HRESULT WINAPI SafeArrayDestroyData(_In_ SAFEARRAY*);
162 HRESULT WINAPI SafeArrayDestroy(_In_ SAFEARRAY*);
163 
164 _Check_return_
165 HRESULT
166 WINAPI
167 SafeArrayCopy(
168   _In_ SAFEARRAY*,
169   _Outptr_ SAFEARRAY**);
170 
171 HRESULT WINAPI SafeArrayRedim(_Inout_ SAFEARRAY*, _In_ SAFEARRAYBOUND*);
172 HRESULT WINAPI SafeArraySetRecordInfo(_In_ SAFEARRAY*, _In_ IRecordInfo*);
173 HRESULT WINAPI SafeArrayGetRecordInfo(_In_ SAFEARRAY*, _Outptr_ IRecordInfo**);
174 HRESULT WINAPI SafeArraySetIID(_In_ SAFEARRAY*, _In_ REFGUID);
175 HRESULT WINAPI SafeArrayGetIID(_In_ SAFEARRAY*, _Out_ GUID*);
176 
177 _Check_return_ HRESULT WINAPI VectorFromBstr(_In_ BSTR, _Outptr_ SAFEARRAY**);
178 _Check_return_ HRESULT WINAPI BstrFromVector(_In_ SAFEARRAY*, _Out_ BSTR*);
179 
180 /* Object registration helpers */
181 #define ACTIVEOBJECT_STRONG 0
182 #define ACTIVEOBJECT_WEAK   1
183 
184 _Check_return_
185 HRESULT
186 WINAPI
187 RegisterActiveObject(
188   LPUNKNOWN,
189   REFCLSID,
190   DWORD,
191   LPDWORD);
192 
193 HRESULT WINAPI RevokeActiveObject(DWORD,LPVOID);
194 HRESULT WINAPI GetActiveObject(REFCLSID,LPVOID,LPUNKNOWN*);
195 
196 /* IRecordInfo helpers */
197 HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo*,IRecordInfo**);
198 HRESULT WINAPI GetRecordInfoFromGuids(REFGUID,ULONG,ULONG,LCID,REFGUID,IRecordInfo**);
199 
200 /*
201  * Variants
202  */
203 
204 /* Macros for accessing the fields of the VARIANT type */
205 #if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)
206 #define V_VT(A)         ((A)->n1.n2.vt)
207 #define V_UNION(A,B)    ((A)->n1.n2.n3.B)
208 #define V_RECORD(A)     (V_UNION(A,brecVal).pvRecord)
209 #define V_RECORDINFO(A) (V_UNION(A,brecVal).pRecInfo)
210 #else
211 #define V_VT(A)         ((A)->vt)
212 #define V_UNION(A,B)    ((A)->B)
213 #define V_RECORD(A)     ((A)->pvRecord)
214 #define V_RECORDINFO(A) ((A)->pRecInfo)
215 #endif
216 
217 #define V_ISBYREF(A)  (V_VT(A) & VT_BYREF)
218 #define V_ISARRAY(A)  (V_VT(A) & VT_ARRAY)
219 #define V_ISVECTOR(A) (V_VT(A) & VT_VECTOR)
220 #define V_NONE(A)     V_I2(A)
221 
222 #define V_ARRAY(A)       V_UNION(A,parray)
223 #define V_ARRAYREF(A)    V_UNION(A,pparray)
224 #define V_BOOL(A)        V_UNION(A,boolVal)
225 #define V_BOOLREF(A)     V_UNION(A,pboolVal)
226 #define V_BSTR(A)        V_UNION(A,bstrVal)
227 #define V_BSTRREF(A)     V_UNION(A,pbstrVal)
228 #define V_BYREF(A)       V_UNION(A,byref)
229 #define V_CY(A)          V_UNION(A,cyVal)
230 #define V_CYREF(A)       V_UNION(A,pcyVal)
231 #define V_DATE(A)        V_UNION(A,date)
232 #define V_DATEREF(A)     V_UNION(A,pdate)
233 #if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)
234 #define V_DECIMAL(A)     ((A)->n1.decVal)
235 #else
236 #define V_DECIMAL(A)     ((A)->decVal)
237 #endif
238 #define V_DECIMALREF(A)  V_UNION(A,pdecVal)
239 #define V_DISPATCH(A)    V_UNION(A,pdispVal)
240 #define V_DISPATCHREF(A) V_UNION(A,ppdispVal)
241 #define V_ERROR(A)       V_UNION(A,scode)
242 #define V_ERRORREF(A)    V_UNION(A,pscode)
243 #define V_I1(A)          V_UNION(A,cVal)
244 #define V_I1REF(A)       V_UNION(A,pcVal)
245 #define V_I2(A)          V_UNION(A,iVal)
246 #define V_I2REF(A)       V_UNION(A,piVal)
247 #define V_I4(A)          V_UNION(A,lVal)
248 #define V_I4REF(A)       V_UNION(A,plVal)
249 #define V_I8(A)          V_UNION(A,llVal)
250 #define V_I8REF(A)       V_UNION(A,pllVal)
251 #define V_INT(A)         V_UNION(A,intVal)
252 #define V_INTREF(A)      V_UNION(A,pintVal)
253 #ifdef _WIN64
254 #define V_INT_PTR(A)     V_I8(A)
255 #define V_INT_PTRREF(A)  V_I8REF(A)
256 #else
257 #define V_INT_PTR(A)     V_I4(A)
258 #define V_INT_PTRREF(A)  V_I4REF(A)
259 #endif
260 #define V_R4(A)          V_UNION(A,fltVal)
261 #define V_R4REF(A)       V_UNION(A,pfltVal)
262 #define V_R8(A)          V_UNION(A,dblVal)
263 #define V_R8REF(A)       V_UNION(A,pdblVal)
264 #define V_UINT(A)        V_UNION(A,uintVal)
265 #define V_UINTREF(A)     V_UNION(A,puintVal)
266 #define V_UI1(A)         V_UNION(A,bVal)
267 #define V_UI1REF(A)      V_UNION(A,pbVal)
268 #define V_UI2(A)         V_UNION(A,uiVal)
269 #define V_UI2REF(A)      V_UNION(A,puiVal)
270 #define V_UI4(A)         V_UNION(A,ulVal)
271 #define V_UI4REF(A)      V_UNION(A,pulVal)
272 #define V_UI8(A)         V_UNION(A,ullVal)
273 #define V_UI8REF(A)      V_UNION(A,pullVal)
274 #ifdef _WIN64
275 #define V_UINT_PTR(A)    V_UI8(A)
276 #define V_UINT_PTRREF(A) V_UI8REF(A)
277 #else
278 #define V_UINT_PTR(A)    V_UI4(A)
279 #define V_UINT_PTRREF(A) V_UI4REF(A)
280 #endif
281 #define V_UNKNOWN(A)     V_UNION(A,punkVal)
282 #define V_UNKNOWNREF(A)  V_UNION(A,ppunkVal)
283 #define V_VARIANTREF(A)  V_UNION(A,pvarVal)
284 
285 void    WINAPI VariantInit(_Out_ VARIANT*);
286 HRESULT WINAPI VariantClear(_Inout_ VARIANT*);
287 _Check_return_ HRESULT WINAPI VariantCopy(_Inout_ VARIANT*, _In_ VARIANT*);
288 _Check_return_ HRESULT WINAPI VariantCopyInd(_Inout_ VARIANT*, _In_ VARIANT*);
289 
290 _Check_return_
291 HRESULT
292 WINAPI
293 VariantChangeType(
294   _Inout_ VARIANT*,
295   _In_ VARIANT*,
296   _In_ USHORT,
297   _In_ VARTYPE);
298 
299 _Check_return_
300 HRESULT
301 WINAPI
302 VariantChangeTypeEx(
303   _Inout_ VARIANT*,
304   _In_ VARIANT*,
305   _In_ LCID,
306   _In_ USHORT,
307   _In_ VARTYPE);
308 
309 /* VariantChangeType/VariantChangeTypeEx flags */
310 #define VARIANT_NOVALUEPROP        0x01 /* Don't get the default value property from IDispatch */
311 #define VARIANT_ALPHABOOL          0x02 /* Coerce to "True"|"False" instead of "-1"|"0" */
312 #define VARIANT_NOUSEROVERRIDE     0x04 /* Pass LOCALE_NOUSEROVERRIDE to low level conversions */
313 #define VARIANT_CALENDAR_HIJRI     0x08 /* Use the Hijri calendar */
314 #define VARIANT_LOCALBOOL          0x10 /* Like VARIANT_ALPHABOOL, but use localised text */
315 #define VARIANT_CALENDAR_THAI      0x20 /* Use the Thai buddhist calendar */
316 #define VARIANT_CALENDAR_GREGORIAN 0x40 /* Use the Gregorian calendar */
317 #define VARIANT_USE_NLS            0x80 /* Format result using NLS calls */
318 
319 /*
320  * Low level Variant coercion functions
321  */
322 
323 #define VT_HARDTYPE VT_RESERVED /* Don't coerce this variant when comparing it to others */
324 
325 /* Flags for low level coercions. LOCALE_ flags can also be passed */
326 #define VAR_TIMEVALUEONLY       0x001 /* Ignore date portion of VT_DATE */
327 #define VAR_DATEVALUEONLY       0x002 /* Ignore time portion of VT_DATE */
328 #define VAR_VALIDDATE           0x004
329 #define VAR_CALENDAR_HIJRI      0x008 /* Use the Hijri calendar */
330 #define VAR_LOCALBOOL           0x010 /* VT_BOOL<->VT_BSTR: Use localised boolean text */
331 #define VAR_FORMAT_NOSUBSTITUTE 0x020 /* Don't change format strings for un-coercable types */
332 #define VAR_FOURDIGITYEARS      0x040 /* Always print years with 4 digits */
333 #define VAR_CALENDAR_THAI       0x080 /* Use the Thai buddhist calendar */
334 #define VAR_CALENDAR_GREGORIAN  0x100 /* Use the Gregorian calendar */
335 
336 #ifndef LOCALE_USE_NLS
337 /* This is missing from native winnls.h, but may be added at some point */
338 #define LOCALE_USE_NLS          0x10000000
339 #endif
340 
341 #define VTDATEGRE_MIN -657434 /* Minimum possible Gregorian date: 1/1/100 */
342 #define VTDATEGRE_MAX 2958465 /* Maximum possible Gregorian date: 31/12/9999 */
343 
344 HRESULT WINAPI VarUI1FromI2(SHORT, _Out_ BYTE*);
345 HRESULT WINAPI VarUI1FromI4(LONG, _Out_ BYTE*);
346 HRESULT WINAPI VarUI1FromI8(LONG64, _Out_ BYTE*);
347 HRESULT WINAPI VarUI1FromR4(FLOAT, _Out_ BYTE*);
348 HRESULT WINAPI VarUI1FromR8(DOUBLE, _Out_ BYTE*);
349 HRESULT WINAPI VarUI1FromDate(DATE, _Out_ BYTE*);
350 HRESULT WINAPI VarUI1FromBool(VARIANT_BOOL, _Out_ BYTE*);
351 HRESULT WINAPI VarUI1FromI1(signed char, _Out_ BYTE*);
352 HRESULT WINAPI VarUI1FromUI2(USHORT, _Out_ BYTE*);
353 HRESULT WINAPI VarUI1FromUI4(ULONG, _Out_ BYTE*);
354 HRESULT WINAPI VarUI1FromUI8(ULONG64, _Out_ BYTE*);
355 HRESULT WINAPI VarUI1FromStr(_In_ OLECHAR*, LCID, ULONG, _Out_ BYTE*);
356 HRESULT WINAPI VarUI1FromCy(CY, _Out_ BYTE*);
357 HRESULT WINAPI VarUI1FromDec(_In_ DECIMAL*, _Out_ BYTE*);
358 HRESULT WINAPI VarUI1FromDisp(IDispatch*, LCID, _Out_ BYTE*);
359 
360 HRESULT WINAPI VarI2FromUI1(BYTE, _Out_ SHORT*);
361 HRESULT WINAPI VarI2FromI4(LONG, _Out_ SHORT*);
362 HRESULT WINAPI VarI2FromI8(LONG64, _Out_ SHORT*);
363 HRESULT WINAPI VarI2FromR4(FLOAT, _Out_ SHORT*);
364 HRESULT WINAPI VarI2FromR8(DOUBLE, _Out_ SHORT*);
365 HRESULT WINAPI VarI2FromDate(DATE, _Out_ SHORT*);
366 HRESULT WINAPI VarI2FromBool(VARIANT_BOOL, _Out_ SHORT*);
367 HRESULT WINAPI VarI2FromI1(signed char, _Out_ SHORT*);
368 HRESULT WINAPI VarI2FromUI2(USHORT, _Out_ SHORT*);
369 HRESULT WINAPI VarI2FromUI4(ULONG, _Out_ SHORT*);
370 HRESULT WINAPI VarI2FromUI8(ULONG64, _Out_ SHORT*);
371 HRESULT WINAPI VarI2FromStr(_In_ OLECHAR*, LCID, ULONG, _Out_ SHORT*);
372 HRESULT WINAPI VarI2FromCy(CY,SHORT*);
373 HRESULT WINAPI VarI2FromDec(_In_ DECIMAL*, _Out_ SHORT*);
374 HRESULT WINAPI VarI2FromDisp(IDispatch*, LCID, _Out_ SHORT*);
375 
376 HRESULT WINAPI VarI4FromUI1(BYTE, _Out_ LONG*);
377 HRESULT WINAPI VarI4FromI2(SHORT, _Out_ LONG*);
378 HRESULT WINAPI VarI4FromI8(LONG64, _Out_ LONG*);
379 HRESULT WINAPI VarI4FromR4(FLOAT, _Out_ LONG*);
380 HRESULT WINAPI VarI4FromR8(DOUBLE, _Out_ LONG*);
381 HRESULT WINAPI VarI4FromDate(DATE, _Out_ LONG*);
382 HRESULT WINAPI VarI4FromBool(VARIANT_BOOL, _Out_ LONG*);
383 HRESULT WINAPI VarI4FromI1(signed char, _Out_ LONG*);
384 HRESULT WINAPI VarI4FromUI2(USHORT, _Out_ LONG*);
385 HRESULT WINAPI VarI4FromUI4(ULONG, _Out_ LONG*);
386 HRESULT WINAPI VarI4FromUI8(ULONG64, _Out_ LONG*);
387 HRESULT WINAPI VarI4FromStr(_In_ OLECHAR*, LCID, ULONG, _Out_ LONG*);
388 HRESULT WINAPI VarI4FromCy(CY, _Out_ LONG*);
389 HRESULT WINAPI VarI4FromDec(_In_ DECIMAL*, _Out_ LONG*);
390 HRESULT WINAPI VarI4FromDisp(IDispatch*, _In_ LCID, _Out_ LONG*);
391 
392 HRESULT WINAPI VarI8FromUI1(BYTE, _Out_ LONG64*);
393 HRESULT WINAPI VarI8FromI2(SHORT, _Out_ LONG64*);
394 HRESULT WINAPI VarI8FromI4(LONG,LONG64*);
395 HRESULT WINAPI VarI8FromR4(FLOAT, _Out_ LONG64*);
396 HRESULT WINAPI VarI8FromR8(DOUBLE, _Out_ LONG64*);
397 HRESULT WINAPI VarI8FromDate(DATE, _Out_ LONG64*);
398 HRESULT WINAPI VarI8FromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ LONG64*);
399 HRESULT WINAPI VarI8FromBool(VARIANT_BOOL, _Out_ LONG64*);
400 HRESULT WINAPI VarI8FromI1(signed char, _Out_ LONG64*);
401 HRESULT WINAPI VarI8FromUI2(USHORT, _Out_ LONG64*);
402 HRESULT WINAPI VarI8FromUI4(ULONG, _Out_ LONG64*);
403 HRESULT WINAPI VarI8FromUI8(ULONG64, _Out_ LONG64*);
404 HRESULT WINAPI VarI8FromDec(_In_ DECIMAL *pdecIn, _Out_ LONG64*);
405 HRESULT WINAPI VarI8FromInt(INT intIn,LONG64*);
406 HRESULT WINAPI VarI8FromCy(_In_ CY, _Out_ LONG64*);
407 HRESULT WINAPI VarI8FromDisp(IDispatch*, _In_ LCID, _Out_ LONG64*);
408 
409 HRESULT WINAPI VarR4FromUI1(BYTE, _Out_ FLOAT*);
410 HRESULT WINAPI VarR4FromI2(SHORT, _Out_ FLOAT*);
411 HRESULT WINAPI VarR4FromI4(LONG, _Out_ FLOAT*);
412 HRESULT WINAPI VarR4FromI8(LONG64, _Out_ FLOAT*);
413 HRESULT WINAPI VarR4FromR8(DOUBLE, _Out_ FLOAT*);
414 HRESULT WINAPI VarR4FromDate(DATE, _Out_ FLOAT*);
415 HRESULT WINAPI VarR4FromBool(VARIANT_BOOL, _Out_ FLOAT*);
416 HRESULT WINAPI VarR4FromI1(signed char, _Out_ FLOAT*);
417 HRESULT WINAPI VarR4FromUI2(USHORT, _Out_ FLOAT*);
418 HRESULT WINAPI VarR4FromUI4(ULONG, _Out_ FLOAT*);
419 HRESULT WINAPI VarR4FromUI8(ULONG64, _Out_ FLOAT*);
420 HRESULT WINAPI VarR4FromStr(_In_ OLECHAR*, LCID, ULONG, _Out_ FLOAT*);
421 HRESULT WINAPI VarR4FromCy(CY,FLOAT*);
422 HRESULT WINAPI VarR4FromDec(_In_ DECIMAL*, _Out_ FLOAT*);
423 HRESULT WINAPI VarR4FromDisp(IDispatch*, LCID, _Out_ FLOAT*);
424 
425 HRESULT WINAPI VarR8FromUI1(BYTE, _Out_ double*);
426 HRESULT WINAPI VarR8FromI2(SHORT, _Out_ double*);
427 HRESULT WINAPI VarR8FromI4(LONG, _Out_ double*);
428 HRESULT WINAPI VarR8FromI8(LONG64, _Out_ double*);
429 HRESULT WINAPI VarR8FromR4(FLOAT, _Out_ double*);
430 HRESULT WINAPI VarR8FromDate(DATE, _Out_ double*);
431 HRESULT WINAPI VarR8FromBool(VARIANT_BOOL, _Out_ double*);
432 HRESULT WINAPI VarR8FromI1(signed char,double*);
433 HRESULT WINAPI VarR8FromUI2(USHORT, _Out_ double*);
434 HRESULT WINAPI VarR8FromUI4(ULONG, _Out_ double*);
435 HRESULT WINAPI VarR8FromUI8(ULONG64, _Out_ double*);
436 HRESULT WINAPI VarR8FromStr(_In_ OLECHAR*, LCID, ULONG, _Out_ double*);
437 HRESULT WINAPI VarR8FromCy(CY,double*);
438 HRESULT WINAPI VarR8FromDec(_In_ const DECIMAL*, _Out_ double*);
439 HRESULT WINAPI VarR8FromDisp(IDispatch*, LCID, _Out_ double*);
440 
441 HRESULT WINAPI VarDateFromUI1(BYTE, _Out_ DATE*);
442 HRESULT WINAPI VarDateFromI2(SHORT, _Out_ DATE*);
443 HRESULT WINAPI VarDateFromI4(LONG, _Out_ DATE*);
444 HRESULT WINAPI VarDateFromI8(LONG64, _Out_ DATE*);
445 HRESULT WINAPI VarDateFromR4(FLOAT, _Out_ DATE*);
446 HRESULT WINAPI VarDateFromR8(DOUBLE, _Out_ DATE*);
447 HRESULT WINAPI VarDateFromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ DATE*);
448 HRESULT WINAPI VarDateFromI1(signed char, _Out_ DATE*);
449 HRESULT WINAPI VarDateFromUI2(USHORT, _Out_ DATE*);
450 HRESULT WINAPI VarDateFromUI4(ULONG, _Out_ DATE*);
451 HRESULT WINAPI VarDateFromUI8(ULONG64, _Out_ DATE*);
452 HRESULT WINAPI VarDateFromBool(VARIANT_BOOL, _Out_ DATE*);
453 HRESULT WINAPI VarDateFromCy(CY, _Out_ DATE*);
454 HRESULT WINAPI VarDateFromDec(_In_ DECIMAL*, _Out_ DATE*);
455 HRESULT WINAPI VarDateFromDisp(IDispatch*, LCID, _Out_ DATE*);
456 
457 HRESULT WINAPI VarCyFromUI1(BYTE, _Out_ CY*);
458 HRESULT WINAPI VarCyFromI2(SHORT sIn, _Out_ CY*);
459 HRESULT WINAPI VarCyFromI4(LONG, _Out_ CY*);
460 HRESULT WINAPI VarCyFromI8(LONG64, _Out_ CY*);
461 HRESULT WINAPI VarCyFromR4(FLOAT, _Out_ CY*);
462 HRESULT WINAPI VarCyFromR8(DOUBLE, _Out_ CY*);
463 HRESULT WINAPI VarCyFromDate(DATE, _Out_ CY*);
464 HRESULT WINAPI VarCyFromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ CY*);
465 HRESULT WINAPI VarCyFromBool(VARIANT_BOOL, _Out_ CY*);
466 HRESULT WINAPI VarCyFromI1(signed char, _Out_ CY*);
467 HRESULT WINAPI VarCyFromUI2(USHORT, _Out_ CY*);
468 HRESULT WINAPI VarCyFromUI4(ULONG, _Out_ CY*);
469 HRESULT WINAPI VarCyFromUI8(ULONG64, _Out_ CY*);
470 HRESULT WINAPI VarCyFromDec(_In_ DECIMAL*, _Out_ CY*);
471 HRESULT WINAPI VarCyFromDisp(_In_ IDispatch*, LCID, _Out_ CY*);
472 
473 HRESULT WINAPI VarBstrFromUI1(BYTE, LCID, ULONG, _Out_ BSTR*);
474 HRESULT WINAPI VarBstrFromI2(SHORT,LCID,ULONG,BSTR*);
475 HRESULT WINAPI VarBstrFromI4(LONG, LCID, ULONG, _Out_ BSTR*);
476 HRESULT WINAPI VarBstrFromI8(LONG64, LCID, ULONG, _Out_ BSTR*);
477 HRESULT WINAPI VarBstrFromR4(FLOAT, LCID, ULONG, _Out_ BSTR*);
478 HRESULT WINAPI VarBstrFromR8(DOUBLE, LCID, ULONG, _Out_ BSTR*);
479 HRESULT WINAPI VarBstrFromDate(_In_ DATE, _In_ LCID, _In_ ULONG, _Out_ BSTR*);
480 HRESULT WINAPI VarBstrFromBool(VARIANT_BOOL, LCID, ULONG, _Out_ BSTR*);
481 HRESULT WINAPI VarBstrFromI1(signed char, LCID, ULONG, _Out_ BSTR*);
482 HRESULT WINAPI VarBstrFromUI2(USHORT, LCID, ULONG, _Out_ BSTR*);
483 HRESULT WINAPI VarBstrFromUI8(ULONG64, LCID, ULONG, _Out_ BSTR*);
484 HRESULT WINAPI VarBstrFromUI4(ULONG, LCID, ULONG, _Out_ BSTR*);
485 HRESULT WINAPI VarBstrFromCy(CY, LCID, ULONG, _Out_ BSTR*);
486 HRESULT WINAPI VarBstrFromDec(_In_ DECIMAL*, _In_ LCID, _In_ ULONG, _Out_ BSTR*);
487 HRESULT WINAPI VarBstrFromDisp(IDispatch*, LCID, ULONG, _Out_ BSTR*);
488 
489 HRESULT WINAPI VarBoolFromUI1(BYTE, _Out_ VARIANT_BOOL*);
490 _Check_return_ HRESULT WINAPI VarBoolFromI2(_In_ SHORT, _Out_ VARIANT_BOOL*);
491 HRESULT WINAPI VarBoolFromI4(LONG, _Out_ VARIANT_BOOL*);
492 HRESULT WINAPI VarBoolFromI8(LONG64, _Out_ VARIANT_BOOL*);
493 HRESULT WINAPI VarBoolFromR4(FLOAT, _Out_ VARIANT_BOOL*);
494 HRESULT WINAPI VarBoolFromR8(DOUBLE, _Out_ VARIANT_BOOL*);
495 HRESULT WINAPI VarBoolFromDate(DATE, _Out_ VARIANT_BOOL*);
496 HRESULT WINAPI VarBoolFromStr(_In_ OLECHAR*, LCID, ULONG, _Out_ VARIANT_BOOL*);
497 HRESULT WINAPI VarBoolFromI1(signed char, _Out_ VARIANT_BOOL*);
498 HRESULT WINAPI VarBoolFromUI2(USHORT, _Out_ VARIANT_BOOL*);
499 HRESULT WINAPI VarBoolFromUI4(ULONG, _Out_ VARIANT_BOOL*);
500 HRESULT WINAPI VarBoolFromUI8(ULONG64, _Out_ VARIANT_BOOL*);
501 HRESULT WINAPI VarBoolFromCy(CY, _Out_ VARIANT_BOOL*);
502 HRESULT WINAPI VarBoolFromDec(_In_ DECIMAL*, _Out_ VARIANT_BOOL*);
503 HRESULT WINAPI VarBoolFromDisp(IDispatch*, LCID, _Out_ VARIANT_BOOL*);
504 
505 HRESULT WINAPI VarI1FromUI1(_In_ BYTE, _Out_ signed char*);
506 HRESULT WINAPI VarI1FromI2(_In_ SHORT, _Out_ signed char*);
507 HRESULT WINAPI VarI1FromI4(_In_ LONG, _Out_ signed char*);
508 HRESULT WINAPI VarI1FromI8(_In_ LONG64, _Out_ signed char*);
509 HRESULT WINAPI VarI1FromR4(_In_ FLOAT, _Out_ signed char*);
510 HRESULT WINAPI VarI1FromR8(_In_ DOUBLE, _Out_ signed char*);
511 HRESULT WINAPI VarI1FromDate(_In_ DATE, _Out_ signed char*);
512 HRESULT WINAPI VarI1FromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ signed char*);
513 HRESULT WINAPI VarI1FromBool(_In_ VARIANT_BOOL, _Out_ signed char*);
514 HRESULT WINAPI VarI1FromUI2(_In_ USHORT, _Out_ signed char*);
515 HRESULT WINAPI VarI1FromUI4(_In_ ULONG, _Out_ signed char*);
516 HRESULT WINAPI VarI1FromUI8(_In_ ULONG64, _Out_ signed char*);
517 HRESULT WINAPI VarI1FromCy(_In_ CY, _Out_ signed char*);
518 HRESULT WINAPI VarI1FromDec(_In_ DECIMAL*, _Out_ signed char*);
519 HRESULT WINAPI VarI1FromDisp(_In_ IDispatch*, _In_ LCID, _Out_ signed char*);
520 
521 HRESULT WINAPI VarUI2FromUI1(BYTE, _Out_ USHORT*);
522 HRESULT WINAPI VarUI2FromI2(SHORT, _Out_ USHORT*);
523 HRESULT WINAPI VarUI2FromI4(LONG, _Out_ USHORT*);
524 HRESULT WINAPI VarUI2FromI8(LONG64, _Out_ USHORT*);
525 HRESULT WINAPI VarUI2FromR4(FLOAT, _Out_ USHORT*);
526 HRESULT WINAPI VarUI2FromR8(DOUBLE,USHORT*);
527 HRESULT WINAPI VarUI2FromDate(DATE, _Out_ USHORT*);
528 HRESULT WINAPI VarUI2FromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ USHORT*);
529 HRESULT WINAPI VarUI2FromBool(VARIANT_BOOL, _Out_ USHORT*);
530 HRESULT WINAPI VarUI2FromI1(signed char, _Out_ USHORT*);
531 HRESULT WINAPI VarUI2FromUI4(ULONG, _Out_ USHORT*);
532 HRESULT WINAPI VarUI2FromUI8(ULONG64, _Out_ USHORT*);
533 HRESULT WINAPI VarUI2FromCy(CY, _Out_ USHORT*);
534 HRESULT WINAPI VarUI2FromDec(_In_ DECIMAL*, _Out_ USHORT*);
535 HRESULT WINAPI VarUI2FromDisp(_In_ IDispatch*, LCID, _Out_ USHORT*);
536 
537 HRESULT WINAPI VarUI4FromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ ULONG*);
538 HRESULT WINAPI VarUI4FromUI1(BYTE, _Out_ ULONG*);
539 HRESULT WINAPI VarUI4FromI2(_In_ SHORT, _Out_ ULONG*);
540 HRESULT WINAPI VarUI4FromI4(LONG, _Out_ ULONG*);
541 HRESULT WINAPI VarUI4FromI8(LONG64, _Out_ ULONG*);
542 HRESULT WINAPI VarUI4FromR4(FLOAT, _Out_ ULONG*);
543 HRESULT WINAPI VarUI4FromR8(DOUBLE, _Out_ ULONG*);
544 HRESULT WINAPI VarUI4FromDate(DATE, _Out_ ULONG*);
545 HRESULT WINAPI VarUI4FromBool(VARIANT_BOOL, _Out_ ULONG*);
546 HRESULT WINAPI VarUI4FromI1(signed char, _Out_ ULONG*);
547 HRESULT WINAPI VarUI4FromUI2(USHORT, _Out_ ULONG*);
548 HRESULT WINAPI VarUI4FromUI8(ULONG64, _Out_ ULONG*);
549 HRESULT WINAPI VarUI4FromCy(CY, _Out_ ULONG*);
550 HRESULT WINAPI VarUI4FromDec(_In_ DECIMAL*, _Out_ ULONG*);
551 HRESULT WINAPI VarUI4FromDisp(_In_ IDispatch*, LCID, _Out_ ULONG*);
552 
553 HRESULT WINAPI VarUI8FromUI1(BYTE, _Out_ ULONG64*);
554 HRESULT WINAPI VarUI8FromI2(SHORT, _Out_ ULONG64*);
555 HRESULT WINAPI VarUI8FromI4(LONG, _Out_ ULONG64*);
556 HRESULT WINAPI VarUI8FromI8(LONG64, _Out_ ULONG64*);
557 HRESULT WINAPI VarUI8FromR4(FLOAT, _Out_ ULONG64*);
558 HRESULT WINAPI VarUI8FromR8(DOUBLE, _Out_ ULONG64*);
559 HRESULT WINAPI VarUI8FromDate(DATE, _Out_ ULONG64*);
560 HRESULT WINAPI VarUI8FromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ ULONG64*);
561 HRESULT WINAPI VarUI8FromBool(VARIANT_BOOL, _Out_ ULONG64*);
562 HRESULT WINAPI VarUI8FromI1(signed char, _Out_ ULONG64*);
563 HRESULT WINAPI VarUI8FromUI2(USHORT, _Out_ ULONG64*);
564 HRESULT WINAPI VarUI8FromUI4(ULONG, _Out_ ULONG64*);
565 HRESULT WINAPI VarUI8FromDec(_In_ DECIMAL*, _Out_ ULONG64*);
566 HRESULT WINAPI VarUI8FromInt(INT,ULONG64*);
567 HRESULT WINAPI VarUI8FromCy(CY, _Out_ ULONG64*);
568 HRESULT WINAPI VarUI8FromDisp(_In_ IDispatch*, LCID, _Out_ ULONG64*);
569 
570 HRESULT WINAPI VarDecFromUI1(_In_ BYTE, _Out_ DECIMAL*);
571 HRESULT WINAPI VarDecFromI2(_In_ SHORT, _Out_ DECIMAL*);
572 HRESULT WINAPI VarDecFromI4(_In_ LONG, _Out_ DECIMAL*);
573 HRESULT WINAPI VarDecFromI8(LONG64, _Out_ DECIMAL*);
574 HRESULT WINAPI VarDecFromR4(_In_ FLOAT, _Out_ DECIMAL*);
575 HRESULT WINAPI VarDecFromR8(_In_ DOUBLE, _Out_ DECIMAL*);
576 HRESULT WINAPI VarDecFromDate(_In_ DATE, _Out_ DECIMAL*);
577 HRESULT WINAPI VarDecFromStr(_In_ OLECHAR*, _In_ LCID, _In_ ULONG, _Out_ DECIMAL*);
578 HRESULT WINAPI VarDecFromBool(_In_ VARIANT_BOOL, _Out_ DECIMAL*);
579 HRESULT WINAPI VarDecFromI1(_In_ signed char, _Out_ DECIMAL*);
580 HRESULT WINAPI VarDecFromUI2(_In_ USHORT, _Out_ DECIMAL*);
581 HRESULT WINAPI VarDecFromUI4(_In_ ULONG, _Out_ DECIMAL*);
582 HRESULT WINAPI VarDecFromUI8(ULONG64, _Out_ DECIMAL*);
583 HRESULT WINAPI VarDecFromCy(_In_ CY, _Out_ DECIMAL*);
584 HRESULT WINAPI VarDecFromDisp(_In_ IDispatch*, _In_ LCID, _Out_ DECIMAL*);
585 
586 #define VarUI4FromUI4( in,pOut ) ( *(pOut) =  (in) )
587 #define VarI4FromI4( in,pOut )   ( *(pOut) =  (in) )
588 
589 #define VarUI1FromInt   VarUI1FromI4
590 #define VarUI1FromUint  VarUI1FromUI4
591 #define VarI2FromInt    VarI2FromI4
592 #define VarI2FromUint   VarI2FromUI4
593 #define VarI4FromInt    VarI4FromI4
594 #define VarI4FromUint   VarI4FromUI4
595 #define VarI8FromInt    VarI8FromI4
596 #define VarI8FromUint   VarI8FromUI4
597 #define VarR4FromInt    VarR4FromI4
598 #define VarR4FromUint   VarR4FromUI4
599 #define VarR8FromInt    VarR8FromI4
600 #define VarR8FromUint   VarR8FromUI4
601 #define VarDateFromInt  VarDateFromI4
602 #define VarDateFromUint VarDateFromUI4
603 #define VarCyFromInt    VarCyFromI4
604 #define VarCyFromUint   VarCyFromUI4
605 #define VarBstrFromInt  VarBstrFromI4
606 #define VarBstrFromUint VarBstrFromUI4
607 #define VarBoolFromInt  VarBoolFromI4
608 #define VarBoolFromUint VarBoolFromUI4
609 #define VarI1FromInt    VarI1FromI4
610 #define VarI1FromUint   VarI1FromUI4
611 #define VarUI2FromInt   VarUI2FromI4
612 #define VarUI2FromUint  VarUI2FromUI4
613 #define VarUI4FromInt   VarUI4FromI4
614 #define VarUI4FromUint  VarUI4FromUI4
615 #define VarUI8FromInt   VarUI8FromI4
616 #define VarUI8FromUint  VarUI8FromUI4
617 #define VarDecFromInt   VarDecFromI4
618 #define VarDecFromUint  VarDecFromUI4
619 #define VarIntFromUI1   VarI4FromUI1
620 #define VarIntFromI2    VarI4FromI2
621 #define VarIntFromI4    VarI4FromI4
622 #define VarIntFromI8    VarI4FromI8
623 #define VarIntFromR4    VarI4FromR4
624 #define VarIntFromR8    VarI4FromR8
625 #define VarIntFromDate  VarI4FromDate
626 #define VarIntFromCy    VarI4FromCy
627 #define VarIntFromStr   VarI4FromStr
628 #define VarIntFromDisp  VarI4FromDisp
629 #define VarIntFromBool  VarI4FromBool
630 #define VarIntFromI1    VarI4FromI1
631 #define VarIntFromUI2   VarI4FromUI2
632 #define VarIntFromUI4   VarI4FromUI4
633 #define VarIntFromUI8   VarI4FromUI8
634 #define VarIntFromDec   VarI4FromDec
635 #define VarIntFromUint  VarI4FromUI4
636 #define VarUintFromUI1  VarUI4FromUI1
637 #define VarUintFromI2   VarUI4FromI2
638 #define VarUintFromI4   VarUI4FromI4
639 #define VarUintFromI8   VarUI4FromI8
640 #define VarUintFromR4   VarUI4FromR4
641 #define VarUintFromR8   VarUI4FromR8
642 #define VarUintFromDate VarUI4FromDate
643 #define VarUintFromCy   VarUI4FromCy
644 #define VarUintFromStr  VarUI4FromStr
645 #define VarUintFromDisp VarUI4FromDisp
646 #define VarUintFromBool VarUI4FromBool
647 #define VarUintFromI1   VarUI4FromI1
648 #define VarUintFromUI2  VarUI4FromUI2
649 #define VarUintFromUI4  VarUI4FromUI4
650 #define VarUintFromUI8  VarUI4FromUI8
651 #define VarUintFromDec  VarUI4FromDec
652 #define VarUintFromInt  VarUI4FromI4
653 
654 /*
655  * Variant Math operations
656  */
657 #define VARCMP_LT   0
658 #define VARCMP_EQ   1
659 #define VARCMP_GT   2
660 #define VARCMP_NULL 3
661 
662 HRESULT WINAPI VarR4CmpR8(_In_ float, _In_ double);
663 
664 HRESULT WINAPI VarR8Pow(_In_ double, _In_ double, _Out_ double*);
665 HRESULT WINAPI VarR8Round(_In_ double, _In_ int, _Out_ double*);
666 
667 HRESULT WINAPI VarDecAbs(_In_ const DECIMAL*, _Out_ DECIMAL*);
668 HRESULT WINAPI VarDecAdd(_In_ const DECIMAL*, _In_ const DECIMAL*, _Out_ DECIMAL*);
669 HRESULT WINAPI VarDecCmp(_In_ const DECIMAL*, _In_ const DECIMAL*);
670 HRESULT WINAPI VarDecCmpR8(_In_ const DECIMAL*, _In_ DOUBLE);
671 HRESULT WINAPI VarDecDiv(_In_ const DECIMAL*, _In_ const DECIMAL*, _Out_ DECIMAL*);
672 HRESULT WINAPI VarDecFix(_In_ const DECIMAL*, _Out_ DECIMAL*);
673 HRESULT WINAPI VarDecInt(_In_ const DECIMAL*, _Out_ DECIMAL*);
674 HRESULT WINAPI VarDecMul(_In_ const DECIMAL*, _In_ const DECIMAL*, _Out_ DECIMAL*);
675 HRESULT WINAPI VarDecNeg(_In_ const DECIMAL*, _Out_ DECIMAL*);
676 HRESULT WINAPI VarDecRound(_In_ const DECIMAL*, int, _Out_ DECIMAL*);
677 HRESULT WINAPI VarDecSub(_In_ const DECIMAL*, _In_ const DECIMAL*, _Out_ DECIMAL*);
678 
679 HRESULT WINAPI VarCyAbs(_In_ CY, _Out_ CY*);
680 HRESULT WINAPI VarCyAdd(_In_ CY, _In_ CY, _Out_ CY*);
681 HRESULT WINAPI VarCyCmp(_In_ CY, _In_ CY);
682 HRESULT WINAPI VarCyCmpR8(_In_ CY, _In_ DOUBLE);
683 HRESULT WINAPI VarCyFix(_In_ CY, _Out_ CY*);
684 HRESULT WINAPI VarCyInt(_In_ CY, _Out_ CY*);
685 HRESULT WINAPI VarCyMul(_In_ CY, _In_ CY, _Out_ CY*);
686 HRESULT WINAPI VarCyMulI4(_In_ CY, _In_ LONG, _Out_ CY*);
687 HRESULT WINAPI VarCyMulI8(_In_ CY, _In_ LONG64, _Out_ CY*);
688 HRESULT WINAPI VarCyNeg(_In_ CY, _Out_ CY*);
689 HRESULT WINAPI VarCyRound(_In_ CY, _In_ INT, _Out_ CY*);
690 HRESULT WINAPI VarCySub(_In_ CY, _In_ CY, _Out_ CY*);
691 
692 HRESULT WINAPI VarAdd(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
693 HRESULT WINAPI VarAnd(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
694 HRESULT WINAPI VarCat(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
695 HRESULT WINAPI VarDiv(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
696 HRESULT WINAPI VarEqv(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
697 HRESULT WINAPI VarIdiv(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
698 HRESULT WINAPI VarImp(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
699 HRESULT WINAPI VarMod(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
700 HRESULT WINAPI VarMul(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
701 HRESULT WINAPI VarOr(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
702 HRESULT WINAPI VarPow(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
703 HRESULT WINAPI VarSub(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
704 HRESULT WINAPI VarXor(_In_ LPVARIANT, _In_ LPVARIANT, _Out_ LPVARIANT);
705 
706 HRESULT WINAPI VarAbs(_In_ LPVARIANT, _Out_ LPVARIANT);
707 HRESULT WINAPI VarFix(_In_ LPVARIANT, _Out_ LPVARIANT);
708 HRESULT WINAPI VarInt(_In_ LPVARIANT, _Out_ LPVARIANT);
709 HRESULT WINAPI VarNeg(_In_ LPVARIANT, _Out_ LPVARIANT);
710 HRESULT WINAPI VarNot(_In_ LPVARIANT, _Out_ LPVARIANT);
711 
712 HRESULT WINAPI VarRound(_In_ LPVARIANT, _In_ int, _Out_ LPVARIANT);
713 
714 HRESULT WINAPI VarCmp(_In_ LPVARIANT, _In_ LPVARIANT, _In_ LCID, _In_ ULONG);
715 
716 HRESULT WINAPI VarBstrCmp(_In_ BSTR, _In_ BSTR, _In_ LCID, _In_ ULONG);
717 HRESULT WINAPI VarBstrCat(_In_ BSTR, _In_ BSTR, _Out_ BSTR*);
718 
719 
720 typedef struct {
721     SYSTEMTIME st;
722     USHORT wDayOfYear;
723 } UDATE;
724 
725 typedef struct
726 {
727     INT   cDig;       /* Number of parsed digits */
728     ULONG dwInFlags;  /* Acceptable state of the input string (NUMPRS_ flags) */
729     ULONG dwOutFlags; /* Parsed state of the output string (NUMPRS_ flags) */
730     INT   cchUsed;    /* Number of characters parsed from input string */
731     INT   nBaseShift; /* Base of the number (but apparently unused) */
732     INT   nPwr10;     /* Scale of the number in powers of 10 */
733 } NUMPARSE;
734 
735 #define NUMPRS_LEADING_WHITE  0x00001 /* Leading whitespace */
736 #define NUMPRS_TRAILING_WHITE 0x00002 /* Trailing whitespace */
737 #define NUMPRS_LEADING_PLUS   0x00004 /* Leading '+' sign */
738 #define NUMPRS_TRAILING_PLUS  0x00008 /* Trailing '+' sign */
739 #define NUMPRS_LEADING_MINUS  0x00010 /* Leading '-' sign */
740 #define NUMPRS_TRAILING_MINUS 0x00020 /* Trailing '-' sign */
741 #define NUMPRS_HEX_OCT        0x00040 /* Octal number (with a leading 0) */
742 #define NUMPRS_PARENS         0x00080 /* Parentheses for negative numbers */
743 #define NUMPRS_DECIMAL        0x00100 /* Decimal separator */
744 #define NUMPRS_THOUSANDS      0x00200 /* Thousands separator */
745 #define NUMPRS_CURRENCY       0x00400 /* Currency symbol */
746 #define NUMPRS_EXPONENT       0x00800 /* Exponent (e.g. "e-14") */
747 #define NUMPRS_USE_ALL        0x01000 /* Parse the entire string */
748 #define NUMPRS_STD            0x01FFF /* Standard flags for internal coercions (All of the above) */
749 #define NUMPRS_NEG            0x10000 /* Number is negative (dwOutFlags only) */
750 #define NUMPRS_INEXACT        0x20000 /* Number is represented inexactly (dwOutFlags only) */
751 
752 #define VTBIT_I1      (1 << VT_I1)
753 #define VTBIT_UI1     (1 << VT_UI1)
754 #define VTBIT_I2      (1 << VT_I2)
755 #define VTBIT_UI2     (1 << VT_UI2)
756 #define VTBIT_I4      (1 << VT_I4)
757 #define VTBIT_UI4     (1 << VT_UI4)
758 #define VTBIT_I8      (1 << VT_I8)
759 #define VTBIT_UI8     (1 << VT_UI8)
760 #define VTBIT_R4      (1 << VT_R4)
761 #define VTBIT_R8      (1 << VT_R8)
762 #define VTBIT_CY      (1 << VT_CY)
763 #define VTBIT_DECIMAL (1 << VT_DECIMAL)
764 
765 _Check_return_
766 HRESULT
767 WINAPI
768 VarParseNumFromStr(
769   _In_ OLECHAR*,
770   _In_ LCID,
771   _In_ ULONG,
772   _Out_ NUMPARSE*,
773   _Out_ BYTE*);
774 
775 _Check_return_
776 HRESULT
777 WINAPI
778 VarNumFromParseNum(
779   _In_ NUMPARSE*,
780   _In_ BYTE*,
781   _In_ ULONG,
782   _Out_ VARIANT*);
783 
784 INT WINAPI DosDateTimeToVariantTime(_In_ USHORT, _In_ USHORT, _Out_ double*);
785 INT WINAPI VariantTimeToDosDateTime(_In_ double, _Out_ USHORT*, _Out_ USHORT*);
786 
787 INT WINAPI VariantTimeToSystemTime(_In_ DOUBLE, _Out_ LPSYSTEMTIME);
788 INT WINAPI SystemTimeToVariantTime(_In_ LPSYSTEMTIME, _Out_ double*);
789 
790 _Check_return_
791 HRESULT
792 WINAPI
793 VarDateFromUdate(
794   _In_ UDATE*,
795   _In_ ULONG,
796   _Out_ DATE*);
797 
798 HRESULT
799 WINAPI
800 VarDateFromUdateEx(
801   _In_ UDATE*,
802   _In_ LCID,
803   _In_ ULONG,
804   _Out_ DATE*);
805 
806 _Check_return_
807 HRESULT
808 WINAPI
809 VarUdateFromDate(
810   _In_ DATE,
811   _In_ ULONG,
812   _Out_ UDATE*);
813 
814 /* Variant formatting */
815 HRESULT WINAPI VarWeekdayName(int, int, int, ULONG, _Out_ BSTR*);
816 HRESULT WINAPI VarMonthName(int, int, ULONG, _Out_ BSTR*);
817 
818 _Check_return_
819 HRESULT
820 WINAPI
821 GetAltMonthNames(
822   LCID,
823   _Outptr_result_buffer_maybenull_(13) LPOLESTR**);
824 
825 HRESULT
826 WINAPI
827 VarFormat(
828   _In_ LPVARIANT,
829   _In_opt_ LPOLESTR,
830   int,
831   int,
832   ULONG,
833   _Out_ BSTR*);
834 
835 HRESULT
836 WINAPI
837 VarFormatCurrency(
838   _In_ LPVARIANT,
839   int,
840   int,
841   int,
842   int,
843   ULONG,
844   _Out_ BSTR*);
845 
846 HRESULT WINAPI VarFormatDateTime(_In_ LPVARIANT, int, ULONG, _Out_ BSTR*);
847 
848 HRESULT
849 WINAPI
850 VarFormatNumber(
851   _In_ LPVARIANT,
852   int,
853   int,
854   int,
855   int,
856   ULONG,
857   _Out_ BSTR*);
858 
859 HRESULT
860 WINAPI
861 VarFormatPercent(
862   _In_ LPVARIANT,
863   int,
864   int,
865   int,
866   int,
867   ULONG,
868   _Out_ BSTR*);
869 
870 HRESULT
871 WINAPI
872 VarFormatFromTokens(
873   _In_ LPVARIANT,
874   _In_opt_ LPOLESTR,
875   LPBYTE,
876   ULONG,
877   _Out_ BSTR*,
878   LCID);
879 
880 HRESULT
881 WINAPI
882 VarTokenizeFormatString(
883   _In_opt_ LPOLESTR,
884   _Inout_ LPBYTE,
885   int,
886   int,
887   int,
888   LCID,
889   _In_opt_ int*);
890 
891 
892 /*
893  * IDispatch types and helper functions
894  */
895 
896 /* A structure describing a single parameter to a com object method. */
897 typedef struct tagPARAMDATA
898 {
899     OLECHAR *szName; /* Name of Parameter */
900     VARTYPE  vt;     /* Type of Parameter */
901 } PARAMDATA, *LPPARAMDATA;
902 
903 /* A structure describing a single method of a com object. */
904 typedef struct tagMETHODDATA
905 {
906     OLECHAR   *szName;   /* Name of method */
907     PARAMDATA *ppdata;   /* Parameters of the method */
908     DISPID     dispid;   /* Id of the method */
909     UINT       iMeth;    /* Vtable index of the method */
910     CALLCONV   cc;       /* Calling convention of the method */
911     UINT       cArgs;    /* Number of parameters in the method */
912     WORD       wFlags;   /* Type of the method (DISPATCH_ flags) */
913     VARTYPE    vtReturn; /* Type of the return value */
914 } METHODDATA, *LPMETHODDATA;
915 
916 /* Structure describing a single com object */
917 typedef struct tagINTERFACEDATA
918 {
919     METHODDATA *pmethdata;  /* Methods of the object */
920     UINT        cMembers;   /* Number of methods in the object */
921 } INTERFACEDATA, *LPINTERFACEDATA;
922 
923 typedef enum tagREGKIND
924 {
925     REGKIND_DEFAULT,
926     REGKIND_REGISTER,
927     REGKIND_NONE
928 } REGKIND;
929 
930 _Check_return_
931 HRESULT
932 WINAPI
933 DispGetParam(
934   _In_ DISPPARAMS*,
935   UINT,
936   VARTYPE,
937   _Out_ VARIANT*,
938   _Out_opt_ UINT*);
939 
940 _Check_return_
941 HRESULT
942 WINAPI
943 DispGetIDsOfNames(
944   ITypeInfo*,
945   _In_reads_(cNames) OLECHAR**,
946   UINT cNames,
947   _Out_writes_(cNames) DISPID*);
948 
949 _Check_return_
950 HRESULT
951 WINAPI
952 DispInvoke(
953   void*,
954   ITypeInfo*,
955   DISPID,
956   WORD,
957   DISPPARAMS*,
958   VARIANT*,
959   EXCEPINFO*,
960   UINT*);
961 
962 _Check_return_
963 HRESULT
964 WINAPI
965 CreateDispTypeInfo(
966   INTERFACEDATA*,
967   LCID,
968   ITypeInfo**);
969 
970 _Check_return_
971 HRESULT
972 WINAPI
973 CreateStdDispatch(
974   IUnknown*,
975   void*,
976   ITypeInfo*,
977   IUnknown**);
978 
979 HRESULT
980 WINAPI
981 DispCallFunc(
982   void*,
983   ULONG_PTR,
984   CALLCONV,
985   VARTYPE,
986   UINT,
987   VARTYPE*,
988   VARIANTARG**,
989   VARIANT*);
990 
991 
992 /*
993  * TypeLib API
994  */
995 
996 ULONG WINAPI LHashValOfNameSysA(SYSKIND,LCID,LPCSTR);
997 ULONG WINAPI LHashValOfNameSys(SYSKIND,LCID,LPCOLESTR);
998 
999 #define LHashValOfName(lcid,name) LHashValOfNameSys(SYS_WIN32,lcid,name)
1000 #define WHashValOfLHashVal(hash) ((USHORT)((hash) & 0xffff))
1001 #define IsHashValCompatible(hash1,hash2) ((hash1) & 0xff0000 == (hash2) & 0xff0000)
1002 
1003 #define MEMBERID_NIL   DISPID_UNKNOWN
1004 #define ID_DEFAULTINST -2
1005 
1006 #define DISPATCH_METHOD         0x1
1007 #define DISPATCH_PROPERTYGET    0x2
1008 #define DISPATCH_PROPERTYPUT    0x4
1009 #define DISPATCH_PROPERTYPUTREF 0x8
1010 
1011 #define LOAD_TLB_AS_32BIT       0x20
1012 #define LOAD_TLB_AS_64BIT       0x40
1013 #define MASK_TO_RESET_TLB_BITS  ~(LOAD_TLB_AS_32BIT|LOAD_TLB_AS_64BIT)
1014 
1015 _Check_return_
1016 HRESULT
1017 WINAPI
1018 CreateTypeLib(
1019   SYSKIND,
1020   const OLECHAR*,
1021   ICreateTypeLib**);
1022 
1023 _Check_return_
1024 HRESULT
1025 WINAPI
1026 CreateTypeLib2(
1027   SYSKIND,
1028   LPCOLESTR,
1029   ICreateTypeLib2**);
1030 
1031 _Check_return_
1032 HRESULT
1033 WINAPI
1034 LoadRegTypeLib(
1035   REFGUID,
1036   WORD,
1037   WORD,
1038   LCID,
1039   ITypeLib**);
1040 
1041 HRESULT WINAPI LoadTypeLib(_In_z_ const OLECHAR*, ITypeLib**);
1042 _Check_return_ HRESULT WINAPI LoadTypeLibEx(LPCOLESTR, REGKIND, ITypeLib**);
1043 HRESULT WINAPI QueryPathOfRegTypeLib(REFGUID,WORD,WORD,LCID,LPBSTR);
1044 
1045 _Check_return_
1046 HRESULT
1047 WINAPI
1048 RegisterTypeLib(
1049   ITypeLib*,
1050   _In_ LPCOLESTR,
1051   _In_opt_ LPCOLESTR);
1052 
1053 _Check_return_
1054 HRESULT
1055 WINAPI
1056 UnRegisterTypeLib(
1057   REFGUID,
1058   WORD,
1059   WORD,
1060   LCID,
1061   SYSKIND);
1062 
1063 HRESULT
1064 WINAPI
1065 RegisterTypeLibForUser(
1066   ITypeLib*,
1067   _In_ OLECHAR*,
1068   _In_opt_ OLECHAR*);
1069 
1070 HRESULT WINAPI UnRegisterTypeLibForUser(REFGUID,WORD,WORD,LCID,SYSKIND);
1071 
1072 VOID WINAPI ClearCustData(LPCUSTDATA);
1073 
1074 #ifdef __cplusplus
1075 } /* extern "C" */
1076 #endif
1077 
1078 
1079 #endif /*__WINE_OLEAUTO_H*/
1080