home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / cor.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  113.4 KB  |  2,314 lines

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