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.

1251 lines
38 KiB

  1. /***
  2. *dispatch.h - OLE Automation definitions.
  3. *
  4. * Copyright (C) 1992-1993, Microsoft Corporation. All Rights Reserved.
  5. *
  6. *Purpose:
  7. * This file defines the Ole Automation interfaces and APIs.
  8. *
  9. *Implementation Notes:
  10. * This file requires ole2.h
  11. *
  12. *****************************************************************************/
  13. #ifndef _DISPATCH_H_
  14. #define _DISPATCH_H_
  15. #include "variant.h"
  16. #ifndef BEGIN_INTERFACE
  17. # define BEGIN_INTERFACE
  18. #endif
  19. #if defined(NONAMELESSUNION) || (defined(_MAC) && !defined(__cplusplus) && !defined(_MSC_VER))
  20. # define UNION_NAME(X) X
  21. #else
  22. # define UNION_NAME(X)
  23. #endif
  24. DEFINE_OLEGUID(IID_IDispatch, 0x00020400L, 0, 0);
  25. DEFINE_OLEGUID(IID_IEnumVARIANT, 0x00020404L, 0, 0);
  26. DEFINE_OLEGUID(IID_ITypeInfo, 0x00020401L, 0, 0);
  27. DEFINE_OLEGUID(IID_ITypeLib, 0x00020402L, 0, 0);
  28. DEFINE_OLEGUID(IID_ITypeComp, 0x00020403L, 0, 0);
  29. DEFINE_OLEGUID(IID_ICreateTypeInfo, 0x00020405L, 0, 0);
  30. DEFINE_OLEGUID(IID_ICreateTypeLib, 0x00020406L, 0, 0);
  31. DEFINE_OLEGUID(IID_StdOle, 0x00020430L, 0, 0);
  32. /* forward declarations */
  33. #ifdef __cplusplus
  34. interface IDispatch;
  35. interface IEnumVARIANT;
  36. interface ITypeInfo;
  37. interface ITypeLib;
  38. interface ITypeComp;
  39. interface ICreateTypeInfo;
  40. interface ICreateTypeLib;
  41. #else
  42. typedef interface IDispatch IDispatch;
  43. typedef interface IEnumVARIANT IEnumVARIANT;
  44. typedef interface ITypeInfo ITypeInfo;
  45. typedef interface ITypeLib ITypeLib;
  46. typedef interface ITypeComp ITypeComp;
  47. typedef interface ICreateTypeInfo ICreateTypeInfo;
  48. typedef interface ICreateTypeLib ICreateTypeLib;
  49. #endif
  50. /* IDispatch related error codes */
  51. #define DISP_ERROR(X) MAKE_SCODE(SEVERITY_ERROR, FACILITY_DISPATCH, X)
  52. #define DISP_E_UNKNOWNINTERFACE DISP_ERROR(1)
  53. #define DISP_E_MEMBERNOTFOUND DISP_ERROR(3)
  54. #define DISP_E_PARAMNOTFOUND DISP_ERROR(4)
  55. #define DISP_E_TYPEMISMATCH DISP_ERROR(5)
  56. #define DISP_E_UNKNOWNNAME DISP_ERROR(6)
  57. #define DISP_E_NONAMEDARGS DISP_ERROR(7)
  58. #define DISP_E_BADVARTYPE DISP_ERROR(8)
  59. #define DISP_E_EXCEPTION DISP_ERROR(9)
  60. #define DISP_E_OVERFLOW DISP_ERROR(10)
  61. #define DISP_E_BADINDEX DISP_ERROR(11)
  62. #define DISP_E_UNKNOWNLCID DISP_ERROR(12)
  63. #define DISP_E_ARRAYISLOCKED DISP_ERROR(13)
  64. #define DISP_E_BADPARAMCOUNT DISP_ERROR(14)
  65. #define DISP_E_PARAMNOTOPTIONAL DISP_ERROR(15)
  66. #define DISP_E_BADCALLEE DISP_ERROR(16)
  67. #define DISP_E_NOTACOLLECTION DISP_ERROR(17)
  68. #define TYPE_ERROR(X) MAKE_SCODE(SEVERITY_ERROR, FACILITY_DISPATCH, X)
  69. #define TYPE_E_BUFFERTOOSMALL TYPE_ERROR(32790)
  70. #define TYPE_E_INVDATAREAD TYPE_ERROR(32792)
  71. #define TYPE_E_UNSUPFORMAT TYPE_ERROR(32793)
  72. #define TYPE_E_REGISTRYACCESS TYPE_ERROR(32796)
  73. #define TYPE_E_LIBNOTREGISTERED TYPE_ERROR(32797)
  74. #define TYPE_E_UNDEFINEDTYPE TYPE_ERROR(32807)
  75. #define TYPE_E_QUALIFIEDNAMEDISALLOWED TYPE_ERROR(32808)
  76. #define TYPE_E_INVALIDSTATE TYPE_ERROR(32809)
  77. #define TYPE_E_WRONGTYPEKIND TYPE_ERROR(32810)
  78. #define TYPE_E_ELEMENTNOTFOUND TYPE_ERROR(32811)
  79. #define TYPE_E_AMBIGUOUSNAME TYPE_ERROR(32812)
  80. #define TYPE_E_NAMECONFLICT TYPE_ERROR(32813)
  81. #define TYPE_E_UNKNOWNLCID TYPE_ERROR(32814)
  82. #define TYPE_E_DLLFUNCTIONNOTFOUND TYPE_ERROR(32815)
  83. #define TYPE_E_BADMODULEKIND TYPE_ERROR(35005)
  84. #define TYPE_E_SIZETOOBIG TYPE_ERROR(35013)
  85. #define TYPE_E_DUPLICATEID TYPE_ERROR(35014)
  86. #define TYPE_E_TYPEMISMATCH TYPE_ERROR(36000)
  87. #define TYPE_E_OUTOFBOUNDS TYPE_ERROR(36001)
  88. #define TYPE_E_IOERROR TYPE_ERROR(36002)
  89. #define TYPE_E_CANTCREATETMPFILE TYPE_ERROR(36003)
  90. #define TYPE_E_CANTLOADLIBRARY TYPE_ERROR(40010)
  91. #define TYPE_E_INCONSISTENTPROPFUNCS TYPE_ERROR(40067)
  92. #define TYPE_E_CIRCULARTYPE TYPE_ERROR(40068)
  93. /* if not already picked up from olenls.h */
  94. #ifndef _LCID_DEFINED
  95. typedef unsigned long LCID;
  96. # define _LCID_DEFINED
  97. #endif
  98. /*---------------------------------------------------------------------*/
  99. /* BSTR API */
  100. /*---------------------------------------------------------------------*/
  101. STDAPI_(BSTR) SysAllocString(const TCHAR FAR*);
  102. STDAPI_(int) SysReAllocString(BSTR FAR*, const TCHAR FAR*);
  103. STDAPI_(BSTR) SysAllocStringLen(const TCHAR FAR*, unsigned int);
  104. STDAPI_(int) SysReAllocStringLen(BSTR FAR*, const TCHAR FAR*, unsigned int);
  105. STDAPI_(void) SysFreeString(BSTR);
  106. STDAPI_(unsigned int) SysStringLen(BSTR);
  107. /*---------------------------------------------------------------------*/
  108. /* Time API */
  109. /*---------------------------------------------------------------------*/
  110. STDAPI_(int)
  111. DosDateTimeToVariantTime(
  112. unsigned short wDosDate,
  113. unsigned short wDosTime,
  114. double FAR* pvtime);
  115. STDAPI_(int)
  116. VariantTimeToDosDateTime(
  117. double vtime,
  118. unsigned short FAR* pwDosDate,
  119. unsigned short FAR* pwDosTime);
  120. /*---------------------------------------------------------------------*/
  121. /* SafeArray API */
  122. /*---------------------------------------------------------------------*/
  123. STDAPI
  124. SafeArrayAllocDescriptor(unsigned int cDims, SAFEARRAY FAR* FAR* ppsaOut);
  125. STDAPI SafeArrayAllocData(SAFEARRAY FAR* psa);
  126. STDAPI_(SAFEARRAY FAR*)
  127. SafeArrayCreate(
  128. VARTYPE vt,
  129. unsigned int cDims,
  130. SAFEARRAYBOUND FAR* rgsabound);
  131. STDAPI SafeArrayDestroyDescriptor(SAFEARRAY FAR* psa);
  132. STDAPI SafeArrayDestroyData(SAFEARRAY FAR* psa);
  133. STDAPI SafeArrayDestroy(SAFEARRAY FAR* psa);
  134. STDAPI SafeArrayRedim(SAFEARRAY FAR* psa, SAFEARRAYBOUND FAR* psaboundNew);
  135. STDAPI_(unsigned int) SafeArrayGetDim(SAFEARRAY FAR* psa);
  136. STDAPI_(unsigned int) SafeArrayGetElemsize(SAFEARRAY FAR* psa);
  137. STDAPI
  138. SafeArrayGetUBound(SAFEARRAY FAR* psa, unsigned int nDim, long FAR* plUbound);
  139. STDAPI
  140. SafeArrayGetLBound(SAFEARRAY FAR* psa, unsigned int nDim, long FAR* plLbound);
  141. STDAPI SafeArrayLock(SAFEARRAY FAR* psa);
  142. STDAPI SafeArrayUnlock(SAFEARRAY FAR* psa);
  143. STDAPI SafeArrayAccessData(SAFEARRAY FAR* psa, void HUGEP* FAR* ppvData);
  144. STDAPI SafeArrayUnaccessData(SAFEARRAY FAR* psa);
  145. STDAPI
  146. SafeArrayGetElement(
  147. SAFEARRAY FAR* psa,
  148. long FAR* rgIndices,
  149. void FAR* pv);
  150. STDAPI
  151. SafeArrayPutElement(
  152. SAFEARRAY FAR* psa,
  153. long FAR* rgIndices,
  154. void FAR* pv);
  155. STDAPI
  156. SafeArrayCopy(
  157. SAFEARRAY FAR* psa,
  158. SAFEARRAY FAR* FAR* ppsaOut);
  159. /*---------------------------------------------------------------------*/
  160. /* VARIANT API */
  161. /*---------------------------------------------------------------------*/
  162. STDAPI_(void)
  163. VariantInit(VARIANTARG FAR* pvarg);
  164. STDAPI
  165. VariantClear(VARIANTARG FAR* pvarg);
  166. STDAPI
  167. VariantCopy(
  168. VARIANTARG FAR* pvargDest,
  169. VARIANTARG FAR* pvargSrc);
  170. STDAPI
  171. VariantCopyInd(
  172. VARIANT FAR* pvarDest,
  173. VARIANTARG FAR* pvargSrc);
  174. STDAPI
  175. VariantChangeType(
  176. VARIANTARG FAR* pvargDest,
  177. VARIANTARG FAR* pvarSrc,
  178. unsigned short wFlags,
  179. VARTYPE vt);
  180. STDAPI
  181. VariantChangeTypeEx(
  182. VARIANTARG FAR* pvargDest,
  183. VARIANTARG FAR* pvarSrc,
  184. LCID lcid,
  185. unsigned short wFlags,
  186. VARTYPE vt);
  187. #define VARIANT_NOVALUEPROP 1
  188. /*---------------------------------------------------------------------*/
  189. /* VARTYPE Coercion API */
  190. /*---------------------------------------------------------------------*/
  191. /* Note: The routines that convert *from* a string are defined
  192. * to take a char* rather than a BSTR because no allocation is
  193. * required, and this makes the routines a bit more generic.
  194. * They may of course still be passed a BSTR as the strIn param.
  195. */
  196. /* Mac Note: Due to a bug in the MPW C compiler having to do with
  197. * passing floats by value, all of the Var*FromR4 routines take
  198. * the fltIn param as a double instead of a float on the mac.
  199. */
  200. /* Any of the coersion functions that converts either from or to a string
  201. * takes an additional lcid and dwFlags arguments. The lcid argument allows
  202. * locale specific parsing to occur. The dwFlags allow additional function
  203. * specific condition to occur. All function that accept the dwFlags argument
  204. * can include either 0 or LOCALE_NOUSEROVERRIDE flag. In addition, the
  205. * VarDateFromStr functions also accepts the VAR_TIMEVALUEONLY and
  206. * VAR_DATEVALUEONLY flags
  207. */
  208. #define VAR_TIMEVALUEONLY 0x0001 /* return time value */
  209. #define VAR_DATEVALUEONLY 0x0002 /* return date value */
  210. STDAPI VarI2FromI4(long lIn, short FAR* psOut);
  211. #ifdef _MAC
  212. STDAPI VarI2FromR4(double fltIn, short FAR* psOut);
  213. #else
  214. STDAPI VarI2FromR4(float fltIn, short FAR* psOut);
  215. #endif
  216. STDAPI VarI2FromR8(double dblIn, short FAR* psOut);
  217. STDAPI VarI2FromCy(CY cyIn, short FAR* psOut);
  218. STDAPI VarI2FromDate(DATE dateIn, short FAR* psOut);
  219. STDAPI VarI2FromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, short FAR* psOut);
  220. STDAPI VarI2FromDisp(IDispatch FAR* pdispIn, LCID lcid, short FAR* psOut);
  221. STDAPI VarI2FromBool(VARIANT_BOOL boolIn, short FAR* psOut);
  222. STDAPI VarI4FromI2(short sIn, long FAR* plOut);
  223. #ifdef _MAC
  224. STDAPI VarI4FromR4(double fltIn, long FAR* plOut);
  225. #else
  226. STDAPI VarI4FromR4(float fltIn, long FAR* plOut);
  227. #endif
  228. STDAPI VarI4FromR8(double dblIn, long FAR* plOut);
  229. STDAPI VarI4FromCy(CY cyIn, long FAR* plOut);
  230. STDAPI VarI4FromDate(DATE dateIn, long FAR* plOut);
  231. STDAPI VarI4FromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, long FAR* plOut);
  232. STDAPI VarI4FromDisp(IDispatch FAR* pdispIn, LCID lcid, long FAR* plOut);
  233. STDAPI VarI4FromBool(VARIANT_BOOL boolIn, long FAR* plOut);
  234. STDAPI VarR4FromI2(short sIn, float FAR* pfltOut);
  235. STDAPI VarR4FromI4(long lIn, float FAR* pfltOut);
  236. STDAPI VarR4FromR8(double dblIn, float FAR* pfltOut);
  237. STDAPI VarR4FromCy(CY cyIn, float FAR* pfltOut);
  238. STDAPI VarR4FromDate(DATE dateIn, float FAR* pfltOut);
  239. STDAPI VarR4FromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, float FAR* pfltOut);
  240. STDAPI VarR4FromDisp(IDispatch FAR* pdispIn, LCID lcid, float FAR* pfltOut);
  241. STDAPI VarR4FromBool(VARIANT_BOOL boolIn, float FAR* pfltOut);
  242. STDAPI VarR8FromI2(short sIn, double FAR* pdblOut);
  243. STDAPI VarR8FromI4(long lIn, double FAR* pdblOut);
  244. #ifdef _MAC
  245. STDAPI VarR8FromR4(double fltIn, double FAR* pdblOut);
  246. #else
  247. STDAPI VarR8FromR4(float fltIn, double FAR* pdblOut);
  248. #endif
  249. STDAPI VarR8FromCy(CY cyIn, double FAR* pdblOut);
  250. STDAPI VarR8FromDate(DATE dateIn, double FAR* pdblOut);
  251. STDAPI VarR8FromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, double FAR* pdblOut);
  252. STDAPI VarR8FromDisp(IDispatch FAR* pdispIn, LCID lcid, double FAR* pdblOut);
  253. STDAPI VarR8FromBool(VARIANT_BOOL boolIn, double FAR* pdblOut);
  254. STDAPI VarDateFromI2(short sIn, DATE FAR* pdateOut);
  255. STDAPI VarDateFromI4(long lIn, DATE FAR* pdateOut);
  256. #ifdef _MAC
  257. STDAPI VarDateFromR4(double fltIn, DATE FAR* pdateOut);
  258. #else
  259. STDAPI VarDateFromR4(float fltIn, DATE FAR* pdateOut);
  260. #endif
  261. STDAPI VarDateFromR8(double dblIn, DATE FAR* pdateOut);
  262. STDAPI VarDateFromCy(CY cyIn, DATE FAR* pdateOut);
  263. STDAPI VarDateFromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, DATE FAR* pdateOut);
  264. STDAPI VarDateFromDisp(IDispatch FAR* pdispIn, LCID lcid, DATE FAR* pdateOut);
  265. STDAPI VarDateFromBool(VARIANT_BOOL boolIn, DATE FAR* pdateOut);
  266. STDAPI VarCyFromI2(short sIn, CY FAR* pcyOut);
  267. STDAPI VarCyFromI4(long lIn, CY FAR* pcyOut);
  268. #ifdef _MAC
  269. STDAPI VarCyFromR4(double fltIn, CY FAR* pcyOut);
  270. #else
  271. STDAPI VarCyFromR4(float fltIn, CY FAR* pcyOut);
  272. #endif
  273. STDAPI VarCyFromR8(double dblIn, CY FAR* pcyOut);
  274. STDAPI VarCyFromDate(DATE dateIn, CY FAR* pcyOut);
  275. STDAPI VarCyFromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, CY FAR* pcyOut);
  276. STDAPI VarCyFromDisp(IDispatch FAR* pdispIn, LCID lcid, CY FAR* pcyOut);
  277. STDAPI VarCyFromBool(VARIANT_BOOL boolIn, CY FAR* pcyOut);
  278. STDAPI VarBstrFromI2(short iVal, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  279. STDAPI VarBstrFromI4(long lIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  280. #ifdef _MAC
  281. STDAPI VarBstrFromR4(double fltIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  282. #else
  283. STDAPI VarBstrFromR4(float fltIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  284. #endif
  285. STDAPI VarBstrFromR8(double dblIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  286. STDAPI VarBstrFromCy(CY cyIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  287. STDAPI VarBstrFromDate(DATE dateIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  288. STDAPI VarBstrFromDisp(IDispatch FAR* pdispIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  289. STDAPI VarBstrFromBool(VARIANT_BOOL boolIn, LCID lcid, unsigned long dwFlags, BSTR FAR* pbstrOut);
  290. STDAPI VarBoolFromI2(short sIn, VARIANT_BOOL FAR* pboolOut);
  291. STDAPI VarBoolFromI4(long lIn, VARIANT_BOOL FAR* pboolOut);
  292. #ifdef _MAC
  293. STDAPI VarBoolFromR4(double fltIn, VARIANT_BOOL FAR* pboolOut);
  294. #else
  295. STDAPI VarBoolFromR4(float fltIn, VARIANT_BOOL FAR* pboolOut);
  296. #endif
  297. STDAPI VarBoolFromR8(double dblIn, VARIANT_BOOL FAR* pboolOut);
  298. STDAPI VarBoolFromDate(DATE dateIn, VARIANT_BOOL FAR* pboolOut);
  299. STDAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL FAR* pboolOut);
  300. STDAPI VarBoolFromStr(TCHAR FAR* strIn, LCID lcid, unsigned long dwFlags, VARIANT_BOOL FAR* pboolOut);
  301. STDAPI VarBoolFromDisp(IDispatch FAR* pdispIn, LCID lcid, VARIANT_BOOL FAR* pboolOut);
  302. /*---------------------------------------------------------------------*/
  303. /* ITypeLib */
  304. /*---------------------------------------------------------------------*/
  305. typedef long DISPID;
  306. typedef DISPID MEMBERID;
  307. #define MEMBERID_NIL DISPID_UNKNOWN
  308. #define ID_DEFAULTINST -2
  309. typedef enum tagSYSKIND {
  310. SYS_WIN16
  311. , SYS_WIN32
  312. , SYS_MAC
  313. #ifdef _MAC
  314. , SYS_FORCELONG = 2147483647
  315. #endif
  316. } SYSKIND;
  317. typedef enum tagLIBFLAGS {
  318. LIBFLAG_FRESTRICTED = 1
  319. #ifdef _MAC
  320. , LIBFLAG_FORCELONG = 2147483647
  321. #endif
  322. } LIBFLAGS;
  323. typedef struct FARSTRUCT tagTLIBATTR {
  324. GUID guid; /* globally unique library id */
  325. LCID lcid; /* locale of the TypeLibrary */
  326. SYSKIND syskind;
  327. unsigned short wMajorVerNum;/* major version number */
  328. unsigned short wMinorVerNum;/* minor version number */
  329. unsigned short wLibFlags; /* library flags */
  330. } TLIBATTR, FAR* LPTLIBATTR;
  331. typedef enum tagTYPEKIND {
  332. TKIND_ENUM = 0
  333. , TKIND_RECORD
  334. , TKIND_MODULE
  335. , TKIND_INTERFACE
  336. , TKIND_DISPATCH
  337. , TKIND_COCLASS
  338. , TKIND_ALIAS
  339. , TKIND_UNION
  340. , TKIND_MAX /* end of enum marker */
  341. #ifdef _MAC
  342. , TKIND_FORCELONG = 2147483647
  343. #endif
  344. } TYPEKIND;
  345. #undef INTERFACE
  346. #define INTERFACE ITypeLib
  347. DECLARE_INTERFACE_(ITypeLib, IUnknown)
  348. {
  349. BEGIN_INTERFACE
  350. /* IUnknown methods */
  351. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  352. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  353. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  354. /* ITypeLib methods */
  355. STDMETHOD_(unsigned int,GetTypeInfoCount)(THIS) PURE;
  356. STDMETHOD(GetTypeInfo)(THIS_
  357. unsigned int index, ITypeInfo FAR* FAR* pptinfo) PURE;
  358. STDMETHOD(GetTypeInfoType)(THIS_
  359. unsigned int index, TYPEKIND FAR* ptypekind) PURE;
  360. STDMETHOD(GetTypeInfoOfGuid)(THIS_
  361. REFGUID guid, ITypeInfo FAR* FAR* pptinfo) PURE;
  362. STDMETHOD(GetLibAttr)(THIS_
  363. TLIBATTR FAR* FAR* pptlibattr) PURE;
  364. STDMETHOD(GetTypeComp)(THIS_
  365. ITypeComp FAR* FAR* pptcomp) PURE;
  366. STDMETHOD(GetDocumentation)(THIS_
  367. int index,
  368. BSTR FAR* pbstrName,
  369. BSTR FAR* pbstrDocString,
  370. unsigned long FAR* pdwHelpContext,
  371. BSTR FAR* pbstrHelpFile) PURE;
  372. STDMETHOD(IsName)(THIS_
  373. TCHAR FAR* szNameBuf,
  374. unsigned long lHashVal,
  375. int FAR* lpfName) PURE;
  376. STDMETHOD(FindName)(THIS_
  377. TCHAR FAR* szNameBuf,
  378. unsigned long lHashVal,
  379. ITypeInfo FAR* FAR* rgptinfo,
  380. MEMBERID FAR* rgmemid,
  381. unsigned short FAR* pcFound) PURE;
  382. STDMETHOD_(void, ReleaseTLibAttr)(THIS_ TLIBATTR FAR* ptlibattr) PURE;
  383. };
  384. typedef ITypeLib FAR* LPTYPELIB;
  385. /*---------------------------------------------------------------------*/
  386. /* ITypeInfo */
  387. /*---------------------------------------------------------------------*/
  388. typedef unsigned long HREFTYPE;
  389. typedef struct FARSTRUCT tagTYPEDESC {
  390. union {
  391. /* VT_PTR - the pointed-at type */
  392. struct FARSTRUCT tagTYPEDESC FAR* lptdesc;
  393. /* VT_CARRAY */
  394. struct FARSTRUCT tagARRAYDESC FAR* lpadesc;
  395. /* VT_USERDEFINED - this is used to get a TypeInfo for the UDT */
  396. HREFTYPE hreftype;
  397. }UNION_NAME(u);
  398. VARTYPE vt;
  399. } TYPEDESC;
  400. typedef struct FARSTRUCT tagARRAYDESC {
  401. TYPEDESC tdescElem; /* element type */
  402. unsigned short cDims; /* dimension count */
  403. SAFEARRAYBOUND rgbounds[1]; /* variable length array of bounds */
  404. } ARRAYDESC;
  405. typedef struct FARSTRUCT tagIDLDESC {
  406. BSTR bstrIDLInfo;
  407. unsigned short wIDLFlags; /* IN, OUT, etc */
  408. } IDLDESC, FAR* LPIDLDESC;
  409. #define IDLFLAG_NONE 0
  410. #define IDLFLAG_FIN 0x1
  411. #define IDLFLAG_FOUT 0x2
  412. typedef struct FARSTRUCT tagELEMDESC {
  413. TYPEDESC tdesc; /* the type of the element */
  414. IDLDESC idldesc; /* info for remoting the element */
  415. } ELEMDESC, FAR* LPELEMDESC;
  416. typedef struct FARSTRUCT tagTYPEATTR {
  417. GUID guid; /* the GUID of the TypeInfo */
  418. LCID lcid; /* locale of member names and doc strings */
  419. unsigned long dwReserved;
  420. MEMBERID memidConstructor; /* ID of constructor, MEMBERID_NIL if none */
  421. MEMBERID memidDestructor; /* ID of destructor, MEMBERID_NIL if none */
  422. TCHAR FAR* lpstrSchema; /* reserved for future use */
  423. unsigned long cbSizeInstance;/* the size of an instance of this type */
  424. TYPEKIND typekind; /* the kind of type this typeinfo describes */
  425. unsigned short cFuncs; /* number of functions */
  426. unsigned short cVars; /* number of variables / data members */
  427. unsigned short cImplTypes; /* number of implemented interfaces */
  428. unsigned short cbSizeVft; /* the size of this types virtual func table */
  429. unsigned short cbAlignment; /* the alignment for an instance of this type */
  430. unsigned short wTypeFlags;
  431. unsigned short wMajorVerNum;/* major version number */
  432. unsigned short wMinorVerNum;/* minor version number */
  433. TYPEDESC tdescAlias; /* if typekind == TKIND_ALIAS this specifies
  434. the type for which this type is an alias */
  435. IDLDESC idldescType; /* IDL attributes of the described type */
  436. } TYPEATTR, FAR* LPTYPEATTR;
  437. typedef struct FARSTRUCT tagDISPPARAMS{
  438. VARIANTARG FAR* rgvarg;
  439. DISPID FAR* rgdispidNamedArgs;
  440. unsigned int cArgs;
  441. unsigned int cNamedArgs;
  442. } DISPPARAMS;
  443. typedef struct FARSTRUCT tagEXCEPINFO {
  444. unsigned short wCode; /* An error code describing the error. */
  445. /* Either (but not both) the wCode or */
  446. /* scode fields must be set */
  447. unsigned short wReserved;
  448. BSTR bstrSource; /* A textual, human readable name of the
  449. source of the exception. It is up to the
  450. IDispatch implementor to fill this in.
  451. Typically this will be an application name. */
  452. BSTR bstrDescription; /* A textual, human readable description of the
  453. error. If no description is available, NULL
  454. should be used. */
  455. BSTR bstrHelpFile; /* Fully qualified drive, path, and file name
  456. of a help file with more information about
  457. the error. If no help is available, NULL
  458. should be used. */
  459. unsigned long dwHelpContext;
  460. /* help context of topic within the help file. */
  461. void FAR* pvReserved;
  462. /* Use of this field allows an application to defer filling in
  463. the bstrDescription, bstrHelpFile, and dwHelpContext fields
  464. until they are needed. This field might be used, for example,
  465. if loading the string for the error is a time-consuming
  466. operation. If deferred fill-in is not desired, this field should
  467. be set to NULL. */
  468. #ifdef _MAC
  469. # ifdef _MSC_VER
  470. HRESULT (STDAPICALLTYPE FAR* pfnDeferredFillIn)(struct tagEXCEPINFO FAR*);
  471. # else
  472. STDAPICALLTYPE HRESULT (FAR* pfnDeferredFillIn)(struct tagEXCEPINFO FAR*);
  473. # endif
  474. #else
  475. HRESULT (STDAPICALLTYPE FAR* pfnDeferredFillIn)(struct tagEXCEPINFO FAR*);
  476. #endif
  477. SCODE scode; /* An SCODE describing the error. */
  478. } EXCEPINFO, FAR* LPEXCEPINFO;
  479. typedef enum tagCALLCONV {
  480. CC_CDECL = 1
  481. , CC_MSCPASCAL
  482. , CC_PASCAL = CC_MSCPASCAL
  483. , CC_MACPASCAL
  484. , CC_STDCALL
  485. , CC_RESERVED
  486. , CC_SYSCALL
  487. , CC_MAX /* end of enum marker */
  488. #ifdef _MAC
  489. , CC_FORCELONG = 2147483647
  490. #endif
  491. } CALLCONV;
  492. typedef enum tagFUNCKIND {
  493. FUNC_VIRTUAL
  494. , FUNC_PUREVIRTUAL
  495. , FUNC_NONVIRTUAL
  496. , FUNC_STATIC
  497. , FUNC_DISPATCH
  498. #ifdef _MAC
  499. , FUNC_FORCELONG = 2147483647
  500. #endif
  501. } FUNCKIND;
  502. /* Flags for IDispatch::Invoke */
  503. #define DISPATCH_METHOD 0x1
  504. #define DISPATCH_PROPERTYGET 0x2
  505. #define DISPATCH_PROPERTYPUT 0x4
  506. #define DISPATCH_PROPERTYPUTREF 0x8
  507. typedef enum tagINVOKEKIND {
  508. INVOKE_FUNC = DISPATCH_METHOD
  509. , INVOKE_PROPERTYGET = DISPATCH_PROPERTYGET
  510. , INVOKE_PROPERTYPUT = DISPATCH_PROPERTYPUT
  511. , INVOKE_PROPERTYPUTREF = DISPATCH_PROPERTYPUTREF
  512. #ifdef _MAC
  513. , INVOKE_FORCELONG = 2147483647
  514. #endif
  515. } INVOKEKIND;
  516. typedef struct FARSTRUCT tagFUNCDESC {
  517. MEMBERID memid;
  518. SCODE FAR* lprgscode;
  519. ELEMDESC FAR* lprgelemdescParam; /* array of parameter types */
  520. FUNCKIND funckind;
  521. INVOKEKIND invkind;
  522. CALLCONV callconv;
  523. short cParams;
  524. short cParamsOpt;
  525. short oVft;
  526. short cScodes;
  527. ELEMDESC elemdescFunc;
  528. unsigned short wFuncFlags;
  529. } FUNCDESC, FAR* LPFUNCDESC;
  530. typedef enum tagVARKIND {
  531. VAR_PERINSTANCE
  532. , VAR_STATIC
  533. , VAR_CONST
  534. , VAR_DISPATCH
  535. #ifdef _MAC
  536. , VAR_FORCELONG = 2147483647
  537. #endif
  538. } VARKIND;
  539. typedef struct FARSTRUCT tagVARDESC {
  540. MEMBERID memid;
  541. TCHAR FAR* lpstrSchema; /* reserved for future use */
  542. union {
  543. /* VAR_PERINSTANCE - the offset of this variable within the instance */
  544. unsigned long oInst;
  545. /* VAR_CONST - the value of the constant */
  546. VARIANT FAR* lpvarValue;
  547. }UNION_NAME(u);
  548. ELEMDESC elemdescVar;
  549. unsigned short wVarFlags;
  550. VARKIND varkind;
  551. } VARDESC, FAR* LPVARDESC;
  552. typedef enum tagTYPEFLAGS {
  553. TYPEFLAG_FAPPOBJECT = 1
  554. , TYPEFLAG_FCANCREATE = 2
  555. #ifdef _MAC
  556. , TYPEFLAG_FORCELONG = 2147483647
  557. #endif
  558. } TYPEFLAGS;
  559. typedef enum tagFUNCFLAGS {
  560. FUNCFLAG_FRESTRICTED= 1
  561. #ifdef _MAC
  562. , FUNCFLAG_FORCELONG = 2147483647
  563. #endif
  564. } FUNCFLAGS;
  565. typedef enum tagVARFLAGS {
  566. VARFLAG_FREADONLY = 1
  567. #ifdef _MAC
  568. , VARFLAG_FORCELONG = 2147483647
  569. #endif
  570. } VARFLAGS;
  571. /* IMPLTYPE Flags */
  572. #define IMPLTYPEFLAG_FDEFAULT 0x1
  573. #define IMPLTYPEFLAG_FSOURCE 0x2
  574. #define IMPLTYPEFLAG_FRESTRICTED 0x4
  575. #undef INTERFACE
  576. #define INTERFACE ITypeInfo
  577. DECLARE_INTERFACE_(ITypeInfo, IUnknown)
  578. {
  579. BEGIN_INTERFACE
  580. /* IUnknown methods */
  581. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  582. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  583. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  584. /* ITypeInfo methods */
  585. STDMETHOD(GetTypeAttr)(THIS_ TYPEATTR FAR* FAR* pptypeattr) PURE;
  586. STDMETHOD(GetTypeComp)(THIS_ ITypeComp FAR* FAR* pptcomp) PURE;
  587. STDMETHOD(GetFuncDesc)(THIS_
  588. unsigned int index, FUNCDESC FAR* FAR* ppfuncdesc) PURE;
  589. STDMETHOD(GetVarDesc)(THIS_
  590. unsigned int index, VARDESC FAR* FAR* ppvardesc) PURE;
  591. STDMETHOD(GetNames)(THIS_
  592. MEMBERID memid,
  593. BSTR FAR* rgbstrNames,
  594. unsigned int cMaxNames,
  595. unsigned int FAR* pcNames) PURE;
  596. STDMETHOD(GetRefTypeOfImplType)(THIS_
  597. unsigned int index, HREFTYPE FAR* phreftype) PURE;
  598. STDMETHOD(GetImplTypeFlags)(THIS_
  599. unsigned int index, int FAR* pimpltypeflags) PURE;
  600. STDMETHOD(GetIDsOfNames)(THIS_
  601. TCHAR FAR* FAR* rgszNames,
  602. unsigned int cNames,
  603. MEMBERID FAR* rgmemid) PURE;
  604. STDMETHOD(Invoke)(THIS_
  605. void FAR* pvInstance,
  606. MEMBERID memid,
  607. unsigned short wFlags,
  608. DISPPARAMS FAR *pdispparams,
  609. VARIANT FAR *pvarResult,
  610. EXCEPINFO FAR *pexcepinfo,
  611. unsigned int FAR *puArgErr) PURE;
  612. STDMETHOD(GetDocumentation)(THIS_
  613. MEMBERID memid,
  614. BSTR FAR* pbstrName,
  615. BSTR FAR* pbstrDocString,
  616. unsigned long FAR* pdwHelpContext,
  617. BSTR FAR* pbstrHelpFile) PURE;
  618. STDMETHOD(GetDllEntry)(THIS_
  619. MEMBERID memid,
  620. INVOKEKIND invkind,
  621. BSTR FAR* pbstrDllName,
  622. BSTR FAR* pbstrName,
  623. unsigned short FAR* pwOrdinal) PURE;
  624. STDMETHOD(GetRefTypeInfo)(THIS_
  625. HREFTYPE hreftype, ITypeInfo FAR* FAR* pptinfo) PURE;
  626. STDMETHOD(AddressOfMember)(THIS_
  627. MEMBERID memid, INVOKEKIND invkind, void FAR* FAR* ppv) PURE;
  628. STDMETHOD(CreateInstance)(THIS_
  629. IUnknown FAR* punkOuter,
  630. REFIID riid,
  631. void FAR* FAR* ppvObj) PURE;
  632. STDMETHOD(GetMops)(THIS_ MEMBERID memid, BSTR FAR* pbstrMops) PURE;
  633. STDMETHOD(GetContainingTypeLib)(THIS_
  634. ITypeLib FAR* FAR* pptlib, unsigned int FAR* pindex) PURE;
  635. STDMETHOD_(void, ReleaseTypeAttr)(THIS_ TYPEATTR FAR* ptypeattr) PURE;
  636. STDMETHOD_(void, ReleaseFuncDesc)(THIS_ FUNCDESC FAR* pfuncdesc) PURE;
  637. STDMETHOD_(void, ReleaseVarDesc)(THIS_ VARDESC FAR* pvardesc) PURE;
  638. };
  639. typedef ITypeInfo FAR* LPTYPEINFO;
  640. /*---------------------------------------------------------------------*/
  641. /* ITypeComp */
  642. /*---------------------------------------------------------------------*/
  643. typedef enum tagDESCKIND {
  644. DESCKIND_NONE = 0
  645. , DESCKIND_FUNCDESC
  646. , DESCKIND_VARDESC
  647. , DESCKIND_TYPECOMP
  648. , DESCKIND_IMPLICITAPPOBJ
  649. , DESCKIND_MAX /* end of enum marker */
  650. #ifdef _MAC
  651. , DESCKIND_FORCELONG = 2147483647
  652. #endif
  653. } DESCKIND;
  654. typedef union tagBINDPTR {
  655. FUNCDESC FAR* lpfuncdesc;
  656. VARDESC FAR* lpvardesc;
  657. ITypeComp FAR* lptcomp;
  658. } BINDPTR, FAR* LPBINDPTR;
  659. #undef INTERFACE
  660. #define INTERFACE ITypeComp
  661. DECLARE_INTERFACE_(ITypeComp, IUnknown)
  662. {
  663. BEGIN_INTERFACE
  664. /* IUnknown methods */
  665. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  666. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  667. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  668. /* ITypeComp methods */
  669. STDMETHOD(Bind)(THIS_
  670. TCHAR FAR* szName,
  671. unsigned long lHashVal,
  672. unsigned short wflags,
  673. ITypeInfo FAR* FAR* pptinfo,
  674. DESCKIND FAR* pdesckind,
  675. BINDPTR FAR* pbindptr) PURE;
  676. STDMETHOD(BindType)(THIS_
  677. TCHAR FAR* szName,
  678. unsigned long lHashVal,
  679. ITypeInfo FAR* FAR* pptinfo,
  680. ITypeComp FAR* FAR* pptcomp) PURE;
  681. };
  682. typedef ITypeComp FAR* LPTYPECOMP;
  683. /*---------------------------------------------------------------------*/
  684. /* ICreateTypeLib */
  685. /*---------------------------------------------------------------------*/
  686. #undef INTERFACE
  687. #define INTERFACE ICreateTypeLib
  688. DECLARE_INTERFACE_(ICreateTypeLib, IUnknown)
  689. {
  690. BEGIN_INTERFACE
  691. /* IUnknown methods */
  692. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  693. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  694. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  695. /* ICreateTypeLib methods */
  696. STDMETHOD(CreateTypeInfo)(THIS_
  697. TCHAR FAR* szName,
  698. TYPEKIND tkind,
  699. ICreateTypeInfo FAR* FAR* lplpictinfo) PURE;
  700. STDMETHOD(SetName)(THIS_ TCHAR FAR* szName) PURE;
  701. STDMETHOD(SetVersion)(THIS_
  702. unsigned short wMajorVerNum, unsigned short wMinorVerNum) PURE;
  703. STDMETHOD(SetGuid) (THIS_ REFGUID guid) PURE;
  704. STDMETHOD(SetDocString)(THIS_ TCHAR FAR* szDoc) PURE;
  705. STDMETHOD(SetHelpFileName)(THIS_ TCHAR FAR* szHelpFileName) PURE;
  706. STDMETHOD(SetHelpContext)(THIS_ unsigned long dwHelpContext) PURE;
  707. STDMETHOD(SetLcid)(THIS_ LCID lcid) PURE;
  708. STDMETHOD(SetLibFlags)(THIS_ unsigned int uLibFlags) PURE;
  709. STDMETHOD(SaveAllChanges)(THIS) PURE;
  710. };
  711. typedef ICreateTypeLib FAR* LPCREATETYPELIB;
  712. /*---------------------------------------------------------------------*/
  713. /* ICreateTypeInfo */
  714. /*---------------------------------------------------------------------*/
  715. #undef INTERFACE
  716. #define INTERFACE ICreateTypeInfo
  717. DECLARE_INTERFACE_(ICreateTypeInfo, IUnknown)
  718. {
  719. BEGIN_INTERFACE
  720. /* IUnknown methods */
  721. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  722. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  723. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  724. /* ICreateTypeInfo methods */
  725. STDMETHOD(SetGuid)(THIS_ REFGUID guid) PURE;
  726. STDMETHOD(SetTypeFlags)(THIS_ unsigned int uTypeFlags) PURE;
  727. STDMETHOD(SetDocString)(THIS_ TCHAR FAR* pstrDoc) PURE;
  728. STDMETHOD(SetHelpContext)(THIS_ unsigned long dwHelpContext) PURE;
  729. STDMETHOD(SetVersion)(THIS_
  730. unsigned short wMajorVerNum, unsigned short wMinorVerNum) PURE;
  731. STDMETHOD(AddRefTypeInfo)(THIS_
  732. ITypeInfo FAR* ptinfo, HREFTYPE FAR* phreftype) PURE;
  733. STDMETHOD(AddFuncDesc)(THIS_
  734. unsigned int index, FUNCDESC FAR* pfuncdesc) PURE;
  735. STDMETHOD(AddImplType)(THIS_
  736. unsigned int index, HREFTYPE hreftype) PURE;
  737. STDMETHOD(SetImplTypeFlags)(THIS_
  738. unsigned int index, int impltypeflags) PURE;
  739. STDMETHOD(SetAlignment)(THIS_ unsigned short cbAlignment) PURE;
  740. STDMETHOD(SetSchema)(THIS_ TCHAR FAR* lpstrSchema) PURE;
  741. STDMETHOD(AddVarDesc)(THIS_
  742. unsigned int index, VARDESC FAR* pvardesc) PURE;
  743. STDMETHOD(SetFuncAndParamNames)(THIS_
  744. unsigned int index, TCHAR FAR* FAR* rgszNames, unsigned int cNames) PURE;
  745. STDMETHOD(SetVarName)(THIS_
  746. unsigned int index, TCHAR FAR* szName) PURE;
  747. STDMETHOD(SetTypeDescAlias)(THIS_
  748. TYPEDESC FAR* ptdescAlias) PURE;
  749. STDMETHOD(DefineFuncAsDllEntry)(THIS_
  750. unsigned int index, TCHAR FAR* szDllName, TCHAR FAR* szProcName) PURE;
  751. STDMETHOD(SetFuncDocString)(THIS_
  752. unsigned int index, TCHAR FAR* szDocString) PURE;
  753. STDMETHOD(SetVarDocString)(THIS_
  754. unsigned int index, TCHAR FAR* szDocString) PURE;
  755. STDMETHOD(SetFuncHelpContext)(THIS_
  756. unsigned int index, unsigned long dwHelpContext) PURE;
  757. STDMETHOD(SetVarHelpContext)(THIS_
  758. unsigned int index, unsigned long dwHelpContext) PURE;
  759. STDMETHOD(SetMops)(THIS_
  760. unsigned int index, BSTR bstrMops) PURE;
  761. STDMETHOD(SetTypeIdldesc)(THIS_
  762. IDLDESC FAR* pidldesc) PURE;
  763. STDMETHOD(LayOut)(THIS) PURE;
  764. };
  765. typedef ICreateTypeInfo FAR* LPCREATETYPEINFO;
  766. /*---------------------------------------------------------------------*/
  767. /* TypeInfo APIs */
  768. /*---------------------------------------------------------------------*/
  769. /* compute a 32bit hash value for the given name based on the lcid and system kind
  770. */
  771. STDAPI_(unsigned long)
  772. LHashValOfNameSys(SYSKIND syskind, LCID lcid, TCHAR FAR* szName);
  773. /* Macro to compute a 32bit hash value for the given name based on the LCID
  774. */
  775. #ifdef _MAC
  776. #define LHashValOfName(lcid, szName) \
  777. LHashValOfNameSys(SYS_MAC, lcid, szName)
  778. #else
  779. #define LHashValOfName(lcid, szName) \
  780. LHashValOfNameSys(SYS_WIN32, lcid, szName)
  781. #endif
  782. /* compute a 16bit hash value from 32 bit hash value
  783. */
  784. #define WHashValOfLHashVal(lhashval) \
  785. ((unsigned short) (0x0000ffff & (lhashval)))
  786. /* Check if the hash values are compatible.
  787. */
  788. #define IsHashValCompatible(lhashval1, lhashval2) \
  789. ((BOOL) ((0x00ff0000 & (lhashval1)) == (0x00ff0000 & (lhashval2))))
  790. /* load the typelib from the file with the given filename
  791. */
  792. STDAPI
  793. LoadTypeLib(TCHAR FAR* szFile, ITypeLib FAR* FAR* pptlib);
  794. /* load registered typelib
  795. */
  796. STDAPI
  797. LoadRegTypeLib(
  798. REFGUID rguid,
  799. unsigned short wVerMajor,
  800. unsigned short wVerMinor,
  801. LCID lcid,
  802. ITypeLib FAR* FAR* pptlib);
  803. /* get path to registered typelib
  804. */
  805. STDAPI
  806. QueryPathOfRegTypeLib(
  807. REFGUID guid,
  808. unsigned short wMaj,
  809. unsigned short wMin,
  810. LCID lcid,
  811. LPBSTR lpbstrPathName);
  812. /* add typelib to registry
  813. */
  814. STDAPI
  815. RegisterTypeLib(
  816. ITypeLib FAR* ptlib,
  817. TCHAR FAR* szFullPath,
  818. TCHAR FAR* szHelpDir);
  819. STDAPI
  820. CreateTypeLib(SYSKIND syskind, LPSTR szFile, ICreateTypeLib FAR* FAR* ppctlib);
  821. /*---------------------------------------------------------------------*/
  822. /* IEnumVARIANT */
  823. /*---------------------------------------------------------------------*/
  824. #undef INTERFACE
  825. #define INTERFACE IEnumVARIANT
  826. DECLARE_INTERFACE_(IEnumVARIANT, IUnknown)
  827. {
  828. BEGIN_INTERFACE
  829. /* IUnknown methods */
  830. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  831. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  832. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  833. /* IEnumVARIANT methods */
  834. STDMETHOD(Next)(
  835. THIS_ unsigned long celt, VARIANT FAR* rgvar, unsigned long FAR* pceltFetched) PURE;
  836. STDMETHOD(Skip)(THIS_ unsigned long celt) PURE;
  837. STDMETHOD(Reset)(THIS) PURE;
  838. STDMETHOD(Clone)(THIS_ IEnumVARIANT FAR* FAR* ppenum) PURE;
  839. };
  840. typedef IEnumVARIANT FAR* LPENUMVARIANT;
  841. /*---------------------------------------------------------------------*/
  842. /* IDispatch */
  843. /*---------------------------------------------------------------------*/
  844. #undef INTERFACE
  845. #define INTERFACE IDispatch
  846. DECLARE_INTERFACE_(IDispatch, IUnknown)
  847. {
  848. BEGIN_INTERFACE
  849. /* IUnknown methods */
  850. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  851. STDMETHOD_(unsigned long, AddRef)(THIS) PURE;
  852. STDMETHOD_(unsigned long, Release)(THIS) PURE;
  853. /* IDispatch methods */
  854. STDMETHOD(GetTypeInfoCount)(THIS_ unsigned int FAR* pctinfo) PURE;
  855. STDMETHOD(GetTypeInfo)(
  856. THIS_
  857. unsigned int itinfo,
  858. LCID lcid,
  859. ITypeInfo FAR* FAR* pptinfo) PURE;
  860. STDMETHOD(GetIDsOfNames)(
  861. THIS_
  862. REFIID riid,
  863. TCHAR FAR* FAR* rgszNames,
  864. unsigned int cNames,
  865. LCID lcid,
  866. DISPID FAR* rgdispid) PURE;
  867. STDMETHOD(Invoke)(
  868. THIS_
  869. DISPID dispidMember,
  870. REFIID riid,
  871. LCID lcid,
  872. unsigned short wFlags,
  873. DISPPARAMS FAR* pdispparams,
  874. VARIANT FAR* pvarResult,
  875. EXCEPINFO FAR* pexcepinfo,
  876. unsigned int FAR* puArgErr) PURE;
  877. };
  878. typedef IDispatch FAR* LPDISPATCH;
  879. /* DISPID reserved for the standard "value" property */
  880. #define DISPID_VALUE 0
  881. /* DISPID reserved to indicate an "unknown" name */
  882. #define DISPID_UNKNOWN -1
  883. /* The following DISPID is reserved to indicate the param
  884. * that is the right-hand-side (or "put" value) of a PropertyPut
  885. */
  886. #define DISPID_PROPERTYPUT -3
  887. /* DISPID reserved for the standard "NewEnum" method */
  888. #define DISPID_NEWENUM -4
  889. /* DISPID reserved for the standard "Evaluate" method */
  890. #define DISPID_EVALUATE -5
  891. /*---------------------------------------------------------------------*/
  892. /* IDispatch implementation support */
  893. /*---------------------------------------------------------------------*/
  894. typedef struct FARSTRUCT tagPARAMDATA {
  895. TCHAR FAR* szName; /* parameter name */
  896. VARTYPE vt; /* parameter type */
  897. } PARAMDATA, FAR* LPPARAMDATA;
  898. typedef struct FARSTRUCT tagMETHODDATA {
  899. TCHAR FAR* szName; /* method name */
  900. PARAMDATA FAR* ppdata; /* pointer to an array of PARAMDATAs */
  901. DISPID dispid; /* method ID */
  902. unsigned int iMeth; /* method index */
  903. CALLCONV cc; /* calling convention */
  904. unsigned int cArgs; /* count of arguments */
  905. unsigned short wFlags; /* same wFlags as on IDispatch::Invoke() */
  906. VARTYPE vtReturn;
  907. } METHODDATA, FAR* LPMETHODDATA;
  908. typedef struct FARSTRUCT tagINTERFACEDATA {
  909. METHODDATA FAR* pmethdata; /* pointer to an array of METHODDATAs */
  910. unsigned int cMembers; /* count of members */
  911. } INTERFACEDATA, FAR* LPINTERFACEDATA;
  912. /* Locate the parameter indicated by the given position, and
  913. * return it coerced to the given target VARTYPE (vtTarg).
  914. */
  915. STDAPI
  916. DispGetParam(
  917. DISPPARAMS FAR* pdispparams,
  918. unsigned int position,
  919. VARTYPE vtTarg,
  920. VARIANT FAR* pvarResult,
  921. unsigned int FAR* puArgErr);
  922. /* Automatic TypeInfo driven implementation of IDispatch::GetIDsOfNames()
  923. */
  924. STDAPI
  925. DispGetIDsOfNames(
  926. ITypeInfo FAR* ptinfo,
  927. TCHAR FAR* FAR* rgszNames,
  928. unsigned int cNames,
  929. DISPID FAR* rgdispid);
  930. /* Automatic TypeInfo driven implementation of IDispatch::Invoke()
  931. */
  932. STDAPI
  933. DispInvoke(
  934. void FAR* _this,
  935. ITypeInfo FAR* ptinfo,
  936. DISPID dispidMember,
  937. unsigned short wFlags,
  938. DISPPARAMS FAR* pparams,
  939. VARIANT FAR* pvarResult,
  940. EXCEPINFO FAR* pexcepinfo,
  941. unsigned int FAR* puArgErr);
  942. /* Construct a TypeInfo from an interface data description
  943. */
  944. STDAPI
  945. CreateDispTypeInfo(
  946. INTERFACEDATA FAR* pidata,
  947. LCID lcid,
  948. ITypeInfo FAR* FAR* pptinfo);
  949. /* Create an instance of the standard TypeInfo driven IDispatch
  950. * implementation.
  951. */
  952. STDAPI
  953. CreateStdDispatch(
  954. IUnknown FAR* punkOuter,
  955. void FAR* pvThis,
  956. ITypeInfo FAR* ptinfo,
  957. IUnknown FAR* FAR* ppunkStdDisp);
  958. /*---------------------------------------------------------------------*/
  959. /* Active Object Registration API */
  960. /*---------------------------------------------------------------------*/
  961. STDAPI
  962. RegisterActiveObject(
  963. IUnknown FAR* punk,
  964. REFCLSID rclsid,
  965. void FAR* pvReserved,
  966. unsigned long FAR* pdwRegister);
  967. STDAPI
  968. RevokeActiveObject(
  969. unsigned long dwRegister,
  970. void FAR* pvReserved);
  971. STDAPI
  972. GetActiveObject(
  973. REFCLSID rclsid,
  974. void FAR* pvReserved,
  975. IUnknown FAR* FAR* ppunk);
  976. #undef UNION_NAME
  977. #endif /* _DISPATCH_H_ */