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.

2305 lines
113 KiB

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