Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1074 lines
47 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. // File: oleauto.h
  7. //
  8. // Contents: Defines Ole Automation support function prototypes, constants
  9. //
  10. //----------------------------------------------------------------------------
  11. #if !defined( _OLEAUTO_H_ )
  12. #define _OLEAUTO_H_
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. // Set packing to 8 for ISV, and Win95 support
  17. #ifndef RC_INVOKED
  18. #include <pshpack8.h>
  19. #endif // RC_INVOKED
  20. // Definition of the OLE Automation APIs, and macros.
  21. #ifdef _OLEAUT32_
  22. #define WINOLEAUTAPI STDAPI
  23. #define WINOLEAUTAPI_(type) STDAPI_(type)
  24. #else
  25. #define WINOLEAUTAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  26. #define WINOLEAUTAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  27. #endif
  28. EXTERN_C const IID IID_StdOle;
  29. #define STDOLE_MAJORVERNUM 0x1
  30. #define STDOLE_MINORVERNUM 0x0
  31. #define STDOLE_LCID 0x0000
  32. // Version # of stdole2.tlb
  33. #define STDOLE2_MAJORVERNUM 0x2
  34. #define STDOLE2_MINORVERNUM 0x0
  35. #define STDOLE2_LCID 0x0000
  36. /* if not already picked up from olenls.h */
  37. #ifndef _LCID_DEFINED
  38. typedef DWORD LCID;
  39. # define _LCID_DEFINED
  40. #endif
  41. #ifndef BEGIN_INTERFACE
  42. #define BEGIN_INTERFACE
  43. #define END_INTERFACE
  44. #endif
  45. /* pull in the MIDL generated header */
  46. #include <oaidl.h>
  47. /*---------------------------------------------------------------------*/
  48. /* BSTR API */
  49. /*---------------------------------------------------------------------*/
  50. WINOLEAUTAPI_(BSTR) SysAllocString(const OLECHAR *);
  51. WINOLEAUTAPI_(INT) SysReAllocString(BSTR *, const OLECHAR *);
  52. WINOLEAUTAPI_(BSTR) SysAllocStringLen(const OLECHAR *, UINT);
  53. WINOLEAUTAPI_(INT) SysReAllocStringLen(BSTR *, const OLECHAR *, UINT);
  54. WINOLEAUTAPI_(void) SysFreeString(BSTR);
  55. WINOLEAUTAPI_(UINT) SysStringLen(BSTR);
  56. #if (defined (_WIN32) || defined (_WIN64))
  57. WINOLEAUTAPI_(UINT) SysStringByteLen(BSTR bstr);
  58. WINOLEAUTAPI_(BSTR) SysAllocStringByteLen(LPCSTR psz, UINT len);
  59. #endif
  60. /*---------------------------------------------------------------------*/
  61. /* Time API */
  62. /*---------------------------------------------------------------------*/
  63. WINOLEAUTAPI_(INT) DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime, DOUBLE * pvtime);
  64. WINOLEAUTAPI_(INT) VariantTimeToDosDateTime(DOUBLE vtime, USHORT * pwDosDate, USHORT * pwDosTime);
  65. #if (defined (_WIN32) || defined (_WIN64))
  66. WINOLEAUTAPI_(INT) SystemTimeToVariantTime(LPSYSTEMTIME lpSystemTime, DOUBLE *pvtime);
  67. WINOLEAUTAPI_(INT) VariantTimeToSystemTime(DOUBLE vtime, LPSYSTEMTIME lpSystemTime);
  68. #endif
  69. /*---------------------------------------------------------------------*/
  70. /* SafeArray API */
  71. /*---------------------------------------------------------------------*/
  72. WINOLEAUTAPI SafeArrayAllocDescriptor(UINT cDims, SAFEARRAY ** ppsaOut);
  73. WINOLEAUTAPI SafeArrayAllocDescriptorEx(VARTYPE vt, UINT cDims, SAFEARRAY ** ppsaOut);
  74. WINOLEAUTAPI SafeArrayAllocData(SAFEARRAY * psa);
  75. WINOLEAUTAPI_(SAFEARRAY *) SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND * rgsabound);
  76. WINOLEAUTAPI_(SAFEARRAY *) SafeArrayCreateEx(VARTYPE vt, UINT cDims, SAFEARRAYBOUND * rgsabound, PVOID pvExtra);
  77. WINOLEAUTAPI SafeArrayCopyData(SAFEARRAY *psaSource, SAFEARRAY *psaTarget);
  78. WINOLEAUTAPI SafeArrayDestroyDescriptor(SAFEARRAY * psa);
  79. WINOLEAUTAPI SafeArrayDestroyData(SAFEARRAY * psa);
  80. WINOLEAUTAPI SafeArrayDestroy(SAFEARRAY * psa);
  81. WINOLEAUTAPI SafeArrayRedim(SAFEARRAY * psa, SAFEARRAYBOUND * psaboundNew);
  82. WINOLEAUTAPI_(UINT) SafeArrayGetDim(SAFEARRAY * psa);
  83. WINOLEAUTAPI_(UINT) SafeArrayGetElemsize(SAFEARRAY * psa);
  84. WINOLEAUTAPI SafeArrayGetUBound(SAFEARRAY * psa, UINT nDim, LONG * plUbound);
  85. WINOLEAUTAPI SafeArrayGetLBound(SAFEARRAY * psa, UINT nDim, LONG * plLbound);
  86. WINOLEAUTAPI SafeArrayLock(SAFEARRAY * psa);
  87. WINOLEAUTAPI SafeArrayUnlock(SAFEARRAY * psa);
  88. WINOLEAUTAPI SafeArrayAccessData(SAFEARRAY * psa, void HUGEP** ppvData);
  89. WINOLEAUTAPI SafeArrayUnaccessData(SAFEARRAY * psa);
  90. WINOLEAUTAPI SafeArrayGetElement(SAFEARRAY * psa, LONG * rgIndices, void * pv);
  91. WINOLEAUTAPI SafeArrayPutElement(SAFEARRAY * psa, LONG * rgIndices, void * pv);
  92. WINOLEAUTAPI SafeArrayCopy(SAFEARRAY * psa, SAFEARRAY ** ppsaOut);
  93. WINOLEAUTAPI SafeArrayPtrOfIndex(SAFEARRAY * psa, LONG * rgIndices, void ** ppvData);
  94. WINOLEAUTAPI SafeArraySetRecordInfo(SAFEARRAY * psa, IRecordInfo * prinfo);
  95. WINOLEAUTAPI SafeArrayGetRecordInfo(SAFEARRAY * psa, IRecordInfo ** prinfo);
  96. WINOLEAUTAPI SafeArraySetIID(SAFEARRAY * psa, REFGUID guid);
  97. WINOLEAUTAPI SafeArrayGetIID(SAFEARRAY * psa, GUID * pguid);
  98. WINOLEAUTAPI SafeArrayGetVartype(SAFEARRAY * psa, VARTYPE * pvt);
  99. WINOLEAUTAPI_(SAFEARRAY *) SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElements);
  100. WINOLEAUTAPI_(SAFEARRAY *) SafeArrayCreateVectorEx(VARTYPE vt, LONG lLbound, ULONG cElements, PVOID pvExtra);
  101. /*---------------------------------------------------------------------*/
  102. /* VARIANT API */
  103. /*---------------------------------------------------------------------*/
  104. WINOLEAUTAPI_(void) VariantInit(VARIANTARG * pvarg);
  105. WINOLEAUTAPI VariantClear(VARIANTARG * pvarg);
  106. WINOLEAUTAPI VariantCopy(VARIANTARG * pvargDest, VARIANTARG * pvargSrc);
  107. WINOLEAUTAPI VariantCopyInd(VARIANT * pvarDest, VARIANTARG * pvargSrc);
  108. WINOLEAUTAPI VariantChangeType(VARIANTARG * pvargDest,
  109. VARIANTARG * pvarSrc, USHORT wFlags, VARTYPE vt);
  110. WINOLEAUTAPI VariantChangeTypeEx(VARIANTARG * pvargDest,
  111. VARIANTARG * pvarSrc, LCID lcid, USHORT wFlags, VARTYPE vt);
  112. // Flags for VariantChangeType/VariantChangeTypeEx
  113. #define VARIANT_NOVALUEPROP 0x01
  114. #define VARIANT_ALPHABOOL 0x02 // For VT_BOOL to VT_BSTR conversions,
  115. // convert to "True"/"False" instead of
  116. // "-1"/"0"
  117. #define VARIANT_NOUSEROVERRIDE 0x04 // For conversions to/from VT_BSTR,
  118. // passes LOCALE_NOUSEROVERRIDE
  119. // to core coercion routines
  120. #define VARIANT_CALENDAR_HIJRI 0x08
  121. #define VARIANT_LOCALBOOL 0x10 // For VT_BOOL to VT_BSTR and back,
  122. // convert to local language rather than
  123. // English
  124. #define VARIANT_CALENDAR_THAI 0x20 // SOUTHASIA calendar support
  125. #define VARIANT_CALENDAR_GREGORIAN 0x40 // SOUTHASIA calendar support
  126. #define VARIANT_USE_NLS 0x80 // NLS function call support
  127. /*---------------------------------------------------------------------*/
  128. /* Vector <-> Bstr conversion APIs */
  129. /*---------------------------------------------------------------------*/
  130. WINOLEAUTAPI VectorFromBstr (BSTR bstr, SAFEARRAY ** ppsa);
  131. WINOLEAUTAPI BstrFromVector (SAFEARRAY *psa, BSTR *pbstr);
  132. /*---------------------------------------------------------------------*/
  133. /* Variant API Flags */
  134. /*---------------------------------------------------------------------*/
  135. /* Any of the coersion functions that converts either from or to a string
  136. * takes an additional lcid and dwFlags arguments. The lcid argument allows
  137. * locale specific parsing to occur. The dwFlags allow additional function
  138. * specific condition to occur. All function that accept the dwFlags argument
  139. * can include either 0 or LOCALE_NOUSEROVERRIDE flag.
  140. */
  141. /* The VarDateFromStr and VarBstrFromDate functions also accept the
  142. * VAR_TIMEVALUEONLY and VAR_DATEVALUEONLY flags
  143. */
  144. #define VAR_TIMEVALUEONLY ((DWORD)0x00000001) /* return time value */
  145. #define VAR_DATEVALUEONLY ((DWORD)0x00000002) /* return date value */
  146. /* VarDateFromUdate() only */
  147. #define VAR_VALIDDATE ((DWORD)0x00000004)
  148. /* Accepted by all date & format APIs */
  149. #define VAR_CALENDAR_HIJRI ((DWORD)0x00000008) /* use Hijri calender */
  150. /* Booleans can optionally be accepted in localized form. Pass VAR_LOCALBOOL
  151. * into VarBoolFromStr and VarBstrFromBool to use localized boolean names
  152. */
  153. #define VAR_LOCALBOOL ((DWORD)0x00000010)
  154. /* When passed into VarFormat and VarFormatFromTokens, prevents substitution
  155. * of formats in the case where a string is passed in that can not be
  156. * coverted into the desired type. (for ex, 'Format("Hello", "General Number")')
  157. */
  158. #define VAR_FORMAT_NOSUBSTITUTE ((DWORD)0x00000020)
  159. /*
  160. * For VarBstrFromDate only - forces years to be 4 digits rather than shortening
  161. * to 2-digits when the years is in the date window.
  162. */
  163. #define VAR_FOURDIGITYEARS ((DWORD)0x00000040)
  164. /*
  165. * Use NLS functions to format date, currency, time, and number.
  166. */
  167. #ifndef LOCALE_USE_NLS
  168. #define LOCALE_USE_NLS 0x10000000
  169. #endif
  170. // SOUTHASIA START
  171. /* SOUTHASIA
  172. * For VarBstrFromDate only - forces years to be 4 digits rather than shortening
  173. * to 2-digits when the years is in the date window.
  174. */
  175. #define VAR_CALENDAR_THAI ((DWORD)0x00000080)
  176. #define VAR_CALENDAR_GREGORIAN ((DWORD)0x00000100)
  177. //SOUTHASIA END
  178. #define VTDATEGRE_MAX 2958465 /* Dec 31, 9999, 0:0:0 in Gregorain Calendar */
  179. #define VTDATEGRE_MIN -657434 /* Jan 1, 100, 0:0:0 in Gregorain Calendar */
  180. /*---------------------------------------------------------------------*/
  181. /* VARTYPE Coercion API */
  182. /*---------------------------------------------------------------------*/
  183. /* Note: The routines that convert *from* a string are defined
  184. * to take a OLECHAR* rather than a BSTR because no allocation is
  185. * required, and this makes the routines a bit more generic.
  186. * They may of course still be passed a BSTR as the strIn param.
  187. */
  188. WINOLEAUTAPI VarUI1FromI2(SHORT sIn, BYTE * pbOut);
  189. WINOLEAUTAPI VarUI1FromI4(LONG lIn, BYTE * pbOut);
  190. WINOLEAUTAPI VarUI1FromI8(LONG64 i64In, BYTE FAR* pbOut);
  191. WINOLEAUTAPI VarUI1FromR4(FLOAT fltIn, BYTE * pbOut);
  192. WINOLEAUTAPI VarUI1FromR8(DOUBLE dblIn, BYTE * pbOut);
  193. WINOLEAUTAPI VarUI1FromCy(CY cyIn, BYTE * pbOut);
  194. WINOLEAUTAPI VarUI1FromDate(DATE dateIn, BYTE * pbOut);
  195. WINOLEAUTAPI VarUI1FromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags, BYTE * pbOut);
  196. WINOLEAUTAPI VarUI1FromDisp(IDispatch * pdispIn, LCID lcid, BYTE * pbOut);
  197. WINOLEAUTAPI VarUI1FromBool(VARIANT_BOOL boolIn, BYTE * pbOut);
  198. WINOLEAUTAPI VarUI1FromI1(CHAR cIn, BYTE *pbOut);
  199. WINOLEAUTAPI VarUI1FromUI2(USHORT uiIn, BYTE *pbOut);
  200. WINOLEAUTAPI VarUI1FromUI4(ULONG ulIn, BYTE *pbOut);
  201. WINOLEAUTAPI VarUI1FromUI8(ULONG64 ui64In, BYTE FAR* pbOut);
  202. WINOLEAUTAPI VarUI1FromDec(DECIMAL *pdecIn, BYTE *pbOut);
  203. WINOLEAUTAPI VarI2FromUI1(BYTE bIn, SHORT * psOut);
  204. WINOLEAUTAPI VarI2FromI4(LONG lIn, SHORT * psOut);
  205. WINOLEAUTAPI VarI2FromI8(LONG64 i64In, SHORT FAR* psOut);
  206. WINOLEAUTAPI VarI2FromR4(FLOAT fltIn, SHORT * psOut);
  207. WINOLEAUTAPI VarI2FromR8(DOUBLE dblIn, SHORT * psOut);
  208. WINOLEAUTAPI VarI2FromCy(CY cyIn, SHORT * psOut);
  209. WINOLEAUTAPI VarI2FromDate(DATE dateIn, SHORT * psOut);
  210. WINOLEAUTAPI VarI2FromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags, SHORT * psOut);
  211. WINOLEAUTAPI VarI2FromDisp(IDispatch * pdispIn, LCID lcid, SHORT * psOut);
  212. WINOLEAUTAPI VarI2FromBool(VARIANT_BOOL boolIn, SHORT * psOut);
  213. WINOLEAUTAPI VarI2FromI1(CHAR cIn, SHORT *psOut);
  214. WINOLEAUTAPI VarI2FromUI2(USHORT uiIn, SHORT *psOut);
  215. WINOLEAUTAPI VarI2FromUI4(ULONG ulIn, SHORT *psOut);
  216. WINOLEAUTAPI VarI2FromUI8(ULONG64 ui64In, SHORT FAR* psOut);
  217. WINOLEAUTAPI VarI2FromDec(DECIMAL *pdecIn, SHORT *psOut);
  218. WINOLEAUTAPI VarI4FromUI1(BYTE bIn, LONG * plOut);
  219. WINOLEAUTAPI VarI4FromI2(SHORT sIn, LONG * plOut);
  220. WINOLEAUTAPI VarI4FromI8(LONG64 i64In, LONG FAR* plOut);
  221. WINOLEAUTAPI VarI4FromR4(FLOAT fltIn, LONG * plOut);
  222. WINOLEAUTAPI VarI4FromR8(DOUBLE dblIn, LONG * plOut);
  223. WINOLEAUTAPI VarI4FromCy(CY cyIn, LONG * plOut);
  224. WINOLEAUTAPI VarI4FromDate(DATE dateIn, LONG * plOut);
  225. WINOLEAUTAPI VarI4FromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags, LONG * plOut);
  226. WINOLEAUTAPI VarI4FromDisp(IDispatch * pdispIn, LCID lcid, LONG * plOut);
  227. WINOLEAUTAPI VarI4FromBool(VARIANT_BOOL boolIn, LONG * plOut);
  228. WINOLEAUTAPI VarI4FromI1(CHAR cIn, LONG *plOut);
  229. WINOLEAUTAPI VarI4FromUI2(USHORT uiIn, LONG *plOut);
  230. WINOLEAUTAPI VarI4FromUI4(ULONG ulIn, LONG *plOut);
  231. WINOLEAUTAPI VarI4FromUI8(ULONG64 ui64In, LONG FAR* plOut);
  232. WINOLEAUTAPI VarI4FromDec(DECIMAL *pdecIn, LONG *plOut);
  233. WINOLEAUTAPI VarI4FromInt(INT intIn, LONG *plOut);
  234. /******************************************/
  235. WINOLEAUTAPI VarI8FromUI1(BYTE bIn, LONG64 FAR* pi64Out);
  236. WINOLEAUTAPI VarI8FromI2(SHORT sIn, LONG64 FAR* pi64Out);
  237. WINOLEAUTAPI VarI8FromI4(LONG lIn, LONG64 FAR* pi64Out);
  238. WINOLEAUTAPI VarI8FromR4(FLOAT fltIn, LONG64 FAR* pi64Out);
  239. WINOLEAUTAPI VarI8FromR8(DOUBLE dblIn, LONG64 FAR* pi64Out);
  240. WINOLEAUTAPI VarI8FromCy(CY cyIn, LONG64 FAR* pi64Out);
  241. WINOLEAUTAPI VarI8FromDate(DATE dateIn, LONG64 FAR* pi64Out);
  242. WINOLEAUTAPI VarI8FromStr(OLECHAR FAR* strIn, LCID lcid, unsigned long dwFlags, LONG64 FAR* pi64Out);
  243. WINOLEAUTAPI VarI8FromDisp(IDispatch FAR* pdispIn, LCID lcid, LONG64 FAR* pi64Out);
  244. WINOLEAUTAPI VarI8FromBool(VARIANT_BOOL boolIn, LONG64 FAR* pi64Out);
  245. WINOLEAUTAPI VarI8FromI1(CHAR cIn, LONG64 FAR* pi64Out);
  246. WINOLEAUTAPI VarI8FromUI2(USHORT uiIn, LONG64 FAR* pi64Out);
  247. WINOLEAUTAPI VarI8FromUI4(ULONG ulIn, LONG64 FAR* pi64Out);
  248. WINOLEAUTAPI VarI8FromUI8(ULONG64 ui64In, LONG64 FAR* pi64Out);
  249. WINOLEAUTAPI VarI8FromDec(DECIMAL *pdecIn, LONG64 FAR* pi64Out);
  250. WINOLEAUTAPI VarI8FromInt(INT intIn, LONG64 FAR* pi64Out);
  251. /*********************/
  252. WINOLEAUTAPI VarR4FromUI1(BYTE bIn, FLOAT * pfltOut);
  253. WINOLEAUTAPI VarR4FromI2(SHORT sIn, FLOAT * pfltOut);
  254. WINOLEAUTAPI VarR4FromI4(LONG lIn, FLOAT * pfltOut);
  255. WINOLEAUTAPI VarR4FromI8(LONG64 i64In, FLOAT FAR* pfltOut);
  256. WINOLEAUTAPI VarR4FromR8(DOUBLE dblIn, FLOAT * pfltOut);
  257. WINOLEAUTAPI VarR4FromCy(CY cyIn, FLOAT * pfltOut);
  258. WINOLEAUTAPI VarR4FromDate(DATE dateIn, FLOAT * pfltOut);
  259. WINOLEAUTAPI VarR4FromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags, FLOAT *pfltOut);
  260. WINOLEAUTAPI VarR4FromDisp(IDispatch * pdispIn, LCID lcid, FLOAT * pfltOut);
  261. WINOLEAUTAPI VarR4FromBool(VARIANT_BOOL boolIn, FLOAT * pfltOut);
  262. WINOLEAUTAPI VarR4FromI1(CHAR cIn, FLOAT *pfltOut);
  263. WINOLEAUTAPI VarR4FromUI2(USHORT uiIn, FLOAT *pfltOut);
  264. WINOLEAUTAPI VarR4FromUI4(ULONG ulIn, FLOAT *pfltOut);
  265. WINOLEAUTAPI VarR4FromUI8(ULONG64 ui64In, FLOAT FAR* pfltOut);
  266. WINOLEAUTAPI VarR4FromDec(DECIMAL *pdecIn, FLOAT *pfltOut);
  267. WINOLEAUTAPI VarR8FromUI1(BYTE bIn, DOUBLE * pdblOut);
  268. WINOLEAUTAPI VarR8FromI2(SHORT sIn, DOUBLE * pdblOut);
  269. WINOLEAUTAPI VarR8FromI4(LONG lIn, DOUBLE * pdblOut);
  270. WINOLEAUTAPI VarR8FromI8(LONG64 i64In, DOUBLE FAR* pdblOut);
  271. WINOLEAUTAPI VarR8FromR4(FLOAT fltIn, DOUBLE * pdblOut);
  272. WINOLEAUTAPI VarR8FromCy(CY cyIn, DOUBLE * pdblOut);
  273. WINOLEAUTAPI VarR8FromDate(DATE dateIn, DOUBLE * pdblOut);
  274. WINOLEAUTAPI VarR8FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, DOUBLE *pdblOut);
  275. WINOLEAUTAPI VarR8FromDisp(IDispatch * pdispIn, LCID lcid, DOUBLE * pdblOut);
  276. WINOLEAUTAPI VarR8FromBool(VARIANT_BOOL boolIn, DOUBLE * pdblOut);
  277. WINOLEAUTAPI VarR8FromI1(CHAR cIn, DOUBLE *pdblOut);
  278. WINOLEAUTAPI VarR8FromUI2(USHORT uiIn, DOUBLE *pdblOut);
  279. WINOLEAUTAPI VarR8FromUI4(ULONG ulIn, DOUBLE *pdblOut);
  280. WINOLEAUTAPI VarR8FromUI8(ULONG64 ui64In, DOUBLE FAR* pdblOut);
  281. WINOLEAUTAPI VarR8FromDec(DECIMAL *pdecIn, DOUBLE *pdblOut);
  282. WINOLEAUTAPI VarDateFromUI1(BYTE bIn, DATE * pdateOut);
  283. WINOLEAUTAPI VarDateFromI2(SHORT sIn, DATE * pdateOut);
  284. WINOLEAUTAPI VarDateFromI4(LONG lIn, DATE * pdateOut);
  285. WINOLEAUTAPI VarDateFromI8(LONG64 i64In, DATE FAR* pdateOut);
  286. WINOLEAUTAPI VarDateFromR4(FLOAT fltIn, DATE * pdateOut);
  287. WINOLEAUTAPI VarDateFromR8(DOUBLE dblIn, DATE * pdateOut);
  288. WINOLEAUTAPI VarDateFromCy(CY cyIn, DATE * pdateOut);
  289. WINOLEAUTAPI VarDateFromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, DATE *pdateOut);
  290. WINOLEAUTAPI VarDateFromDisp(IDispatch * pdispIn, LCID lcid, DATE * pdateOut);
  291. WINOLEAUTAPI VarDateFromBool(VARIANT_BOOL boolIn, DATE * pdateOut);
  292. WINOLEAUTAPI VarDateFromI1(CHAR cIn, DATE *pdateOut);
  293. WINOLEAUTAPI VarDateFromUI2(USHORT uiIn, DATE *pdateOut);
  294. WINOLEAUTAPI VarDateFromUI4(ULONG ulIn, DATE *pdateOut);
  295. WINOLEAUTAPI VarDateFromUI8(ULONG64 ui64In, DATE FAR* pdateOut);
  296. WINOLEAUTAPI VarDateFromDec(DECIMAL *pdecIn, DATE *pdateOut);
  297. WINOLEAUTAPI VarCyFromUI1(BYTE bIn, CY * pcyOut);
  298. WINOLEAUTAPI VarCyFromI2(SHORT sIn, CY * pcyOut);
  299. WINOLEAUTAPI VarCyFromI4(LONG lIn, CY * pcyOut);
  300. WINOLEAUTAPI VarCyFromI8(LONG64 i64In, CY FAR* pcyOut);
  301. WINOLEAUTAPI VarCyFromR4(FLOAT fltIn, CY * pcyOut);
  302. WINOLEAUTAPI VarCyFromR8(DOUBLE dblIn, CY * pcyOut);
  303. WINOLEAUTAPI VarCyFromDate(DATE dateIn, CY * pcyOut);
  304. WINOLEAUTAPI VarCyFromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags, CY * pcyOut);
  305. WINOLEAUTAPI VarCyFromDisp(IDispatch * pdispIn, LCID lcid, CY * pcyOut);
  306. WINOLEAUTAPI VarCyFromBool(VARIANT_BOOL boolIn, CY * pcyOut);
  307. WINOLEAUTAPI VarCyFromI1(CHAR cIn, CY *pcyOut);
  308. WINOLEAUTAPI VarCyFromUI2(USHORT uiIn, CY *pcyOut);
  309. WINOLEAUTAPI VarCyFromUI4(ULONG ulIn, CY *pcyOut);
  310. WINOLEAUTAPI VarCyFromUI8(ULONG64 ui64In, CY FAR* pcyOut);
  311. WINOLEAUTAPI VarCyFromDec(DECIMAL *pdecIn, CY *pcyOut);
  312. WINOLEAUTAPI VarBstrFromUI1(BYTE bVal, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  313. WINOLEAUTAPI VarBstrFromI2(SHORT iVal, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  314. WINOLEAUTAPI VarBstrFromI4(LONG lIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  315. WINOLEAUTAPI VarBstrFromI8(LONG64 i64In, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  316. WINOLEAUTAPI VarBstrFromR4(FLOAT fltIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  317. WINOLEAUTAPI VarBstrFromR8(DOUBLE dblIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  318. WINOLEAUTAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  319. WINOLEAUTAPI VarBstrFromDate(DATE dateIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  320. WINOLEAUTAPI VarBstrFromDisp(IDispatch * pdispIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  321. WINOLEAUTAPI VarBstrFromBool(VARIANT_BOOL boolIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
  322. WINOLEAUTAPI VarBstrFromI1(CHAR cIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
  323. WINOLEAUTAPI VarBstrFromUI2(USHORT uiIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
  324. WINOLEAUTAPI VarBstrFromUI4(ULONG ulIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
  325. WINOLEAUTAPI VarBstrFromUI8(ULONG64 ui64In, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  326. WINOLEAUTAPI VarBstrFromDec(DECIMAL *pdecIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
  327. WINOLEAUTAPI VarBoolFromUI1(BYTE bIn, VARIANT_BOOL * pboolOut);
  328. WINOLEAUTAPI VarBoolFromI2(SHORT sIn, VARIANT_BOOL * pboolOut);
  329. WINOLEAUTAPI VarBoolFromI4(LONG lIn, VARIANT_BOOL * pboolOut);
  330. WINOLEAUTAPI VarBoolFromI8(LONG64 i64In, VARIANT_BOOL FAR* pboolOut);
  331. WINOLEAUTAPI VarBoolFromR4(FLOAT fltIn, VARIANT_BOOL * pboolOut);
  332. WINOLEAUTAPI VarBoolFromR8(DOUBLE dblIn, VARIANT_BOOL * pboolOut);
  333. WINOLEAUTAPI VarBoolFromDate(DATE dateIn, VARIANT_BOOL * pboolOut);
  334. WINOLEAUTAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL * pboolOut);
  335. WINOLEAUTAPI VarBoolFromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags, VARIANT_BOOL * pboolOut);
  336. WINOLEAUTAPI VarBoolFromDisp(IDispatch * pdispIn, LCID lcid, VARIANT_BOOL * pboolOut);
  337. WINOLEAUTAPI VarBoolFromI1(CHAR cIn, VARIANT_BOOL *pboolOut);
  338. WINOLEAUTAPI VarBoolFromUI2(USHORT uiIn, VARIANT_BOOL *pboolOut);
  339. WINOLEAUTAPI VarBoolFromUI4(ULONG ulIn, VARIANT_BOOL *pboolOut);
  340. WINOLEAUTAPI VarBoolFromUI8(ULONG64 i64In, VARIANT_BOOL FAR* pboolOut);
  341. WINOLEAUTAPI VarBoolFromDec(DECIMAL *pdecIn, VARIANT_BOOL *pboolOut);
  342. WINOLEAUTAPI VarI1FromUI1(BYTE bIn, CHAR *pcOut);
  343. WINOLEAUTAPI VarI1FromI2(SHORT uiIn, CHAR *pcOut);
  344. WINOLEAUTAPI VarI1FromI4(LONG lIn, CHAR *pcOut);
  345. WINOLEAUTAPI VarI1FromI8(LONG64 i64In, CHAR *pcOut);
  346. WINOLEAUTAPI VarI1FromR4(FLOAT fltIn, CHAR *pcOut);
  347. WINOLEAUTAPI VarI1FromR8(DOUBLE dblIn, CHAR *pcOut);
  348. WINOLEAUTAPI VarI1FromDate(DATE dateIn, CHAR *pcOut);
  349. WINOLEAUTAPI VarI1FromCy(CY cyIn, CHAR *pcOut);
  350. WINOLEAUTAPI VarI1FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, CHAR *pcOut);
  351. WINOLEAUTAPI VarI1FromDisp(IDispatch *pdispIn, LCID lcid, CHAR *pcOut);
  352. WINOLEAUTAPI VarI1FromBool(VARIANT_BOOL boolIn, CHAR *pcOut);
  353. WINOLEAUTAPI VarI1FromUI2(USHORT uiIn, CHAR *pcOut);
  354. WINOLEAUTAPI VarI1FromUI4(ULONG ulIn, CHAR *pcOut);
  355. WINOLEAUTAPI VarI1FromUI8(ULONG64 i64In, CHAR *pcOut);
  356. WINOLEAUTAPI VarI1FromDec(DECIMAL *pdecIn, CHAR *pcOut);
  357. WINOLEAUTAPI VarUI2FromUI1(BYTE bIn, USHORT *puiOut);
  358. WINOLEAUTAPI VarUI2FromI2(SHORT uiIn, USHORT *puiOut);
  359. WINOLEAUTAPI VarUI2FromI4(LONG lIn, USHORT *puiOut);
  360. WINOLEAUTAPI VarUI2FromI8(LONG64 i64In, USHORT *puiOut);
  361. WINOLEAUTAPI VarUI2FromR4(FLOAT fltIn, USHORT *puiOut);
  362. WINOLEAUTAPI VarUI2FromR8(DOUBLE dblIn, USHORT *puiOut);
  363. WINOLEAUTAPI VarUI2FromDate(DATE dateIn, USHORT *puiOut);
  364. WINOLEAUTAPI VarUI2FromCy(CY cyIn, USHORT *puiOut);
  365. WINOLEAUTAPI VarUI2FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, USHORT *puiOut);
  366. WINOLEAUTAPI VarUI2FromDisp(IDispatch *pdispIn, LCID lcid, USHORT *puiOut);
  367. WINOLEAUTAPI VarUI2FromBool(VARIANT_BOOL boolIn, USHORT *puiOut);
  368. WINOLEAUTAPI VarUI2FromI1(CHAR cIn, USHORT *puiOut);
  369. WINOLEAUTAPI VarUI2FromUI4(ULONG ulIn, USHORT *puiOut);
  370. WINOLEAUTAPI VarUI2FromUI8(ULONG64 i64In, USHORT *puiOut);
  371. WINOLEAUTAPI VarUI2FromDec(DECIMAL *pdecIn, USHORT *puiOut);
  372. WINOLEAUTAPI VarUI4FromUI1(BYTE bIn, ULONG *pulOut);
  373. WINOLEAUTAPI VarUI4FromI2(SHORT uiIn, ULONG *pulOut);
  374. WINOLEAUTAPI VarUI4FromI4(LONG lIn, ULONG *pulOut);
  375. WINOLEAUTAPI VarUI4FromI8(LONG64 i64In, ULONG *plOut);
  376. WINOLEAUTAPI VarUI4FromR4(FLOAT fltIn, ULONG *pulOut);
  377. WINOLEAUTAPI VarUI4FromR8(DOUBLE dblIn, ULONG *pulOut);
  378. WINOLEAUTAPI VarUI4FromDate(DATE dateIn, ULONG *pulOut);
  379. WINOLEAUTAPI VarUI4FromCy(CY cyIn, ULONG *pulOut);
  380. WINOLEAUTAPI VarUI4FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, ULONG *pulOut);
  381. WINOLEAUTAPI VarUI4FromDisp(IDispatch *pdispIn, LCID lcid, ULONG *pulOut);
  382. WINOLEAUTAPI VarUI4FromBool(VARIANT_BOOL boolIn, ULONG *pulOut);
  383. WINOLEAUTAPI VarUI4FromI1(CHAR cIn, ULONG *pulOut);
  384. WINOLEAUTAPI VarUI4FromUI2(USHORT uiIn, ULONG *pulOut);
  385. WINOLEAUTAPI VarUI4FromUI8(ULONG64 ui64In, ULONG *plOut);
  386. WINOLEAUTAPI VarUI4FromDec(DECIMAL *pdecIn, ULONG *pulOut);
  387. /******************************************/
  388. WINOLEAUTAPI VarUI8FromUI1(BYTE bIn, ULONG64 FAR* pi64Out);
  389. WINOLEAUTAPI VarUI8FromI2(SHORT sIn, ULONG64 FAR* pi64Out);
  390. WINOLEAUTAPI VarUI8FromI4(LONG lIn, ULONG64 FAR* pi64Out);
  391. WINOLEAUTAPI VarUI8FromI8(LONG64 ui64In, ULONG64 FAR* pi64Out);
  392. WINOLEAUTAPI VarUI8FromR4(FLOAT fltIn, ULONG64 FAR* pi64Out);
  393. WINOLEAUTAPI VarUI8FromR8(DOUBLE dblIn, ULONG64 FAR* pi64Out);
  394. WINOLEAUTAPI VarUI8FromCy(CY cyIn, ULONG64 FAR* pi64Out);
  395. WINOLEAUTAPI VarUI8FromDate(DATE dateIn, ULONG64 FAR* pi64Out);
  396. WINOLEAUTAPI VarUI8FromStr(OLECHAR FAR* strIn, LCID lcid, unsigned long dwFlags, ULONG64 FAR* pi64Out);
  397. WINOLEAUTAPI VarUI8FromDisp(IDispatch FAR* pdispIn, LCID lcid, ULONG64 FAR* pi64Out);
  398. WINOLEAUTAPI VarUI8FromBool(VARIANT_BOOL boolIn, ULONG64 FAR* pi64Out);
  399. WINOLEAUTAPI VarUI8FromI1(CHAR cIn, ULONG64 FAR* pi64Out);
  400. WINOLEAUTAPI VarUI8FromUI2(USHORT uiIn, ULONG64 FAR* pi64Out);
  401. WINOLEAUTAPI VarUI8FromUI4(ULONG ulIn, ULONG64 FAR* pi64Out);
  402. WINOLEAUTAPI VarUI8FromDec(DECIMAL *pdecIn, ULONG64 FAR* pi64Out);
  403. WINOLEAUTAPI VarUI8FromInt(INT intIn, ULONG64 FAR* pi64Out);
  404. /*********************/
  405. WINOLEAUTAPI VarDecFromUI1(BYTE bIn, DECIMAL *pdecOut);
  406. WINOLEAUTAPI VarDecFromI2(SHORT uiIn, DECIMAL *pdecOut);
  407. WINOLEAUTAPI VarDecFromI4(LONG lIn, DECIMAL *pdecOut);
  408. WINOLEAUTAPI VarDecFromI8(LONG64 i64In, DECIMAL *pdecOut);
  409. WINOLEAUTAPI VarDecFromR4(FLOAT fltIn, DECIMAL *pdecOut);
  410. WINOLEAUTAPI VarDecFromR8(DOUBLE dblIn, DECIMAL *pdecOut);
  411. WINOLEAUTAPI VarDecFromDate(DATE dateIn, DECIMAL *pdecOut);
  412. WINOLEAUTAPI VarDecFromCy(CY cyIn, DECIMAL *pdecOut);
  413. WINOLEAUTAPI VarDecFromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, DECIMAL *pdecOut);
  414. WINOLEAUTAPI VarDecFromDisp(IDispatch *pdispIn, LCID lcid, DECIMAL *pdecOut);
  415. WINOLEAUTAPI VarDecFromBool(VARIANT_BOOL boolIn, DECIMAL *pdecOut);
  416. WINOLEAUTAPI VarDecFromI1(CHAR cIn, DECIMAL *pdecOut);
  417. WINOLEAUTAPI VarDecFromUI2(USHORT uiIn, DECIMAL *pdecOut);
  418. WINOLEAUTAPI VarDecFromUI4(ULONG ulIn, DECIMAL *pdecOut);
  419. WINOLEAUTAPI VarDecFromUI8(ULONG64 ui64In, DECIMAL *pdecOut);
  420. #define VarUI4FromUI4(in, pOut) (*(pOut) = (in))
  421. #define VarI4FromI4(in, pOut) (*(pOut) = (in))
  422. WINOLEAUTAPI VarI4FromI8(LONG64 i64In, LONG *plOut);
  423. WINOLEAUTAPI VarI4FromUI8(ULONG64 ui64In, LONG *plOut);
  424. #define VarUI8FromUI8(in, pOut) (*(pOut) = (in))
  425. #define VarI8FromI8(in, pOut) (*(pOut) = (in))
  426. #define VarUI1FromInt VarUI1FromI4
  427. #define VarUI1FromUint VarUI1FromUI4
  428. #define VarI2FromInt VarI2FromI4
  429. #define VarI2FromUint VarI2FromUI4
  430. #define VarI4FromInt VarI4FromI4
  431. #define VarI4FromUint VarI4FromUI4
  432. #define VarI8FromInt VarI8FromI4
  433. #define VarI8FromUint VarI8FromUI4
  434. #define VarR4FromInt VarR4FromI4
  435. #define VarR4FromUint VarR4FromUI4
  436. #define VarR8FromInt VarR8FromI4
  437. #define VarR8FromUint VarR8FromUI4
  438. #define VarDateFromInt VarDateFromI4
  439. #define VarDateFromUint VarDateFromUI4
  440. #define VarCyFromInt VarCyFromI4
  441. #define VarCyFromUint VarCyFromUI4
  442. #define VarBstrFromInt VarBstrFromI4
  443. #define VarBstrFromUint VarBstrFromUI4
  444. #define VarBoolFromInt VarBoolFromI4
  445. #define VarBoolFromUint VarBoolFromUI4
  446. #define VarI1FromInt VarI1FromI4
  447. #define VarI1FromUint VarI1FromUI4
  448. #define VarUI2FromInt VarUI2FromI4
  449. #define VarUI2FromUint VarUI2FromUI4
  450. #define VarUI4FromInt VarUI4FromI4
  451. #define VarUI4FromUint VarUI4FromUI4
  452. #define VarDecFromInt VarDecFromI4
  453. #define VarDecFromUint VarDecFromUI4
  454. #define VarIntFromUI1 VarI4FromUI1
  455. #define VarIntFromI2 VarI4FromI2
  456. #define VarIntFromI4 VarI4FromI4
  457. #define VarIntFromI8 VarI4FromI8
  458. #define VarIntFromR4 VarI4FromR4
  459. #define VarIntFromR8 VarI4FromR8
  460. #define VarIntFromDate VarI4FromDate
  461. #define VarIntFromCy VarI4FromCy
  462. #define VarIntFromStr VarI4FromStr
  463. #define VarIntFromDisp VarI4FromDisp
  464. #define VarIntFromBool VarI4FromBool
  465. #define VarIntFromI1 VarI4FromI1
  466. #define VarIntFromUI2 VarI4FromUI2
  467. #define VarIntFromUI4 VarI4FromUI4
  468. #define VarIntFromUI8 VarI4FromUI8
  469. #define VarIntFromDec VarI4FromDec
  470. #define VarIntFromUint VarI4FromUI4
  471. #define VarUintFromUI1 VarUI4FromUI1
  472. #define VarUintFromI2 VarUI4FromI2
  473. #define VarUintFromI4 VarUI4FromI4
  474. #define VarUintFromI8 VarUI4FromI8
  475. #define VarUintFromR4 VarUI4FromR4
  476. #define VarUintFromR8 VarUI4FromR8
  477. #define VarUintFromDate VarUI4FromDate
  478. #define VarUintFromCy VarUI4FromCy
  479. #define VarUintFromStr VarUI4FromStr
  480. #define VarUintFromDisp VarUI4FromDisp
  481. #define VarUintFromBool VarUI4FromBool
  482. #define VarUintFromI1 VarUI4FromI1
  483. #define VarUintFromUI2 VarUI4FromUI2
  484. #define VarUintFromUI4 VarUI4FromUI4
  485. #define VarUintFromUI8 VarUI4FromUI8
  486. #define VarUintFromDec VarUI4FromDec
  487. #define VarUintFromInt VarUI4FromI4
  488. /* Mac Note: On the Mac, the coersion functions support the
  489. * Symantec C++ calling convention for float/double. To support
  490. * float/double arguments compiled with the MPW C compiler,
  491. * use the following APIs to move MPW float/double values into
  492. * a VARIANT.
  493. */
  494. /*---------------------------------------------------------------------*/
  495. /* New VARIANT <-> string parsing functions */
  496. /*---------------------------------------------------------------------*/
  497. typedef struct {
  498. INT cDig;
  499. ULONG dwInFlags;
  500. ULONG dwOutFlags;
  501. INT cchUsed;
  502. INT nBaseShift;
  503. INT nPwr10;
  504. } NUMPARSE;
  505. /* flags used by both dwInFlags and dwOutFlags:
  506. */
  507. #define NUMPRS_LEADING_WHITE 0x0001
  508. #define NUMPRS_TRAILING_WHITE 0x0002
  509. #define NUMPRS_LEADING_PLUS 0x0004
  510. #define NUMPRS_TRAILING_PLUS 0x0008
  511. #define NUMPRS_LEADING_MINUS 0x0010
  512. #define NUMPRS_TRAILING_MINUS 0x0020
  513. #define NUMPRS_HEX_OCT 0x0040
  514. #define NUMPRS_PARENS 0x0080
  515. #define NUMPRS_DECIMAL 0x0100
  516. #define NUMPRS_THOUSANDS 0x0200
  517. #define NUMPRS_CURRENCY 0x0400
  518. #define NUMPRS_EXPONENT 0x0800
  519. #define NUMPRS_USE_ALL 0x1000
  520. #define NUMPRS_STD 0x1FFF
  521. /* flags used by dwOutFlags only:
  522. */
  523. #define NUMPRS_NEG 0x10000
  524. #define NUMPRS_INEXACT 0x20000
  525. /* flags used by VarNumFromParseNum to indicate acceptable result types:
  526. */
  527. #define VTBIT_I1 (1 << VT_I1)
  528. #define VTBIT_UI1 (1 << VT_UI1)
  529. #define VTBIT_I2 (1 << VT_I2)
  530. #define VTBIT_UI2 (1 << VT_UI2)
  531. #define VTBIT_I4 (1 << VT_I4)
  532. #define VTBIT_UI4 (1 << VT_UI4)
  533. #define VTBIT_I8 (1 << VT_I8)
  534. #define VTBIT_UI8 (1 << VT_UI8)
  535. #define VTBIT_R4 (1 << VT_R4)
  536. #define VTBIT_R8 (1 << VT_R8)
  537. #define VTBIT_CY (1 << VT_CY)
  538. #define VTBIT_DECIMAL (1 << VT_DECIMAL)
  539. WINOLEAUTAPI VarParseNumFromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags,
  540. NUMPARSE * pnumprs, BYTE * rgbDig);
  541. WINOLEAUTAPI VarNumFromParseNum(NUMPARSE * pnumprs, BYTE * rgbDig,
  542. ULONG dwVtBits, VARIANT * pvar);
  543. /*---------------------------------------------------------------------*/
  544. /* VARTYPE Math API */
  545. /*---------------------------------------------------------------------*/
  546. STDAPI VarAdd(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  547. STDAPI VarAnd(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  548. STDAPI VarCat(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  549. STDAPI VarDiv(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  550. STDAPI VarEqv(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  551. STDAPI VarIdiv(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  552. STDAPI VarImp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  553. STDAPI VarMod(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  554. STDAPI VarMul(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  555. STDAPI VarOr(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  556. STDAPI VarPow(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  557. STDAPI VarSub(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  558. STDAPI VarXor(LPVARIANT pvarLeft, LPVARIANT pvarRight, LPVARIANT pvarResult);
  559. STDAPI VarAbs(LPVARIANT pvarIn, LPVARIANT pvarResult);
  560. STDAPI VarFix(LPVARIANT pvarIn, LPVARIANT pvarResult);
  561. STDAPI VarInt(LPVARIANT pvarIn, LPVARIANT pvarResult);
  562. STDAPI VarNeg(LPVARIANT pvarIn, LPVARIANT pvarResult);
  563. STDAPI VarNot(LPVARIANT pvarIn, LPVARIANT pvarResult);
  564. STDAPI VarRound(LPVARIANT pvarIn, int cDecimals, LPVARIANT pvarResult);
  565. // dwFlags passed to CompareString if a string compare
  566. STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, ULONG dwFlags);
  567. #ifdef __cplusplus
  568. extern "C++" {
  569. // Add wrapper for old ATL headers to call
  570. __inline
  571. HRESULT
  572. STDAPICALLTYPE
  573. VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid) {
  574. return VarCmp(pvarLeft, pvarRight, lcid, 0);
  575. }
  576. } // extern "C++"
  577. #endif
  578. // Decimal math
  579. //
  580. STDAPI VarDecAdd(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
  581. STDAPI VarDecDiv(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
  582. STDAPI VarDecMul(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
  583. STDAPI VarDecSub(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
  584. STDAPI VarDecAbs(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
  585. STDAPI VarDecFix(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
  586. STDAPI VarDecInt(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
  587. STDAPI VarDecNeg(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
  588. STDAPI VarDecRound(LPDECIMAL pdecIn, int cDecimals, LPDECIMAL pdecResult);
  589. STDAPI VarDecCmp(LPDECIMAL pdecLeft, LPDECIMAL pdecRight);
  590. STDAPI VarDecCmpR8(LPDECIMAL pdecLeft, double dblRight);
  591. // Currency math
  592. //
  593. STDAPI VarCyAdd(CY cyLeft, CY cyRight, LPCY pcyResult);
  594. STDAPI VarCyMul(CY cyLeft, CY cyRight, LPCY pcyResult);
  595. STDAPI VarCyMulI4(CY cyLeft, long lRight, LPCY pcyResult);
  596. STDAPI VarCyMulI8(CY cyLeft, LONG64 lRight, LPCY pcyResult);
  597. STDAPI VarCySub(CY cyLeft, CY cyRight, LPCY pcyResult);
  598. STDAPI VarCyAbs(CY cyIn, LPCY pcyResult);
  599. STDAPI VarCyFix(CY cyIn, LPCY pcyResult);
  600. STDAPI VarCyInt(CY cyIn, LPCY pcyResult);
  601. STDAPI VarCyNeg(CY cyIn, LPCY pcyResult);
  602. STDAPI VarCyRound(CY cyIn, int cDecimals, LPCY pcyResult);
  603. STDAPI VarCyCmp(CY cyLeft, CY cyRight);
  604. STDAPI VarCyCmpR8(CY cyLeft, double dblRight);
  605. // Misc support functions
  606. //
  607. STDAPI VarBstrCat(BSTR bstrLeft, BSTR bstrRight, LPBSTR pbstrResult);
  608. STDAPI VarBstrCmp(BSTR bstrLeft, BSTR bstrRight, LCID lcid, ULONG dwFlags); // dwFlags passed to CompareString
  609. STDAPI VarR8Pow(double dblLeft, double dblRight, double *pdblResult);
  610. STDAPI VarR4CmpR8(float fltLeft, double dblRight);
  611. STDAPI VarR8Round(double dblIn, int cDecimals, double *pdblResult);
  612. // Compare results. These are returned as a SUCCESS HResult. Subtracting
  613. // one gives the usual values of -1 for Less Than, 0 for Equal To, +1 for
  614. // Greater Than.
  615. //
  616. #define VARCMP_LT 0
  617. #define VARCMP_EQ 1
  618. #define VARCMP_GT 2
  619. #define VARCMP_NULL 3
  620. // VT_HARDTYPE tells the compare routine that the argument is a literal or
  621. // otherwise declared of that specific type. It causes comparison rules to
  622. // change. For example, if a hard-type string is compared to a variant (not hard
  623. // -type) number, the number is converted to string. If a hard-type number is
  624. // compared to a variant string, the string is converted to number. If they're
  625. // both variant, then number < string.
  626. #define VT_HARDTYPE VT_RESERVED
  627. /*---------------------------------------------------------------------*/
  628. /* New date functions */
  629. /*---------------------------------------------------------------------*/
  630. /* The UDATE structure is used with VarDateFromUdate() and VarUdateFromDate().
  631. * It represents an "unpacked date".
  632. */
  633. typedef struct {
  634. SYSTEMTIME st;
  635. USHORT wDayOfYear;
  636. } UDATE;
  637. /* APIs to "pack" and "unpack" dates.
  638. * NOTE: Ex version of VarDateFromUdate obeys 2 digit year setting in
  639. * control panel.
  640. */
  641. WINOLEAUTAPI VarDateFromUdate(UDATE *pudateIn, ULONG dwFlags, DATE *pdateOut);
  642. WINOLEAUTAPI VarDateFromUdateEx(UDATE *pudateIn, LCID lcid, ULONG dwFlags, DATE *pdateOut);
  643. WINOLEAUTAPI VarUdateFromDate(DATE dateIn, ULONG dwFlags, UDATE *pudateOut);
  644. /* API to retrieve the secondary(altername) month names
  645. Useful for Hijri, Polish and Russian alternate month names
  646. */
  647. WINOLEAUTAPI GetAltMonthNames(LCID lcid, LPOLESTR * * prgp);
  648. /*---------------------------------------------------------------------*/
  649. /* Format */
  650. /*---------------------------------------------------------------------*/
  651. WINOLEAUTAPI VarFormat(LPVARIANT pvarIn, LPOLESTR pstrFormat, int iFirstDay, int iFirstWeek, ULONG dwFlags, BSTR *pbstrOut);
  652. WINOLEAUTAPI VarFormatDateTime(LPVARIANT pvarIn, int iNamedFormat, ULONG dwFlags, BSTR *pbstrOut);
  653. WINOLEAUTAPI VarFormatNumber(LPVARIANT pvarIn, int iNumDig, int iIncLead, int iUseParens, int iGroup, ULONG dwFlags, BSTR *pbstrOut);
  654. WINOLEAUTAPI VarFormatPercent(LPVARIANT pvarIn, int iNumDig, int iIncLead, int iUseParens, int iGroup, ULONG dwFlags, BSTR *pbstrOut);
  655. WINOLEAUTAPI VarFormatCurrency(LPVARIANT pvarIn, int iNumDig, int iIncLead, int iUseParens, int iGroup, ULONG dwFlags, BSTR *pbstrOut);
  656. WINOLEAUTAPI VarWeekdayName(int iWeekday, int fAbbrev, int iFirstDay, ULONG dwFlags, BSTR *pbstrOut);
  657. WINOLEAUTAPI VarMonthName(int iMonth, int fAbbrev, ULONG dwFlags, BSTR *pbstrOut);
  658. WINOLEAUTAPI VarFormatFromTokens(LPVARIANT pvarIn, LPOLESTR pstrFormat, LPBYTE pbTokCur, ULONG dwFlags, BSTR *pbstrOut, LCID lcid);
  659. WINOLEAUTAPI VarTokenizeFormatString(LPOLESTR pstrFormat, LPBYTE rgbTok, int cbTok, int iFirstDay, int iFirstWeek, LCID lcid, int *pcbActual);
  660. /*---------------------------------------------------------------------*/
  661. /* ITypeLib */
  662. /*---------------------------------------------------------------------*/
  663. typedef ITypeLib * LPTYPELIB;
  664. /*---------------------------------------------------------------------*/
  665. /* ITypeInfo */
  666. /*---------------------------------------------------------------------*/
  667. typedef LONG DISPID;
  668. typedef DISPID MEMBERID;
  669. #define MEMBERID_NIL DISPID_UNKNOWN
  670. #define ID_DEFAULTINST -2
  671. /* Flags for IDispatch::Invoke */
  672. #define DISPATCH_METHOD 0x1
  673. #define DISPATCH_PROPERTYGET 0x2
  674. #define DISPATCH_PROPERTYPUT 0x4
  675. #define DISPATCH_PROPERTYPUTREF 0x8
  676. typedef ITypeInfo * LPTYPEINFO;
  677. /*---------------------------------------------------------------------*/
  678. /* ITypeComp */
  679. /*---------------------------------------------------------------------*/
  680. typedef ITypeComp * LPTYPECOMP;
  681. /*---------------------------------------------------------------------*/
  682. /* ICreateTypeLib */
  683. /*---------------------------------------------------------------------*/
  684. typedef ICreateTypeLib * LPCREATETYPELIB;
  685. typedef ICreateTypeInfo * LPCREATETYPEINFO;
  686. /*---------------------------------------------------------------------*/
  687. /* TypeInfo API */
  688. /*---------------------------------------------------------------------*/
  689. /* compute a 16bit hash value for the given name
  690. */
  691. #if (defined (_WIN32) || defined (_WIN64))
  692. WINOLEAUTAPI_(ULONG) LHashValOfNameSysA(SYSKIND syskind, LCID lcid,
  693. LPCSTR szName);
  694. #endif
  695. WINOLEAUTAPI_(ULONG)
  696. LHashValOfNameSys(SYSKIND syskind, LCID lcid, const OLECHAR * szName);
  697. #define LHashValOfName(lcid, szName) \
  698. LHashValOfNameSys(SYS_WIN32, lcid, szName)
  699. #define WHashValOfLHashVal(lhashval) \
  700. ((USHORT) (0x0000ffff & (lhashval)))
  701. #define IsHashValCompatible(lhashval1, lhashval2) \
  702. ((BOOL) ((0x00ff0000 & (lhashval1)) == (0x00ff0000 & (lhashval2))))
  703. /* load the typelib from the file with the given filename
  704. */
  705. WINOLEAUTAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib ** pptlib);
  706. /* Control how a type library is registered
  707. */
  708. typedef enum tagREGKIND
  709. {
  710. REGKIND_DEFAULT,
  711. REGKIND_REGISTER,
  712. REGKIND_NONE
  713. } REGKIND;
  714. // Constants for specifying format in which TLB should be loaded
  715. // (the default format is 32-bit on WIN32 and 64-bit on WIN64)
  716. #define LOAD_TLB_AS_32BIT 0x20
  717. #define LOAD_TLB_AS_64BIT 0x40
  718. #define MASK_TO_RESET_TLB_BITS ~(LOAD_TLB_AS_32BIT | LOAD_TLB_AS_64BIT)
  719. WINOLEAUTAPI LoadTypeLibEx(LPCOLESTR szFile, REGKIND regkind,
  720. ITypeLib ** pptlib);
  721. /* load registered typelib
  722. */
  723. WINOLEAUTAPI LoadRegTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor,
  724. LCID lcid, ITypeLib ** pptlib);
  725. /* get path to registered typelib
  726. */
  727. WINOLEAUTAPI QueryPathOfRegTypeLib(REFGUID guid, USHORT wMaj, USHORT wMin,
  728. LCID lcid, LPBSTR lpbstrPathName);
  729. /* add typelib to registry
  730. */
  731. WINOLEAUTAPI RegisterTypeLib(ITypeLib * ptlib, OLECHAR *szFullPath,
  732. OLECHAR *szHelpDir);
  733. /* remove typelib from registry
  734. */
  735. WINOLEAUTAPI UnRegisterTypeLib(REFGUID libID, WORD wVerMajor,
  736. WORD wVerMinor, LCID lcid, SYSKIND syskind);
  737. WINOLEAUTAPI CreateTypeLib(SYSKIND syskind, const OLECHAR *szFile,
  738. ICreateTypeLib ** ppctlib);
  739. WINOLEAUTAPI CreateTypeLib2(SYSKIND syskind, LPCOLESTR szFile,
  740. ICreateTypeLib2 **ppctlib);
  741. /*---------------------------------------------------------------------*/
  742. /* IDispatch implementation support */
  743. /*---------------------------------------------------------------------*/
  744. typedef IDispatch * LPDISPATCH;
  745. typedef struct tagPARAMDATA {
  746. OLECHAR * szName; /* parameter name */
  747. VARTYPE vt; /* parameter type */
  748. } PARAMDATA, * LPPARAMDATA;
  749. typedef struct tagMETHODDATA {
  750. OLECHAR * szName; /* method name */
  751. PARAMDATA * ppdata; /* pointer to an array of PARAMDATAs */
  752. DISPID dispid; /* method ID */
  753. UINT iMeth; /* method index */
  754. CALLCONV cc; /* calling convention */
  755. UINT cArgs; /* count of arguments */
  756. WORD wFlags; /* same wFlags as on IDispatch::Invoke() */
  757. VARTYPE vtReturn;
  758. } METHODDATA, * LPMETHODDATA;
  759. typedef struct tagINTERFACEDATA {
  760. METHODDATA * pmethdata; /* pointer to an array of METHODDATAs */
  761. UINT cMembers; /* count of members */
  762. } INTERFACEDATA, * LPINTERFACEDATA;
  763. /* Locate the parameter indicated by the given position, and
  764. * return it coerced to the given target VARTYPE (vtTarg).
  765. */
  766. WINOLEAUTAPI DispGetParam(DISPPARAMS * pdispparams, UINT position,
  767. VARTYPE vtTarg, VARIANT * pvarResult, UINT * puArgErr);
  768. /* Automatic TypeInfo driven implementation of IDispatch::GetIDsOfNames()
  769. */
  770. WINOLEAUTAPI DispGetIDsOfNames(ITypeInfo * ptinfo, OLECHAR ** rgszNames,
  771. UINT cNames, DISPID * rgdispid);
  772. /* Automatic TypeInfo driven implementation of IDispatch::Invoke()
  773. */
  774. WINOLEAUTAPI DispInvoke(void * _this, ITypeInfo * ptinfo, DISPID dispidMember,
  775. WORD wFlags, DISPPARAMS * pparams, VARIANT * pvarResult,
  776. EXCEPINFO * pexcepinfo, UINT * puArgErr);
  777. /* Construct a TypeInfo from an interface data description
  778. */
  779. WINOLEAUTAPI CreateDispTypeInfo(INTERFACEDATA * pidata, LCID lcid,
  780. ITypeInfo ** pptinfo);
  781. /* Create an instance of the standard TypeInfo driven IDispatch
  782. * implementation.
  783. */
  784. WINOLEAUTAPI CreateStdDispatch(IUnknown * punkOuter, void * pvThis,
  785. ITypeInfo * ptinfo, IUnknown ** ppunkStdDisp);
  786. /* Low-level helper for IDispatch::Invoke() provides machine independence
  787. * for customized Invoke().
  788. */
  789. WINOLEAUTAPI DispCallFunc(void * pvInstance, ULONG_PTR oVft, CALLCONV cc,
  790. VARTYPE vtReturn, UINT cActuals, VARTYPE * prgvt,
  791. VARIANTARG ** prgpvarg, VARIANT * pvargResult);
  792. /*---------------------------------------------------------------------*/
  793. /* Active Object Registration API */
  794. /*---------------------------------------------------------------------*/
  795. /* flags for RegisterActiveObject */
  796. #define ACTIVEOBJECT_STRONG 0x0
  797. #define ACTIVEOBJECT_WEAK 0x1
  798. WINOLEAUTAPI RegisterActiveObject(IUnknown * punk, REFCLSID rclsid,
  799. DWORD dwFlags, DWORD * pdwRegister);
  800. WINOLEAUTAPI RevokeActiveObject(DWORD dwRegister, void * pvReserved);
  801. WINOLEAUTAPI GetActiveObject(REFCLSID rclsid, void * pvReserved,
  802. IUnknown ** ppunk);
  803. /*---------------------------------------------------------------------*/
  804. /* ErrorInfo API */
  805. /*---------------------------------------------------------------------*/
  806. WINOLEAUTAPI SetErrorInfo(ULONG dwReserved, IErrorInfo * perrinfo);
  807. WINOLEAUTAPI GetErrorInfo(ULONG dwReserved, IErrorInfo ** pperrinfo);
  808. WINOLEAUTAPI CreateErrorInfo(ICreateErrorInfo ** pperrinfo);
  809. /*---------------------------------------------------------------------*/
  810. /* User Defined Data types support */
  811. /*---------------------------------------------------------------------*/
  812. WINOLEAUTAPI GetRecordInfoFromTypeInfo(ITypeInfo * pTypeInfo,
  813. IRecordInfo ** ppRecInfo);
  814. WINOLEAUTAPI GetRecordInfoFromGuids(REFGUID rGuidTypeLib,
  815. ULONG uVerMajor, ULONG uVerMinor, LCID lcid,
  816. REFGUID rGuidTypeInfo, IRecordInfo ** ppRecInfo);
  817. /*---------------------------------------------------------------------*/
  818. /* MISC API */
  819. /*---------------------------------------------------------------------*/
  820. WINOLEAUTAPI_(ULONG) OaBuildVersion(void);
  821. WINOLEAUTAPI_(void) ClearCustData(LPCUSTDATA pCustData);
  822. // Declare variant access functions.
  823. #if __STDC__ || defined(NONAMELESSUNION)
  824. #define V_UNION(X, Y) ((X)->n1.n2.n3.Y)
  825. #define V_VT(X) ((X)->n1.n2.vt)
  826. #define V_RECORDINFO(X) ((X)->n1.n2.n3.brecVal.pRecInfo)
  827. #define V_RECORD(X) ((X)->n1.n2.n3.brecVal.pvRecord)
  828. #else
  829. #define V_UNION(X, Y) ((X)->Y)
  830. #define V_VT(X) ((X)->vt)
  831. #define V_RECORDINFO(X) ((X)->pRecInfo)
  832. #define V_RECORD(X) ((X)->pvRecord)
  833. #endif
  834. /* Variant access macros
  835. */
  836. #define V_ISBYREF(X) (V_VT(X)&VT_BYREF)
  837. #define V_ISARRAY(X) (V_VT(X)&VT_ARRAY)
  838. #define V_ISVECTOR(X) (V_VT(X)&VT_VECTOR)
  839. #define V_NONE(X) V_I2(X)
  840. #define V_UI1(X) V_UNION(X, bVal)
  841. #define V_UI1REF(X) V_UNION(X, pbVal)
  842. #define V_I2(X) V_UNION(X, iVal)
  843. #define V_I2REF(X) V_UNION(X, piVal)
  844. #define V_I4(X) V_UNION(X, lVal)
  845. #define V_I4REF(X) V_UNION(X, plVal)
  846. #define V_I8(X) V_UNION(X, llVal)
  847. #define V_I8REF(X) V_UNION(X, pllVal)
  848. #define V_R4(X) V_UNION(X, fltVal)
  849. #define V_R4REF(X) V_UNION(X, pfltVal)
  850. #define V_R8(X) V_UNION(X, dblVal)
  851. #define V_R8REF(X) V_UNION(X, pdblVal)
  852. #define V_I1(X) V_UNION(X, cVal)
  853. #define V_I1REF(X) V_UNION(X, pcVal)
  854. #define V_UI2(X) V_UNION(X, uiVal)
  855. #define V_UI2REF(X) V_UNION(X, puiVal)
  856. #define V_UI4(X) V_UNION(X, ulVal)
  857. #define V_UI4REF(X) V_UNION(X, pulVal)
  858. #define V_UI8(X) V_UNION(X, ullVal)
  859. #define V_UI8REF(X) V_UNION(X, pullVal)
  860. #define V_INT(X) V_UNION(X, intVal)
  861. #define V_INTREF(X) V_UNION(X, pintVal)
  862. #define V_UINT(X) V_UNION(X, uintVal)
  863. #define V_UINTREF(X) V_UNION(X, puintVal)
  864. #ifdef _WIN64
  865. #define V_INT_PTR(X) V_UNION(X, llVal)
  866. #define V_UINT_PTR(X) V_UNION(X, ullVal)
  867. #define V_INT_PTRREF(X) V_UNION(X, pllVal)
  868. #define V_UINT_PTRREF(X) V_UNION(X, pullVal)
  869. #else
  870. #define V_INT_PTR(X) V_UNION(X, lVal)
  871. #define V_UINT_PTR(X) V_UNION(X, ulVal)
  872. #define V_INT_PTRREF(X) V_UNION(X, plVal)
  873. #define V_UINT_PTRREF(X) V_UNION(X, pulVal)
  874. #endif
  875. #define V_CY(X) V_UNION(X, cyVal)
  876. #define V_CYREF(X) V_UNION(X, pcyVal)
  877. #define V_DATE(X) V_UNION(X, date)
  878. #define V_DATEREF(X) V_UNION(X, pdate)
  879. #define V_BSTR(X) V_UNION(X, bstrVal)
  880. #define V_BSTRREF(X) V_UNION(X, pbstrVal)
  881. #define V_DISPATCH(X) V_UNION(X, pdispVal)
  882. #define V_DISPATCHREF(X) V_UNION(X, ppdispVal)
  883. #define V_ERROR(X) V_UNION(X, scode)
  884. #define V_ERRORREF(X) V_UNION(X, pscode)
  885. #define V_BOOL(X) V_UNION(X, boolVal)
  886. #define V_BOOLREF(X) V_UNION(X, pboolVal)
  887. #define V_UNKNOWN(X) V_UNION(X, punkVal)
  888. #define V_UNKNOWNREF(X) V_UNION(X, ppunkVal)
  889. #define V_VARIANTREF(X) V_UNION(X, pvarVal)
  890. #define V_ARRAY(X) V_UNION(X, parray)
  891. #define V_ARRAYREF(X) V_UNION(X, pparray)
  892. #define V_BYREF(X) V_UNION(X, byref)
  893. #define V_DECIMAL(X) V_UNION(X, decVal)
  894. #define V_DECIMALREF(X) V_UNION(X, pdecVal)
  895. #ifndef RC_INVOKED
  896. #include <poppack.h>
  897. #endif // RC_INVOKED
  898. #endif // __OLEAUTO_H__