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.

1009 lines
28 KiB

  1. /***
  2. *dispatch.h - Application Programmability 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. #ifdef _MAC
  17. DEFINE_OLEGUID(IID_IDispatch, 0x00, 0x04, 0x02, 0, 0, 0, 0, 0);
  18. DEFINE_OLEGUID(IID_IEnumVARIANT, 0x04, 0x04, 0x02, 0, 0, 0, 0, 0);
  19. DEFINE_OLEGUID(IID_ITypeInfo, 0x01, 0x04, 0x02, 0, 0, 0, 0, 0);
  20. DEFINE_OLEGUID(IID_ITypeLib, 0x02, 0x04, 0x02, 0, 0, 0, 0, 0);
  21. DEFINE_OLEGUID(IID_ITypeComp, 0x03, 0x04, 0x02, 0, 0, 0, 0, 0);
  22. DEFINE_OLEGUID(IID_ICreateTypeInfo, 0x05, 0x04, 0x02, 0, 0, 0, 0, 0);
  23. DEFINE_OLEGUID(IID_ICreateTypeLib, 0x06, 0x04, 0x02, 0, 0, 0, 0, 0);
  24. #else
  25. DEFINE_OLEGUID(IID_IDispatch, 0x00020400L, 0, 0);
  26. DEFINE_OLEGUID(IID_IEnumVARIANT, 0x00020404L, 0, 0);
  27. DEFINE_OLEGUID(IID_ITypeInfo, 0x00020401L, 0, 0);
  28. DEFINE_OLEGUID(IID_ITypeLib, 0x00020402L, 0, 0);
  29. DEFINE_OLEGUID(IID_ITypeComp, 0x00020403L, 0, 0);
  30. DEFINE_OLEGUID(IID_ICreateTypeInfo, 0x00020405L, 0, 0);
  31. DEFINE_OLEGUID(IID_ICreateTypeLib, 0x00020406L, 0, 0);
  32. #endif
  33. /* forward declarations */
  34. #ifdef __cplusplus
  35. interface IDispatch;
  36. interface IEnumVARIANT;
  37. interface ITypeInfo;
  38. interface ITypeLib;
  39. interface ITypeComp;
  40. interface ICreateTypeInfo;
  41. interface ICreateTypeLib;
  42. #else
  43. typedef interface IDispatch IDispatch;
  44. typedef interface IEnumVARIANT IEnumVARIANT;
  45. typedef interface ITypeInfo ITypeInfo;
  46. typedef interface ITypeLib ITypeLib;
  47. typedef interface ITypeComp ITypeComp;
  48. typedef interface ICreateTypeInfo ICreateTypeInfo;
  49. typedef interface ICreateTypeLib ICreateTypeLib;
  50. #endif
  51. /* IDispatch related error codes */
  52. #define DISP_ERROR(X) MAKE_SCODE(SEVERITY_ERROR, FACILITY_DISPATCH, X)
  53. #define DISP_E_UNKNOWNINTERFACE DISP_ERROR(1)
  54. #define DISP_E_MEMBERNOTFOUND DISP_ERROR(3)
  55. #define DISP_E_PARAMNOTFOUND DISP_ERROR(4)
  56. #define DISP_E_TYPEMISMATCH DISP_ERROR(5)
  57. #define DISP_E_UNKNOWNNAME DISP_ERROR(6)
  58. #define DISP_E_NONAMEDARGS DISP_ERROR(7)
  59. #define DISP_E_BADVARTYPE DISP_ERROR(8)
  60. #define DISP_E_EXCEPTION DISP_ERROR(9)
  61. #define DISP_E_OVERFLOW DISP_ERROR(10)
  62. #define DISP_E_BADINDEX DISP_ERROR(11)
  63. #define DISP_E_UNKNOWNLCID DISP_ERROR(12)
  64. #define DISP_E_ARRAYISLOCKED DISP_ERROR(13)
  65. #define DISP_E_BADPARAMCOUNT DISP_ERROR(14)
  66. #define DISP_E_PARAMNOTOPTIONAL DISP_ERROR(15)
  67. #define DISP_E_BADCALLEE DISP_ERROR(16)
  68. #define DISP_E_NOTACOLLECTION DISP_ERROR(17)
  69. #define TYPE_ERROR(X) MAKE_SCODE(SEVERITY_ERROR, FACILITY_DISPATCH, X)
  70. #define TYPE_E_IOERROR TYPE_ERROR( 57)
  71. #define TYPE_E_COMPILEERROR TYPE_ERROR( 90)
  72. #define TYPE_E_CANTCREATETMPFILE TYPE_ERROR( 322)
  73. #define TYPE_E_ILLEGALINDEX TYPE_ERROR( 341)
  74. #define TYPE_E_IDNOTFOUND TYPE_ERROR( 1000)
  75. #define TYPE_E_BUFFERTOOSMALL TYPE_ERROR(32790)
  76. #define TYPE_E_READONLY TYPE_ERROR(32791)
  77. #define TYPE_E_INVDATAREAD TYPE_ERROR(32792)
  78. #define TYPE_E_UNSUPFORMAT TYPE_ERROR(32793)
  79. #define TYPE_E_ALREADYCONTAINSNAME TYPE_ERROR(32794)
  80. #define TYPE_E_NOMATCHINGARITY TYPE_ERROR(32795)
  81. #define TYPE_E_REGISTRYACCESS TYPE_ERROR(32796)
  82. #define TYPE_E_LIBNOTREGISTERED TYPE_ERROR(32797)
  83. #define TYPE_E_DUPLICATEDEFINITION TYPE_ERROR(32798)
  84. #define TYPE_E_USAGE TYPE_ERROR(32799)
  85. #define TYPE_E_DESTNOTKNOWN TYPE_ERROR(32800)
  86. #define TYPE_E_UNDEFINEDTYPE TYPE_ERROR(32807)
  87. #define TYPE_E_QUALIFIEDNAMEDISALLOWED TYPE_ERROR(32808)
  88. #define TYPE_E_INVALIDSTATE TYPE_ERROR(32809)
  89. #define TYPE_E_WRONGTYPEKIND TYPE_ERROR(32810)
  90. #define TYPE_E_ELEMENTNOTFOUND TYPE_ERROR(32811)
  91. #define TYPE_E_AMBIGUOUSNAME TYPE_ERROR(32812)
  92. #define TYPE_E_INVOKEFUNCTIONMISMATCH TYPE_ERROR(32813)
  93. #define TYPE_E_DLLFUNCTIONNOTFOUND TYPE_ERROR(32814)
  94. #define TYPE_E_BADMODULEKIND TYPE_ERROR(35005)
  95. #define TYPE_E_WRONGPLATFORM TYPE_ERROR(35006)
  96. #define TYPE_E_ALREADYBEINGLAIDOUT TYPE_ERROR(35007)
  97. #define TYPE_E_CANTLOADLIBRARY TYPE_ERROR(40010)
  98. /* if not already picked up from olenls.h */
  99. #ifndef _LCID_DEFINED
  100. typedef DWORD LCID;
  101. # define _LCID_DEFINED
  102. #endif
  103. /*---------------------------------------------------------------------*/
  104. /* BSTR API */
  105. /*---------------------------------------------------------------------*/
  106. STDAPI_(BSTR) SysAllocString(char FAR*);
  107. STDAPI_(BOOL) SysReAllocString(BSTR FAR*, char FAR*);
  108. STDAPI_(BSTR) SysAllocStringLen(char FAR*, UINT);
  109. STDAPI_(BOOL) SysReAllocStringLen(BSTR FAR*, char FAR*, UINT);
  110. STDAPI_(void) SysFreeString(BSTR);
  111. STDAPI_(UINT) SysStringLen(BSTR);
  112. /*---------------------------------------------------------------------*/
  113. /* Time API */
  114. /*---------------------------------------------------------------------*/
  115. STDAPI_(BOOL)
  116. DosDateTimeToVariantTime(
  117. WORD wDosDate,
  118. WORD wDosTime,
  119. double FAR* pvtime);
  120. STDAPI_(BOOL)
  121. VariantTimeToDosDateTime(
  122. double vtime,
  123. WORD FAR* pwDosDate,
  124. WORD FAR* pwDosTime);
  125. /*---------------------------------------------------------------------*/
  126. /* SafeArray API */
  127. /*---------------------------------------------------------------------*/
  128. STDAPI_(SAFEARRAY FAR*)
  129. SafeArrayCreate(
  130. VARTYPE vt,
  131. UINT cDims,
  132. SAFEARRAYBOUND FAR* rgsabound);
  133. STDAPI SafeArrayDestroy(SAFEARRAY FAR* psa);
  134. STDAPI_(UINT) SafeArrayGetDim(SAFEARRAY FAR* psa);
  135. STDAPI_(UINT) SafeArrayGetElemsize(SAFEARRAY FAR* psa);
  136. STDAPI
  137. SafeArrayGetUBound(
  138. SAFEARRAY FAR* psa,
  139. UINT nDim,
  140. LONG FAR* plUbound);
  141. STDAPI
  142. SafeArrayGetLBound(
  143. SAFEARRAY FAR* psa,
  144. UINT nDim,
  145. LONG FAR* plLbound);
  146. STDAPI SafeArrayLock(SAFEARRAY FAR* psa);
  147. STDAPI SafeArrayUnlock(SAFEARRAY FAR* psa);
  148. STDAPI SafeArrayAccessData(SAFEARRAY FAR* psa, void FAR* HUGEP* ppvData);
  149. STDAPI SafeArrayUnaccessData(SAFEARRAY FAR* psa);
  150. STDAPI
  151. SafeArrayGetElement(
  152. SAFEARRAY FAR* psa,
  153. LONG FAR* rgIndices,
  154. void FAR* pv);
  155. STDAPI
  156. SafeArrayPutElement(
  157. SAFEARRAY FAR* psa,
  158. LONG FAR* rgIndices,
  159. void FAR* pv);
  160. /* return a copy of the given SafeArray
  161. */
  162. STDAPI
  163. SafeArrayCopy(
  164. SAFEARRAY FAR* psa,
  165. SAFEARRAY FAR* FAR* ppsaOut);
  166. /*---------------------------------------------------------------------*/
  167. /* VARIANT API */
  168. /*---------------------------------------------------------------------*/
  169. STDAPI_(void)
  170. VariantInit(
  171. VARIANTARG FAR* pvarg);
  172. STDAPI
  173. VariantClear(VARIANTARG FAR* pvarg);
  174. STDAPI
  175. VariantCopy(
  176. VARIANTARG FAR* pvargDest,
  177. VARIANTARG FAR* pvargSrc);
  178. STDAPI
  179. VariantCopyInd(
  180. VARIANT FAR* pvarDest,
  181. VARIANTARG FAR* pvargSrc);
  182. STDAPI
  183. VariantChangeType(
  184. VARIANTARG FAR* pvargDest,
  185. VARIANTARG FAR* pvarSrc,
  186. WORD wFlags,
  187. VARTYPE vt);
  188. #define VARIANT_NOVALUEPROP 1
  189. /*---------------------------------------------------------------------*/
  190. /* ITypeLib */
  191. /*---------------------------------------------------------------------*/
  192. typedef struct FARSTRUCT tagTLIBATTR {
  193. LCID lcid; /* locale of the TypeLibrary */
  194. WORD wMajorVerNum; /* major version number */
  195. WORD wMinorVerNum; /* minor version number */
  196. GUID guid; /* globally unique library id */
  197. } TLIBATTR, FAR* LPTLIBATTR;
  198. #undef INTERFACE
  199. #define INTERFACE ITypeLib
  200. DECLARE_INTERFACE_(ITypeLib, IUnknown)
  201. {
  202. /* IUnknown methods */
  203. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  204. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  205. STDMETHOD_(ULONG, Release)(THIS) PURE;
  206. /* ITypeLib methods */
  207. STDMETHOD_(UINT,GetTypeInfoCount)(THIS) PURE;
  208. STDMETHOD(GetTypeInfo)(THIS_
  209. UINT index, ITypeInfo FAR* FAR* pptinfo) PURE;
  210. STDMETHOD(GetTypeInfoOfGuid)(THIS_
  211. REFGUID guid, ITypeInfo FAR* FAR* pptinfo) PURE;
  212. STDMETHOD(GetLibAttr)(THIS_
  213. TLIBATTR FAR* FAR* pptlibattr) PURE;
  214. STDMETHOD(GetTypeComp)(THIS_
  215. ITypeComp FAR* FAR* pptcomp) PURE;
  216. STDMETHOD(GetDocumentation)(THIS_
  217. int index,
  218. BSTR FAR* pbstrName,
  219. BSTR FAR* pbstrDocString,
  220. DWORD FAR* pdwHelpContext,
  221. BSTR FAR* pbstrHelpFile) PURE;
  222. STDMETHOD(IsName)(THIS_
  223. LPSTR szNameBuf, WORD wHashVal, BOOL FAR* pfName) PURE;
  224. STDMETHOD_(void, ReleaseTLibAttr)(THIS_ TLIBATTR FAR* ptlibattr) PURE;
  225. STDMETHOD(Load)(THIS_
  226. IStorage FAR* pstg, LPSTR szFileName) PURE;
  227. };
  228. typedef ITypeLib FAR* LPTYPELIB;
  229. /*---------------------------------------------------------------------*/
  230. /* ITypeInfo */
  231. /*---------------------------------------------------------------------*/
  232. typedef LONG DISPID;
  233. typedef DISPID MEMBERID;
  234. #define MEMBERID_NIL DISPID_UNKNOWN
  235. #define ID_DEFAULTINST -2
  236. typedef DWORD HREFTYPE;
  237. typedef enum tagTYPEKIND {
  238. TKIND_ENUM = 0,
  239. TKIND_RECORD,
  240. TKIND_MODULE,
  241. TKIND_INTERFACE,
  242. TKIND_DISPATCH,
  243. TKIND_COCLASS,
  244. TKIND_ALIAS,
  245. TKIND_UNION,
  246. TKIND_ENCUNION,
  247. TKIND_Class,
  248. TKIND_MAX /* end of enum marker */
  249. } TYPEKIND;
  250. typedef struct FARSTRUCT tagTYPEDESC {
  251. VARTYPE vt;
  252. union {
  253. /* VT_PTR - the pointed-at type */
  254. struct FARSTRUCT tagTYPEDESC FAR* lptdesc;
  255. /* VT_CARRAY */
  256. struct FARSTRUCT tagARRAYDESC FAR* lpadesc;
  257. /* VT_USERDEFINED - this is used to get a TypeInfo for the UDT */
  258. HREFTYPE hreftype;
  259. }
  260. #ifdef NONAMELESSUNION
  261. u
  262. #endif
  263. ;
  264. } TYPEDESC;
  265. typedef struct FARSTRUCT tagARRAYDESC {
  266. TYPEDESC tdescElem; /* element type */
  267. USHORT cDims; /* dimension count */
  268. SAFEARRAYBOUND rgbounds[1]; /* variable length array of bounds */
  269. } ARRAYDESC;
  270. typedef struct FARSTRUCT tagIDLDESC {
  271. WORD wIDLFlags; /* IN, OUT, etc */
  272. BSTR bstrIDLInfo;
  273. } IDLDESC, FAR* LPIDLDESC;
  274. #define IDLFLAG_NONE 0
  275. #define IDLFLAG_FIN 0x1
  276. #define IDLFLAG_FOUT 0x2
  277. typedef struct FARSTRUCT tagELEMDESC {
  278. TYPEDESC tdesc; /* the type of the element */
  279. IDLDESC idldesc; /* info for remoting the element */
  280. } ELEMDESC, FAR* LPELEMDESC;
  281. typedef struct FARSTRUCT tagTYPEATTR {
  282. TYPEKIND typekind; /* the kind of type this typeinfo describes */
  283. WORD wMajorVerNum; /* major version number */
  284. WORD wMinorVerNum; /* minor version number */
  285. LCID lcid; /* locale of member names and doc strings */
  286. WORD cFuncs; /* number of functions */
  287. WORD cVars; /* number of variables / data members */
  288. WORD cImplTypes; /* number of implemented interfaces */
  289. TYPEDESC tdescAlias; /* if typekind == TKIND_ALIAS this field
  290. specifies the type for which this type
  291. is an alias */
  292. GUID guid; /* the GUID of the TypeInfo */
  293. WORD wTypeFlags;
  294. DWORD dwReserved;
  295. WORD cbAlignment; /* specifies the alignment requirements for
  296. an instance of this type,
  297. 0 = align on 64k boundary
  298. 1 = byte align
  299. 2 = word align
  300. 4 = dword align... */
  301. WORD cbSizeInstance; /* the size of an instance of this type */
  302. WORD cbSizeVft; /* the size of this types virtual func table */
  303. IDLDESC idldescType; /* IDL attributes of the described type */
  304. MEMBERID memidConstructor; /* ID of constructor, MEMBERID_NIL if none */
  305. MEMBERID memidDestructor; /* ID of destructor, MEMBERID_NIL if none */
  306. } TYPEATTR, FAR* LPTYPEATTR;
  307. typedef struct FARSTRUCT tagDISPPARAMS{
  308. VARIANTARG FAR* rgvarg;
  309. DISPID FAR* rgdispidNamedArgs;
  310. UINT cArgs;
  311. UINT cNamedArgs;
  312. } DISPPARAMS;
  313. typedef struct FARSTRUCT tagEXCEPINFO {
  314. WORD wCode; /* An error code describing the error. */
  315. WORD wReserved;
  316. BSTR bstrSource; /* A textual, human readable name of the
  317. source of the exception. It is up to the
  318. IDispatch implementor to fill this in.
  319. Typically this will be an application name. */
  320. BSTR bstrDescription; /* A textual, human readable description of the
  321. error. If no description is available, NULL
  322. should be used. */
  323. BSTR bstrHelpFile; /* Fully qualified drive, path, and file name
  324. of a help file with more information about
  325. the error. If no help is available, NULL
  326. should be used. */
  327. DWORD dwHelpContext; /* help context of topic within the help file. */
  328. void FAR* pvReserved;
  329. HRESULT (STDAPICALLTYPE FAR* pfnDeferredFillIn)(struct tagEXCEPINFO FAR*);
  330. /* Use of this field allows an application
  331. to defer filling in the bstrDescription,
  332. bstrHelpFile, and dwHelpContext fields
  333. until they are needed. This field might
  334. be used, for example, if loading the
  335. string for the error is a time-consuming
  336. operation. If deferred fill-in is not
  337. desired, this field should be set to NULL. */
  338. DWORD dwReserved;
  339. } EXCEPINFO, FAR* LPEXCEPINFO;
  340. typedef enum tagCALLCONV {
  341. CC_CDECL = 1,
  342. CC_MSCPASCAL,
  343. CC_PASCAL = CC_MSCPASCAL,
  344. CC_MACPASCAL,
  345. CC_STDCALL,
  346. CC_THISCALL,
  347. CC_MAX /* end of enum marker */
  348. } CALLCONV;
  349. typedef enum tagFUNCKIND {
  350. FUNC_VIRTUAL,
  351. FUNC_PUREVIRTUAL,
  352. FUNC_NONVIRTUAL,
  353. FUNC_STATIC,
  354. FUNC_DISPATCH
  355. } FUNCKIND;
  356. /* Flags for IDispatch::Invoke */
  357. #define DISPATCH_METHOD 0x1
  358. #define DISPATCH_PROPERTYGET 0x2
  359. #define DISPATCH_PROPERTYPUT 0x4
  360. #define DISPATCH_PROPERTYPUTREF 0x8
  361. typedef enum tagINVOKEKIND {
  362. INVOKE_FUNC = DISPATCH_METHOD,
  363. INVOKE_PROPERTYGET = DISPATCH_PROPERTYGET,
  364. INVOKE_PROPERTYPUT = DISPATCH_PROPERTYPUT,
  365. INVOKE_PROPERTYPUTREF = DISPATCH_PROPERTYPUTREF
  366. } INVOKEKIND;
  367. typedef struct FARSTRUCT tagFUNCDESC {
  368. MEMBERID memid;
  369. FUNCKIND funckind;
  370. INVOKEKIND invkind;
  371. CALLCONV callconv;
  372. SHORT cParams;
  373. SHORT cParamsOpt;
  374. SHORT oVft;
  375. WORD wFuncFlags;
  376. ELEMDESC elemdescFunc;
  377. ELEMDESC FAR* lprgelemdescParam; /* array of parameter types */
  378. SHORT cScodes;
  379. SCODE FAR* lprgscode;
  380. } FUNCDESC, FAR* LPFUNCDESC;
  381. typedef enum tagVARKIND {
  382. VAR_PERINSTANCE,
  383. VAR_STATIC,
  384. VAR_CONST,
  385. VAR_DISPATCH
  386. } VARKIND;
  387. typedef struct FARSTRUCT tagVARDESC {
  388. MEMBERID memid;
  389. WORD wVarFlags;
  390. VARKIND varkind;
  391. ELEMDESC elemdescVar;
  392. union {
  393. ULONG oInst; /* VAR_PERINSTANCE - the offset of this
  394. variable within the instance */
  395. VARIANT FAR* lpvarValue; /* VAR_CONST - the value of the constant */
  396. }
  397. #ifdef NONAMELESSUNION
  398. u
  399. #endif
  400. ;
  401. } VARDESC, FAR* LPVARDESC;
  402. typedef enum tagTYPEFLAGS {
  403. TYPEFLAG_FAPPOBJECT = 1,
  404. TYPEFLAG_FCANCREATE = 2
  405. } TYPEFLAGS;
  406. typedef enum tagFUNCFLAGS {
  407. FUNCFLAG_FRESTRICTED = 1
  408. } FUNCFLAGS;
  409. typedef enum tagVARFLAGS {
  410. VARFLAG_FREADONLY = 1
  411. } VARFLAGS;
  412. #undef INTERFACE
  413. #define INTERFACE ITypeInfo
  414. DECLARE_INTERFACE_(ITypeInfo, IUnknown)
  415. {
  416. /* IUnknown methods */
  417. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  418. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  419. STDMETHOD_(ULONG, Release)(THIS) PURE;
  420. /* ITypeInfo methods */
  421. STDMETHOD(GetTypeAttr)(THIS_ TYPEATTR FAR* FAR* pptypeattr) PURE;
  422. STDMETHOD(GetTypeComp)(THIS_ ITypeComp FAR* FAR* pptcomp) PURE;
  423. STDMETHOD(GetFuncDesc)(THIS_
  424. UINT index, FUNCDESC FAR* FAR* ppfuncdesc) PURE;
  425. STDMETHOD(GetVarDesc)(THIS_
  426. UINT index, VARDESC FAR* FAR* ppvardesc) PURE;
  427. STDMETHOD(GetNames)(THIS_
  428. MEMBERID memid,
  429. BSTR FAR* rgbstrNames,
  430. UINT cMaxNames,
  431. UINT FAR* pcNames) PURE;
  432. STDMETHOD(GetRefTypeOfImplType)(THIS_
  433. UINT index, HREFTYPE FAR* phreftype) PURE;
  434. STDMETHOD(GetIDsOfNames)(THIS_
  435. char FAR* FAR* rgszNames, UINT cNames, MEMBERID FAR* rgmemid) PURE;
  436. STDMETHOD(Invoke)(THIS_
  437. void FAR* pvInstance,
  438. MEMBERID memid,
  439. WORD wFlags,
  440. DISPPARAMS FAR *pdispparams,
  441. VARIANT FAR *pvarResult,
  442. EXCEPINFO FAR *pexcepinfo,
  443. UINT FAR *puArgErr) PURE;
  444. STDMETHOD(GetDocumentation)(THIS_
  445. MEMBERID memid,
  446. BSTR FAR* pbstrName,
  447. BSTR FAR* pbstrDocString,
  448. DWORD FAR* pdwHelpContext,
  449. BSTR FAR* pbstrHelpFile) PURE;
  450. STDMETHOD(GetDllEntry)(THIS_
  451. MEMBERID memid,
  452. BSTR FAR* pbstrDllName,
  453. BSTR FAR* pbstrName,
  454. WORD FAR* pwOrdinal) PURE;
  455. STDMETHOD(GetRefTypeInfo)(THIS_
  456. HREFTYPE hreftype, ITypeInfo FAR* FAR* pptinfo) PURE;
  457. STDMETHOD(AddressOfMember)(THIS_
  458. MEMBERID memid, INVOKEKIND invkind, void FAR* FAR* ppv) PURE;
  459. STDMETHOD(CreateInstance)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  460. STDMETHOD(GetMops)(THIS_ MEMBERID memid, BSTR FAR* pbstrMops) PURE;
  461. STDMETHOD(GetContainingTypeLib)(THIS_
  462. ITypeLib FAR* FAR* pptlib, UINT FAR* pindex) PURE;
  463. STDMETHOD_(void, ReleaseTypeAttr)(THIS_ TYPEATTR FAR* ptypeattr) PURE;
  464. STDMETHOD_(void, ReleaseFuncDesc)(THIS_ FUNCDESC FAR* pfuncdesc) PURE;
  465. STDMETHOD_(void, ReleaseVarDesc)(THIS_ VARDESC FAR* pvardesc) PURE;
  466. };
  467. typedef ITypeInfo FAR* LPTYPEINFO;
  468. /*---------------------------------------------------------------------*/
  469. /* ITypeComp */
  470. /*---------------------------------------------------------------------*/
  471. typedef enum tagDESCKIND {
  472. DESCKIND_NONE = 0,
  473. DESCKIND_FUNCDESC,
  474. DESCKIND_VARDESC,
  475. DESCKIND_TYPECOMP,
  476. DESCKIND_MAX /* end of enum marker */
  477. } DESCKIND;
  478. typedef union tagBINDPTR {
  479. FUNCDESC FAR* lpfuncdesc;
  480. VARDESC FAR* lpvardesc;
  481. ITypeComp FAR* lptcomp;
  482. } BINDPTR, FAR* LPBINDPTR;
  483. #undef INTERFACE
  484. #define INTERFACE ITypeComp
  485. DECLARE_INTERFACE_(ITypeComp, IUnknown)
  486. {
  487. /* IUnknown methods */
  488. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  489. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  490. STDMETHOD_(ULONG, Release)(THIS) PURE;
  491. /* ITypeComp methods */
  492. STDMETHOD(Bind)(THIS_
  493. LPSTR szName,
  494. WORD wHashVal,
  495. WORD wflags,
  496. ITypeInfo FAR* FAR* pptinfo,
  497. DESCKIND FAR* pdesckind,
  498. BINDPTR FAR* pbindptr) PURE;
  499. STDMETHOD(BindType)(THIS_
  500. LPSTR szName,
  501. WORD wHashVal,
  502. ITypeInfo FAR* FAR* pptinfo,
  503. ITypeComp FAR* FAR* pptcomp) PURE;
  504. };
  505. typedef ITypeComp FAR* LPTYPECOMP;
  506. /*---------------------------------------------------------------------*/
  507. /* ICreateTypeLib */
  508. /*---------------------------------------------------------------------*/
  509. #undef INTERFACE
  510. #define INTERFACE ICreateTypeLib
  511. DECLARE_INTERFACE_(ICreateTypeLib, IUnknown)
  512. {
  513. /* IUnknown methods */
  514. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  515. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  516. STDMETHOD_(ULONG, Release)(THIS) PURE;
  517. /* ICreateTypeLib methods */
  518. STDMETHOD(CreateTypeInfo)(THIS_
  519. LPSTR szName,
  520. TYPEKIND tkind,
  521. ICreateTypeInfo FAR* FAR* lplpictinfo) PURE;
  522. STDMETHOD(SetName)(THIS_ LPSTR szName) PURE;
  523. STDMETHOD(SetVersion)(THIS_
  524. WORD wMajorVerNum, WORD wMinorVerNum) PURE;
  525. STDMETHOD(SetGuid) (THIS_ REFGUID guid) PURE;
  526. STDMETHOD(SetDocString)(THIS_ LPSTR szDoc) PURE;
  527. STDMETHOD(SetHelpFileName)(THIS_ LPSTR szHelpFileName) PURE;
  528. STDMETHOD(SetHelpContext)(THIS_ DWORD dwHelpContext) PURE;
  529. STDMETHOD(SetLcid)(THIS_ LCID lcid) PURE;
  530. STDMETHOD(SaveAllChanges)(THIS_ IStorage FAR* pstg) PURE;
  531. };
  532. typedef ICreateTypeLib FAR* LPCREATETYPELIB;
  533. /*---------------------------------------------------------------------*/
  534. /* ICreateTypeInfo */
  535. /*---------------------------------------------------------------------*/
  536. #undef INTERFACE
  537. #define INTERFACE ICreateTypeInfo
  538. DECLARE_INTERFACE_(ICreateTypeInfo, IUnknown)
  539. {
  540. /* IUnknown methods */
  541. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  542. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  543. STDMETHOD_(ULONG, Release)(THIS) PURE;
  544. /* ICreateTypeInfo methods */
  545. STDMETHOD(SetGuid)(THIS_ REFGUID guid) PURE;
  546. STDMETHOD(SetTypeFlags)(THIS_ UINT uTypeFlags) PURE;
  547. STDMETHOD(SetDocString)(THIS_ LPSTR pstrDoc) PURE;
  548. STDMETHOD(SetHelpContext)(THIS_ DWORD dwHelpContext) PURE;
  549. STDMETHOD(SetVersion)(THIS_
  550. WORD wMajorVerNum, WORD wMinorVerNum) PURE;
  551. STDMETHOD(AddRefTypeInfo)(THIS_
  552. ITypeInfo FAR* ptinfo, HREFTYPE FAR* phreftype) PURE;
  553. STDMETHOD(AddFuncDesc)(THIS_
  554. UINT index, FUNCDESC FAR* pfuncdesc) PURE;
  555. STDMETHOD(AddImplType)(THIS_
  556. UINT index, HREFTYPE hreftype) PURE;
  557. STDMETHOD(AddVarDesc)(THIS_
  558. UINT index, VARDESC FAR* pvardesc) PURE;
  559. STDMETHOD(SetFuncAndParamNames)(THIS_
  560. UINT index, LPSTR FAR* rgszNames, UINT cNames) PURE;
  561. STDMETHOD(SetVarName)(THIS_
  562. UINT index, LPSTR szName) PURE;
  563. STDMETHOD(SetTypeDescAlias)(THIS_
  564. TYPEDESC FAR* ptdescAlias) PURE;
  565. STDMETHOD(DefineFuncAsDllEntry)(THIS_
  566. UINT index, LPSTR szDllName, LPSTR szProcName) PURE;
  567. STDMETHOD(SetFuncDocString)(THIS_
  568. UINT index, LPSTR szDocString) PURE;
  569. STDMETHOD(SetVarDocString)(THIS_
  570. UINT index, LPSTR szDocString) PURE;
  571. STDMETHOD(SetFuncHelpContext)(THIS_
  572. UINT index, DWORD dwHelpContext) PURE;
  573. STDMETHOD(SetVarHelpContext)(THIS_
  574. UINT index, DWORD dwHelpContext) PURE;
  575. STDMETHOD(SetMops)(THIS_
  576. UINT index, BSTR bstrMops) PURE;
  577. STDMETHOD(SetTypeIdldesc)(THIS_
  578. IDLDESC FAR* pidldesc) PURE;
  579. STDMETHOD(LayOut)(THIS) PURE;
  580. };
  581. typedef ICreateTypeInfo FAR* LPCREATETYPEINFO;
  582. /*---------------------------------------------------------------------*/
  583. /* TypeInfo APIs */
  584. /*---------------------------------------------------------------------*/
  585. /* compute a 16bit hash value for the given name
  586. */
  587. STDAPI_(WORD)
  588. WHashValOfName(LPSTR szName);
  589. /* load the typelib from the file with the given filename
  590. */
  591. STDAPI
  592. LoadTypeLib(LPSTR szFile, ITypeLib FAR* FAR* pptlib);
  593. /* load registered typelib
  594. */
  595. STDAPI
  596. LoadRegTypeLib(
  597. REFGUID rguid,
  598. WORD wVerMajor,
  599. WORD wVerMinor,
  600. LCID lcid,
  601. ITypeLib FAR* FAR* pptlib);
  602. /* add typelib to registry
  603. */
  604. STDAPI
  605. RegisterTypeLib(ITypeLib FAR* ptlib, LPSTR szFullPath, LPSTR szHelpDir);
  606. /* remove typelib from registry
  607. */
  608. STDAPI
  609. DeregisterTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor, LCID lcid);
  610. typedef enum tagSYSKIND {
  611. SYS_WIN16,
  612. SYS_WIN32,
  613. SYS_MAC
  614. } SYSKIND;
  615. STDAPI
  616. CreateTypeLib(SYSKIND syskind, ICreateTypeLib FAR* FAR* ppctlib);
  617. /*---------------------------------------------------------------------*/
  618. /* IEnumVARIANT */
  619. /*---------------------------------------------------------------------*/
  620. #undef INTERFACE
  621. #define INTERFACE IEnumVARIANT
  622. DECLARE_INTERFACE_(IEnumVARIANT, IUnknown)
  623. {
  624. /* IUnknown methods */
  625. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  626. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  627. STDMETHOD_(ULONG, Release)(THIS) PURE;
  628. /* IEnumVARIANT methods */
  629. STDMETHOD(Next)(
  630. THIS_ ULONG celt, VARIANT FAR* rgvar, ULONG FAR* pceltFetched) PURE;
  631. STDMETHOD(Skip)(THIS_ ULONG celt) PURE;
  632. STDMETHOD(Reset)(THIS) PURE;
  633. STDMETHOD(Clone)(THIS_ IEnumVARIANT FAR* FAR* ppenum) PURE;
  634. };
  635. typedef IEnumVARIANT FAR* LPENUMVARIANT;
  636. /*---------------------------------------------------------------------*/
  637. /* IDispatch */
  638. /*---------------------------------------------------------------------*/
  639. #undef INTERFACE
  640. #define INTERFACE IDispatch
  641. DECLARE_INTERFACE_(IDispatch, IUnknown)
  642. {
  643. /* IUnknown methods */
  644. STDMETHOD(QueryInterface)(THIS_ REFIID riid, void FAR* FAR* ppvObj) PURE;
  645. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  646. STDMETHOD_(ULONG, Release)(THIS) PURE;
  647. /* IDispatch methods */
  648. STDMETHOD(GetTypeInfoCount)(THIS_ UINT FAR* pctinfo) PURE;
  649. STDMETHOD(GetTypeInfo)(
  650. THIS_
  651. UINT itinfo,
  652. LCID lcid,
  653. ITypeInfo FAR* FAR* pptinfo) PURE;
  654. STDMETHOD(GetIDsOfNames)(
  655. THIS_
  656. REFIID riid,
  657. char FAR* FAR* rgszNames,
  658. UINT cNames,
  659. LCID lcid,
  660. DISPID FAR* rgdispid) PURE;
  661. STDMETHOD(Invoke)(
  662. THIS_
  663. DISPID dispidMember,
  664. REFIID riid,
  665. LCID lcid,
  666. WORD wFlags,
  667. DISPPARAMS FAR* pdispparams,
  668. VARIANT FAR* pvarResult,
  669. EXCEPINFO FAR* pexcepinfo,
  670. UINT FAR* puArgErr) PURE;
  671. };
  672. typedef IDispatch FAR* LPDISPATCH;
  673. /* DISPID reserved for the standard "value" property */
  674. #define DISPID_VALUE 0
  675. /* DISPID reserved to indicate an "unknown" name */
  676. #define DISPID_UNKNOWN -1
  677. /* The following DISPID is reserved to indicate the param
  678. * that is the right-hand-side (or "put" value) of a PropertyPut
  679. */
  680. #define DISPID_PROPERTYPUT -3
  681. /* DISPID reserved for the standard "NewEnum" method */
  682. #define DISPID_NEWENUM -4
  683. /* DISPID reserved for the standard "Evaluate" method */
  684. #define DISPID_EVALUATE -5
  685. /*---------------------------------------------------------------------*/
  686. /* IDispatch implementation support */
  687. /*---------------------------------------------------------------------*/
  688. typedef struct FARSTRUCT tagPARAMDATA {
  689. char FAR* szName; /* parameter name */
  690. VARTYPE vt; /* parameter type */
  691. } PARAMDATA, FAR* LPPARAMDATA;
  692. typedef struct FARSTRUCT tagMETHODDATA {
  693. char FAR* szName; /* method name */
  694. PARAMDATA FAR* ppdata; /* pointer to an array of PARAMDATAs */
  695. DISPID dispid; /* method ID */
  696. UINT iMeth; /* method index */
  697. CALLCONV cc; /* calling convention */
  698. UINT cArgs; /* count of arguments */
  699. WORD wFlags; /* same wFlags as on IDispatch::Invoke() */
  700. VARTYPE vtReturn;
  701. } METHODDATA, FAR* LPMETHODDATA;
  702. typedef struct FARSTRUCT tagINTERFACEDATA {
  703. METHODDATA FAR* pmethdata; /* pointer to an array of METHODDATAs */
  704. UINT cMembers; /* count of members */
  705. } INTERFACEDATA, FAR* LPINTERFACEDATA;
  706. /* Locate the parameter indicated by the given position, and
  707. * return it coerced to the given target VARTYPE (vtTarg).
  708. */
  709. STDAPI
  710. DispGetParam(
  711. DISPPARAMS FAR* pdispparams,
  712. UINT position,
  713. VARTYPE vtTarg,
  714. VARIANT FAR* pvarResult,
  715. UINT FAR* puArgErr);
  716. /* Automatic TypeInfo driven implementation of IDispatch::GetIDsOfNames()
  717. */
  718. STDAPI
  719. DispGetIDsOfNames(
  720. ITypeInfo FAR* ptinfo,
  721. char FAR* FAR* rgszNames,
  722. UINT cNames,
  723. DISPID FAR* rgdispid);
  724. /* Automatic TypeInfo driven implementation of IDispatch::Invoke()
  725. */
  726. STDAPI
  727. DispInvoke(
  728. void FAR* _this,
  729. ITypeInfo FAR* ptinfo,
  730. DISPID dispidMember,
  731. WORD wFlags,
  732. DISPPARAMS FAR* pparams,
  733. VARIANT FAR* pvarResult,
  734. EXCEPINFO FAR* pexcepinfo,
  735. UINT FAR* puArgErr);
  736. /* Construct a TypeInfo from an interface data description
  737. */
  738. STDAPI
  739. CreateDispTypeInfo(
  740. INTERFACEDATA FAR* pidata,
  741. LCID lcid,
  742. ITypeInfo FAR* FAR* pptinfo);
  743. /* Create an instance of the standard TypeInfo driven IDispatch
  744. * implementation.
  745. */
  746. STDAPI
  747. CreateStdDispatch(
  748. IUnknown FAR* punkOuter,
  749. void FAR* pvThis,
  750. ITypeInfo FAR* ptinfo,
  751. IUnknown FAR* FAR* ppunkStdDisp);
  752. /*---------------------------------------------------------------------*/
  753. /* Active Object Registration API */
  754. /*---------------------------------------------------------------------*/
  755. STDAPI
  756. RegisterActiveObject(
  757. IUnknown FAR* punk,
  758. REFCLSID rclsid,
  759. void FAR* pvReserved,
  760. DWORD FAR* pdwRegister);
  761. STDAPI
  762. RevokeActiveObject(
  763. DWORD dwRegister,
  764. void FAR* pvReserved);
  765. STDAPI
  766. GetActiveObject(
  767. REFCLSID rclsid,
  768. void FAR* pvReserved,
  769. IUnknown FAR* FAR* ppunk);
  770. #endif /* _DISPATCH_H_ */