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.

2241 lines
109 KiB

  1. // ==++==
  2. //
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. // ==--==
  6. /*****************************************************************************
  7. ** **
  8. ** Cor.h - general header for the Runtime. **
  9. ** **
  10. *****************************************************************************/
  11. #ifndef _COR_H_
  12. #define _COR_H_
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. //*****************************************************************************
  20. // Required includes
  21. #include <ole2.h> // Definitions of OLE types.
  22. //*****************************************************************************
  23. #ifndef DECLSPEC_SELECT_ANY
  24. #define DECLSPEC_SELECT_ANY __declspec(selectany)
  25. #endif // DECLSPEC_SELECT_ANY
  26. // {BED7F4EA-1A96-11d2-8F08-00A0C9A6186D}
  27. extern const GUID DECLSPEC_SELECT_ANY LIBID_ComPlusRuntime =
  28. { 0xbed7f4ea, 0x1a96, 0x11d2, { 0x8f, 0x8, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d } };
  29. // {90883F05-3D28-11D2-8F17-00A0C9A6186D}
  30. extern const GUID DECLSPEC_SELECT_ANY GUID_ExportedFromComPlus =
  31. { 0x90883f05, 0x3d28, 0x11d2, { 0x8f, 0x17, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d } };
  32. // {0F21F359-AB84-41e8-9A78-36D110E6D2F9}
  33. extern const GUID DECLSPEC_SELECT_ANY GUID_ManagedName =
  34. { 0xf21f359, 0xab84, 0x41e8, { 0x9a, 0x78, 0x36, 0xd1, 0x10, 0xe6, 0xd2, 0xf9 } };
  35. // {54FC8F55-38DE-4703-9C4E-250351302B1C}
  36. extern const GUID DECLSPEC_SELECT_ANY GUID_Function2Getter =
  37. { 0x54fc8f55, 0x38de, 0x4703, { 0x9c, 0x4e, 0x25, 0x3, 0x51, 0x30, 0x2b, 0x1c } };
  38. // CLSID_CorMetaDataDispenserRuntime: {1EC2DE53-75CC-11d2-9775-00A0C9B4D50C}
  39. // Dispenser coclass for version 1.5 and 2.0 meta data. To get the "latest" bind
  40. // to CLSID_MetaDataDispenser.
  41. extern const GUID DECLSPEC_SELECT_ANY CLSID_CorMetaDataDispenserRuntime =
  42. { 0x1ec2de53, 0x75cc, 0x11d2, { 0x97, 0x75, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc } };
  43. // CLSID_CorMetaDataRuntime: {005023CA-72B1-11D3-9FC4-00C04F79A0A3}
  44. // For Common Language Runtime Meta Data, managed program meta data.
  45. extern const GUID DECLSPEC_SELECT_ANY CLSID_CorMetaDataRuntime =
  46. { 0x005023ca, 0x72b1, 0x11d3, { 0x9f, 0xc4, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3 } };
  47. // {90883F06-3D28-11D2-8F17-00A0C9A6186D}
  48. extern const GUID DECLSPEC_SELECT_ANY GUID_ImportedToComPlus =
  49. { 0x90883f06, 0x3d28, 0x11d2, { 0x8f, 0x17, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d } };
  50. extern const char DECLSPEC_SELECT_ANY szGUID_ImportedToComPlus[] = "{90883F06-3D28-11D2-8F17-00A0C9A6186D}";
  51. extern const WCHAR DECLSPEC_SELECT_ANY wzGUID_ImportedToComPlus[] = L"{90883F06-3D28-11D2-8F17-00A0C9A6186D}";
  52. // {30FE7BE8-D7D9-11D2-9F80-00C04F79A0A3}
  53. extern const GUID DECLSPEC_SELECT_ANY MetaDataCheckDuplicatesFor =
  54. { 0x30fe7be8, 0xd7d9, 0x11d2, { 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3 } };
  55. // {DE3856F8-D7D9-11D2-9F80-00C04F79A0A3}
  56. extern const GUID DECLSPEC_SELECT_ANY MetaDataRefToDefCheck =
  57. { 0xde3856f8, 0xd7d9, 0x11d2, { 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3 } };
  58. // {E5D71A4C-D7DA-11D2-9F80-00C04F79A0A3}
  59. extern const GUID DECLSPEC_SELECT_ANY MetaDataNotificationForTokenMovement =
  60. { 0xe5d71a4c, 0xd7da, 0x11d2, { 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3 } };
  61. // {2eee315c-d7db-11d2-9f80-00c04f79a0a3}
  62. extern const GUID DECLSPEC_SELECT_ANY MetaDataSetUpdate =
  63. { 0x2eee315c, 0xd7db, 0x11d2, { 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3 } };
  64. #define MetaDataSetENC MetaDataSetUpdate
  65. // Use this guid in SetOption to indicate if the import enumerator should skip over
  66. // delete items or not. The default is yes.
  67. //
  68. // {79700F36-4AAC-11d3-84C3-009027868CB1}
  69. extern const GUID DECLSPEC_SELECT_ANY MetaDataImportOption =
  70. { 0x79700f36, 0x4aac, 0x11d3, { 0x84, 0xc3, 0x0, 0x90, 0x27, 0x86, 0x8c, 0xb1 } };
  71. // Use this guid in the SetOption if compiler wants to have MetaData API to take reader/writer lock
  72. // CorThreadSafetyOptions.
  73. // {F7559806-F266-42ea-8C63-0ADB45E8B234}
  74. extern const GUID DECLSPEC_SELECT_ANY MetaDataThreadSafetyOptions =
  75. { 0xf7559806, 0xf266, 0x42ea, { 0x8c, 0x63, 0xa, 0xdb, 0x45, 0xe8, 0xb2, 0x34 } };
  76. // Use this guid in the SetOption if compiler wants error when some tokens are emitted out of order
  77. // {1547872D-DC03-11d2-9420-0000F8083460}
  78. extern const GUID DECLSPEC_SELECT_ANY MetaDataErrorIfEmitOutOfOrder =
  79. { 0x1547872d, 0xdc03, 0x11d2, { 0x94, 0x20, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60 } };
  80. // Use this guid in the SetOption to indicate if the tlbimporter should generate the
  81. // TCE adapters for COM connection point containers.
  82. // {DCC9DE90-4151-11d3-88D6-00902754C43A}
  83. extern const GUID DECLSPEC_SELECT_ANY MetaDataGenerateTCEAdapters =
  84. { 0xdcc9de90, 0x4151, 0x11d3, { 0x88, 0xd6, 0x0, 0x90, 0x27, 0x54, 0xc4, 0x3a } };
  85. // Use this guid in the SetOption to specifiy a non-default namespace for typelib import.
  86. // {F17FF889-5A63-11d3-9FF2-00C04FF7431A}
  87. extern const GUID DECLSPEC_SELECT_ANY MetaDataTypeLibImportNamespace =
  88. { 0xf17ff889, 0x5a63, 0x11d3, { 0x9f, 0xf2, 0x0, 0xc0, 0x4f, 0xf7, 0x43, 0x1a } };
  89. // Use this guid in the SetOption to specify the behavior of UnmarkAll. See CorLinkerOptions.
  90. // {47E099B6-AE7C-4797-8317-B48AA645B8F9}
  91. extern const GUID DECLSPEC_SELECT_ANY MetaDataLinkerOptions =
  92. { 0x47e099b6, 0xae7c, 0x4797, {0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9 } };
  93. // Use this guid in the SetOption to specify the runtime version stored in the CLR metadata.
  94. // {47E099B7-AE7C-4797-8317-B48AA645B8F9}
  95. extern const GUID DECLSPEC_SELECT_ANY MetaDataRuntimeVersion =
  96. { 0x47e099b7, 0xae7c, 0x4797, {0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9 } };
  97. interface IMetaDataImport;
  98. interface IMetaDataAssemblyEmit;
  99. interface IMetaDataAssemblyImport;
  100. interface IMetaDataEmit;
  101. interface ICeeGen;
  102. //*****************************************************************************
  103. //*****************************************************************************
  104. //
  105. // D L L P U B L I C E N T R Y P O I N T D E C L A R A T I O N S
  106. //
  107. //*****************************************************************************
  108. //*****************************************************************************
  109. BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved);
  110. __int32 STDMETHODCALLTYPE _CorExeMain();
  111. __int32 STDMETHODCALLTYPE _CorExeMain2( // Executable exit code.
  112. PBYTE pUnmappedPE, // -> memory mapped code
  113. DWORD cUnmappedPE, // Size of memory mapped code
  114. LPWSTR pImageNameIn, // -> Executable Name
  115. LPWSTR pLoadersFileName, // -> Loaders Name
  116. LPWSTR pCmdLine); // -> Command Line
  117. STDAPI _CorValidateImage(PVOID *ImageBase, LPCWSTR FileName);
  118. STDAPI_(VOID) _CorImageUnloading(PVOID ImageBase);
  119. STDAPI CoInitializeEE(DWORD fFlags);
  120. STDAPI_(void) CoUninitializeEE(BOOL fFlags);
  121. STDAPI_(void) CoEEShutDownCOM(void);
  122. //
  123. // CoInitializeCor flags.
  124. //
  125. typedef enum tagCOINITCOR
  126. {
  127. COINITCOR_DEFAULT = 0x0 // Default initialization mode.
  128. } COINITICOR;
  129. //
  130. // CoInitializeEE flags.
  131. //
  132. typedef enum tagCOINITEE
  133. {
  134. COINITEE_DEFAULT = 0x0, // Default initialization mode.
  135. COINITEE_DLL = 0x1, // Initialization mode for loading DLL.
  136. COINITEE_MAIN = 0x2 // Initialize prior to entering the main routine
  137. } COINITIEE;
  138. //
  139. // CoInitializeEE flags.
  140. //
  141. typedef enum tagCOUNINITEE
  142. {
  143. COUNINITEE_DEFAULT = 0x0, // Default uninitialization mode.
  144. COUNINITEE_DLL = 0x1 // Uninitialization mode for unloading DLL.
  145. } COUNINITIEE;
  146. //*****************************************************************************
  147. //*****************************************************************************
  148. //
  149. // I L & F I L E F O R M A T D E C L A R A T I O N S
  150. //
  151. //*****************************************************************************
  152. //*****************************************************************************
  153. // The following definitions will get moved into <windows.h> by RTM but are
  154. // kept here for the Alpha's and Beta's.
  155. #ifndef _WINDOWS_UDPATES_
  156. #include <corhdr.h>
  157. #endif // <windows.h> updates
  158. //*****************************************************************************
  159. //*****************************************************************************
  160. //
  161. // D L L P U B L I C E N T R Y P O I N T D E C L A R A T I O N S
  162. //
  163. //*****************************************************************************
  164. //*****************************************************************************
  165. STDAPI CoInitializeCor(DWORD fFlags);
  166. STDAPI_(void) CoUninitializeCor(void);
  167. typedef void (* TDestructorCallback)(EXCEPTION_RECORD*);
  168. STDAPI_(void) AddDestructorCallback(int code, TDestructorCallback callback);
  169. #include <pshpack1.h>
  170. #include <poppack.h>
  171. //
  172. //*****************************************************************************
  173. //*****************************************************************************
  174. // CLSID_Cor: {bee00000-ee77-11d0-a015-00c04fbbb884}
  175. extern const GUID DECLSPEC_SELECT_ANY CLSID_Cor =
  176. { 0xbee00010, 0xee77, 0x11d0, {0xa0, 0x15, 0x00, 0xc0, 0x4f, 0xbb, 0xb8, 0x84 } };
  177. // CLSID_CorMetaDataDispenser: {E5CB7A31-7512-11d2-89CE-0080C792E5D8}
  178. // This is the "Master Dispenser", always guaranteed to be the most recent
  179. // dispenser on the machine.
  180. extern const GUID DECLSPEC_SELECT_ANY CLSID_CorMetaDataDispenser =
  181. { 0xe5cb7a31, 0x7512, 0x11d2, { 0x89, 0xce, 0x0, 0x80, 0xc7, 0x92, 0xe5, 0xd8 } };
  182. // CLSID_CorMetaDataDispenserReg: {435755FF-7397-11d2-9771-00A0C9B4D50C}
  183. // Dispenser coclass for version 1.0 meta data. To get the "latest" bind
  184. // to CLSID_CorMetaDataDispenser.
  185. extern const GUID DECLSPEC_SELECT_ANY CLSID_CorMetaDataDispenserReg =
  186. { 0x435755ff, 0x7397, 0x11d2, { 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc } };
  187. // CLSID_CorMetaDataReg: {87F3A1F5-7397-11d2-9771-00A0C9B4D50C}
  188. // For COM+ Meta Data, Data Driven Registration
  189. extern const GUID DECLSPEC_SELECT_ANY CLSID_CorMetaDataReg =
  190. { 0x87f3a1f5, 0x7397, 0x11d2, { 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc } };
  191. // IID_IMetaDataInternal {39EE28B3-0181-4d48-B53C-2FFAFFD5FEC1}
  192. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataInternal =
  193. { 0x39ee28b3, 0x181, 0x4d48, { 0xb5, 0x3c, 0x2f, 0xfa, 0xff, 0xd5, 0xfe, 0xc1 } };
  194. interface IMetaDataDispenser;
  195. //-------------------------------------
  196. //--- IMetaDataError
  197. //-------------------------------------
  198. //---
  199. // {B81FF171-20F3-11d2-8DCC-00A0C9B09C19}
  200. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataError =
  201. { 0xb81ff171, 0x20f3, 0x11d2, { 0x8d, 0xcc, 0x0, 0xa0, 0xc9, 0xb0, 0x9c, 0x19 } };
  202. //---
  203. #undef INTERFACE
  204. #define INTERFACE IMetaDataError
  205. DECLARE_INTERFACE_(IMetaDataError, IUnknown)
  206. {
  207. STDMETHOD(OnError)(HRESULT hrError, mdToken token) PURE;
  208. };
  209. //-------------------------------------
  210. //--- IMapToken
  211. //-------------------------------------
  212. //---
  213. // IID_IMapToken: {06A3EA8B-0225-11d1-BF72-00C04FC31E12}
  214. extern const GUID DECLSPEC_SELECT_ANY IID_IMapToken =
  215. { 0x6a3ea8b, 0x225, 0x11d1, {0xbf, 0x72, 0x0, 0xc0, 0x4f, 0xc3, 0x1e, 0x12 } };
  216. //---
  217. #undef INTERFACE
  218. #define INTERFACE IMapToken
  219. DECLARE_INTERFACE_(IMapToken, IUnknown)
  220. {
  221. STDMETHOD(Map)(mdToken tkImp, mdToken tkEmit) PURE;
  222. };
  223. //-------------------------------------
  224. //--- IMetaDataDispenser
  225. //-------------------------------------
  226. //---
  227. // {B81FF171-20F3-11d2-8DCC-00A0C9B09C19}
  228. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataDispenser =
  229. { 0x809c652e, 0x7396, 0x11d2, { 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc } };
  230. #undef INTERFACE
  231. #define INTERFACE IMetaDataDispenser
  232. DECLARE_INTERFACE_(IMetaDataDispenser, IUnknown)
  233. {
  234. STDMETHOD(DefineScope)( // Return code.
  235. REFCLSID rclsid, // [in] What version to create.
  236. DWORD dwCreateFlags, // [in] Flags on the create.
  237. REFIID riid, // [in] The interface desired.
  238. IUnknown **ppIUnk) PURE; // [out] Return interface on success.
  239. STDMETHOD(OpenScope)( // Return code.
  240. LPCWSTR szScope, // [in] The scope to open.
  241. DWORD dwOpenFlags, // [in] Open mode flags.
  242. REFIID riid, // [in] The interface desired.
  243. IUnknown **ppIUnk) PURE; // [out] Return interface on success.
  244. STDMETHOD(OpenScopeOnMemory)( // Return code.
  245. LPCVOID pData, // [in] Location of scope data.
  246. ULONG cbData, // [in] Size of the data pointed to by pData.
  247. DWORD dwOpenFlags, // [in] Open mode flags.
  248. REFIID riid, // [in] The interface desired.
  249. IUnknown **ppIUnk) PURE; // [out] Return interface on success.
  250. };
  251. //-------------------------------------
  252. //--- IMetaDataEmit
  253. //-------------------------------------
  254. // {BA3FEE4C-ECB9-4e41-83B7-183FA41CD859}
  255. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataEmit =
  256. { 0xba3fee4c, 0xecb9, 0x4e41, { 0x83, 0xb7, 0x18, 0x3f, 0xa4, 0x1c, 0xd8, 0x59 } };
  257. //---
  258. #undef INTERFACE
  259. #define INTERFACE IMetaDataEmit
  260. DECLARE_INTERFACE_(IMetaDataEmit, IUnknown)
  261. {
  262. STDMETHOD(SetModuleProps)( // S_OK or error.
  263. LPCWSTR szName) PURE; // [IN] If not NULL, the GUID to set.
  264. STDMETHOD(Save)( // S_OK or error.
  265. LPCWSTR szFile, // [IN] The filename to save to.
  266. DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
  267. STDMETHOD(SaveToStream)( // S_OK or error.
  268. IStream *pIStream, // [IN] A writable stream to save to.
  269. DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
  270. STDMETHOD(GetSaveSize)( // S_OK or error.
  271. CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
  272. DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
  273. STDMETHOD(DefineTypeDef)( // S_OK or error.
  274. LPCWSTR szTypeDef, // [IN] Name of TypeDef
  275. DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
  276. mdToken tkExtends, // [IN] extends this TypeDef or typeref
  277. mdToken rtkImplements[], // [IN] Implements interfaces
  278. mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
  279. STDMETHOD(DefineNestedType)( // S_OK or error.
  280. LPCWSTR szTypeDef, // [IN] Name of TypeDef
  281. DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
  282. mdToken tkExtends, // [IN] extends this TypeDef or typeref
  283. mdToken rtkImplements[], // [IN] Implements interfaces
  284. mdTypeDef tdEncloser, // [IN] TypeDef token of the enclosing type.
  285. mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
  286. STDMETHOD(SetHandler)( // S_OK.
  287. IUnknown *pUnk) PURE; // [IN] The new error handler.
  288. STDMETHOD(DefineMethod)( // S_OK or error.
  289. mdTypeDef td, // Parent TypeDef
  290. LPCWSTR szName, // Name of member
  291. DWORD dwMethodFlags, // Member attributes
  292. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  293. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  294. ULONG ulCodeRVA,
  295. DWORD dwImplFlags,
  296. mdMethodDef *pmd) PURE; // Put member token here
  297. STDMETHOD(DefineMethodImpl)( // S_OK or error.
  298. mdTypeDef td, // [IN] The class implementing the method
  299. mdToken tkBody, // [IN] Method body - MethodDef or MethodRef
  300. mdToken tkDecl) PURE; // [IN] Method declaration - MethodDef or MethodRef
  301. STDMETHOD(DefineTypeRefByName)( // S_OK or error.
  302. mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
  303. LPCWSTR szName, // [IN] Name of the TypeRef.
  304. mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
  305. STDMETHOD(DefineImportType)( // S_OK or error.
  306. IMetaDataAssemblyImport *pAssemImport, // [IN] Assemby containing the TypeDef.
  307. const void *pbHashValue, // [IN] Hash Blob for Assembly.
  308. ULONG cbHashValue, // [IN] Count of bytes.
  309. IMetaDataImport *pImport, // [IN] Scope containing the TypeDef.
  310. mdTypeDef tdImport, // [IN] The imported TypeDef.
  311. IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the TypeDef is imported.
  312. mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
  313. STDMETHOD(DefineMemberRef)( // S_OK or error
  314. mdToken tkImport, // [IN] ClassRef or ClassDef importing a member.
  315. LPCWSTR szName, // [IN] member's name
  316. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  317. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  318. mdMemberRef *pmr) PURE; // [OUT] memberref token
  319. STDMETHOD(DefineImportMember)( // S_OK or error.
  320. IMetaDataAssemblyImport *pAssemImport, // [IN] Assemby containing the Member.
  321. const void *pbHashValue, // [IN] Hash Blob for Assembly.
  322. ULONG cbHashValue, // [IN] Count of bytes.
  323. IMetaDataImport *pImport, // [IN] Import scope, with member.
  324. mdToken mbMember, // [IN] Member in import scope.
  325. IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the Member is imported.
  326. mdToken tkParent, // [IN] Classref or classdef in emit scope.
  327. mdMemberRef *pmr) PURE; // [OUT] Put member ref here.
  328. STDMETHOD(DefineEvent) (
  329. mdTypeDef td, // [IN] the class/interface on which the event is being defined
  330. LPCWSTR szEvent, // [IN] Name of the event
  331. DWORD dwEventFlags, // [IN] CorEventAttr
  332. mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class
  333. mdMethodDef mdAddOn, // [IN] required add method
  334. mdMethodDef mdRemoveOn, // [IN] required remove method
  335. mdMethodDef mdFire, // [IN] optional fire method
  336. mdMethodDef rmdOtherMethods[], // [IN] optional array of other methods associate with the event
  337. mdEvent *pmdEvent) PURE; // [OUT] output event token
  338. STDMETHOD(SetClassLayout) (
  339. mdTypeDef td, // [IN] typedef
  340. DWORD dwPackSize, // [IN] packing size specified as 1, 2, 4, 8, or 16
  341. COR_FIELD_OFFSET rFieldOffsets[], // [IN] array of layout specification
  342. ULONG ulClassSize) PURE; // [IN] size of the class
  343. STDMETHOD(DeleteClassLayout) (
  344. mdTypeDef td) PURE; // [IN] typedef whose layout is to be deleted.
  345. STDMETHOD(SetFieldMarshal) (
  346. mdToken tk, // [IN] given a fieldDef or paramDef token
  347. PCCOR_SIGNATURE pvNativeType, // [IN] native type specification
  348. ULONG cbNativeType) PURE; // [IN] count of bytes of pvNativeType
  349. STDMETHOD(DeleteFieldMarshal) (
  350. mdToken tk) PURE; // [IN] given a fieldDef or paramDef token
  351. STDMETHOD(DefinePermissionSet) (
  352. mdToken tk, // [IN] the object to be decorated.
  353. DWORD dwAction, // [IN] CorDeclSecurity.
  354. void const *pvPermission, // [IN] permission blob.
  355. ULONG cbPermission, // [IN] count of bytes of pvPermission.
  356. mdPermission *ppm) PURE; // [OUT] returned permission token.
  357. STDMETHOD(SetRVA)( // S_OK or error.
  358. mdMethodDef md, // [IN] Method for which to set offset
  359. ULONG ulRVA) PURE; // [IN] The offset
  360. STDMETHOD(GetTokenFromSig)( // S_OK or error.
  361. PCCOR_SIGNATURE pvSig, // [IN] Signature to define.
  362. ULONG cbSig, // [IN] Size of signature data.
  363. mdSignature *pmsig) PURE; // [OUT] returned signature token.
  364. STDMETHOD(DefineModuleRef)( // S_OK or error.
  365. LPCWSTR szName, // [IN] DLL name
  366. mdModuleRef *pmur) PURE; // [OUT] returned
  367. // @FUTURE: This should go away once everyone starts using SetMemberRefProps.
  368. STDMETHOD(SetParent)( // S_OK or error.
  369. mdMemberRef mr, // [IN] Token for the ref to be fixed up.
  370. mdToken tk) PURE; // [IN] The ref parent.
  371. STDMETHOD(GetTokenFromTypeSpec)( // S_OK or error.
  372. PCCOR_SIGNATURE pvSig, // [IN] TypeSpec Signature to define.
  373. ULONG cbSig, // [IN] Size of signature data.
  374. mdTypeSpec *ptypespec) PURE; // [OUT] returned TypeSpec token.
  375. STDMETHOD(SaveToMemory)( // S_OK or error.
  376. void *pbData, // [OUT] Location to write data.
  377. ULONG cbData) PURE; // [IN] Max size of data buffer.
  378. STDMETHOD(DefineUserString)( // Return code.
  379. LPCWSTR szString, // [IN] User literal string.
  380. ULONG cchString, // [IN] Length of string.
  381. mdString *pstk) PURE; // [OUT] String token.
  382. STDMETHOD(DeleteToken)( // Return code.
  383. mdToken tkObj) PURE; // [IN] The token to be deleted
  384. STDMETHOD(SetMethodProps)( // S_OK or error.
  385. mdMethodDef md, // [IN] The MethodDef.
  386. DWORD dwMethodFlags, // [IN] Method attributes.
  387. ULONG ulCodeRVA, // [IN] Code RVA.
  388. DWORD dwImplFlags) PURE; // [IN] Impl flags.
  389. STDMETHOD(SetTypeDefProps)( // S_OK or error.
  390. mdTypeDef td, // [IN] The TypeDef.
  391. DWORD dwTypeDefFlags, // [IN] TypeDef flags.
  392. mdToken tkExtends, // [IN] Base TypeDef or TypeRef.
  393. mdToken rtkImplements[]) PURE; // [IN] Implemented interfaces.
  394. STDMETHOD(SetEventProps)( // S_OK or error.
  395. mdEvent ev, // [IN] The event token.
  396. DWORD dwEventFlags, // [IN] CorEventAttr.
  397. mdToken tkEventType, // [IN] A reference (mdTypeRef or mdTypeRef) to the Event class.
  398. mdMethodDef mdAddOn, // [IN] Add method.
  399. mdMethodDef mdRemoveOn, // [IN] Remove method.
  400. mdMethodDef mdFire, // [IN] Fire method.
  401. mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods associate with the event.
  402. STDMETHOD(SetPermissionSetProps)( // S_OK or error.
  403. mdToken tk, // [IN] The object to be decorated.
  404. DWORD dwAction, // [IN] CorDeclSecurity.
  405. void const *pvPermission, // [IN] Permission blob.
  406. ULONG cbPermission, // [IN] Count of bytes of pvPermission.
  407. mdPermission *ppm) PURE; // [OUT] Permission token.
  408. STDMETHOD(DefinePinvokeMap)( // Return code.
  409. mdToken tk, // [IN] FieldDef or MethodDef.
  410. DWORD dwMappingFlags, // [IN] Flags used for mapping.
  411. LPCWSTR szImportName, // [IN] Import name.
  412. mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
  413. STDMETHOD(SetPinvokeMap)( // Return code.
  414. mdToken tk, // [IN] FieldDef or MethodDef.
  415. DWORD dwMappingFlags, // [IN] Flags used for mapping.
  416. LPCWSTR szImportName, // [IN] Import name.
  417. mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
  418. STDMETHOD(DeletePinvokeMap)( // Return code.
  419. mdToken tk) PURE; // [IN] FieldDef or MethodDef.
  420. // New CustomAttribute functions.
  421. STDMETHOD(DefineCustomAttribute)( // Return code.
  422. mdToken tkObj, // [IN] The object to put the value on.
  423. mdToken tkType, // [IN] Type of the CustomAttribute (TypeRef/TypeDef).
  424. void const *pCustomAttribute, // [IN] The custom value data.
  425. ULONG cbCustomAttribute, // [IN] The custom value data length.
  426. mdCustomAttribute *pcv) PURE; // [OUT] The custom value token value on return.
  427. STDMETHOD(SetCustomAttributeValue)( // Return code.
  428. mdCustomAttribute pcv, // [IN] The custom value token whose value to replace.
  429. void const *pCustomAttribute, // [IN] The custom value data.
  430. ULONG cbCustomAttribute) PURE; // [IN] The custom value data length.
  431. STDMETHOD(DefineField)( // S_OK or error.
  432. mdTypeDef td, // Parent TypeDef
  433. LPCWSTR szName, // Name of member
  434. DWORD dwFieldFlags, // Member attributes
  435. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  436. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  437. DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
  438. void const *pValue, // [IN] constant value
  439. ULONG cchValue, // [IN] size of constant value (string, in wide chars).
  440. mdFieldDef *pmd) PURE; // [OUT] Put member token here
  441. STDMETHOD(DefineProperty)(
  442. mdTypeDef td, // [IN] the class/interface on which the property is being defined
  443. LPCWSTR szProperty, // [IN] Name of the property
  444. DWORD dwPropFlags, // [IN] CorPropertyAttr
  445. PCCOR_SIGNATURE pvSig, // [IN] the required type signature
  446. ULONG cbSig, // [IN] the size of the type signature blob
  447. DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
  448. void const *pValue, // [IN] constant value
  449. ULONG cchValue, // [IN] size of constant value (string, in wide chars).
  450. mdMethodDef mdSetter, // [IN] optional setter of the property
  451. mdMethodDef mdGetter, // [IN] optional getter of the property
  452. mdMethodDef rmdOtherMethods[], // [IN] an optional array of other methods
  453. mdProperty *pmdProp) PURE; // [OUT] output property token
  454. STDMETHOD(DefineParam)(
  455. mdMethodDef md, // [IN] Owning method
  456. ULONG ulParamSeq, // [IN] Which param
  457. LPCWSTR szName, // [IN] Optional param name
  458. DWORD dwParamFlags, // [IN] Optional param flags
  459. DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
  460. void const *pValue, // [IN] constant value
  461. ULONG cchValue, // [IN] size of constant value (string, in wide chars).
  462. mdParamDef *ppd) PURE; // [OUT] Put param token here
  463. STDMETHOD(SetFieldProps)( // S_OK or error.
  464. mdFieldDef fd, // [IN] The FieldDef.
  465. DWORD dwFieldFlags, // [IN] Field attributes.
  466. DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_*
  467. void const *pValue, // [IN] Constant value.
  468. ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
  469. STDMETHOD(SetPropertyProps)( // S_OK or error.
  470. mdProperty pr, // [IN] Property token.
  471. DWORD dwPropFlags, // [IN] CorPropertyAttr.
  472. DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_*
  473. void const *pValue, // [IN] Constant value.
  474. ULONG cchValue, // [IN] size of constant value (string, in wide chars).
  475. mdMethodDef mdSetter, // [IN] Setter of the property.
  476. mdMethodDef mdGetter, // [IN] Getter of the property.
  477. mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods.
  478. STDMETHOD(SetParamProps)( // Return code.
  479. mdParamDef pd, // [IN] Param token.
  480. LPCWSTR szName, // [IN] Param name.
  481. DWORD dwParamFlags, // [IN] Param flags.
  482. DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*.
  483. void const *pValue, // [OUT] Constant value.
  484. ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
  485. // Specialized Custom Attributes for security.
  486. STDMETHOD(DefineSecurityAttributeSet)( // Return code.
  487. mdToken tkObj, // [IN] Class or method requiring security attributes.
  488. COR_SECATTR rSecAttrs[], // [IN] Array of security attribute descriptions.
  489. ULONG cSecAttrs, // [IN] Count of elements in above array.
  490. ULONG *pulErrorAttr) PURE; // [OUT] On error, index of attribute causing problem.
  491. STDMETHOD(ApplyEditAndContinue)( // S_OK or error.
  492. IUnknown *pImport) PURE; // [IN] Metadata from the delta PE.
  493. STDMETHOD(TranslateSigWithScope)(
  494. IMetaDataAssemblyImport *pAssemImport, // [IN] importing assembly interface
  495. const void *pbHashValue, // [IN] Hash Blob for Assembly.
  496. ULONG cbHashValue, // [IN] Count of bytes.
  497. IMetaDataImport *import, // [IN] importing interface
  498. PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
  499. ULONG cbSigBlob, // [IN] count of bytes of signature
  500. IMetaDataAssemblyEmit *pAssemEmit, // [IN] emit assembly interface
  501. IMetaDataEmit *emit, // [IN] emit interface
  502. PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature
  503. ULONG cbTranslatedSigMax,
  504. ULONG *pcbTranslatedSig) PURE;// [OUT] count of bytes in the translated signature
  505. STDMETHOD(SetMethodImplFlags)( // [IN] S_OK or error.
  506. mdMethodDef md, // [IN] Method for which to set ImplFlags
  507. DWORD dwImplFlags) PURE;
  508. STDMETHOD(SetFieldRVA)( // [IN] S_OK or error.
  509. mdFieldDef fd, // [IN] Field for which to set offset
  510. ULONG ulRVA) PURE; // [IN] The offset
  511. STDMETHOD(Merge)( // S_OK or error.
  512. IMetaDataImport *pImport, // [IN] The scope to be merged.
  513. IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
  514. IUnknown *pHandler) PURE; // [IN] An object to receive to receive error notification.
  515. STDMETHOD(MergeEnd)() PURE; // S_OK or error.
  516. }; // IMetaDataEmit
  517. //-------------------------------------
  518. //--- IMetaDataImport
  519. //-------------------------------------
  520. // {7DAC8207-D3AE-4c75-9B67-92801A497D44}
  521. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataImport =
  522. { 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } };
  523. //---
  524. #undef INTERFACE
  525. #define INTERFACE IMetaDataImport
  526. DECLARE_INTERFACE_(IMetaDataImport, IUnknown)
  527. {
  528. STDMETHOD_(void, CloseEnum)(HCORENUM hEnum) PURE;
  529. STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount) PURE;
  530. STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos) PURE;
  531. STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],
  532. ULONG cMax, ULONG *pcTypeDefs) PURE;
  533. STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td,
  534. mdInterfaceImpl rImpls[], ULONG cMax,
  535. ULONG* pcImpls) PURE;
  536. STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[],
  537. ULONG cMax, ULONG* pcTypeRefs) PURE;
  538. STDMETHOD(FindTypeDefByName)( // S_OK or error.
  539. LPCWSTR szTypeDef, // [IN] Name of the Type.
  540. mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
  541. mdTypeDef *ptd) PURE; // [OUT] Put the TypeDef token here.
  542. STDMETHOD(GetScopeProps)( // S_OK or error.
  543. LPWSTR szName, // [OUT] Put the name here.
  544. ULONG cchName, // [IN] Size of name buffer in wide chars.
  545. ULONG *pchName, // [OUT] Put size of name (wide chars) here.
  546. GUID *pmvid) PURE; // [OUT, OPTIONAL] Put MVID here.
  547. STDMETHOD(GetModuleFromScope)( // S_OK.
  548. mdModule *pmd) PURE; // [OUT] Put mdModule token here.
  549. STDMETHOD(GetTypeDefProps)( // S_OK or error.
  550. mdTypeDef td, // [IN] TypeDef token for inquiry.
  551. LPWSTR szTypeDef, // [OUT] Put name here.
  552. ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
  553. ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
  554. DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
  555. mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here.
  556. STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
  557. mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
  558. mdTypeDef *pClass, // [OUT] Put implementing class token here.
  559. mdToken *ptkIface) PURE; // [OUT] Put implemented interface token here.
  560. STDMETHOD(GetTypeRefProps)( // S_OK or error.
  561. mdTypeRef tr, // [IN] TypeRef token.
  562. mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
  563. LPWSTR szName, // [OUT] Name of the TypeRef.
  564. ULONG cchName, // [IN] Size of buffer.
  565. ULONG *pchName) PURE; // [OUT] Size of Name.
  566. STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) PURE;
  567. STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
  568. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  569. mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
  570. mdToken rMembers[], // [OUT] Put MemberDefs here.
  571. ULONG cMax, // [IN] Max MemberDefs to put.
  572. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  573. STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
  574. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  575. mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
  576. LPCWSTR szName, // [IN] Limit results to those with this name.
  577. mdToken rMembers[], // [OUT] Put MemberDefs here.
  578. ULONG cMax, // [IN] Max MemberDefs to put.
  579. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  580. STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
  581. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  582. mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
  583. mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
  584. ULONG cMax, // [IN] Max MethodDefs to put.
  585. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  586. STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
  587. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  588. mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
  589. LPCWSTR szName, // [IN] Limit results to those with this name.
  590. mdMethodDef rMethods[], // [OU] Put MethodDefs here.
  591. ULONG cMax, // [IN] Max MethodDefs to put.
  592. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  593. STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
  594. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  595. mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
  596. mdFieldDef rFields[], // [OUT] Put FieldDefs here.
  597. ULONG cMax, // [IN] Max FieldDefs to put.
  598. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  599. STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
  600. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  601. mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
  602. LPCWSTR szName, // [IN] Limit results to those with this name.
  603. mdFieldDef rFields[], // [OUT] Put MemberDefs here.
  604. ULONG cMax, // [IN] Max MemberDefs to put.
  605. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  606. STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
  607. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  608. mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
  609. mdParamDef rParams[], // [OUT] Put ParamDefs here.
  610. ULONG cMax, // [IN] Max ParamDefs to put.
  611. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  612. STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
  613. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  614. mdToken tkParent, // [IN] Parent token to scope the enumeration.
  615. mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
  616. ULONG cMax, // [IN] Max MemberRefs to put.
  617. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  618. STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
  619. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  620. mdTypeDef td, // [IN] TypeDef to scope the enumeration.
  621. mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
  622. mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
  623. ULONG cMax, // [IN] Max tokens to put.
  624. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  625. STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
  626. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  627. mdToken tk, // [IN] if !NIL, token to scope the enumeration.
  628. DWORD dwActions, // [IN] if !0, return only these actions.
  629. mdPermission rPermission[], // [OUT] Put Permissions here.
  630. ULONG cMax, // [IN] Max Permissions to put.
  631. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  632. STDMETHOD(FindMember)(
  633. mdTypeDef td, // [IN] given typedef
  634. LPCWSTR szName, // [IN] member name
  635. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  636. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  637. mdToken *pmb) PURE; // [OUT] matching memberdef
  638. STDMETHOD(FindMethod)(
  639. mdTypeDef td, // [IN] given typedef
  640. LPCWSTR szName, // [IN] member name
  641. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  642. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  643. mdMethodDef *pmb) PURE; // [OUT] matching memberdef
  644. STDMETHOD(FindField)(
  645. mdTypeDef td, // [IN] given typedef
  646. LPCWSTR szName, // [IN] member name
  647. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  648. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  649. mdFieldDef *pmb) PURE; // [OUT] matching memberdef
  650. STDMETHOD(FindMemberRef)(
  651. mdTypeRef td, // [IN] given typeRef
  652. LPCWSTR szName, // [IN] member name
  653. PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
  654. ULONG cbSigBlob, // [IN] count of bytes in the signature blob
  655. mdMemberRef *pmr) PURE; // [OUT] matching memberref
  656. STDMETHOD (GetMethodProps)(
  657. mdMethodDef mb, // The method for which to get props.
  658. mdTypeDef *pClass, // Put method's class here.
  659. LPWSTR szMethod, // Put method's name here.
  660. ULONG cchMethod, // Size of szMethod buffer in wide chars.
  661. ULONG *pchMethod, // Put actual size here
  662. DWORD *pdwAttr, // Put flags here.
  663. PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
  664. ULONG *pcbSigBlob, // [OUT] actual size of signature blob
  665. ULONG *pulCodeRVA, // [OUT] codeRVA
  666. DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
  667. STDMETHOD(GetMemberRefProps)( // S_OK or error.
  668. mdMemberRef mr, // [IN] given memberref
  669. mdToken *ptk, // [OUT] Put classref or classdef here.
  670. LPWSTR szMember, // [OUT] buffer to fill for member's name
  671. ULONG cchMember, // [IN] the count of char of szMember
  672. ULONG *pchMember, // [OUT] actual count of char in member name
  673. PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
  674. ULONG *pbSig) PURE; // [OUT] actual size of signature blob
  675. STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
  676. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  677. mdTypeDef td, // [IN] TypeDef to scope the enumeration.
  678. mdProperty rProperties[], // [OUT] Put Properties here.
  679. ULONG cMax, // [IN] Max properties to put.
  680. ULONG *pcProperties) PURE; // [OUT] Put # put here.
  681. STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
  682. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  683. mdTypeDef td, // [IN] TypeDef to scope the enumeration.
  684. mdEvent rEvents[], // [OUT] Put events here.
  685. ULONG cMax, // [IN] Max events to put.
  686. ULONG *pcEvents) PURE; // [OUT] Put # put here.
  687. STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
  688. mdEvent ev, // [IN] event token
  689. mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
  690. LPCWSTR szEvent, // [OUT] Event name
  691. ULONG cchEvent, // [IN] the count of wchar of szEvent
  692. ULONG *pchEvent, // [OUT] actual count of wchar for event's name
  693. DWORD *pdwEventFlags, // [OUT] Event flags.
  694. mdToken *ptkEventType, // [OUT] EventType class
  695. mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
  696. mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
  697. mdMethodDef *pmdFire, // [OUT] Fire method of the event
  698. mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
  699. ULONG cMax, // [IN] size of rmdOtherMethod
  700. ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this event
  701. STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error.
  702. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  703. mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
  704. mdToken rEventProp[], // [OUT] Put Event/Property here.
  705. ULONG cMax, // [IN] Max properties to put.
  706. ULONG *pcEventProp) PURE; // [OUT] Put # put here.
  707. STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
  708. mdMethodDef mb, // [IN] method token
  709. mdToken tkEventProp, // [IN] event/property token.
  710. DWORD *pdwSemanticsFlags) PURE; // [OUT] the role flags for the method/propevent pair
  711. STDMETHOD(GetClassLayout) (
  712. mdTypeDef td, // [IN] give typedef
  713. DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
  714. COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
  715. ULONG cMax, // [IN] size of the array
  716. ULONG *pcFieldOffset, // [OUT] needed array size
  717. ULONG *pulClassSize) PURE; // [OUT] the size of the class
  718. STDMETHOD(GetFieldMarshal) (
  719. mdToken tk, // [IN] given a field's memberdef
  720. PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
  721. ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
  722. STDMETHOD(GetRVA)( // S_OK or error.
  723. mdToken tk, // Member for which to set offset
  724. ULONG *pulCodeRVA, // The offset
  725. DWORD *pdwImplFlags) PURE; // the implementation flags
  726. STDMETHOD(GetPermissionSetProps) (
  727. mdPermission pm, // [IN] the permission token.
  728. DWORD *pdwAction, // [OUT] CorDeclSecurity.
  729. void const **ppvPermission, // [OUT] permission blob.
  730. ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
  731. STDMETHOD(GetSigFromToken)( // S_OK or error.
  732. mdSignature mdSig, // [IN] Signature token.
  733. PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
  734. ULONG *pcbSig) PURE; // [OUT] return size of signature.
  735. STDMETHOD(GetModuleRefProps)( // S_OK or error.
  736. mdModuleRef mur, // [IN] moduleref token.
  737. LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
  738. ULONG cchName, // [IN] size of szName in wide characters.
  739. ULONG *pchName) PURE; // [OUT] actual count of characters in the name.
  740. STDMETHOD(EnumModuleRefs)( // S_OK or error.
  741. HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
  742. mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
  743. ULONG cmax, // [IN] max memberrefs to put.
  744. ULONG *pcModuleRefs) PURE; // [OUT] put # put here.
  745. STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
  746. mdTypeSpec typespec, // [IN] TypeSpec token.
  747. PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
  748. ULONG *pcbSig) PURE; // [OUT] return size of signature.
  749. STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
  750. mdToken tk, // [IN] Token to get name from. Must have a name.
  751. MDUTF8CSTR *pszUtf8NamePtr) PURE; // [OUT] Return pointer to UTF8 name in heap.
  752. STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
  753. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  754. mdToken rMethods[], // [OUT] Put MemberDefs here.
  755. ULONG cMax, // [IN] Max MemberDefs to put.
  756. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  757. STDMETHOD(GetUserString)( // S_OK or error.
  758. mdString stk, // [IN] String token.
  759. LPWSTR szString, // [OUT] Copy of string.
  760. ULONG cchString, // [IN] Max chars of room in szString.
  761. ULONG *pchString) PURE; // [OUT] How many chars in actual string.
  762. STDMETHOD(GetPinvokeMap)( // S_OK or error.
  763. mdToken tk, // [IN] FieldDef or MethodDef.
  764. DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
  765. LPWSTR szImportName, // [OUT] Import name.
  766. ULONG cchImportName, // [IN] Size of the name buffer.
  767. ULONG *pchImportName, // [OUT] Actual number of characters stored.
  768. mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
  769. STDMETHOD(EnumSignatures)( // S_OK or error.
  770. HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
  771. mdSignature rSignatures[], // [OUT] put signatures here.
  772. ULONG cmax, // [IN] max signatures to put.
  773. ULONG *pcSignatures) PURE; // [OUT] put # put here.
  774. STDMETHOD(EnumTypeSpecs)( // S_OK or error.
  775. HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
  776. mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
  777. ULONG cmax, // [IN] max TypeSpecs to put.
  778. ULONG *pcTypeSpecs) PURE; // [OUT] put # put here.
  779. STDMETHOD(EnumUserStrings)( // S_OK or error.
  780. HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
  781. mdString rStrings[], // [OUT] put Strings here.
  782. ULONG cmax, // [IN] max Strings to put.
  783. ULONG *pcStrings) PURE; // [OUT] put # put here.
  784. STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
  785. mdMethodDef md, // [IN] Method token.
  786. ULONG ulParamSeq, // [IN] Parameter sequence.
  787. mdParamDef *ppd) PURE; // [IN] Put Param token here.
  788. STDMETHOD(EnumCustomAttributes)( // S_OK or error.
  789. HCORENUM *phEnum, // [IN, OUT] COR enumerator.
  790. mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
  791. mdToken tkType, // [IN] Type of interest, 0 for all.
  792. mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
  793. ULONG cMax, // [IN] Size of rCustomAttributes.
  794. ULONG *pcCustomAttributes) PURE; // [OUT, OPTIONAL] Put count of token values here.
  795. STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
  796. mdCustomAttribute cv, // [IN] CustomAttribute token.
  797. mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
  798. mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
  799. void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
  800. ULONG *pcbSize) PURE; // [OUT, OPTIONAL] Put size of date here.
  801. STDMETHOD(FindTypeRef)(
  802. mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
  803. LPCWSTR szName, // [IN] TypeRef Name.
  804. mdTypeRef *ptr) PURE; // [OUT] matching TypeRef.
  805. STDMETHOD(GetMemberProps)(
  806. mdToken mb, // The member for which to get props.
  807. mdTypeDef *pClass, // Put member's class here.
  808. LPWSTR szMember, // Put member's name here.
  809. ULONG cchMember, // Size of szMember buffer in wide chars.
  810. ULONG *pchMember, // Put actual size here
  811. DWORD *pdwAttr, // Put flags here.
  812. PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
  813. ULONG *pcbSigBlob, // [OUT] actual size of signature blob
  814. ULONG *pulCodeRVA, // [OUT] codeRVA
  815. DWORD *pdwImplFlags, // [OUT] Impl. Flags
  816. DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
  817. void const **ppValue, // [OUT] constant value
  818. ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
  819. STDMETHOD(GetFieldProps)(
  820. mdFieldDef mb, // The field for which to get props.
  821. mdTypeDef *pClass, // Put field's class here.
  822. LPWSTR szField, // Put field's name here.
  823. ULONG cchField, // Size of szField buffer in wide chars.
  824. ULONG *pchField, // Put actual size here
  825. DWORD *pdwAttr, // Put flags here.
  826. PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
  827. ULONG *pcbSigBlob, // [OUT] actual size of signature blob
  828. DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
  829. void const **ppValue, // [OUT] constant value
  830. ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
  831. STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
  832. mdProperty prop, // [IN] property token
  833. mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
  834. LPCWSTR szProperty, // [OUT] Property name
  835. ULONG cchProperty, // [IN] the count of wchar of szProperty
  836. ULONG *pchProperty, // [OUT] actual count of wchar for property name
  837. DWORD *pdwPropFlags, // [OUT] property flags.
  838. PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
  839. ULONG *pbSig, // [OUT] count of bytes in *ppvSig
  840. DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
  841. void const **ppDefaultValue, // [OUT] constant value
  842. ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
  843. mdMethodDef *pmdSetter, // [OUT] setter method of the property
  844. mdMethodDef *pmdGetter, // [OUT] getter method of the property
  845. mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
  846. ULONG cMax, // [IN] size of rmdOtherMethod
  847. ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this property
  848. STDMETHOD(GetParamProps)( // S_OK or error.
  849. mdParamDef tk, // [IN]The Parameter.
  850. mdMethodDef *pmd, // [OUT] Parent Method token.
  851. ULONG *pulSequence, // [OUT] Parameter sequence.
  852. LPWSTR szName, // [OUT] Put name here.
  853. ULONG cchName, // [OUT] Size of name buffer.
  854. ULONG *pchName, // [OUT] Put actual size of name here.
  855. DWORD *pdwAttr, // [OUT] Put flags here.
  856. DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
  857. void const **ppValue, // [OUT] Constant value.
  858. ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
  859. STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
  860. mdToken tkObj, // [IN] Object with Custom Attribute.
  861. LPCWSTR szName, // [IN] Name of desired Custom Attribute.
  862. const void **ppData, // [OUT] Put pointer to data here.
  863. ULONG *pcbData) PURE; // [OUT] Put size of data here.
  864. STDMETHOD_(BOOL, IsValidToken)( // True or False.
  865. mdToken tk) PURE; // [IN] Given token.
  866. STDMETHOD(GetNestedClassProps)( // S_OK or error.
  867. mdTypeDef tdNestedClass, // [IN] NestedClass token.
  868. mdTypeDef *ptdEnclosingClass) PURE; // [OUT] EnclosingClass token.
  869. STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
  870. void const *pvSig, // [IN] Pointer to signature.
  871. ULONG cbSig, // [IN] Count of signature bytes.
  872. ULONG *pCallConv) PURE; // [OUT] Put calling conv here (see CorPinvokemap).
  873. STDMETHOD(IsGlobal)( // S_OK or error.
  874. mdToken pd, // [IN] Type, Field, or Method token.
  875. int *pbGlobal) PURE; // [OUT] Put 1 if global, 0 otherwise.
  876. }; // IMetaDataImport
  877. //-------------------------------------
  878. //--- IMetaDataFilter
  879. //-------------------------------------
  880. // {D0E80DD1-12D4-11d3-B39D-00C04FF81795}
  881. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataFilter =
  882. {0xd0e80dd1, 0x12d4, 0x11d3, {0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95} };
  883. //---
  884. #undef INTERFACE
  885. #define INTERFACE IMetaDataFilter
  886. DECLARE_INTERFACE_(IMetaDataFilter, IUnknown)
  887. {
  888. STDMETHOD(UnmarkAll)() PURE;
  889. STDMETHOD(MarkToken)(mdToken tk) PURE;
  890. STDMETHOD(IsTokenMarked)(mdToken tk, BOOL *pIsMarked) PURE;
  891. };
  892. //-------------------------------------
  893. //--- IHostFilter
  894. //-------------------------------------
  895. // {D0E80DD3-12D4-11d3-B39D-00C04FF81795}
  896. extern const GUID DECLSPEC_SELECT_ANY IID_IHostFilter =
  897. {0xd0e80dd3, 0x12d4, 0x11d3, {0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95} };
  898. //---
  899. #undef INTERFACE
  900. #define INTERFACE IHostFilter
  901. DECLARE_INTERFACE_(IHostFilter, IUnknown)
  902. {
  903. STDMETHOD(MarkToken)(mdToken tk) PURE;
  904. };
  905. //--------------------------------------
  906. //--- IMetaDataConverter
  907. //--------------------------------------
  908. // {D9DEBD79-2992-11d3-8BC1-0000F8083A57}
  909. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataConverter =
  910. { 0xd9debd79, 0x2992, 0x11d3, { 0x8b, 0xc1, 0x0, 0x0, 0xf8, 0x8, 0x3a, 0x57 } };
  911. //---
  912. #undef INTERFACE
  913. #define INTERFACE IMetaDataConverter
  914. DECLARE_INTERFACE_(IMetaDataConverter, IUnknown)
  915. {
  916. STDMETHOD(GetMetaDataFromTypeInfo)(
  917. ITypeInfo* pITI, // [in] Type info
  918. IMetaDataImport** ppMDI) PURE; // [out] return IMetaDataImport on success
  919. STDMETHOD(GetMetaDataFromTypeLib)(
  920. ITypeLib* pITL, // [in] Type library
  921. IMetaDataImport** ppMDI) PURE; // [out] return IMetaDataImport on success
  922. STDMETHOD(GetTypeLibFromMetaData)(
  923. BSTR strModule, // [in] Module name
  924. BSTR strTlbName, // [in] Type library name
  925. ITypeLib** ppITL) PURE; // [out] return ITypeLib on success
  926. };
  927. //*****************************************************************************
  928. // Assembly Declarations
  929. //*****************************************************************************
  930. typedef struct
  931. {
  932. DWORD dwOSPlatformId; // Operating system platform.
  933. DWORD dwOSMajorVersion; // OS Major version.
  934. DWORD dwOSMinorVersion; // OS Minor version.
  935. } OSINFO;
  936. typedef struct
  937. {
  938. USHORT usMajorVersion; // Major Version.
  939. USHORT usMinorVersion; // Minor Version.
  940. USHORT usBuildNumber; // Build Number.
  941. USHORT usRevisionNumber; // Revision Number.
  942. LPWSTR szLocale; // Locale.
  943. ULONG cbLocale; // [IN/OUT] Size of the buffer in wide chars/Actual size.
  944. DWORD *rProcessor; // Processor ID array.
  945. ULONG ulProcessor; // [IN/OUT] Size of the Processor ID array/Actual # of entries filled in.
  946. OSINFO *rOS; // OSINFO array.
  947. ULONG ulOS; // [IN/OUT]Size of the OSINFO array/Actual # of entries filled in.
  948. } ASSEMBLYMETADATA;
  949. // {211EF15B-5317-4438-B196-DEC87B887693}
  950. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataAssemblyEmit =
  951. { 0x211ef15b, 0x5317, 0x4438, { 0xb1, 0x96, 0xde, 0xc8, 0x7b, 0x88, 0x76, 0x93 } };
  952. //---
  953. #undef INTERFACE
  954. #define INTERFACE IMetaDataAssemblyEmit
  955. DECLARE_INTERFACE_(IMetaDataAssemblyEmit, IUnknown)
  956. {
  957. STDMETHOD(DefineAssembly)( // S_OK or error.
  958. const void *pbPublicKey, // [IN] Public key of the assembly.
  959. ULONG cbPublicKey, // [IN] Count of bytes in the public key.
  960. ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
  961. LPCWSTR szName, // [IN] Name of the assembly.
  962. const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
  963. DWORD dwAssemblyFlags, // [IN] Flags.
  964. mdAssembly *pma) PURE; // [OUT] Returned Assembly token.
  965. STDMETHOD(DefineAssemblyRef)( // S_OK or error.
  966. const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
  967. ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
  968. LPCWSTR szName, // [IN] Name of the assembly being referenced.
  969. const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
  970. const void *pbHashValue, // [IN] Hash Blob.
  971. ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
  972. DWORD dwAssemblyRefFlags, // [IN] Flags.
  973. mdAssemblyRef *pmdar) PURE; // [OUT] Returned AssemblyRef token.
  974. STDMETHOD(DefineFile)( // S_OK or error.
  975. LPCWSTR szName, // [IN] Name of the file.
  976. const void *pbHashValue, // [IN] Hash Blob.
  977. ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
  978. DWORD dwFileFlags, // [IN] Flags.
  979. mdFile *pmdf) PURE; // [OUT] Returned File token.
  980. STDMETHOD(DefineExportedType)( // S_OK or error.
  981. LPCWSTR szName, // [IN] Name of the Com Type.
  982. mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType
  983. mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
  984. DWORD dwExportedTypeFlags, // [IN] Flags.
  985. mdExportedType *pmdct) PURE; // [OUT] Returned ExportedType token.
  986. STDMETHOD(DefineManifestResource)( // S_OK or error.
  987. LPCWSTR szName, // [IN] Name of the resource.
  988. mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
  989. DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
  990. DWORD dwResourceFlags, // [IN] Flags.
  991. mdManifestResource *pmdmr) PURE; // [OUT] Returned ManifestResource token.
  992. STDMETHOD(SetAssemblyProps)( // S_OK or error.
  993. mdAssembly pma, // [IN] Assembly token.
  994. const void *pbPublicKey, // [IN] Public key of the assembly.
  995. ULONG cbPublicKey, // [IN] Count of bytes in the public key.
  996. ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
  997. LPCWSTR szName, // [IN] Name of the assembly.
  998. const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
  999. DWORD dwAssemblyFlags) PURE; // [IN] Flags.
  1000. STDMETHOD(SetAssemblyRefProps)( // S_OK or error.
  1001. mdAssemblyRef ar, // [IN] AssemblyRefToken.
  1002. const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
  1003. ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
  1004. LPCWSTR szName, // [IN] Name of the assembly being referenced.
  1005. const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
  1006. const void *pbHashValue, // [IN] Hash Blob.
  1007. ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
  1008. DWORD dwAssemblyRefFlags) PURE; // [IN] Token for Execution Location.
  1009. STDMETHOD(SetFileProps)( // S_OK or error.
  1010. mdFile file, // [IN] File token.
  1011. const void *pbHashValue, // [IN] Hash Blob.
  1012. ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
  1013. DWORD dwFileFlags) PURE; // [IN] Flags.
  1014. STDMETHOD(SetExportedTypeProps)( // S_OK or error.
  1015. mdExportedType ct, // [IN] ExportedType token.
  1016. mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType.
  1017. mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
  1018. DWORD dwExportedTypeFlags) PURE; // [IN] Flags.
  1019. STDMETHOD(SetManifestResourceProps)( // S_OK or error.
  1020. mdManifestResource mr, // [IN] ManifestResource token.
  1021. mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
  1022. DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
  1023. DWORD dwResourceFlags) PURE; // [IN] Flags.
  1024. }; // IMetaDataAssemblyEmit
  1025. // {EE62470B-E94B-424e-9B7C-2F00C9249F93}
  1026. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataAssemblyImport =
  1027. { 0xee62470b, 0xe94b, 0x424e, { 0x9b, 0x7c, 0x2f, 0x0, 0xc9, 0x24, 0x9f, 0x93 } };
  1028. //---
  1029. #undef INTERFACE
  1030. #define INTERFACE IMetaDataAssemblyImport
  1031. DECLARE_INTERFACE_(IMetaDataAssemblyImport, IUnknown)
  1032. {
  1033. STDMETHOD(GetAssemblyProps)( // S_OK or error.
  1034. mdAssembly mda, // [IN] The Assembly for which to get the properties.
  1035. const void **ppbPublicKey, // [OUT] Pointer to the public key.
  1036. ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
  1037. ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
  1038. LPWSTR szName, // [OUT] Buffer to fill with name.
  1039. ULONG cchName, // [IN] Size of buffer in wide chars.
  1040. ULONG *pchName, // [OUT] Actual # of wide chars in name.
  1041. ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
  1042. DWORD *pdwAssemblyFlags) PURE; // [OUT] Flags.
  1043. STDMETHOD(GetAssemblyRefProps)( // S_OK or error.
  1044. mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
  1045. const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
  1046. ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
  1047. LPWSTR szName, // [OUT] Buffer to fill with name.
  1048. ULONG cchName, // [IN] Size of buffer in wide chars.
  1049. ULONG *pchName, // [OUT] Actual # of wide chars in name.
  1050. ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
  1051. const void **ppbHashValue, // [OUT] Hash blob.
  1052. ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
  1053. DWORD *pdwAssemblyRefFlags) PURE; // [OUT] Flags.
  1054. STDMETHOD(GetFileProps)( // S_OK or error.
  1055. mdFile mdf, // [IN] The File for which to get the properties.
  1056. LPWSTR szName, // [OUT] Buffer to fill with name.
  1057. ULONG cchName, // [IN] Size of buffer in wide chars.
  1058. ULONG *pchName, // [OUT] Actual # of wide chars in name.
  1059. const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
  1060. ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
  1061. DWORD *pdwFileFlags) PURE; // [OUT] Flags.
  1062. STDMETHOD(GetExportedTypeProps)( // S_OK or error.
  1063. mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
  1064. LPWSTR szName, // [OUT] Buffer to fill with name.
  1065. ULONG cchName, // [IN] Size of buffer in wide chars.
  1066. ULONG *pchName, // [OUT] Actual # of wide chars in name.
  1067. mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
  1068. mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
  1069. DWORD *pdwExportedTypeFlags) PURE; // [OUT] Flags.
  1070. STDMETHOD(GetManifestResourceProps)( // S_OK or error.
  1071. mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
  1072. LPWSTR szName, // [OUT] Buffer to fill with name.
  1073. ULONG cchName, // [IN] Size of buffer in wide chars.
  1074. ULONG *pchName, // [OUT] Actual # of wide chars in name.
  1075. mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource.
  1076. DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
  1077. DWORD *pdwResourceFlags) PURE;// [OUT] Flags.
  1078. STDMETHOD(EnumAssemblyRefs)( // S_OK or error
  1079. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  1080. mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
  1081. ULONG cMax, // [IN] Max AssemblyRefs to put.
  1082. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  1083. STDMETHOD(EnumFiles)( // S_OK or error
  1084. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  1085. mdFile rFiles[], // [OUT] Put Files here.
  1086. ULONG cMax, // [IN] Max Files to put.
  1087. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  1088. STDMETHOD(EnumExportedTypes)( // S_OK or error
  1089. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  1090. mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
  1091. ULONG cMax, // [IN] Max ExportedTypes to put.
  1092. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  1093. STDMETHOD(EnumManifestResources)( // S_OK or error
  1094. HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
  1095. mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here.
  1096. ULONG cMax, // [IN] Max Resources to put.
  1097. ULONG *pcTokens) PURE; // [OUT] Put # put here.
  1098. STDMETHOD(GetAssemblyFromScope)( // S_OK or error
  1099. mdAssembly *ptkAssembly) PURE; // [OUT] Put token here.
  1100. STDMETHOD(FindExportedTypeByName)( // S_OK or error
  1101. LPCWSTR szName, // [IN] Name of the ExportedType.
  1102. mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
  1103. mdExportedType *ptkExportedType) PURE; // [OUT] Put the ExportedType token here.
  1104. STDMETHOD(FindManifestResourceByName)( // S_OK or error
  1105. LPCWSTR szName, // [IN] Name of the ManifestResource.
  1106. mdManifestResource *ptkManifestResource) PURE; // [OUT] Put the ManifestResource token here.
  1107. STDMETHOD_(void, CloseEnum)(
  1108. HCORENUM hEnum) PURE; // Enum to be closed.
  1109. STDMETHOD(FindAssembliesByName)( // S_OK or error
  1110. LPCWSTR szAppBase, // [IN] optional - can be NULL
  1111. LPCWSTR szPrivateBin, // [IN] optional - can be NULL
  1112. LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
  1113. IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
  1114. ULONG cMax, // [IN] The max number to put
  1115. ULONG *pcAssemblies) PURE; // [OUT] The number of assemblies returned.
  1116. }; // IMetaDataAssemblyImport
  1117. //*****************************************************************************
  1118. // End Assembly Declarations
  1119. //*****************************************************************************
  1120. //*****************************************************************************
  1121. // MetaData Validator Declarations
  1122. //*****************************************************************************
  1123. // Specifies the type of the module, PE file vs. .obj file.
  1124. typedef enum
  1125. {
  1126. ValidatorModuleTypeInvalid = 0x0,
  1127. ValidatorModuleTypeMin = 0x00000001,
  1128. ValidatorModuleTypePE = 0x00000001,
  1129. ValidatorModuleTypeObj = 0x00000002,
  1130. ValidatorModuleTypeEnc = 0x00000003,
  1131. ValidatorModuleTypeIncr = 0x00000004,
  1132. ValidatorModuleTypeMax = 0x00000004,
  1133. } CorValidatorModuleType;
  1134. // {4709C9C6-81FF-11D3-9FC7-00C04F79A0A3}
  1135. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataValidate =
  1136. { 0x4709c9c6, 0x81ff, 0x11d3, { 0x9f, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3} };
  1137. //---
  1138. #undef INTERFACE
  1139. #define INTERFACE IMetaDataValidate
  1140. DECLARE_INTERFACE_(IMetaDataValidate, IUnknown)
  1141. {
  1142. STDMETHOD(ValidatorInit)( // S_OK or error.
  1143. DWORD dwModuleType, // [IN] Specifies the type of the module.
  1144. IUnknown *pUnk) PURE; // [IN] Validation error handler.
  1145. STDMETHOD(ValidateMetaData)( // S_OK or error.
  1146. ) PURE;
  1147. }; // IMetaDataValidate
  1148. //*****************************************************************************
  1149. // End MetaData Validator Declarations
  1150. //*****************************************************************************
  1151. //*****************************************************************************
  1152. // IMetaDataDispenserEx declarations.
  1153. //*****************************************************************************
  1154. // {31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3}
  1155. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataDispenserEx =
  1156. { 0x31bcfce2, 0xdafb, 0x11d2, { 0x9f, 0x81, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3 } };
  1157. #undef INTERFACE
  1158. #define INTERFACE IMetaDataDispenserEx
  1159. DECLARE_INTERFACE_(IMetaDataDispenserEx, IMetaDataDispenser)
  1160. {
  1161. STDMETHOD(SetOption)( // Return code.
  1162. REFGUID optionid, // [in] GUID for the option to be set.
  1163. const VARIANT *value) PURE; // [in] Value to which the option is to be set.
  1164. STDMETHOD(GetOption)( // Return code.
  1165. REFGUID optionid, // [in] GUID for the option to be set.
  1166. VARIANT *pvalue) PURE; // [out] Value to which the option is currently set.
  1167. STDMETHOD(OpenScopeOnITypeInfo)( // Return code.
  1168. ITypeInfo *pITI, // [in] ITypeInfo to open.
  1169. DWORD dwOpenFlags, // [in] Open mode flags.
  1170. REFIID riid, // [in] The interface desired.
  1171. IUnknown **ppIUnk) PURE; // [out] Return interface on success.
  1172. STDMETHOD(GetCORSystemDirectory)( // Return code.
  1173. LPWSTR szBuffer, // [out] Buffer for the directory name
  1174. DWORD cchBuffer, // [in] Size of the buffer
  1175. DWORD* pchBuffer) PURE; // [OUT] Number of characters returned
  1176. STDMETHOD(FindAssembly)( // S_OK or error
  1177. LPCWSTR szAppBase, // [IN] optional - can be NULL
  1178. LPCWSTR szPrivateBin, // [IN] optional - can be NULL
  1179. LPCWSTR szGlobalBin, // [IN] optional - can be NULL
  1180. LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
  1181. LPCWSTR szName, // [OUT] buffer - to hold name
  1182. ULONG cchName, // [IN] the name buffer's size
  1183. ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
  1184. STDMETHOD(FindAssemblyModule)( // S_OK or error
  1185. LPCWSTR szAppBase, // [IN] optional - can be NULL
  1186. LPCWSTR szPrivateBin, // [IN] optional - can be NULL
  1187. LPCWSTR szGlobalBin, // [IN] optional - can be NULL
  1188. LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
  1189. LPCWSTR szModuleName, // [IN] required - the name of the module
  1190. LPWSTR szName, // [OUT] buffer - to hold name
  1191. ULONG cchName, // [IN] the name buffer's size
  1192. ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
  1193. };
  1194. //*****************************************************************************
  1195. //*****************************************************************************
  1196. //
  1197. // Registration declarations. Will be replace by Services' Registration
  1198. // implementation.
  1199. //
  1200. //*****************************************************************************
  1201. //*****************************************************************************
  1202. // Various flags for use in installing a module or a composite
  1203. typedef enum
  1204. {
  1205. regNoCopy = 0x00000001, // Don't copy files into destination
  1206. regConfig = 0x00000002, // Is a configuration
  1207. regHasRefs = 0x00000004 // Has class references
  1208. } CorRegFlags;
  1209. typedef GUID CVID;
  1210. typedef struct {
  1211. short Major;
  1212. short Minor;
  1213. short Sub;
  1214. short Build;
  1215. } CVStruct;
  1216. //*****************************************************************************
  1217. //*****************************************************************************
  1218. //
  1219. // CeeGen interfaces for generating in-memory Common Language Runtime files
  1220. //
  1221. //*****************************************************************************
  1222. //*****************************************************************************
  1223. typedef void *HCEESECTION;
  1224. typedef enum {
  1225. sdNone = 0,
  1226. sdReadOnly = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA,
  1227. sdReadWrite = sdReadOnly | IMAGE_SCN_MEM_WRITE,
  1228. sdExecute = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE
  1229. } CeeSectionAttr;
  1230. //
  1231. // Relocation types.
  1232. //
  1233. typedef enum {
  1234. // generate only a section-relative reloc, nothing into .reloc section
  1235. srRelocAbsolute,
  1236. // generate a .reloc for the top 16-bits of a 32 bit number
  1237. srRelocHigh,
  1238. // generate a .reloc for the bottom 16-bits of a 32 bit number
  1239. srRelocLow,
  1240. // generate a .reloc for a 32 bit number
  1241. srRelocHighLow,
  1242. // generate a .reloc for the top 16-bits of a 32 bit number, where the
  1243. // bottom 16 bits are included in the next word in the .reloc table
  1244. srRelocHighAdj,
  1245. // generate a token map relocation, nothing into .reloc section
  1246. srRelocMapToken,
  1247. // relative address fixup
  1248. srRelocRelative,
  1249. // Generate only a section-relative reloc, nothing into .reloc
  1250. // section. This reloc is relative to the file position of the
  1251. // section, not the section's virtual address.
  1252. srRelocFilePos,
  1253. // pre-fixup contents of memory are ptr rather than a section offset
  1254. srRelocPtr = 0x8000,
  1255. // legal enums which include the Ptr flag
  1256. srRelocAbsolutePtr = srRelocAbsolute + srRelocPtr,
  1257. srRelocHighLowPtr = srRelocHighLow + srRelocPtr,
  1258. srRelocRelativePtr = srRelocRelative + srRelocPtr,
  1259. /*
  1260. // these are for compatibility and should not be used by new code
  1261. // address should be added to the .reloc section
  1262. srRelocNone = srRelocHighLow,
  1263. // address should be not go into .reloc section
  1264. srRelocRVA = srRelocAbsolute
  1265. */
  1266. } CeeSectionRelocType;
  1267. typedef union {
  1268. USHORT highAdj;
  1269. } CeeSectionRelocExtra;
  1270. //-------------------------------------
  1271. //--- ICeeGen
  1272. //-------------------------------------
  1273. // {7ED1BDFF-8E36-11d2-9C56-00A0C9B7CC45}
  1274. extern const GUID DECLSPEC_SELECT_ANY IID_ICeeGen =
  1275. { 0x7ed1bdff, 0x8e36, 0x11d2, { 0x9c, 0x56, 0x0, 0xa0, 0xc9, 0xb7, 0xcc, 0x45 } };
  1276. DECLARE_INTERFACE_(ICeeGen, IUnknown)
  1277. {
  1278. STDMETHOD (EmitString) (
  1279. LPWSTR lpString, // [IN] String to emit
  1280. ULONG *RVA) PURE; // [OUT] RVA for string emitted string
  1281. STDMETHOD (GetString) (
  1282. ULONG RVA, // [IN] RVA for string to return
  1283. LPWSTR *lpString) PURE; // [OUT] Returned string
  1284. STDMETHOD (AllocateMethodBuffer) (
  1285. ULONG cchBuffer, // [IN] Length of buffer to create
  1286. UCHAR **lpBuffer, // [OUT] Returned buffer
  1287. ULONG *RVA) PURE; // [OUT] RVA for method
  1288. STDMETHOD (GetMethodBuffer) (
  1289. ULONG RVA, // [IN] RVA for method to return
  1290. UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
  1291. STDMETHOD (GetIMapTokenIface) (
  1292. IUnknown **pIMapToken) PURE;
  1293. STDMETHOD (GenerateCeeFile) () PURE;
  1294. STDMETHOD (GetIlSection) (
  1295. HCEESECTION *section) PURE;
  1296. STDMETHOD (GetStringSection) (
  1297. HCEESECTION *section) PURE;
  1298. STDMETHOD (AddSectionReloc) (
  1299. HCEESECTION section,
  1300. ULONG offset,
  1301. HCEESECTION relativeTo,
  1302. CeeSectionRelocType relocType) PURE;
  1303. // use these only if you have special section requirements not handled
  1304. // by other APIs
  1305. STDMETHOD (GetSectionCreate) (
  1306. const char *name,
  1307. DWORD flags,
  1308. HCEESECTION *section) PURE;
  1309. STDMETHOD (GetSectionDataLen) (
  1310. HCEESECTION section,
  1311. ULONG *dataLen) PURE;
  1312. STDMETHOD (GetSectionBlock) (
  1313. HCEESECTION section,
  1314. ULONG len,
  1315. ULONG align=1,
  1316. void **ppBytes=0) PURE;
  1317. STDMETHOD (TruncateSection) (
  1318. HCEESECTION section,
  1319. ULONG len) PURE;
  1320. STDMETHOD (GenerateCeeMemoryImage) (
  1321. void **ppImage) PURE;
  1322. STDMETHOD (ComputePointer) (
  1323. HCEESECTION section,
  1324. ULONG RVA, // [IN] RVA for method to return
  1325. UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
  1326. };
  1327. //*****************************************************************************
  1328. //*****************************************************************************
  1329. //
  1330. // End of CeeGen declarations.
  1331. //
  1332. //*****************************************************************************
  1333. //*****************************************************************************
  1334. //*****************************************************************************
  1335. //
  1336. // CorModule interfaces for generating in-memory modules
  1337. //
  1338. //*****************************************************************************
  1339. //*****************************************************************************
  1340. typedef enum {
  1341. CORMODULE_MATCH = 0x00, // find an existing module that matches interfaces supported
  1342. CORMODULE_NEW = 0x01, // always create a new module and interfaces
  1343. } ICorModuleInitializeFlags;
  1344. //-------------------------------------
  1345. //--- ICorModule
  1346. //-------------------------------------
  1347. // {2629F8E1-95E5-11d2-9C56-00A0C9B7CC45}
  1348. extern const GUID DECLSPEC_SELECT_ANY IID_ICorModule =
  1349. { 0x2629f8e1, 0x95e5, 0x11d2, { 0x9c, 0x56, 0x0, 0xa0, 0xc9, 0xb7, 0xcc, 0x45 } };
  1350. DECLARE_INTERFACE_(ICorModule, IUnknown)
  1351. {
  1352. STDMETHOD (Initialize) (
  1353. DWORD flags, // [IN] flags to control emitter returned
  1354. REFIID riidCeeGen, // [IN] type of cee generator to initialize with
  1355. REFIID riidEmitter) PURE; // [IN] type of emitter to initialize with
  1356. STDMETHOD (GetCeeGen) (
  1357. ICeeGen **pCeeGen) PURE; // [OUT] cee generator
  1358. STDMETHOD (GetMetaDataEmit) (
  1359. IMetaDataEmit **pEmitter) PURE; // [OUT] emitter
  1360. };
  1361. //*****************************************************************************
  1362. //*****************************************************************************
  1363. //
  1364. // End of CorModule declarations.
  1365. //
  1366. //*****************************************************************************
  1367. //**********************************************************************
  1368. //**********************************************************************
  1369. //--- IMetaDataTables
  1370. //-------------------------------------
  1371. // {D8F579AB-402D-4b8e-82D9-5D63B1065C68}
  1372. extern const GUID DECLSPEC_SELECT_ANY IID_IMetaDataTables =
  1373. { 0xd8f579ab, 0x402d, 0x4b8e, { 0x82, 0xd9, 0x5d, 0x63, 0xb1, 0x6, 0x5c, 0x68 } };
  1374. DECLARE_INTERFACE_(IMetaDataTables, IUnknown)
  1375. {
  1376. STDMETHOD (GetStringHeapSize) (
  1377. ULONG *pcbStrings) PURE; // [OUT] Size of the string heap.
  1378. STDMETHOD (GetBlobHeapSize) (
  1379. ULONG *pcbBlobs) PURE; // [OUT] Size of the Blob heap.
  1380. STDMETHOD (GetGuidHeapSize) (
  1381. ULONG *pcbGuids) PURE; // [OUT] Size of the Guid heap.
  1382. STDMETHOD (GetUserStringHeapSize) (
  1383. ULONG *pcbBlobs) PURE; // [OUT] Size of the User String heap.
  1384. STDMETHOD (GetNumTables) (
  1385. ULONG *pcTables) PURE; // [OUT] Count of tables.
  1386. STDMETHOD (GetTableIndex) (
  1387. ULONG token, // [IN] Token for which to get table index.
  1388. ULONG *pixTbl) PURE; // [OUT] Put table index here.
  1389. STDMETHOD (GetTableInfo) (
  1390. ULONG ixTbl, // [IN] Which table.
  1391. ULONG *pcbRow, // [OUT] Size of a row, bytes.
  1392. ULONG *pcRows, // [OUT] Number of rows.
  1393. ULONG *pcCols, // [OUT] Number of columns in each row.
  1394. ULONG *piKey, // [OUT] Key column, or -1 if none.
  1395. const char **ppName) PURE; // [OUT] Name of the table.
  1396. STDMETHOD (GetColumnInfo) (
  1397. ULONG ixTbl, // [IN] Which Table
  1398. ULONG ixCol, // [IN] Which Column in the table
  1399. ULONG *poCol, // [OUT] Offset of the column in the row.
  1400. ULONG *pcbCol, // [OUT] Size of a column, bytes.
  1401. ULONG *pType, // [OUT] Type of the column.
  1402. const char **ppName) PURE; // [OUT] Name of the Column.
  1403. STDMETHOD (GetCodedTokenInfo) (
  1404. ULONG ixCdTkn, // [IN] Which kind of coded token.
  1405. ULONG *pcTokens, // [OUT] Count of tokens.
  1406. ULONG **ppTokens, // [OUT] List of tokens.
  1407. const char **ppName) PURE; // [OUT] Name of the CodedToken.
  1408. STDMETHOD (GetRow) (
  1409. ULONG ixTbl, // [IN] Which table.
  1410. ULONG rid, // [IN] Which row.
  1411. void **ppRow) PURE; // [OUT] Put pointer to row here.
  1412. STDMETHOD (GetColumn) (
  1413. ULONG ixTbl, // [IN] Which table.
  1414. ULONG ixCol, // [IN] Which column.
  1415. ULONG rid, // [IN] Which row.
  1416. ULONG *pVal) PURE; // [OUT] Put the column contents here.
  1417. STDMETHOD (GetString) (
  1418. ULONG ixString, // [IN] Value from a string column.
  1419. const char **ppString) PURE; // [OUT] Put a pointer to the string here.
  1420. STDMETHOD (GetBlob) (
  1421. ULONG ixBlob, // [IN] Value from a blob column.
  1422. ULONG *pcbData, // [OUT] Put size of the blob here.
  1423. const void **ppData) PURE; // [OUT] Put a pointer to the blob here.
  1424. STDMETHOD (GetGuid) (
  1425. ULONG ixGuid, // [IN] Value from a guid column.
  1426. const GUID **ppGUID) PURE; // [OUT] Put a pointer to the GUID here.
  1427. STDMETHOD (GetUserString) (
  1428. ULONG ixUserString, // [IN] Value from a UserString column.
  1429. ULONG *pcbData, // [OUT] Put size of the UserString here.
  1430. const void **ppData) PURE; // [OUT] Put a pointer to the UserString here.
  1431. STDMETHOD (GetNextString) (
  1432. ULONG ixString, // [IN] Value from a string column.
  1433. ULONG *pNext) PURE; // [OUT] Put the index of the next string here.
  1434. STDMETHOD (GetNextBlob) (
  1435. ULONG ixBlob, // [IN] Value from a blob column.
  1436. ULONG *pNext) PURE; // [OUT] Put the index of the netxt blob here.
  1437. STDMETHOD (GetNextGuid) (
  1438. ULONG ixGuid, // [IN] Value from a guid column.
  1439. ULONG *pNext) PURE; // [OUT] Put the index of the next guid here.
  1440. STDMETHOD (GetNextUserString) (
  1441. ULONG ixUserString, // [IN] Value from a UserString column.
  1442. ULONG *pNext) PURE; // [OUT] Put the index of the next user string here.
  1443. };
  1444. #ifdef _DEFINE_META_DATA_META_CONSTANTS
  1445. #ifndef _META_DATA_META_CONSTANTS_DEFINED
  1446. #define _META_DATA_META_CONSTANTS_DEFINED
  1447. const unsigned int iRidMax = 63;
  1448. const unsigned int iCodedToken = 64; // base of coded tokens.
  1449. const unsigned int iCodedTokenMax = 95;
  1450. const unsigned int iSHORT = 96; // fixed types.
  1451. const unsigned int iUSHORT = 97;
  1452. const unsigned int iLONG = 98;
  1453. const unsigned int iULONG = 99;
  1454. const unsigned int iBYTE = 100;
  1455. const unsigned int iSTRING = 101; // pool types.
  1456. const unsigned int iGUID = 102;
  1457. const unsigned int iBLOB = 103;
  1458. inline int IsRidType(ULONG ix) { return ix <= iRidMax; }
  1459. inline int IsCodedTokenType(ULONG ix) { return (ix >= iCodedToken) && (ix <= iCodedTokenMax); }
  1460. inline int IsRidOrToken(ULONG ix) { return ix <= iCodedTokenMax; }
  1461. inline int IsHeapType(ULONG ix) { return ix >= iSTRING; }
  1462. inline int IsFixedType(ULONG ix) { return (ix < iSTRING) && (ix > iCodedTokenMax); }
  1463. #endif
  1464. #endif
  1465. //**********************************************************************
  1466. // End of IMetaDataTables.
  1467. //**********************************************************************
  1468. //**********************************************************************
  1469. //**********************************************************************
  1470. //
  1471. // Predefined CustomAttribute and structures for these custom value
  1472. //
  1473. //**********************************************************************
  1474. //
  1475. // Native Link method custom value definitions. This is for N-direct support.
  1476. //
  1477. #define COR_NATIVE_LINK_CUSTOM_VALUE L"COMPLUS_NativeLink"
  1478. #define COR_NATIVE_LINK_CUSTOM_VALUE_ANSI "COMPLUS_NativeLink"
  1479. // count of chars for COR_NATIVE_LINK_CUSTOM_VALUE(_ANSI)
  1480. #define COR_NATIVE_LINK_CUSTOM_VALUE_CC 18
  1481. #include <pshpack1.h>
  1482. typedef struct
  1483. {
  1484. BYTE m_linkType; // see CorNativeLinkType below
  1485. BYTE m_flags; // see CorNativeLinkFlags below
  1486. mdMemberRef m_entryPoint; // member ref token giving entry point, format is lib:entrypoint
  1487. } COR_NATIVE_LINK;
  1488. #include <poppack.h>
  1489. typedef enum
  1490. {
  1491. nltNone = 1, // none of the keywords are specified
  1492. nltAnsi = 2, // ansi keyword specified
  1493. nltUnicode = 3, // unicode keyword specified
  1494. nltAuto = 4, // auto keyword specified
  1495. nltOle = 5, // ole keyword specified
  1496. } CorNativeLinkType;
  1497. typedef enum
  1498. {
  1499. nlfNone = 0x00, // no flags
  1500. nlfLastError = 0x01, // setLastError keyword specified
  1501. nlfNoMangle = 0x02, // nomangle keyword specified
  1502. } CorNativeLinkFlags;
  1503. #define COR_DUAL_CUSTOM_VALUE L"IsDual"
  1504. #define COR_DUAL_CUSTOM_VALUE_ANSI "IsDual"
  1505. #define COR_DISPATCH_CUSTOM_VALUE L"DISPID"
  1506. #define COR_DISPATCH_CUSTOM_VALUE_ANSI "DISPID"
  1507. //
  1508. // Security custom value definitions (these are all deprecated).
  1509. //
  1510. #define COR_PERM_REQUEST_REQD_CUSTOM_VALUE L"SecPermReq_Reqd"
  1511. #define COR_PERM_REQUEST_REQD_CUSTOM_VALUE_ANSI "SecPermReq_Reqd"
  1512. #define COR_PERM_REQUEST_OPT_CUSTOM_VALUE L"SecPermReq_Opt"
  1513. #define COR_PERM_REQUEST_OPT_CUSTOM_VALUE_ANSI "SecPermReq_Opt"
  1514. #define COR_PERM_REQUEST_REFUSE_CUSTOM_VALUE L"SecPermReq_Refuse"
  1515. #define COR_PERM_REQUEST_REFUSE_CUSTOM_VALUE_ANSI "SecPermReq_Refuse"
  1516. //
  1517. // Base class for security custom attributes.
  1518. //
  1519. #define COR_BASE_SECURITY_ATTRIBUTE_CLASS L"System.Security.Permissions.SecurityAttribute"
  1520. #define COR_BASE_SECURITY_ATTRIBUTE_CLASS_ANSI "System.Security.Permissions.SecurityAttribute"
  1521. //
  1522. // Name of custom attribute used to indicate that per-call security checks should
  1523. // be disabled for P/Invoke calls.
  1524. //
  1525. #define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE L"System.Security.SuppressUnmanagedCodeSecurityAttribute"
  1526. #define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI "System.Security.SuppressUnmanagedCodeSecurityAttribute"
  1527. //
  1528. // Name of custom attribute tagged on module to indicate it contains
  1529. // unverifiable code.
  1530. //
  1531. #define COR_UNVER_CODE_ATTRIBUTE L"System.Security.UnverifiableCodeAttribute"
  1532. #define COR_UNVER_CODE_ATTRIBUTE_ANSI "System.Security.UnverifiableCodeAttribute"
  1533. //
  1534. // Name of custom attribute indicating that a method requires a security object
  1535. // slot on the caller's stack.
  1536. //
  1537. #define COR_REQUIRES_SECOBJ_ATTRIBUTE L"System.Security.DynamicSecurityMethodAttribute"
  1538. #define COR_REQUIRES_SECOBJ_ATTRIBUTE_ANSI "System.Security.DynamicSecurityMethodAttribute"
  1539. #define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE L"System.Runtime.CompilerServices.DiscardableAttribute"
  1540. #define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE_ASNI "System.Runtime.CompilerServices.DiscardableAttribute"
  1541. #ifdef __cplusplus
  1542. }
  1543. //*****************************************************************************
  1544. //*****************************************************************************
  1545. //
  1546. // C O M + s i g n a t u r e s u p p o r t
  1547. //
  1548. //*****************************************************************************
  1549. //*****************************************************************************
  1550. #ifndef FORCEINLINE
  1551. #if _MSC_VER < 1200
  1552. #define FORCEINLINE inline
  1553. #else
  1554. #define FORCEINLINE __forceinline
  1555. #endif
  1556. #endif
  1557. // return true if it is a primitive type, i.e. only need to store CorElementType
  1558. FORCEINLINE int CorIsPrimitiveType(CorElementType elementtype)
  1559. {
  1560. return (elementtype < ELEMENT_TYPE_PTR);
  1561. }
  1562. // Return true if element type is a modifier, i.e. ELEMENT_TYPE_MODIFIER bits are
  1563. // turned on. For now, it is checking for ELEMENT_TYPE_PTR and ELEMENT_TYPE_BYREF
  1564. // as well. This will be removed when we turn on ELEMENT_TYPE_MODIFIER bits for
  1565. // these two enum members.
  1566. //
  1567. FORCEINLINE int CorIsModifierElementType(CorElementType elementtype)
  1568. {
  1569. if (elementtype == ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_BYREF)
  1570. return 1;
  1571. return (elementtype & ELEMENT_TYPE_MODIFIER);
  1572. }
  1573. // Given a compress byte (*pData), return the size of the uncompressed data.
  1574. inline ULONG CorSigUncompressedDataSize(
  1575. PCCOR_SIGNATURE pData)
  1576. {
  1577. if ((*pData & 0x80) == 0)
  1578. return 1;
  1579. else if ((*pData & 0xC0) == 0x80)
  1580. return 2;
  1581. else
  1582. return 4;
  1583. }
  1584. /////////////////////////////////////////////////////////////////////////////////////////////
  1585. //
  1586. // Given a compressed integer(*pData), expand the compressed int to *pDataOut.
  1587. // Return value is the number of bytes that the integer occupies in the compressed format
  1588. // It is caller's responsibility to ensure pDataOut has at least 4 bytes to be written to.
  1589. //
  1590. // This function returns -1 if pass in with an incorrectly compressed data, such as
  1591. // (*pBytes & 0xE0) == 0XE0.
  1592. /////////////////////////////////////////////////////////////////////////////////////////////
  1593. //@future: BIGENDIAN work here.
  1594. inline ULONG CorSigUncompressBigData(
  1595. PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
  1596. {
  1597. ULONG res;
  1598. // 1 byte data is handled in CorSigUncompressData
  1599. // _ASSERTE(*pData & 0x80);
  1600. // Medium.
  1601. if ((*pData & 0xC0) == 0x80) // 10?? ????
  1602. {
  1603. res = 0;
  1604. ((BYTE *) &res)[1] = *pData++ & 0x3f;
  1605. ((BYTE *) &res)[0] = *pData++;
  1606. }
  1607. else // 110? ????
  1608. {
  1609. ((BYTE *) &res)[3] = *pData++ & 0x1f;
  1610. ((BYTE *) &res)[2] = *pData++;
  1611. ((BYTE *) &res)[1] = *pData++;
  1612. ((BYTE *) &res)[0] = *pData++;
  1613. }
  1614. return res;
  1615. }
  1616. FORCEINLINE ULONG CorSigUncompressData(
  1617. PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
  1618. {
  1619. // Handle smallest data inline.
  1620. if ((*pData & 0x80) == 0x00) // 0??? ????
  1621. return *pData++;
  1622. return CorSigUncompressBigData(pData);
  1623. }
  1624. inline ULONG CorSigUncompressData( // return number of bytes of that compressed data occupied in pData
  1625. PCCOR_SIGNATURE pData, // [IN] compressed data
  1626. ULONG *pDataOut) // [OUT] the expanded *pData
  1627. {
  1628. ULONG cb = (ULONG) -1;
  1629. BYTE const *pBytes = reinterpret_cast<BYTE const*>(pData);
  1630. // Smallest.
  1631. if ((*pBytes & 0x80) == 0x00) // 0??? ????
  1632. {
  1633. *pDataOut = *pBytes;
  1634. cb = 1;
  1635. }
  1636. // Medium.
  1637. else if ((*pBytes & 0xC0) == 0x80) // 10?? ????
  1638. {
  1639. *pDataOut = ((*pBytes & 0x3f) << 8 | *(pBytes+1));
  1640. cb = 2;
  1641. }
  1642. else if ((*pBytes & 0xE0) == 0xC0) // 110? ????
  1643. {
  1644. *pDataOut = ((*pBytes & 0x1f) << 24 | *(pBytes+1) << 16 | *(pBytes+2) << 8 | *(pBytes+3));
  1645. cb = 4;
  1646. }
  1647. return cb;
  1648. }
  1649. const static mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};
  1650. // uncompress a token
  1651. inline mdToken CorSigUncompressToken( // return the token.
  1652. PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
  1653. {
  1654. mdToken tk;
  1655. mdToken tkType;
  1656. tk = CorSigUncompressData(pData);
  1657. tkType = g_tkCorEncodeToken[tk & 0x3];
  1658. tk = TokenFromRid(tk >> 2, tkType);
  1659. return tk;
  1660. }
  1661. inline ULONG CorSigUncompressToken( // return number of bytes of that compressed data occupied in pData
  1662. PCCOR_SIGNATURE pData, // [IN] compressed data
  1663. mdToken *pToken) // [OUT] the expanded *pData
  1664. {
  1665. ULONG cb;
  1666. mdToken tk;
  1667. mdToken tkType;
  1668. cb = CorSigUncompressData(pData, (ULONG *)&tk);
  1669. tkType = g_tkCorEncodeToken[tk & 0x3];
  1670. tk = TokenFromRid(tk >> 2, tkType);
  1671. *pToken = tk;
  1672. return cb;
  1673. }
  1674. FORCEINLINE ULONG CorSigUncompressCallingConv(
  1675. PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
  1676. {
  1677. return *pData++;
  1678. }
  1679. enum {
  1680. SIGN_MASK_ONEBYTE = 0xffffffc0, // Mask the same size as the missing bits.
  1681. SIGN_MASK_TWOBYTE = 0xffffe000, // Mask the same size as the missing bits.
  1682. SIGN_MASK_FOURBYTE = 0xf0000000, // Mask the same size as the missing bits.
  1683. };
  1684. // uncompress a signed integer
  1685. inline ULONG CorSigUncompressSignedInt( // return number of bytes of that compressed data occupied in pData
  1686. PCCOR_SIGNATURE pData, // [IN] compressed data
  1687. int *pInt) // [OUT] the expanded *pInt
  1688. {
  1689. ULONG cb;
  1690. ULONG ulSigned;
  1691. ULONG iData;
  1692. cb = CorSigUncompressData(pData, &iData);
  1693. if (cb == -1) return cb;
  1694. ulSigned = iData & 0x1;
  1695. iData = iData >> 1;
  1696. if (ulSigned)
  1697. {
  1698. if (cb == 1)
  1699. {
  1700. iData |= SIGN_MASK_ONEBYTE;
  1701. }
  1702. else if (cb == 2)
  1703. {
  1704. iData |= SIGN_MASK_TWOBYTE;
  1705. }
  1706. else
  1707. {
  1708. iData |= SIGN_MASK_FOURBYTE;
  1709. }
  1710. }
  1711. *pInt = iData;
  1712. return cb;
  1713. }
  1714. // uncompress encoded element type
  1715. FORCEINLINE CorElementType CorSigUncompressElementType(//Element type
  1716. PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
  1717. {
  1718. return (CorElementType)*pData++;
  1719. }
  1720. inline ULONG CorSigUncompressElementType(// return number of bytes of that compressed data occupied in pData
  1721. PCCOR_SIGNATURE pData, // [IN] compressed data
  1722. CorElementType *pElementType) // [OUT] the expanded *pData
  1723. {
  1724. *pElementType = (CorElementType)(*pData & 0x7f);
  1725. return 1;
  1726. }
  1727. /////////////////////////////////////////////////////////////////////////////////////////////
  1728. //
  1729. // Given an uncompressed unsigned integer (iLen), Store it to pDataOut in a compressed format.
  1730. // Return value is the number of bytes that the integer occupies in the compressed format.
  1731. // It is caller's responsibilityt to ensure *pDataOut has at least 4 bytes to write to.
  1732. //
  1733. // Note that this function returns -1 if iLen is too big to be compressed. We currently can
  1734. // only represent to 0x1FFFFFFF.
  1735. //
  1736. /////////////////////////////////////////////////////////////////////////////////////////////
  1737. inline ULONG CorSigCompressData( // return number of bytes that compressed form of iLen will take
  1738. ULONG iLen, // [IN] given uncompressed data
  1739. void *pDataOut) // [OUT] buffer where iLen will be compressed and stored.
  1740. {
  1741. BYTE *pBytes = reinterpret_cast<BYTE *>(pDataOut);
  1742. if (iLen <= 0x7F)
  1743. {
  1744. *pBytes = BYTE(iLen);
  1745. return 1;
  1746. }
  1747. if (iLen <= 0x3FFF)
  1748. {
  1749. *pBytes = BYTE((iLen >> 8) | 0x80);
  1750. *(pBytes+1) = BYTE(iLen);
  1751. return 2;
  1752. }
  1753. if (iLen <= 0x1FFFFFFF)
  1754. {
  1755. *pBytes = BYTE((iLen >> 24) | 0xC0);
  1756. *(pBytes+1) = BYTE(iLen >> 16);
  1757. *(pBytes+2) = BYTE(iLen >> 8);
  1758. *(pBytes+3) = BYTE(iLen);
  1759. return 4;
  1760. }
  1761. return (ULONG) -1;
  1762. }
  1763. // compress a token
  1764. // The least significant bit of the first compress byte will indicate the token type.
  1765. //
  1766. inline ULONG CorSigCompressToken( // return number of bytes that compressed form of iLen will take
  1767. mdToken tk, // [IN] given token
  1768. void *pDataOut) // [OUT] buffer where iLen will be compressed and stored.
  1769. {
  1770. RID rid = RidFromToken(tk);
  1771. ULONG32 ulTyp = TypeFromToken(tk);
  1772. if (rid > 0x3FFFFFF)
  1773. // token is too big to be compressed
  1774. return (ULONG) -1;
  1775. rid = (rid << 2);
  1776. // TypeDef is encoded with low bits 00
  1777. // TypeRef is encoded with low bits 01
  1778. // TypeSpec is encoded with low bits 10
  1779. // BaseType is encoded with low bit 11
  1780. //
  1781. if (ulTyp == g_tkCorEncodeToken[1])
  1782. {
  1783. // make the last two bits 01
  1784. rid |= 0x1;
  1785. }
  1786. else if (ulTyp == g_tkCorEncodeToken[2])
  1787. {
  1788. // make last two bits 0
  1789. rid |= 0x2;
  1790. }
  1791. else if (ulTyp == g_tkCorEncodeToken[3])
  1792. {
  1793. rid |= 0x3;
  1794. }
  1795. return CorSigCompressData((ULONG)rid, pDataOut);
  1796. }
  1797. // compress a signed integer
  1798. // The least significant bit of the first compress byte will be the signed bit.
  1799. //
  1800. inline ULONG CorSigCompressSignedInt( // return number of bytes that compressed form of iData will take
  1801. int iData, // [IN] given integer
  1802. void *pDataOut) // [OUT] buffer where iLen will be compressed and stored.
  1803. {
  1804. ULONG isSigned = 0;
  1805. if (iData < 0)
  1806. isSigned = 0x1;
  1807. if ((iData & SIGN_MASK_ONEBYTE) == 0 || (iData & SIGN_MASK_ONEBYTE) == SIGN_MASK_ONEBYTE)
  1808. {
  1809. iData &= ~SIGN_MASK_ONEBYTE;
  1810. }
  1811. else if ((iData & SIGN_MASK_TWOBYTE) == 0 || (iData & SIGN_MASK_TWOBYTE) == SIGN_MASK_TWOBYTE)
  1812. {
  1813. iData &= ~SIGN_MASK_TWOBYTE;
  1814. }
  1815. else if ((iData & SIGN_MASK_FOURBYTE) == 0 || (iData & SIGN_MASK_FOURBYTE) == SIGN_MASK_FOURBYTE)
  1816. {
  1817. iData &= ~SIGN_MASK_FOURBYTE;
  1818. }
  1819. else
  1820. {
  1821. // out of compressable range
  1822. return (ULONG) -1;
  1823. }
  1824. iData = iData << 1 | isSigned;
  1825. return CorSigCompressData(iData, pDataOut);
  1826. }
  1827. // uncompress encoded element type
  1828. inline ULONG CorSigCompressElementType(// return number of bytes of that compressed data occupied in pData
  1829. CorElementType et, // [OUT] the expanded *pData
  1830. void *pData) // [IN] compressed data
  1831. {
  1832. BYTE *pBytes = (BYTE *)(pData);
  1833. *pBytes = BYTE(et);
  1834. return 1;
  1835. }
  1836. // Compress a pointer (used for internal element types only, never for persisted
  1837. // signatures).
  1838. inline ULONG CorSigCompressPointer( // return number of bytes of that compressed data occupied
  1839. void *pvPointer, // [IN] given uncompressed data
  1840. void *pData) // [OUT] buffer where iLen will be compressed and stored.
  1841. {
  1842. *((void**)pData) = pvPointer;
  1843. return sizeof(void*);
  1844. }
  1845. // Uncompress a pointer (see above for comments).
  1846. inline ULONG CorSigUncompressPointer( // return number of bytes of that compressed data occupied
  1847. PCCOR_SIGNATURE pData, // [IN] compressed data
  1848. void **ppvPointer) // [OUT] the expanded *pData
  1849. {
  1850. *ppvPointer = *(void**)pData;
  1851. return sizeof(void*);
  1852. }
  1853. #endif // __cplusplus
  1854. #endif // _COR_H_
  1855. // EOF =======================================================================