1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 /*****************************************************************************
7 ** Cor.h - general header for the Runtime. **
9 *****************************************************************************/
15 //*****************************************************************************
17 #include <ole2.h> // Definitions of OLE types.
18 #include <specstrings.h>
21 //*****************************************************************************
23 #if defined(_MSC_VER) && !defined(USE_DEPRECATED_CLR_API_WITHOUT_WARNING)
24 #define DEPRECATED_CLR_API_MESG "This API has been deprecated. Refer to http://go.microsoft.com/fwlink/?LinkId=143720 for more details."
25 #define DECLARE_DEPRECATED __declspec(deprecated(DEPRECATED_CLR_API_MESG))
26 #define DEPRECATED_CLR_STDAPI EXTERN_C DECLARE_DEPRECATED HRESULT STDAPICALLTYPE
27 #define DEPRECATED_CLR_STDAPI_(type) EXTERN_C DECLARE_DEPRECATED type STDAPICALLTYPE
28 #else // _MSC_VER && !USE_DEPRECATED_CLR_API_WITHOUT_WARNING
29 #define DECLARE_DEPRECATED
30 #define DEPRECATED_CLR_STDAPI STDAPI
31 #define DEPRECATED_CLR_STDAPI_(type) STDAPI_(type)
32 #endif // _MSC_VER && !USE_DEPRECATED_CLR_API_WITHOUT_WARNING
38 // {BED7F4EA-1A96-11d2-8F08-00A0C9A6186D}
39 EXTERN_GUID(LIBID_ComPlusRuntime, 0xbed7f4ea, 0x1a96, 0x11d2, 0x8f, 0x8, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d);
41 // {90883F05-3D28-11D2-8F17-00A0C9A6186D}
42 EXTERN_GUID(GUID_ExportedFromComPlus, 0x90883f05, 0x3d28, 0x11d2, 0x8f, 0x17, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d);
44 // {0F21F359-AB84-41e8-9A78-36D110E6D2F9}
45 EXTERN_GUID(GUID_ManagedName, 0xf21f359, 0xab84, 0x41e8, 0x9a, 0x78, 0x36, 0xd1, 0x10, 0xe6, 0xd2, 0xf9);
47 // {54FC8F55-38DE-4703-9C4E-250351302B1C}
48 EXTERN_GUID(GUID_Function2Getter, 0x54fc8f55, 0x38de, 0x4703, 0x9c, 0x4e, 0x25, 0x3, 0x51, 0x30, 0x2b, 0x1c);
50 // CLSID_CorMetaDataDispenserRuntime: {1EC2DE53-75CC-11d2-9775-00A0C9B4D50C}
51 // Dispenser coclass for version 1.5 and 2.0 meta data. To get the "latest" bind
52 // to CLSID_MetaDataDispenser.
53 EXTERN_GUID(CLSID_CorMetaDataDispenserRuntime, 0x1ec2de53, 0x75cc, 0x11d2, 0x97, 0x75, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
55 // {CD2BC5C9-F452-4326-B714-F9C539D4DA58}
56 EXTERN_GUID(GUID_DispIdOverride, 0xcd2bc5c9, 0xf452, 0x4326, 0xb7, 0x14, 0xf9, 0xc5, 0x39, 0xd4, 0xda, 0x58);
58 // {B64784EB-D8D4-4d9b-9ACD-0E30806426F7}
59 EXTERN_GUID(GUID_ForceIEnumerable, 0xb64784eb, 0xd8d4, 0x4d9b, 0x9a, 0xcd, 0x0e, 0x30, 0x80, 0x64, 0x26, 0xf7);
61 // {2941FF83-88D8-4F73-B6A9-BDF8712D000D}
62 EXTERN_GUID(GUID_PropGetCA, 0x2941ff83, 0x88d8, 0x4f73, 0xb6, 0xa9, 0xbd, 0xf8, 0x71, 0x2d, 0x00, 0x0d);
64 // {29533527-3683-4364-ABC0-DB1ADD822FA2}
65 EXTERN_GUID(GUID_PropPutCA, 0x29533527, 0x3683, 0x4364, 0xab, 0xc0, 0xdb, 0x1a, 0xdd, 0x82, 0x2f, 0xa2);
67 // CLSID_CLR_v1_MetaData: {005023CA-72B1-11D3-9FC4-00C04F79A0A3}
68 // Used to generate v1 metadata (for v1.0 and v1.1 CLR compatibility).
69 EXTERN_GUID(CLSID_CLR_v1_MetaData, 0x005023ca, 0x72b1, 0x11d3, 0x9f, 0xc4, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
71 // CLSID_CLR_v2_MetaData: {EFEA471A-44FD-4862-9292-0C58D46E1F3A}
72 EXTERN_GUID(CLSID_CLR_v2_MetaData, 0xefea471a, 0x44fd, 0x4862, 0x92, 0x92, 0xc, 0x58, 0xd4, 0x6e, 0x1f, 0x3a);
75 // CLSID_CorMetaDataRuntime:
76 // This will can always be used to generate the "latest" metadata available.
77 #define CLSID_CorMetaDataRuntime CLSID_CLR_v2_MetaData
80 // {30FE7BE8-D7D9-11D2-9F80-00C04F79A0A3}
81 EXTERN_GUID(MetaDataCheckDuplicatesFor, 0x30fe7be8, 0xd7d9, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
83 // {DE3856F8-D7D9-11D2-9F80-00C04F79A0A3}
84 EXTERN_GUID(MetaDataRefToDefCheck, 0xde3856f8, 0xd7d9, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
86 // {E5D71A4C-D7DA-11D2-9F80-00C04F79A0A3}
87 EXTERN_GUID(MetaDataNotificationForTokenMovement, 0xe5d71a4c, 0xd7da, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
89 // {2eee315c-d7db-11d2-9f80-00c04f79a0a3}
90 EXTERN_GUID(MetaDataSetUpdate, 0x2eee315c, 0xd7db, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
91 #define MetaDataSetENC MetaDataSetUpdate
93 // Use this guid in SetOption to indicate if the import enumerator should skip over
94 // delete items or not. The default is yes.
96 // {79700F36-4AAC-11d3-84C3-009027868CB1}
97 EXTERN_GUID(MetaDataImportOption, 0x79700f36, 0x4aac, 0x11d3, 0x84, 0xc3, 0x0, 0x90, 0x27, 0x86, 0x8c, 0xb1);
99 // Use this guid in the SetOption if compiler wants to have MetaData API to take reader/writer lock
101 // {F7559806-F266-42ea-8C63-0ADB45E8B234}
102 EXTERN_GUID(MetaDataThreadSafetyOptions, 0xf7559806, 0xf266, 0x42ea, 0x8c, 0x63, 0xa, 0xdb, 0x45, 0xe8, 0xb2, 0x34);
104 // Use this guid in the SetOption if compiler wants error when some tokens are emitted out of order
105 // {1547872D-DC03-11d2-9420-0000F8083460}
106 EXTERN_GUID(MetaDataErrorIfEmitOutOfOrder, 0x1547872d, 0xdc03, 0x11d2, 0x94, 0x20, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60);
108 // Use this guid in the SetOption to indicate if the tlbimporter should generate the
109 // TCE adapters for COM connection point containers.
110 // {DCC9DE90-4151-11d3-88D6-00902754C43A}
111 EXTERN_GUID(MetaDataGenerateTCEAdapters, 0xdcc9de90, 0x4151, 0x11d3, 0x88, 0xd6, 0x0, 0x90, 0x27, 0x54, 0xc4, 0x3a);
113 // Use this guid in the SetOption to specifiy a non-default namespace for typelib import.
114 // {F17FF889-5A63-11d3-9FF2-00C04FF7431A}
115 EXTERN_GUID(MetaDataTypeLibImportNamespace, 0xf17ff889, 0x5a63, 0x11d3, 0x9f, 0xf2, 0x0, 0xc0, 0x4f, 0xf7, 0x43, 0x1a);
117 // Use this guid in the SetOption to specify the behavior of UnmarkAll. See CorLinkerOptions.
118 // {47E099B6-AE7C-4797-8317-B48AA645B8F9}
119 EXTERN_GUID(MetaDataLinkerOptions, 0x47e099b6, 0xae7c, 0x4797, 0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9);
121 // Use this guid in the SetOption to specify the runtime version stored in the CLR metadata.
122 // {47E099B7-AE7C-4797-8317-B48AA645B8F9}
123 EXTERN_GUID(MetaDataRuntimeVersion, 0x47e099b7, 0xae7c, 0x4797, 0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9);
125 // Use this guid in the SetOption to specify the behavior of the merger.
126 // {132D3A6E-B35D-464e-951A-42EFB9FB6601}
127 EXTERN_GUID(MetaDataMergerOptions, 0x132d3a6e, 0xb35d, 0x464e, 0x95, 0x1a, 0x42, 0xef, 0xb9, 0xfb, 0x66, 0x1);
129 // Use this guid in SetOption to disable optimizing module-local refs to defs
130 // {a55c0354-e91b-468b-8648-7cc31035d533}
131 EXTERN_GUID(MetaDataPreserveLocalRefs, 0xa55c0354, 0xe91b, 0x468b, 0x86, 0x48, 0x7c, 0xc3, 0x10, 0x35, 0xd5, 0x33);
133 interface IMetaDataImport;
134 interface IMetaDataAssemblyEmit;
135 interface IMetaDataAssemblyImport;
136 interface IMetaDataEmit;
140 typedef UNALIGNED void const *UVCP_CONSTANT;
143 // Constant for connection id and task id
144 #define INVALID_CONNECTION_ID 0x0
145 #define INVALID_TASK_ID 0x0
146 #define MAX_CONNECTION_NAME MAX_PATH
148 //*****************************************************************************
149 //*****************************************************************************
151 // 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
153 //*****************************************************************************
154 //*****************************************************************************
156 BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved);
157 __int32 STDMETHODCALLTYPE _CorExeMain();
158 __int32 STDMETHODCALLTYPE _CorExeMainInternal();
159 __int32 STDMETHODCALLTYPE _CorExeMain2( // Executable exit code.
160 PBYTE pUnmappedPE, // -> memory mapped code
161 DWORD cUnmappedPE, // Size of memory mapped code
162 _In_ LPWSTR pImageNameIn, // -> Executable Name
163 _In_ LPWSTR pLoadersFileName, // -> Loaders Name
164 _In_ LPWSTR pCmdLine); // -> Command Line
166 STDAPI _CorValidateImage(PVOID *ImageBase, LPCWSTR FileName);
167 STDAPI_(VOID) _CorImageUnloading(PVOID ImageBase);
169 DEPRECATED_CLR_STDAPI CoInitializeEE(DWORD fFlags);
170 DEPRECATED_CLR_STDAPI_(void) CoUninitializeEE(BOOL fFlags);
171 DEPRECATED_CLR_STDAPI_(void) CoEEShutDownCOM(void);
174 #ifdef FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
176 #define MAIN_CLR_MODULE_NAME_W W("coreclr")
177 #define MAIN_CLR_MODULE_NAME_A "coreclr"
179 #define MAIN_CLR_DLL_NAME_W MAKEDLLNAME_W(MAIN_CLR_MODULE_NAME_W)
180 #define MAIN_CLR_DLL_NAME_A MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A)
182 #else //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
184 #define MAIN_CLR_MODULE_NAME_W L"clr"
185 #define MAIN_CLR_MODULE_NAME_A "clr"
187 #define MAIN_CLR_DLL_NAME_W MAKEDLLNAME_W(MAIN_CLR_MODULE_NAME_W)
188 #define MAIN_CLR_DLL_NAME_A MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A)
190 #endif //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
193 #define MSCOREE_SHIM_W MAIN_CLR_DLL_NAME_W
194 #define MSCOREE_SHIM_A MAIN_CLR_DLL_NAME_A
196 #define SWITCHOUT_HANDLE_VALUE ((HANDLE)(LONG_PTR)-2)
200 // CoInitializeCor flags.
202 typedef enum tagCOINITCOR
204 COINITCOR_DEFAULT = 0x0 // Default initialization mode.
208 // CoInitializeEE flags.
210 typedef enum tagCOINITEE
212 COINITEE_DEFAULT = 0x0, // Default initialization mode.
213 COINITEE_DLL = 0x1, // Initialization mode for loading DLL.
214 COINITEE_MAIN = 0x2 // Initialize prior to entering the main routine
218 // CoInitializeEE flags.
220 typedef enum tagCOUNINITEE
222 COUNINITEE_DEFAULT = 0x0, // Default uninitialization mode.
223 COUNINITEE_DLL = 0x1 // Uninitialization mode for unloading DLL.
226 //*****************************************************************************
227 //*****************************************************************************
229 // I L & F I L E F O R M A T D E C L A R A T I O N S
231 //*****************************************************************************
232 //*****************************************************************************
236 #ifndef _WINDOWS_UPDATES_
238 #endif // <windows.h> updates
240 //*****************************************************************************
241 //*****************************************************************************
243 // 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
245 //*****************************************************************************
246 //*****************************************************************************
248 DEPRECATED_CLR_STDAPI CoInitializeCor(DWORD fFlags);
249 DEPRECATED_CLR_STDAPI_(void) CoUninitializeCor(void);
252 //*****************************************************************************
253 //*****************************************************************************
255 // CLSID_Cor: {bee00000-ee77-11d0-a015-00c04fbbb884}
256 EXTERN_GUID(CLSID_Cor, 0xbee00010, 0xee77, 0x11d0, 0xa0, 0x15, 0x00, 0xc0, 0x4f, 0xbb, 0xb8, 0x84);
258 // CLSID_CorMetaDataDispenser: {E5CB7A31-7512-11d2-89CE-0080C792E5D8}
259 // This is the "Master Dispenser", always guaranteed to be the most recent
260 // dispenser on the machine.
261 EXTERN_GUID(CLSID_CorMetaDataDispenser, 0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x0, 0x80, 0xc7, 0x92, 0xe5, 0xd8);
264 // CLSID_CorMetaDataDispenserReg: {435755FF-7397-11d2-9771-00A0C9B4D50C}
265 // Dispenser coclass for version 1.0 meta data. To get the "latest" bind
266 // to CLSID_CorMetaDataDispenser.
267 EXTERN_GUID(CLSID_CorMetaDataDispenserReg, 0x435755ff, 0x7397, 0x11d2, 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
270 // CLSID_CorMetaDataReg: {87F3A1F5-7397-11d2-9771-00A0C9B4D50C}
271 // For COM+ Meta Data, Data Driven Registration
272 EXTERN_GUID(CLSID_CorMetaDataReg, 0x87f3a1f5, 0x7397, 0x11d2, 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
275 interface IMetaDataDispenser;
277 //-------------------------------------
279 //-------------------------------------
280 // {B81FF171-20F3-11d2-8DCC-00A0C9B09C19}
281 EXTERN_GUID(IID_IMetaDataError, 0xb81ff171, 0x20f3, 0x11d2, 0x8d, 0xcc, 0x0, 0xa0, 0xc9, 0xb0, 0x9c, 0x19);
285 #define INTERFACE IMetaDataError
286 DECLARE_INTERFACE_(IMetaDataError, IUnknown)
288 STDMETHOD(OnError)(HRESULT hrError, mdToken token) PURE;
291 //-------------------------------------
293 //-------------------------------------
294 // IID_IMapToken: {06A3EA8B-0225-11d1-BF72-00C04FC31E12}
295 EXTERN_GUID(IID_IMapToken, 0x6a3ea8b, 0x225, 0x11d1, 0xbf, 0x72, 0x0, 0xc0, 0x4f, 0xc3, 0x1e, 0x12);
299 #define INTERFACE IMapToken
300 DECLARE_INTERFACE_(IMapToken, IUnknown)
302 STDMETHOD(Map)(mdToken tkImp, mdToken tkEmit) PURE;
305 //-------------------------------------
306 //--- IMetaDataDispenser
307 //-------------------------------------
308 // {809C652E-7396-11D2-9771-00A0C9B4D50C}
309 EXTERN_GUID(IID_IMetaDataDispenser, 0x809c652e, 0x7396, 0x11d2, 0x97, 0x71, 0x00, 0xa0, 0xc9, 0xb4, 0xd5, 0x0c);
313 #define INTERFACE IMetaDataDispenser
314 DECLARE_INTERFACE_(IMetaDataDispenser, IUnknown)
316 STDMETHOD(DefineScope)( // Return code.
317 REFCLSID rclsid, // [in] What version to create.
318 DWORD dwCreateFlags, // [in] Flags on the create.
319 REFIID riid, // [in] The interface desired.
320 IUnknown **ppIUnk) PURE; // [out] Return interface on success.
322 STDMETHOD(OpenScope)( // Return code.
323 LPCWSTR szScope, // [in] The scope to open.
324 DWORD dwOpenFlags, // [in] Open mode flags.
325 REFIID riid, // [in] The interface desired.
326 IUnknown **ppIUnk) PURE; // [out] Return interface on success.
328 STDMETHOD(OpenScopeOnMemory)( // Return code.
329 LPCVOID pData, // [in] Location of scope data.
330 ULONG cbData, // [in] Size of the data pointed to by pData.
331 DWORD dwOpenFlags, // [in] Open mode flags.
332 REFIID riid, // [in] The interface desired.
333 IUnknown **ppIUnk) PURE; // [out] Return interface on success.
336 //-------------------------------------
338 //-------------------------------------
339 // {BA3FEE4C-ECB9-4e41-83B7-183FA41CD859}
340 EXTERN_GUID(IID_IMetaDataEmit, 0xba3fee4c, 0xecb9, 0x4e41, 0x83, 0xb7, 0x18, 0x3f, 0xa4, 0x1c, 0xd8, 0x59);
344 #define INTERFACE IMetaDataEmit
345 DECLARE_INTERFACE_(IMetaDataEmit, IUnknown)
347 STDMETHOD(SetModuleProps)( // S_OK or error.
348 LPCWSTR szName) PURE; // [IN] If not NULL, the name of the module to set.
350 STDMETHOD(Save)( // S_OK or error.
351 LPCWSTR szFile, // [IN] The filename to save to.
352 DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
354 STDMETHOD(SaveToStream)( // S_OK or error.
355 IStream *pIStream, // [IN] A writable stream to save to.
356 DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
358 STDMETHOD(GetSaveSize)( // S_OK or error.
359 CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
360 DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
362 STDMETHOD(DefineTypeDef)( // S_OK or error.
363 LPCWSTR szTypeDef, // [IN] Name of TypeDef
364 DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
365 mdToken tkExtends, // [IN] extends this TypeDef or typeref
366 mdToken rtkImplements[], // [IN] Implements interfaces
367 mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
369 STDMETHOD(DefineNestedType)( // S_OK or error.
370 LPCWSTR szTypeDef, // [IN] Name of TypeDef
371 DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
372 mdToken tkExtends, // [IN] extends this TypeDef or typeref
373 mdToken rtkImplements[], // [IN] Implements interfaces
374 mdTypeDef tdEncloser, // [IN] TypeDef token of the enclosing type.
375 mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
377 STDMETHOD(SetHandler)( // S_OK.
378 IUnknown *pUnk) PURE; // [IN] The new error handler.
380 STDMETHOD(DefineMethod)( // S_OK or error.
381 mdTypeDef td, // Parent TypeDef
382 LPCWSTR szName, // Name of member
383 DWORD dwMethodFlags, // Member attributes
384 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
385 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
388 mdMethodDef *pmd) PURE; // Put member token here
390 STDMETHOD(DefineMethodImpl)( // S_OK or error.
391 mdTypeDef td, // [IN] The class implementing the method
392 mdToken tkBody, // [IN] Method body - MethodDef or MethodRef
393 mdToken tkDecl) PURE; // [IN] Method declaration - MethodDef or MethodRef
395 STDMETHOD(DefineTypeRefByName)( // S_OK or error.
396 mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
397 LPCWSTR szName, // [IN] Name of the TypeRef.
398 mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
400 STDMETHOD(DefineImportType)( // S_OK or error.
401 IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the TypeDef.
402 const void *pbHashValue, // [IN] Hash Blob for Assembly.
403 ULONG cbHashValue, // [IN] Count of bytes.
404 IMetaDataImport *pImport, // [IN] Scope containing the TypeDef.
405 mdTypeDef tdImport, // [IN] The imported TypeDef.
406 IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the TypeDef is imported.
407 mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
409 STDMETHOD(DefineMemberRef)( // S_OK or error
410 mdToken tkImport, // [IN] ClassRef or ClassDef importing a member.
411 LPCWSTR szName, // [IN] member's name
412 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
413 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
414 mdMemberRef *pmr) PURE; // [OUT] memberref token
416 STDMETHOD(DefineImportMember)( // S_OK or error.
417 IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the Member.
418 const void *pbHashValue, // [IN] Hash Blob for Assembly.
419 ULONG cbHashValue, // [IN] Count of bytes.
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.
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
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
443 STDMETHOD(DeleteClassLayout) (
444 mdTypeDef td) PURE; // [IN] typedef whose layout is to be deleted.
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
451 STDMETHOD(DeleteFieldMarshal) (
452 mdToken tk) PURE; // [IN] given a fieldDef or paramDef token
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.
461 STDMETHOD(SetRVA)( // S_OK or error.
462 mdMethodDef md, // [IN] Method for which to set offset
463 ULONG ulRVA) PURE; // [IN] The offset
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.
470 STDMETHOD(DefineModuleRef)( // S_OK or error.
471 LPCWSTR szName, // [IN] DLL name
472 mdModuleRef *pmur) PURE; // [OUT] returned
474 // <TODO>@FUTURE: This should go away once everyone starts using SetMemberRefProps.</TODO>
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.
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.
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.
488 STDMETHOD(DefineUserString)( // Return code.
489 LPCWSTR szString, // [IN] User literal string.
490 ULONG cchString, // [IN] Length of string.
491 mdString *pstk) PURE; // [OUT] String token.
493 STDMETHOD(DeleteToken)( // Return code.
494 mdToken tkObj) PURE; // [IN] The token to be deleted
496 STDMETHOD(SetMethodProps)( // S_OK or error.
497 mdMethodDef md, // [IN] The MethodDef.
498 DWORD dwMethodFlags, // [IN] Method attributes.
499 ULONG ulCodeRVA, // [IN] Code RVA.
500 DWORD dwImplFlags) PURE; // [IN] Impl flags.
502 STDMETHOD(SetTypeDefProps)( // S_OK or error.
503 mdTypeDef td, // [IN] The TypeDef.
504 DWORD dwTypeDefFlags, // [IN] TypeDef flags.
505 mdToken tkExtends, // [IN] Base TypeDef or TypeRef.
506 mdToken rtkImplements[]) PURE; // [IN] Implemented interfaces.
508 STDMETHOD(SetEventProps)( // S_OK or error.
509 mdEvent ev, // [IN] The event token.
510 DWORD dwEventFlags, // [IN] CorEventAttr.
511 mdToken tkEventType, // [IN] A reference (mdTypeRef or mdTypeRef) to the Event class.
512 mdMethodDef mdAddOn, // [IN] Add method.
513 mdMethodDef mdRemoveOn, // [IN] Remove method.
514 mdMethodDef mdFire, // [IN] Fire method.
515 mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods associate with the event.
517 STDMETHOD(SetPermissionSetProps)( // S_OK or error.
518 mdToken tk, // [IN] The object to be decorated.
519 DWORD dwAction, // [IN] CorDeclSecurity.
520 void const *pvPermission, // [IN] Permission blob.
521 ULONG cbPermission, // [IN] Count of bytes of pvPermission.
522 mdPermission *ppm) PURE; // [OUT] Permission token.
524 STDMETHOD(DefinePinvokeMap)( // Return code.
525 mdToken tk, // [IN] FieldDef or MethodDef.
526 DWORD dwMappingFlags, // [IN] Flags used for mapping.
527 LPCWSTR szImportName, // [IN] Import name.
528 mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
530 STDMETHOD(SetPinvokeMap)( // Return code.
531 mdToken tk, // [IN] FieldDef or MethodDef.
532 DWORD dwMappingFlags, // [IN] Flags used for mapping.
533 LPCWSTR szImportName, // [IN] Import name.
534 mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
536 STDMETHOD(DeletePinvokeMap)( // Return code.
537 mdToken tk) PURE; // [IN] FieldDef or MethodDef.
539 // New CustomAttribute functions.
540 STDMETHOD(DefineCustomAttribute)( // Return code.
541 mdToken tkOwner, // [IN] The object to put the value on.
542 mdToken tkCtor, // [IN] Constructor of the CustomAttribute type (MemberRef/MethodDef).
543 void const *pCustomAttribute, // [IN] The custom value data.
544 ULONG cbCustomAttribute, // [IN] The custom value data length.
545 mdCustomAttribute *pcv) PURE; // [OUT] The custom value token value on return.
547 STDMETHOD(SetCustomAttributeValue)( // Return code.
548 mdCustomAttribute pcv, // [IN] The custom value token whose value to replace.
549 void const *pCustomAttribute, // [IN] The custom value data.
550 ULONG cbCustomAttribute) PURE;// [IN] The custom value data length.
552 STDMETHOD(DefineField)( // S_OK or error.
553 mdTypeDef td, // Parent TypeDef
554 LPCWSTR szName, // Name of member
555 DWORD dwFieldFlags, // Member attributes
556 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
557 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
558 DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
559 void const *pValue, // [IN] constant value
560 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
561 mdFieldDef *pmd) PURE; // [OUT] Put member token here
563 STDMETHOD(DefineProperty)(
564 mdTypeDef td, // [IN] the class/interface on which the property is being defined
565 LPCWSTR szProperty, // [IN] Name of the property
566 DWORD dwPropFlags, // [IN] CorPropertyAttr
567 PCCOR_SIGNATURE pvSig, // [IN] the required type signature
568 ULONG cbSig, // [IN] the size of the type signature blob
569 DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
570 void const *pValue, // [IN] constant value
571 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
572 mdMethodDef mdSetter, // [IN] optional setter of the property
573 mdMethodDef mdGetter, // [IN] optional getter of the property
574 mdMethodDef rmdOtherMethods[], // [IN] an optional array of other methods
575 mdProperty *pmdProp) PURE; // [OUT] output property token
577 STDMETHOD(DefineParam)(
578 mdMethodDef md, // [IN] Owning method
579 ULONG ulParamSeq, // [IN] Which param
580 LPCWSTR szName, // [IN] Optional param name
581 DWORD dwParamFlags, // [IN] Optional param flags
582 DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
583 void const *pValue, // [IN] constant value
584 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
585 mdParamDef *ppd) PURE; // [OUT] Put param token here
587 STDMETHOD(SetFieldProps)( // S_OK or error.
588 mdFieldDef fd, // [IN] The FieldDef.
589 DWORD dwFieldFlags, // [IN] Field attributes.
590 DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_*
591 void const *pValue, // [IN] Constant value.
592 ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
594 STDMETHOD(SetPropertyProps)( // S_OK or error.
595 mdProperty pr, // [IN] Property token.
596 DWORD dwPropFlags, // [IN] CorPropertyAttr.
597 DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_*
598 void const *pValue, // [IN] Constant value.
599 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
600 mdMethodDef mdSetter, // [IN] Setter of the property.
601 mdMethodDef mdGetter, // [IN] Getter of the property.
602 mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods.
604 STDMETHOD(SetParamProps)( // Return code.
605 mdParamDef pd, // [IN] Param token.
606 LPCWSTR szName, // [IN] Param name.
607 DWORD dwParamFlags, // [IN] Param flags.
608 DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*.
609 void const *pValue, // [OUT] Constant value.
610 ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
612 // Specialized Custom Attributes for security.
613 STDMETHOD(DefineSecurityAttributeSet)( // Return code.
614 mdToken tkObj, // [IN] Class or method requiring security attributes.
615 COR_SECATTR rSecAttrs[], // [IN] Array of security attribute descriptions.
616 ULONG cSecAttrs, // [IN] Count of elements in above array.
617 ULONG *pulErrorAttr) PURE; // [OUT] On error, index of attribute causing problem.
619 STDMETHOD(ApplyEditAndContinue)( // S_OK or error.
620 IUnknown *pImport) PURE; // [IN] Metadata from the delta PE.
622 STDMETHOD(TranslateSigWithScope)(
623 IMetaDataAssemblyImport *pAssemImport, // [IN] importing assembly interface
624 const void *pbHashValue, // [IN] Hash Blob for Assembly.
625 ULONG cbHashValue, // [IN] Count of bytes.
626 IMetaDataImport *import, // [IN] importing interface
627 PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
628 ULONG cbSigBlob, // [IN] count of bytes of signature
629 IMetaDataAssemblyEmit *pAssemEmit, // [IN] emit assembly interface
630 IMetaDataEmit *emit, // [IN] emit interface
631 PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature
632 ULONG cbTranslatedSigMax,
633 ULONG *pcbTranslatedSig) PURE;// [OUT] count of bytes in the translated signature
635 STDMETHOD(SetMethodImplFlags)( // [IN] S_OK or error.
636 mdMethodDef md, // [IN] Method for which to set ImplFlags
637 DWORD dwImplFlags) PURE;
639 STDMETHOD(SetFieldRVA)( // [IN] S_OK or error.
640 mdFieldDef fd, // [IN] Field for which to set offset
641 ULONG ulRVA) PURE; // [IN] The offset
643 STDMETHOD(Merge)( // S_OK or error.
644 IMetaDataImport *pImport, // [IN] The scope to be merged.
645 IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
646 IUnknown *pHandler) PURE; // [IN] An object to receive to receive error notification.
648 STDMETHOD(MergeEnd)() PURE; // S_OK or error.
650 // This interface is sealed. Do not change, add, or remove anything. Instead, derive a new iterface.
654 //-------------------------------------
656 //-------------------------------------
657 // {F5DD9950-F693-42e6-830E-7B833E8146A9}
658 EXTERN_GUID(IID_IMetaDataEmit2, 0xf5dd9950, 0xf693, 0x42e6, 0x83, 0xe, 0x7b, 0x83, 0x3e, 0x81, 0x46, 0xa9);
662 #define INTERFACE IMetaDataEmit2
663 DECLARE_INTERFACE_(IMetaDataEmit2, IMetaDataEmit)
665 STDMETHOD(DefineMethodSpec)(
666 mdToken tkParent, // [IN] MethodDef or MemberRef
667 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature
668 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
669 mdMethodSpec *pmi) PURE; // [OUT] method instantiation token
671 STDMETHOD(GetDeltaSaveSize)( // S_OK or error.
672 CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
673 DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
675 STDMETHOD(SaveDelta)( // S_OK or error.
676 LPCWSTR szFile, // [IN] The filename to save to.
677 DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
679 STDMETHOD(SaveDeltaToStream)( // S_OK or error.
680 IStream *pIStream, // [IN] A writable stream to save to.
681 DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
683 STDMETHOD(SaveDeltaToMemory)( // S_OK or error.
684 void *pbData, // [OUT] Location to write data.
685 ULONG cbData) PURE; // [IN] Max size of data buffer.
687 STDMETHOD(DefineGenericParam)( // S_OK or error.
688 mdToken tk, // [IN] TypeDef or MethodDef
689 ULONG ulParamSeq, // [IN] Index of the type parameter
690 DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance)
691 LPCWSTR szname, // [IN] Name
692 DWORD reserved, // [IN] For future use (e.g. non-type parameters)
693 mdToken rtkConstraints[], // [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec)
694 mdGenericParam *pgp) PURE; // [OUT] Put GenericParam token here
696 STDMETHOD(SetGenericParamProps)( // S_OK or error.
697 mdGenericParam gp, // [IN] GenericParam
698 DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance)
699 LPCWSTR szName, // [IN] Optional name
700 DWORD reserved, // [IN] For future use (e.g. non-type parameters)
701 mdToken rtkConstraints[]) PURE;// [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec)
703 STDMETHOD(ResetENCLog)() PURE; // S_OK or error.
707 //-------------------------------------
708 //--- IMetaDataImport
709 //-------------------------------------
710 // {7DAC8207-D3AE-4c75-9B67-92801A497D44}
711 EXTERN_GUID(IID_IMetaDataImport, 0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44);
715 #define INTERFACE IMetaDataImport
716 DECLARE_INTERFACE_(IMetaDataImport, IUnknown)
718 STDMETHOD_(void, CloseEnum)(HCORENUM hEnum) PURE;
719 STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount) PURE;
720 STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos) PURE;
721 STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],
722 ULONG cMax, ULONG *pcTypeDefs) PURE;
723 STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td,
724 mdInterfaceImpl rImpls[], ULONG cMax,
725 ULONG* pcImpls) PURE;
726 STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[],
727 ULONG cMax, ULONG* pcTypeRefs) PURE;
729 STDMETHOD(FindTypeDefByName)( // S_OK or error.
730 LPCWSTR szTypeDef, // [IN] Name of the Type.
731 mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
732 mdTypeDef *ptd) PURE; // [OUT] Put the TypeDef token here.
734 STDMETHOD(GetScopeProps)( // S_OK or error.
735 _Out_writes_to_opt_(cchName, *pchName)
736 LPWSTR szName, // [OUT] Put the name here.
737 ULONG cchName, // [IN] Size of name buffer in wide chars.
738 ULONG *pchName, // [OUT] Put size of name (wide chars) here.
739 GUID *pmvid) PURE; // [OUT, OPTIONAL] Put MVID here.
741 STDMETHOD(GetModuleFromScope)( // S_OK.
742 mdModule *pmd) PURE; // [OUT] Put mdModule token here.
744 STDMETHOD(GetTypeDefProps)( // S_OK or error.
745 mdTypeDef td, // [IN] TypeDef token for inquiry.
746 _Out_writes_to_opt_(cchTypeDef, *pchTypeDef)
747 LPWSTR szTypeDef, // [OUT] Put name here.
748 ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
749 ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
750 DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
751 mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here.
753 STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
754 mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
755 mdTypeDef *pClass, // [OUT] Put implementing class token here.
756 mdToken *ptkIface) PURE; // [OUT] Put implemented interface token here.
758 STDMETHOD(GetTypeRefProps)( // S_OK or error.
759 mdTypeRef tr, // [IN] TypeRef token.
760 mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
761 _Out_writes_to_opt_(cchName, *pchName)
762 LPWSTR szName, // [OUT] Name of the TypeRef.
763 ULONG cchName, // [IN] Size of buffer.
764 ULONG *pchName) PURE; // [OUT] Size of Name.
766 STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) PURE;
768 STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
769 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
770 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
771 mdToken rMembers[], // [OUT] Put MemberDefs here.
772 ULONG cMax, // [IN] Max MemberDefs to put.
773 ULONG *pcTokens) PURE; // [OUT] Put # put here.
775 STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
776 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
777 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
778 LPCWSTR szName, // [IN] Limit results to those with this name.
779 mdToken rMembers[], // [OUT] Put MemberDefs here.
780 ULONG cMax, // [IN] Max MemberDefs to put.
781 ULONG *pcTokens) PURE; // [OUT] Put # put here.
783 STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
784 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
785 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
786 mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
787 ULONG cMax, // [IN] Max MethodDefs to put.
788 ULONG *pcTokens) PURE; // [OUT] Put # put here.
790 STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
791 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
792 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
793 LPCWSTR szName, // [IN] Limit results to those with this name.
794 mdMethodDef rMethods[], // [OU] Put MethodDefs here.
795 ULONG cMax, // [IN] Max MethodDefs to put.
796 ULONG *pcTokens) PURE; // [OUT] Put # put here.
798 STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
799 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
800 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
801 mdFieldDef rFields[], // [OUT] Put FieldDefs here.
802 ULONG cMax, // [IN] Max FieldDefs to put.
803 ULONG *pcTokens) PURE; // [OUT] Put # put here.
805 STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
806 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
807 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
808 LPCWSTR szName, // [IN] Limit results to those with this name.
809 mdFieldDef rFields[], // [OUT] Put MemberDefs here.
810 ULONG cMax, // [IN] Max MemberDefs to put.
811 ULONG *pcTokens) PURE; // [OUT] Put # put here.
814 STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
815 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
816 mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
817 mdParamDef rParams[], // [OUT] Put ParamDefs here.
818 ULONG cMax, // [IN] Max ParamDefs to put.
819 ULONG *pcTokens) PURE; // [OUT] Put # put here.
821 STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
822 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
823 mdToken tkParent, // [IN] Parent token to scope the enumeration.
824 mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
825 ULONG cMax, // [IN] Max MemberRefs to put.
826 ULONG *pcTokens) PURE; // [OUT] Put # put here.
828 STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
829 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
830 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
831 mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
832 mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
833 ULONG cMax, // [IN] Max tokens to put.
834 ULONG *pcTokens) PURE; // [OUT] Put # put here.
836 STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
837 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
838 mdToken tk, // [IN] if !NIL, token to scope the enumeration.
839 DWORD dwActions, // [IN] if !0, return only these actions.
840 mdPermission rPermission[], // [OUT] Put Permissions here.
841 ULONG cMax, // [IN] Max Permissions to put.
842 ULONG *pcTokens) PURE; // [OUT] Put # put here.
844 STDMETHOD(FindMember)(
845 mdTypeDef td, // [IN] given typedef
846 LPCWSTR szName, // [IN] member name
847 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
848 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
849 mdToken *pmb) PURE; // [OUT] matching memberdef
851 STDMETHOD(FindMethod)(
852 mdTypeDef td, // [IN] given typedef
853 LPCWSTR szName, // [IN] member name
854 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
855 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
856 mdMethodDef *pmb) PURE; // [OUT] matching memberdef
858 STDMETHOD(FindField)(
859 mdTypeDef td, // [IN] given typedef
860 LPCWSTR szName, // [IN] member name
861 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
862 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
863 mdFieldDef *pmb) PURE; // [OUT] matching memberdef
865 STDMETHOD(FindMemberRef)(
866 mdTypeRef td, // [IN] given typeRef
867 LPCWSTR szName, // [IN] member name
868 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
869 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
870 mdMemberRef *pmr) PURE; // [OUT] matching memberref
872 STDMETHOD (GetMethodProps)(
873 mdMethodDef mb, // The method for which to get props.
874 mdTypeDef *pClass, // Put method's class here.
875 _Out_writes_to_opt_(cchMethod, *pchMethod)
876 LPWSTR szMethod, // Put method's name here.
877 ULONG cchMethod, // Size of szMethod buffer in wide chars.
878 ULONG *pchMethod, // Put actual size here
879 DWORD *pdwAttr, // Put flags here.
880 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
881 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
882 ULONG *pulCodeRVA, // [OUT] codeRVA
883 DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
885 STDMETHOD(GetMemberRefProps)( // S_OK or error.
886 mdMemberRef mr, // [IN] given memberref
887 mdToken *ptk, // [OUT] Put classref or classdef here.
888 _Out_writes_to_opt_(cchMember, *pchMember)
889 LPWSTR szMember, // [OUT] buffer to fill for member's name
890 ULONG cchMember, // [IN] the count of char of szMember
891 ULONG *pchMember, // [OUT] actual count of char in member name
892 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
893 ULONG *pbSig) PURE; // [OUT] actual size of signature blob
895 STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
896 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
897 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
898 mdProperty rProperties[], // [OUT] Put Properties here.
899 ULONG cMax, // [IN] Max properties to put.
900 ULONG *pcProperties) PURE; // [OUT] Put # put here.
902 STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
903 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
904 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
905 mdEvent rEvents[], // [OUT] Put events here.
906 ULONG cMax, // [IN] Max events to put.
907 ULONG *pcEvents) PURE; // [OUT] Put # put here.
909 STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
910 mdEvent ev, // [IN] event token
911 mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
912 LPCWSTR szEvent, // [OUT] Event name
913 ULONG cchEvent, // [IN] the count of wchar of szEvent
914 ULONG *pchEvent, // [OUT] actual count of wchar for event's name
915 DWORD *pdwEventFlags, // [OUT] Event flags.
916 mdToken *ptkEventType, // [OUT] EventType class
917 mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
918 mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
919 mdMethodDef *pmdFire, // [OUT] Fire method of the event
920 mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
921 ULONG cMax, // [IN] size of rmdOtherMethod
922 ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this event
924 STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error.
925 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
926 mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
927 mdToken rEventProp[], // [OUT] Put Event/Property here.
928 ULONG cMax, // [IN] Max properties to put.
929 ULONG *pcEventProp) PURE; // [OUT] Put # put here.
931 STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
932 mdMethodDef mb, // [IN] method token
933 mdToken tkEventProp, // [IN] event/property token.
934 DWORD *pdwSemanticsFlags) PURE; // [OUT] the role flags for the method/propevent pair
936 STDMETHOD(GetClassLayout) (
937 mdTypeDef td, // [IN] give typedef
938 DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
939 COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
940 ULONG cMax, // [IN] size of the array
941 ULONG *pcFieldOffset, // [OUT] needed array size
942 ULONG *pulClassSize) PURE; // [OUT] the size of the class
944 STDMETHOD(GetFieldMarshal) (
945 mdToken tk, // [IN] given a field's memberdef
946 PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
947 ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
949 STDMETHOD(GetRVA)( // S_OK or error.
950 mdToken tk, // Member for which to set offset
951 ULONG *pulCodeRVA, // The offset
952 DWORD *pdwImplFlags) PURE; // the implementation flags
954 STDMETHOD(GetPermissionSetProps) (
955 mdPermission pm, // [IN] the permission token.
956 DWORD *pdwAction, // [OUT] CorDeclSecurity.
957 void const **ppvPermission, // [OUT] permission blob.
958 ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
960 STDMETHOD(GetSigFromToken)( // S_OK or error.
961 mdSignature mdSig, // [IN] Signature token.
962 PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
963 ULONG *pcbSig) PURE; // [OUT] return size of signature.
965 STDMETHOD(GetModuleRefProps)( // S_OK or error.
966 mdModuleRef mur, // [IN] moduleref token.
967 _Out_writes_to_opt_(cchName, *pchName)
968 LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
969 ULONG cchName, // [IN] size of szName in wide characters.
970 ULONG *pchName) PURE; // [OUT] actual count of characters in the name.
972 STDMETHOD(EnumModuleRefs)( // S_OK or error.
973 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
974 mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
975 ULONG cmax, // [IN] max memberrefs to put.
976 ULONG *pcModuleRefs) PURE; // [OUT] put # put here.
978 STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
979 mdTypeSpec typespec, // [IN] TypeSpec token.
980 PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
981 ULONG *pcbSig) PURE; // [OUT] return size of signature.
983 STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
984 mdToken tk, // [IN] Token to get name from. Must have a name.
985 MDUTF8CSTR *pszUtf8NamePtr) PURE; // [OUT] Return pointer to UTF8 name in heap.
987 STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
988 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
989 mdToken rMethods[], // [OUT] Put MemberDefs here.
990 ULONG cMax, // [IN] Max MemberDefs to put.
991 ULONG *pcTokens) PURE; // [OUT] Put # put here.
993 STDMETHOD(GetUserString)( // S_OK or error.
994 mdString stk, // [IN] String token.
995 _Out_writes_to_opt_(cchString, *pchString)
996 LPWSTR szString, // [OUT] Copy of string.
997 ULONG cchString, // [IN] Max chars of room in szString.
998 ULONG *pchString) PURE; // [OUT] How many chars in actual string.
1000 STDMETHOD(GetPinvokeMap)( // S_OK or error.
1001 mdToken tk, // [IN] FieldDef or MethodDef.
1002 DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
1003 _Out_writes_to_opt_(cchImportName, *pchImportName)
1004 LPWSTR szImportName, // [OUT] Import name.
1005 ULONG cchImportName, // [IN] Size of the name buffer.
1006 ULONG *pchImportName, // [OUT] Actual number of characters stored.
1007 mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
1009 STDMETHOD(EnumSignatures)( // S_OK or error.
1010 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
1011 mdSignature rSignatures[], // [OUT] put signatures here.
1012 ULONG cmax, // [IN] max signatures to put.
1013 ULONG *pcSignatures) PURE; // [OUT] put # put here.
1015 STDMETHOD(EnumTypeSpecs)( // S_OK or error.
1016 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
1017 mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
1018 ULONG cmax, // [IN] max TypeSpecs to put.
1019 ULONG *pcTypeSpecs) PURE; // [OUT] put # put here.
1021 STDMETHOD(EnumUserStrings)( // S_OK or error.
1022 HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
1023 mdString rStrings[], // [OUT] put Strings here.
1024 ULONG cmax, // [IN] max Strings to put.
1025 ULONG *pcStrings) PURE; // [OUT] put # put here.
1027 STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
1028 mdMethodDef md, // [IN] Method token.
1029 ULONG ulParamSeq, // [IN] Parameter sequence.
1030 mdParamDef *ppd) PURE; // [IN] Put Param token here.
1032 STDMETHOD(EnumCustomAttributes)( // S_OK or error.
1033 HCORENUM *phEnum, // [IN, OUT] COR enumerator.
1034 mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
1035 mdToken tkType, // [IN] Type of interest, 0 for all.
1036 mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
1037 ULONG cMax, // [IN] Size of rCustomAttributes.
1038 ULONG *pcCustomAttributes) PURE; // [OUT, OPTIONAL] Put count of token values here.
1040 STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
1041 mdCustomAttribute cv, // [IN] CustomAttribute token.
1042 mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
1043 mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
1044 void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
1045 ULONG *pcbSize) PURE; // [OUT, OPTIONAL] Put size of date here.
1047 STDMETHOD(FindTypeRef)(
1048 mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
1049 LPCWSTR szName, // [IN] TypeRef Name.
1050 mdTypeRef *ptr) PURE; // [OUT] matching TypeRef.
1052 STDMETHOD(GetMemberProps)(
1053 mdToken mb, // The member for which to get props.
1054 mdTypeDef *pClass, // Put member's class here.
1055 _Out_writes_to_opt_(cchMember, *pchMember)
1056 LPWSTR szMember, // Put member's name here.
1057 ULONG cchMember, // Size of szMember buffer in wide chars.
1058 ULONG *pchMember, // Put actual size here
1059 DWORD *pdwAttr, // Put flags here.
1060 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
1061 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
1062 ULONG *pulCodeRVA, // [OUT] codeRVA
1063 DWORD *pdwImplFlags, // [OUT] Impl. Flags
1064 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
1065 UVCP_CONSTANT *ppValue, // [OUT] constant value
1066 ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
1068 STDMETHOD(GetFieldProps)(
1069 mdFieldDef mb, // The field for which to get props.
1070 mdTypeDef *pClass, // Put field's class here.
1071 _Out_writes_to_opt_(cchField, *pchField)
1072 LPWSTR szField, // Put field's name here.
1073 ULONG cchField, // Size of szField buffer in wide chars.
1074 ULONG *pchField, // Put actual size here
1075 DWORD *pdwAttr, // Put flags here.
1076 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
1077 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
1078 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
1079 UVCP_CONSTANT *ppValue, // [OUT] constant value
1080 ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
1082 STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
1083 mdProperty prop, // [IN] property token
1084 mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
1085 LPCWSTR szProperty, // [OUT] Property name
1086 ULONG cchProperty, // [IN] the count of wchar of szProperty
1087 ULONG *pchProperty, // [OUT] actual count of wchar for property name
1088 DWORD *pdwPropFlags, // [OUT] property flags.
1089 PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
1090 ULONG *pbSig, // [OUT] count of bytes in *ppvSig
1091 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
1092 UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value
1093 ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
1094 mdMethodDef *pmdSetter, // [OUT] setter method of the property
1095 mdMethodDef *pmdGetter, // [OUT] getter method of the property
1096 mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
1097 ULONG cMax, // [IN] size of rmdOtherMethod
1098 ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this property
1100 STDMETHOD(GetParamProps)( // S_OK or error.
1101 mdParamDef tk, // [IN]The Parameter.
1102 mdMethodDef *pmd, // [OUT] Parent Method token.
1103 ULONG *pulSequence, // [OUT] Parameter sequence.
1104 _Out_writes_to_opt_(cchName, *pchName)
1105 LPWSTR szName, // [OUT] Put name here.
1106 ULONG cchName, // [OUT] Size of name buffer.
1107 ULONG *pchName, // [OUT] Put actual size of name here.
1108 DWORD *pdwAttr, // [OUT] Put flags here.
1109 DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
1110 UVCP_CONSTANT *ppValue, // [OUT] Constant value.
1111 ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
1113 STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
1114 mdToken tkObj, // [IN] Object with Custom Attribute.
1115 LPCWSTR szName, // [IN] Name of desired Custom Attribute.
1116 const void **ppData, // [OUT] Put pointer to data here.
1117 ULONG *pcbData) PURE; // [OUT] Put size of data here.
1119 STDMETHOD_(BOOL, IsValidToken)( // True or False.
1120 mdToken tk) PURE; // [IN] Given token.
1122 STDMETHOD(GetNestedClassProps)( // S_OK or error.
1123 mdTypeDef tdNestedClass, // [IN] NestedClass token.
1124 mdTypeDef *ptdEnclosingClass) PURE; // [OUT] EnclosingClass token.
1126 STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
1127 void const *pvSig, // [IN] Pointer to signature.
1128 ULONG cbSig, // [IN] Count of signature bytes.
1129 ULONG *pCallConv) PURE; // [OUT] Put calling conv here (see CorPinvokemap).
1131 STDMETHOD(IsGlobal)( // S_OK or error.
1132 mdToken pd, // [IN] Type, Field, or Method token.
1133 int *pbGlobal) PURE; // [OUT] Put 1 if global, 0 otherwise.
1135 // This interface is sealed. Do not change, add, or remove anything. Instead, derive a new iterface.
1137 }; // IMetaDataImport
1139 //-------------------------------------
1140 //--- IMetaDataImport2
1141 //-------------------------------------
1142 // {FCE5EFA0-8BBA-4f8e-A036-8F2022B08466}
1143 EXTERN_GUID(IID_IMetaDataImport2, 0xfce5efa0, 0x8bba, 0x4f8e, 0xa0, 0x36, 0x8f, 0x20, 0x22, 0xb0, 0x84, 0x66);
1147 #define INTERFACE IMetaDataImport2
1148 DECLARE_INTERFACE_(IMetaDataImport2, IMetaDataImport)
1150 STDMETHOD(EnumGenericParams)(
1151 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1152 mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested
1153 mdGenericParam rGenericParams[], // [OUT] Put GenericParams here.
1154 ULONG cMax, // [IN] Max GenericParams to put.
1155 ULONG *pcGenericParams) PURE; // [OUT] Put # put here.
1157 STDMETHOD(GetGenericParamProps)( // S_OK or error.
1158 mdGenericParam gp, // [IN] GenericParam
1159 ULONG *pulParamSeq, // [OUT] Index of the type parameter
1160 DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance)
1161 mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef)
1162 DWORD *reserved, // [OUT] For future use (e.g. non-type parameters)
1163 _Out_writes_to_opt_(cchName, *pchName)
1164 LPWSTR wzname, // [OUT] Put name here
1165 ULONG cchName, // [IN] Size of buffer
1166 ULONG *pchName) PURE; // [OUT] Put size of name (wide chars) here.
1168 STDMETHOD(GetMethodSpecProps)(
1169 mdMethodSpec mi, // [IN] The method instantiation
1170 mdToken *tkParent, // [OUT] MethodDef or MemberRef
1171 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
1172 ULONG *pcbSigBlob) PURE; // [OUT] actual size of signature blob
1174 STDMETHOD(EnumGenericParamConstraints)(
1175 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1176 mdGenericParam tk, // [IN] GenericParam whose constraints are requested
1177 mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here.
1178 ULONG cMax, // [IN] Max GenericParamConstraints to put.
1179 ULONG *pcGenericParamConstraints) PURE; // [OUT] Put # put here.
1181 STDMETHOD(GetGenericParamConstraintProps)( // S_OK or error.
1182 mdGenericParamConstraint gpc, // [IN] GenericParamConstraint
1183 mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
1184 mdToken *ptkConstraintType) PURE; // [OUT] TypeDef/Ref/Spec constraint
1186 STDMETHOD(GetPEKind)( // S_OK or error.
1187 DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE)
1188 DWORD* pdwMAchine) PURE; // [OUT] Machine as defined in NT header
1190 STDMETHOD(GetVersionString)( // S_OK or error.
1191 _Out_writes_to_opt_(ccBufSize, *pccBufSize)
1192 LPWSTR pwzBuf, // [OUT] Put version string here.
1193 DWORD ccBufSize, // [IN] size of the buffer, in wide chars
1194 DWORD *pccBufSize) PURE; // [OUT] Size of the version string, wide chars, including terminating nul.
1196 STDMETHOD(EnumMethodSpecs)(
1197 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1198 mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested
1199 mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here.
1200 ULONG cMax, // [IN] Max tokens to put.
1201 ULONG *pcMethodSpecs) PURE; // [OUT] Put actual count here.
1203 }; // IMetaDataImport2
1205 //-------------------------------------
1206 //--- IMetaDataFilter
1207 //-------------------------------------
1208 // {D0E80DD1-12D4-11d3-B39D-00C04FF81795}
1209 EXTERN_GUID(IID_IMetaDataFilter, 0xd0e80dd1, 0x12d4, 0x11d3, 0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95);
1213 #define INTERFACE IMetaDataFilter
1214 DECLARE_INTERFACE_(IMetaDataFilter, IUnknown)
1216 STDMETHOD(UnmarkAll)() PURE;
1217 STDMETHOD(MarkToken)(mdToken tk) PURE;
1218 STDMETHOD(IsTokenMarked)(mdToken tk, BOOL *pIsMarked) PURE;
1222 //-------------------------------------
1224 //-------------------------------------
1225 // {D0E80DD3-12D4-11d3-B39D-00C04FF81795}
1226 EXTERN_GUID(IID_IHostFilter, 0xd0e80dd3, 0x12d4, 0x11d3, 0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95);
1230 #define INTERFACE IHostFilter
1231 DECLARE_INTERFACE_(IHostFilter, IUnknown)
1233 STDMETHOD(MarkToken)(mdToken tk) PURE;
1237 //*****************************************************************************
1238 // Assembly Declarations
1239 //*****************************************************************************
1243 DWORD dwOSPlatformId; // Operating system platform.
1244 DWORD dwOSMajorVersion; // OS Major version.
1245 DWORD dwOSMinorVersion; // OS Minor version.
1251 USHORT usMajorVersion; // Major Version.
1252 USHORT usMinorVersion; // Minor Version.
1253 USHORT usBuildNumber; // Build Number.
1254 USHORT usRevisionNumber; // Revision Number.
1255 LPWSTR szLocale; // Locale.
1256 ULONG cbLocale; // [IN/OUT] Size of the buffer in wide chars/Actual size.
1257 DWORD *rProcessor; // Processor ID array.
1258 ULONG ulProcessor; // [IN/OUT] Size of the Processor ID array/Actual # of entries filled in.
1259 OSINFO *rOS; // OSINFO array.
1260 ULONG ulOS; // [IN/OUT]Size of the OSINFO array/Actual # of entries filled in.
1264 // {211EF15B-5317-4438-B196-DEC87B887693}
1265 EXTERN_GUID(IID_IMetaDataAssemblyEmit, 0x211ef15b, 0x5317, 0x4438, 0xb1, 0x96, 0xde, 0xc8, 0x7b, 0x88, 0x76, 0x93);
1269 #define INTERFACE IMetaDataAssemblyEmit
1270 DECLARE_INTERFACE_(IMetaDataAssemblyEmit, IUnknown)
1272 STDMETHOD(DefineAssembly)( // S_OK or error.
1273 const void *pbPublicKey, // [IN] Public key of the assembly.
1274 ULONG cbPublicKey, // [IN] Count of bytes in the public key.
1275 ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
1276 LPCWSTR szName, // [IN] Name of the assembly.
1277 const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
1278 DWORD dwAssemblyFlags, // [IN] Flags.
1279 mdAssembly *pma) PURE; // [OUT] Returned Assembly token.
1281 STDMETHOD(DefineAssemblyRef)( // S_OK or error.
1282 const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
1283 ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
1284 LPCWSTR szName, // [IN] Name of the assembly being referenced.
1285 const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
1286 const void *pbHashValue, // [IN] Hash Blob.
1287 ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
1288 DWORD dwAssemblyRefFlags, // [IN] Flags.
1289 mdAssemblyRef *pmdar) PURE; // [OUT] Returned AssemblyRef token.
1291 STDMETHOD(DefineFile)( // S_OK or error.
1292 LPCWSTR szName, // [IN] Name of the file.
1293 const void *pbHashValue, // [IN] Hash Blob.
1294 ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
1295 DWORD dwFileFlags, // [IN] Flags.
1296 mdFile *pmdf) PURE; // [OUT] Returned File token.
1298 STDMETHOD(DefineExportedType)( // S_OK or error.
1299 LPCWSTR szName, // [IN] Name of the Com Type.
1300 mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType
1301 mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
1302 DWORD dwExportedTypeFlags, // [IN] Flags.
1303 mdExportedType *pmdct) PURE; // [OUT] Returned ExportedType token.
1305 STDMETHOD(DefineManifestResource)( // S_OK or error.
1306 LPCWSTR szName, // [IN] Name of the resource.
1307 mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
1308 DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
1309 DWORD dwResourceFlags, // [IN] Flags.
1310 mdManifestResource *pmdmr) PURE; // [OUT] Returned ManifestResource token.
1312 STDMETHOD(SetAssemblyProps)( // S_OK or error.
1313 mdAssembly pma, // [IN] Assembly token.
1314 const void *pbPublicKey, // [IN] Public key of the assembly.
1315 ULONG cbPublicKey, // [IN] Count of bytes in the public key.
1316 ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
1317 LPCWSTR szName, // [IN] Name of the assembly.
1318 const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
1319 DWORD dwAssemblyFlags) PURE; // [IN] Flags.
1321 STDMETHOD(SetAssemblyRefProps)( // S_OK or error.
1322 mdAssemblyRef ar, // [IN] AssemblyRefToken.
1323 const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
1324 ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
1325 LPCWSTR szName, // [IN] Name of the assembly being referenced.
1326 const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
1327 const void *pbHashValue, // [IN] Hash Blob.
1328 ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
1329 DWORD dwAssemblyRefFlags) PURE; // [IN] Token for Execution Location.
1331 STDMETHOD(SetFileProps)( // S_OK or error.
1332 mdFile file, // [IN] File token.
1333 const void *pbHashValue, // [IN] Hash Blob.
1334 ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
1335 DWORD dwFileFlags) PURE; // [IN] Flags.
1337 STDMETHOD(SetExportedTypeProps)( // S_OK or error.
1338 mdExportedType ct, // [IN] ExportedType token.
1339 mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType.
1340 mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
1341 DWORD dwExportedTypeFlags) PURE; // [IN] Flags.
1343 STDMETHOD(SetManifestResourceProps)( // S_OK or error.
1344 mdManifestResource mr, // [IN] ManifestResource token.
1345 mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
1346 DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
1347 DWORD dwResourceFlags) PURE; // [IN] Flags.
1349 }; // IMetaDataAssemblyEmit
1352 // {EE62470B-E94B-424e-9B7C-2F00C9249F93}
1353 EXTERN_GUID(IID_IMetaDataAssemblyImport, 0xee62470b, 0xe94b, 0x424e, 0x9b, 0x7c, 0x2f, 0x0, 0xc9, 0x24, 0x9f, 0x93);
1357 #define INTERFACE IMetaDataAssemblyImport
1358 DECLARE_INTERFACE_(IMetaDataAssemblyImport, IUnknown)
1360 STDMETHOD(GetAssemblyProps)( // S_OK or error.
1361 mdAssembly mda, // [IN] The Assembly for which to get the properties.
1362 const void **ppbPublicKey, // [OUT] Pointer to the public key.
1363 ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
1364 ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
1365 _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with assembly's simply name.
1366 ULONG cchName, // [IN] Size of buffer in wide chars.
1367 ULONG *pchName, // [OUT] Actual # of wide chars in name.
1368 ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
1369 DWORD *pdwAssemblyFlags) PURE; // [OUT] Flags.
1371 STDMETHOD(GetAssemblyRefProps)( // S_OK or error.
1372 mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
1373 const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
1374 ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
1375 _Out_writes_to_opt_(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name.
1376 ULONG cchName, // [IN] Size of buffer in wide chars.
1377 ULONG *pchName, // [OUT] Actual # of wide chars in name.
1378 ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
1379 const void **ppbHashValue, // [OUT] Hash blob.
1380 ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
1381 DWORD *pdwAssemblyRefFlags) PURE; // [OUT] Flags.
1383 STDMETHOD(GetFileProps)( // S_OK or error.
1384 mdFile mdf, // [IN] The File for which to get the properties.
1385 _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name.
1386 ULONG cchName, // [IN] Size of buffer in wide chars.
1387 ULONG *pchName, // [OUT] Actual # of wide chars in name.
1388 const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
1389 ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
1390 DWORD *pdwFileFlags) PURE; // [OUT] Flags.
1392 STDMETHOD(GetExportedTypeProps)( // S_OK or error.
1393 mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
1394 _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name.
1395 ULONG cchName, // [IN] Size of buffer in wide chars.
1396 ULONG *pchName, // [OUT] Actual # of wide chars in name.
1397 mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
1398 mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
1399 DWORD *pdwExportedTypeFlags) PURE; // [OUT] Flags.
1401 STDMETHOD(GetManifestResourceProps)( // S_OK or error.
1402 mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
1403 _Out_writes_to_opt_(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name.
1404 ULONG cchName, // [IN] Size of buffer in wide chars.
1405 ULONG *pchName, // [OUT] Actual # of wide chars in name.
1406 mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource.
1407 DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
1408 DWORD *pdwResourceFlags) PURE;// [OUT] Flags.
1410 STDMETHOD(EnumAssemblyRefs)( // S_OK or error
1411 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1412 mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
1413 ULONG cMax, // [IN] Max AssemblyRefs to put.
1414 ULONG *pcTokens) PURE; // [OUT] Put # put here.
1416 STDMETHOD(EnumFiles)( // S_OK or error
1417 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1418 mdFile rFiles[], // [OUT] Put Files here.
1419 ULONG cMax, // [IN] Max Files to put.
1420 ULONG *pcTokens) PURE; // [OUT] Put # put here.
1422 STDMETHOD(EnumExportedTypes)( // S_OK or error
1423 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1424 mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
1425 ULONG cMax, // [IN] Max ExportedTypes to put.
1426 ULONG *pcTokens) PURE; // [OUT] Put # put here.
1428 STDMETHOD(EnumManifestResources)( // S_OK or error
1429 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
1430 mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here.
1431 ULONG cMax, // [IN] Max Resources to put.
1432 ULONG *pcTokens) PURE; // [OUT] Put # put here.
1434 STDMETHOD(GetAssemblyFromScope)( // S_OK or error
1435 mdAssembly *ptkAssembly) PURE; // [OUT] Put token here.
1437 STDMETHOD(FindExportedTypeByName)( // S_OK or error
1438 LPCWSTR szName, // [IN] Name of the ExportedType.
1439 mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
1440 mdExportedType *ptkExportedType) PURE; // [OUT] Put the ExportedType token here.
1442 STDMETHOD(FindManifestResourceByName)( // S_OK or error
1443 LPCWSTR szName, // [IN] Name of the ManifestResource.
1444 mdManifestResource *ptkManifestResource) PURE; // [OUT] Put the ManifestResource token here.
1446 STDMETHOD_(void, CloseEnum)(
1447 HCORENUM hEnum) PURE; // Enum to be closed.
1449 STDMETHOD(FindAssembliesByName)( // S_OK or error
1450 LPCWSTR szAppBase, // [IN] optional - can be NULL
1451 LPCWSTR szPrivateBin, // [IN] optional - can be NULL
1452 LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
1453 IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
1454 ULONG cMax, // [IN] The max number to put
1455 ULONG *pcAssemblies) PURE; // [OUT] The number of assemblies returned.
1456 }; // IMetaDataAssemblyImport
1459 //*****************************************************************************
1460 // End Assembly Declarations
1461 //*****************************************************************************
1463 //*****************************************************************************
1464 // MetaData Validator Declarations
1465 //*****************************************************************************
1467 // Specifies the type of the module, PE file vs. .obj file.
1470 ValidatorModuleTypeInvalid = 0x0,
1471 ValidatorModuleTypeMin = 0x00000001,
1472 ValidatorModuleTypePE = 0x00000001,
1473 ValidatorModuleTypeObj = 0x00000002,
1474 ValidatorModuleTypeEnc = 0x00000003,
1475 ValidatorModuleTypeIncr = 0x00000004,
1476 ValidatorModuleTypeMax = 0x00000004,
1477 } CorValidatorModuleType;
1480 // {4709C9C6-81FF-11D3-9FC7-00C04F79A0A3}
1481 EXTERN_GUID(IID_IMetaDataValidate, 0x4709c9c6, 0x81ff, 0x11d3, 0x9f, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
1485 #define INTERFACE IMetaDataValidate
1486 DECLARE_INTERFACE_(IMetaDataValidate, IUnknown)
1488 STDMETHOD(ValidatorInit)( // S_OK or error.
1489 DWORD dwModuleType, // [IN] Specifies the type of the module.
1490 IUnknown *pUnk) PURE; // [IN] Validation error handler.
1492 STDMETHOD(ValidateMetaData)( // S_OK or error.
1494 }; // IMetaDataValidate
1496 //*****************************************************************************
1497 // End MetaData Validator Declarations
1498 //*****************************************************************************
1500 //*****************************************************************************
1501 // IMetaDataDispenserEx declarations.
1502 //*****************************************************************************
1504 // {31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3}
1505 EXTERN_GUID(IID_IMetaDataDispenserEx, 0x31bcfce2, 0xdafb, 0x11d2, 0x9f, 0x81, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
1508 #define INTERFACE IMetaDataDispenserEx
1509 DECLARE_INTERFACE_(IMetaDataDispenserEx, IMetaDataDispenser)
1511 STDMETHOD(SetOption)( // Return code.
1512 REFGUID optionid, // [in] GUID for the option to be set.
1513 const VARIANT *value) PURE; // [in] Value to which the option is to be set.
1515 STDMETHOD(GetOption)( // Return code.
1516 REFGUID optionid, // [in] GUID for the option to be set.
1517 VARIANT *pvalue) PURE; // [out] Value to which the option is currently set.
1519 STDMETHOD(OpenScopeOnITypeInfo)( // Return code.
1520 ITypeInfo *pITI, // [in] ITypeInfo to open.
1521 DWORD dwOpenFlags, // [in] Open mode flags.
1522 REFIID riid, // [in] The interface desired.
1523 IUnknown **ppIUnk) PURE; // [out] Return interface on success.
1525 STDMETHOD(GetCORSystemDirectory)( // Return code.
1526 _Out_writes_to_opt_(cchBuffer, *pchBuffer)
1527 LPWSTR szBuffer, // [out] Buffer for the directory name
1528 DWORD cchBuffer, // [in] Size of the buffer
1529 DWORD* pchBuffer) PURE; // [OUT] Number of characters returned
1531 STDMETHOD(FindAssembly)( // S_OK or error
1532 LPCWSTR szAppBase, // [IN] optional - can be NULL
1533 LPCWSTR szPrivateBin, // [IN] optional - can be NULL
1534 LPCWSTR szGlobalBin, // [IN] optional - can be NULL
1535 LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
1536 LPCWSTR szName, // [OUT] buffer - to hold name
1537 ULONG cchName, // [IN] the name buffer's size
1538 ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
1540 STDMETHOD(FindAssemblyModule)( // S_OK or error
1541 LPCWSTR szAppBase, // [IN] optional - can be NULL
1542 LPCWSTR szPrivateBin, // [IN] optional - can be NULL
1543 LPCWSTR szGlobalBin, // [IN] optional - can be NULL
1544 LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
1545 LPCWSTR szModuleName, // [IN] required - the name of the module
1546 _Out_writes_to_opt_(cchName, *pcName)
1547 LPWSTR szName, // [OUT] buffer - to hold name
1548 ULONG cchName, // [IN] the name buffer's size
1549 ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
1553 //*****************************************************************************
1554 //*****************************************************************************
1556 // Registration declarations. Will be replace by Services' Registration
1559 //*****************************************************************************
1560 //*****************************************************************************
1561 // Various flags for use in installing a module or a composite
1564 regNoCopy = 0x00000001, // Don't copy files into destination
1565 regConfig = 0x00000002, // Is a configuration
1566 regHasRefs = 0x00000004 // Has class references
1579 //*****************************************************************************
1580 //*****************************************************************************
1582 // CeeGen interfaces for generating in-memory Common Language Runtime files
1584 //*****************************************************************************
1585 //*****************************************************************************
1587 typedef void *HCEESECTION;
1591 sdReadOnly = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA,
1592 sdReadWrite = sdReadOnly | IMAGE_SCN_MEM_WRITE,
1593 sdExecute = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE
1597 // Relocation types.
1601 // generate only a section-relative reloc, nothing into .reloc section
1604 // generate a .reloc for a pointer sized location,
1605 // This is transformed into BASED_HIGHLOW or BASED_DIR64 based on the platform
1608 // generate a .reloc for the top 16-bits of a 32 bit number, where the
1609 // bottom 16 bits are included in the next word in the .reloc table
1610 srRelocHighAdj, // Never Used
1612 // generate a token map relocation, nothing into .reloc section
1615 // relative address fixup
1618 // Generate only a section-relative reloc, nothing into .reloc
1619 // section. This reloc is relative to the file position of the
1620 // section, not the section's virtual address.
1623 // code relative address fixup
1624 srRelocCodeRelative,
1626 // generate a .reloc for a 64 bit address in an ia64 movl instruction
1629 // generate a .reloc for a 64 bit address
1632 // generate a .reloc for a 25-bit PC relative address in an ia64 br.call instruction
1635 // generate a .reloc for a 64-bit PC relative address in an ia64 brl.call instruction
1638 // generate a 30-bit section-relative reloc, used for tagged pointer values
1639 srRelocAbsoluteTagged,
1642 // A sentinel value to help ensure any additions to this enum are reflected
1643 // in PEWriter.cpp's RelocName array.
1646 // Flags that can be used with the above reloc types
1648 // do not emit base reloc
1649 srNoBaseReloc = 0x4000,
1651 // pre-fixup contents of memory are ptr rather than a section offset
1652 srRelocPtr = 0x8000,
1654 // legal enums which include the Ptr flag
1655 srRelocAbsolutePtr = srRelocPtr + srRelocAbsolute,
1656 srRelocHighLowPtr = srRelocPtr + srRelocHighLow,
1657 srRelocRelativePtr = srRelocPtr + srRelocRelative,
1658 srRelocIA64Imm64Ptr = srRelocPtr + srRelocIA64Imm64,
1659 srRelocDir64Ptr = srRelocPtr + srRelocDir64,
1661 } CeeSectionRelocType;
1665 } CeeSectionRelocExtra;
1667 //-------------------------------------
1669 //-------------------------------------
1670 // {7ED1BDFF-8E36-11d2-9C56-00A0C9B7CC45}
1671 EXTERN_GUID(IID_ICeeGen, 0x7ed1bdff, 0x8e36, 0x11d2, 0x9c, 0x56, 0x0, 0xa0, 0xc9, 0xb7, 0xcc, 0x45);
1673 DECLARE_INTERFACE_(ICeeGen, IUnknown)
1675 STDMETHOD (EmitString) (
1677 LPWSTR lpString, // [IN] String to emit
1678 ULONG *RVA) PURE; // [OUT] RVA for string emitted string
1680 STDMETHOD (GetString) (
1681 ULONG RVA, // [IN] RVA for string to return
1683 LPWSTR *lpString) PURE; // [OUT] Returned string
1685 STDMETHOD (AllocateMethodBuffer) (
1686 ULONG cchBuffer, // [IN] Length of buffer to create
1687 UCHAR **lpBuffer, // [OUT] Returned buffer
1688 ULONG *RVA) PURE; // [OUT] RVA for method
1690 STDMETHOD (GetMethodBuffer) (
1691 ULONG RVA, // [IN] RVA for method to return
1692 UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
1694 STDMETHOD (GetIMapTokenIface) (
1695 IUnknown **pIMapToken) PURE;
1697 STDMETHOD (GenerateCeeFile) () PURE;
1699 STDMETHOD (GetIlSection) (
1700 HCEESECTION *section) PURE;
1702 STDMETHOD (GetStringSection) (
1703 HCEESECTION *section) PURE;
1705 STDMETHOD (AddSectionReloc) (
1706 HCEESECTION section,
1708 HCEESECTION relativeTo,
1709 CeeSectionRelocType relocType) PURE;
1711 // use these only if you have special section requirements not handled
1713 STDMETHOD (GetSectionCreate) (
1716 HCEESECTION *section) PURE;
1718 STDMETHOD (GetSectionDataLen) (
1719 HCEESECTION section,
1720 ULONG *dataLen) PURE;
1722 STDMETHOD (GetSectionBlock) (
1723 HCEESECTION section,
1726 void **ppBytes=0) PURE;
1728 STDMETHOD (TruncateSection) (
1729 HCEESECTION section,
1732 STDMETHOD (GenerateCeeMemoryImage) (
1733 void **ppImage) PURE;
1735 STDMETHOD (ComputePointer) (
1736 HCEESECTION section,
1737 ULONG RVA, // [IN] RVA for method to return
1738 UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
1742 //*****************************************************************************
1743 //*****************************************************************************
1745 // End of CeeGen declarations.
1747 //*****************************************************************************
1749 //**********************************************************************
1750 //**********************************************************************
1751 //--- IMetaDataTables
1752 //-------------------------------------
1753 // This API isn't big endian friendly since it indexes directly into the memory that
1754 // is stored in little endian format.
1755 // {D8F579AB-402D-4b8e-82D9-5D63B1065C68}
1756 EXTERN_GUID(IID_IMetaDataTables, 0xd8f579ab, 0x402d, 0x4b8e, 0x82, 0xd9, 0x5d, 0x63, 0xb1, 0x6, 0x5c, 0x68);
1758 DECLARE_INTERFACE_(IMetaDataTables, IUnknown)
1760 STDMETHOD (GetStringHeapSize) (
1761 ULONG *pcbStrings) PURE; // [OUT] Size of the string heap.
1763 STDMETHOD (GetBlobHeapSize) (
1764 ULONG *pcbBlobs) PURE; // [OUT] Size of the Blob heap.
1766 STDMETHOD (GetGuidHeapSize) (
1767 ULONG *pcbGuids) PURE; // [OUT] Size of the Guid heap.
1769 STDMETHOD (GetUserStringHeapSize) (
1770 ULONG *pcbBlobs) PURE; // [OUT] Size of the User String heap.
1772 STDMETHOD (GetNumTables) (
1773 ULONG *pcTables) PURE; // [OUT] Count of tables.
1775 STDMETHOD (GetTableIndex) (
1776 ULONG token, // [IN] Token for which to get table index.
1777 ULONG *pixTbl) PURE; // [OUT] Put table index here.
1779 STDMETHOD (GetTableInfo) (
1780 ULONG ixTbl, // [IN] Which table.
1781 ULONG *pcbRow, // [OUT] Size of a row, bytes.
1782 ULONG *pcRows, // [OUT] Number of rows.
1783 ULONG *pcCols, // [OUT] Number of columns in each row.
1784 ULONG *piKey, // [OUT] Key column, or -1 if none.
1785 const char **ppName) PURE; // [OUT] Name of the table.
1787 STDMETHOD (GetColumnInfo) (
1788 ULONG ixTbl, // [IN] Which Table
1789 ULONG ixCol, // [IN] Which Column in the table
1790 ULONG *poCol, // [OUT] Offset of the column in the row.
1791 ULONG *pcbCol, // [OUT] Size of a column, bytes.
1792 ULONG *pType, // [OUT] Type of the column.
1793 const char **ppName) PURE; // [OUT] Name of the Column.
1795 STDMETHOD (GetCodedTokenInfo) (
1796 ULONG ixCdTkn, // [IN] Which kind of coded token.
1797 ULONG *pcTokens, // [OUT] Count of tokens.
1798 ULONG **ppTokens, // [OUT] List of tokens.
1799 const char **ppName) PURE; // [OUT] Name of the CodedToken.
1801 STDMETHOD (GetRow) (
1802 ULONG ixTbl, // [IN] Which table.
1803 ULONG rid, // [IN] Which row.
1804 void **ppRow) PURE; // [OUT] Put pointer to row here.
1806 STDMETHOD (GetColumn) (
1807 ULONG ixTbl, // [IN] Which table.
1808 ULONG ixCol, // [IN] Which column.
1809 ULONG rid, // [IN] Which row.
1810 ULONG *pVal) PURE; // [OUT] Put the column contents here.
1812 STDMETHOD (GetString) (
1813 ULONG ixString, // [IN] Value from a string column.
1814 const char **ppString) PURE; // [OUT] Put a pointer to the string here.
1816 STDMETHOD (GetBlob) (
1817 ULONG ixBlob, // [IN] Value from a blob column.
1818 ULONG *pcbData, // [OUT] Put size of the blob here.
1819 const void **ppData) PURE; // [OUT] Put a pointer to the blob here.
1821 STDMETHOD (GetGuid) (
1822 ULONG ixGuid, // [IN] Value from a guid column.
1823 const GUID **ppGUID) PURE; // [OUT] Put a pointer to the GUID here.
1825 STDMETHOD (GetUserString) (
1826 ULONG ixUserString, // [IN] Value from a UserString column.
1827 ULONG *pcbData, // [OUT] Put size of the UserString here.
1828 const void **ppData) PURE; // [OUT] Put a pointer to the UserString here.
1830 STDMETHOD (GetNextString) (
1831 ULONG ixString, // [IN] Value from a string column.
1832 ULONG *pNext) PURE; // [OUT] Put the index of the next string here.
1834 STDMETHOD (GetNextBlob) (
1835 ULONG ixBlob, // [IN] Value from a blob column.
1836 ULONG *pNext) PURE; // [OUT] Put the index of the netxt blob here.
1838 STDMETHOD (GetNextGuid) (
1839 ULONG ixGuid, // [IN] Value from a guid column.
1840 ULONG *pNext) PURE; // [OUT] Put the index of the next guid here.
1842 STDMETHOD (GetNextUserString) (
1843 ULONG ixUserString, // [IN] Value from a UserString column.
1844 ULONG *pNext) PURE; // [OUT] Put the index of the next user string here.
1846 // Interface is sealed.
1849 // This API isn't big endian friendly since it indexes directly into the memory that
1850 // is stored in little endian format.
1851 // {BADB5F70-58DA-43a9-A1C6-D74819F19B15}
1852 EXTERN_GUID(IID_IMetaDataTables2, 0xbadb5f70, 0x58da, 0x43a9, 0xa1, 0xc6, 0xd7, 0x48, 0x19, 0xf1, 0x9b, 0x15);
1854 DECLARE_INTERFACE_(IMetaDataTables2, IMetaDataTables)
1856 STDMETHOD (GetMetaDataStorage) ( //@todo: name?
1857 const void **ppvMd, // [OUT] put pointer to MD section here (aka, 'BSJB').
1858 ULONG *pcbMd) PURE; // [OUT] put size of the stream here.
1860 STDMETHOD (GetMetaDataStreamInfo) ( // Get info about the MD stream.
1861 ULONG ix, // [IN] Stream ordinal desired.
1862 const char **ppchName, // [OUT] put pointer to stream name here.
1863 const void **ppv, // [OUT] put pointer to MD stream here.
1864 ULONG *pcb) PURE; // [OUT] put size of the stream here.
1866 }; // IMetaDataTables2
1868 #ifdef _DEFINE_META_DATA_META_CONSTANTS
1869 #ifndef _META_DATA_META_CONSTANTS_DEFINED
1870 #define _META_DATA_META_CONSTANTS_DEFINED
1871 const unsigned int iRidMax = 63;
1872 const unsigned int iCodedToken = 64; // base of coded tokens.
1873 const unsigned int iCodedTokenMax = 95;
1874 const unsigned int iSHORT = 96; // fixed types.
1875 const unsigned int iUSHORT = 97;
1876 const unsigned int iLONG = 98;
1877 const unsigned int iULONG = 99;
1878 const unsigned int iBYTE = 100;
1879 const unsigned int iSTRING = 101; // pool types.
1880 const unsigned int iGUID = 102;
1881 const unsigned int iBLOB = 103;
1883 inline int IsRidType(ULONG ix) { return ix <= iRidMax; }
1884 inline int IsCodedTokenType(ULONG ix) { return (ix >= iCodedToken) && (ix <= iCodedTokenMax); }
1885 inline int IsRidOrToken(ULONG ix) { return ix <= iCodedTokenMax; }
1886 inline int IsHeapType(ULONG ix) { return ix >= iSTRING; }
1887 inline int IsFixedType(ULONG ix) { return (ix < iSTRING) && (ix > iCodedTokenMax); }
1891 //**********************************************************************
1892 // End of IMetaDataTables.
1893 //**********************************************************************
1895 //-------------------------------------
1897 //-------------------------------------
1898 // {7998EA64-7F95-48B8-86FC-17CAF48BF5CB}
1899 EXTERN_GUID(IID_IMetaDataInfo, 0x7998EA64, 0x7F95, 0x48B8, 0x86, 0xFC, 0x17, 0xCA, 0xF4, 0x8B, 0xF5, 0xCB);
1903 #define INTERFACE IMetaDataInfo
1904 DECLARE_INTERFACE_(IMetaDataInfo, IUnknown)
1907 // S_OK - All parameters are filled.
1908 // COR_E_NOTSUPPORTED - The API is not supported for this particular scope (e.g. .obj files, scope
1909 // opened without whole file via code:IMetaDataDispenser::OpenScopeOnMemory, etc.).
1910 // E_INVALIDARG - If NULL is passed as parameter.
1911 STDMETHOD(GetFileMapping)(
1912 const void ** ppvData, // [out] Pointer to the start of the mapped file.
1913 ULONGLONG * pcbData, // [out] Size of the mapped memory region.
1914 DWORD * pdwMappingType) PURE; // [out] Type of file mapping (code:CorFileMapping).
1915 }; // class IMetaDataInfo
1918 //-------------------------------------
1919 //--- IMetaDataWinMDImport
1920 //-------------------------------------
1921 // {969EA0C5-964E-411B-A807-B0F3C2DFCBD4}
1922 EXTERN_GUID(IID_IMetaDataWinMDImport, 0x969ea0c5, 0x964e, 0x411b, 0xa8, 0x7, 0xb0, 0xf3, 0xc2, 0xdf, 0xcb, 0xd4);
1926 #define INTERFACE IMetaDataWinMDImport
1927 DECLARE_INTERFACE_(IMetaDataWinMDImport, IUnknown)
1929 STDMETHOD(GetUntransformedTypeRefProps)( // S_OK or error.
1930 mdTypeRef tr, // [IN] TypeRef token.
1931 mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
1932 _Out_writes_to_opt_(cchName, *pchName)
1933 LPWSTR szName, // [OUT] Name of the TypeRef.
1934 ULONG cchName, // [IN] Size of buffer.
1935 ULONG *pchName) PURE; // [OUT] Size of Name.
1936 }; // class IMetaDataWinMDImport
1938 //**********************************************************************
1940 // Predefined CustomAttribute and structures for these custom value
1942 //**********************************************************************
1945 // Native Link method custom value definitions. This is for N-direct support.
1948 #define COR_NATIVE_LINK_CUSTOM_VALUE L"COMPLUS_NativeLink"
1949 #define COR_NATIVE_LINK_CUSTOM_VALUE_ANSI "COMPLUS_NativeLink"
1951 // count of chars for COR_NATIVE_LINK_CUSTOM_VALUE(_ANSI)
1952 #define COR_NATIVE_LINK_CUSTOM_VALUE_CC 18
1954 #include <pshpack1.h>
1957 BYTE m_linkType; // see CorNativeLinkType below
1958 BYTE m_flags; // see CorNativeLinkFlags below
1959 mdMemberRef m_entryPoint; // member ref token giving entry point, format is lib:entrypoint
1961 #include <poppack.h>
1965 nltNone = 1, // none of the keywords are specified
1966 nltAnsi = 2, // ansi keyword specified
1967 nltUnicode = 3, // unicode keyword specified
1968 nltAuto = 4, // auto keyword specified
1969 nltOle = 5, // ole keyword specified
1970 nltMaxValue = 7, // used so we can assert how many bits are required for this enum
1971 } CorNativeLinkType;
1975 nlfNone = 0x00, // no flags
1976 nlfLastError = 0x01, // setLastError keyword specified
1977 nlfNoMangle = 0x02, // nomangle keyword specified
1978 nlfMaxValue = 0x03, // used so we can assert how many bits are required for this enum
1979 } CorNativeLinkFlags;
1982 // Base class for security custom attributes.
1985 #define COR_BASE_SECURITY_ATTRIBUTE_CLASS L"System.Security.Permissions.SecurityAttribute"
1986 #define COR_BASE_SECURITY_ATTRIBUTE_CLASS_ANSI "System.Security.Permissions.SecurityAttribute"
1989 // Name of custom attribute used to indicate that per-call security checks should
1990 // be disabled for P/Invoke calls.
1993 #define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE L"System.Security.SuppressUnmanagedCodeSecurityAttribute"
1994 #define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI "System.Security.SuppressUnmanagedCodeSecurityAttribute"
1997 // Name of custom attribute tagged on module to indicate it contains
1998 // unverifiable code.
2001 #define COR_UNVER_CODE_ATTRIBUTE L"System.Security.UnverifiableCodeAttribute"
2002 #define COR_UNVER_CODE_ATTRIBUTE_ANSI "System.Security.UnverifiableCodeAttribute"
2005 // Name of custom attribute indicating that a method requires a security object
2006 // slot on the caller's stack.
2009 #define COR_REQUIRES_SECOBJ_ATTRIBUTE W("System.Security.DynamicSecurityMethodAttribute")
2010 #define COR_REQUIRES_SECOBJ_ATTRIBUTE_ANSI "System.Security.DynamicSecurityMethodAttribute"
2012 #define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE L"System.Runtime.CompilerServices.DiscardableAttribute"
2013 #define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE_ASNI "System.Runtime.CompilerServices.DiscardableAttribute"
2019 //*****************************************************************************
2020 //*****************************************************************************
2022 // C O M + s i g n a t u r e s u p p o r t
2024 //*****************************************************************************
2025 //*****************************************************************************
2029 #define FORCEINLINE inline
2031 #define FORCEINLINE __forceinline
2036 // We need a version that is FORCEINLINE on retail and NOINLINE on debug
2038 #ifndef DEBUG_NOINLINE
2040 #define DEBUG_NOINLINE __declspec(noinline)
2042 #define DEBUG_NOINLINE
2046 #ifndef DBG_NOINLINE_X86__RET_INLINE
2047 #if defined(_DEBUG) && defined(_X86_)
2048 #define DBG_NOINLINE_X86__RET_INLINE __declspec(noinline)
2050 #define DBG_NOINLINE_X86__RET_INLINE FORCEINLINE
2056 #define NOINLINE __declspec(noinline)
2057 #elif defined __GNUC__
2058 #define NOINLINE __attribute__ ((noinline))
2064 // return true if it is a primitive type, i.e. only need to store CorElementType
2065 FORCEINLINE int CorIsPrimitiveType(CorElementType elementtype)
2067 return (elementtype < ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_I || elementtype == ELEMENT_TYPE_U);
2071 // Return true if element type is a modifier, i.e. ELEMENT_TYPE_MODIFIER bits are
2072 // turned on. For now, it is checking for ELEMENT_TYPE_PTR and ELEMENT_TYPE_BYREF
2073 // as well. This will be removed when we turn on ELEMENT_TYPE_MODIFIER bits for
2074 // these two enum members.
2076 FORCEINLINE int CorIsModifierElementType(CorElementType elementtype)
2078 if (elementtype == ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_BYREF)
2080 return (elementtype & ELEMENT_TYPE_MODIFIER);
2083 // Given a compress byte (*pData), return the size of the uncompressed data.
2084 inline ULONG CorSigUncompressedDataSize(
2085 PCCOR_SIGNATURE pData)
2087 if ((*pData & 0x80) == 0)
2089 else if ((*pData & 0xC0) == 0x80)
2095 /////////////////////////////////////////////////////////////////////////////////////////////
2097 // Given a compressed integer(*pData), expand the compressed int to *pDataOut.
2098 // Return value is the number of bytes that the integer occupies in the compressed format
2099 // It is caller's responsibility to ensure pDataOut has at least 4 bytes to be written to.
2101 // This function returns -1 if pass in with an incorrectly compressed data, such as
2102 // (*pBytes & 0xE0) == 0XE0.
2103 /////////////////////////////////////////////////////////////////////////////////////////////
2104 inline ULONG CorSigUncompressBigData(
2105 PCCOR_SIGNATURE & pData) // [IN,OUT] compressed data
2109 // 1 byte data is handled in CorSigUncompressData
2110 // _ASSERTE(*pData & 0x80);
2113 if ((*pData & 0xC0) == 0x80) // 10?? ????
2115 res = (ULONG)((*pData++ & 0x3f) << 8);
2120 res = (*pData++ & 0x1f) << 24;
2121 res |= *pData++ << 16;
2122 res |= *pData++ << 8;
2127 FORCEINLINE ULONG CorSigUncompressData(
2128 PCCOR_SIGNATURE & pData) // [IN,OUT] compressed data
2130 // Handle smallest data inline.
2131 if ((*pData & 0x80) == 0x00) // 0??? ????
2133 return CorSigUncompressBigData(pData);
2136 inline HRESULT CorSigUncompressData(// return S_OK or E_BADIMAGEFORMAT if the signature is bad
2137 PCCOR_SIGNATURE pData, // [IN] compressed data
2138 DWORD len, // [IN] length of the signature
2139 ULONG * pDataOut, // [OUT] the expanded *pData
2140 ULONG * pDataLen) // [OUT] length of the expanded *pData
2143 BYTE const *pBytes = reinterpret_cast<BYTE const*>(pData);
2146 if ((*pBytes & 0x80) == 0x00) // 0??? ????
2152 hr = META_E_BAD_SIGNATURE;
2156 *pDataOut = *pBytes;
2161 else if ((*pBytes & 0xC0) == 0x80) // 10?? ????
2167 hr = META_E_BAD_SIGNATURE;
2171 *pDataOut = (ULONG)(((*pBytes & 0x3f) << 8 | *(pBytes+1)));
2175 else if ((*pBytes & 0xE0) == 0xC0) // 110? ????
2181 hr = META_E_BAD_SIGNATURE;
2185 *pDataOut = (ULONG)(((*pBytes & 0x1f) << 24 | *(pBytes+1) << 16 | *(pBytes+2) << 8 | *(pBytes+3)));
2189 else // We don't recognize this encoding
2193 hr = META_E_BAD_SIGNATURE;
2199 inline ULONG CorSigUncompressData( // return number of bytes of that compressed data occupied in pData
2200 PCCOR_SIGNATURE pData, // [IN] compressed data
2201 ULONG *pDataOut) // [OUT] the expanded *pData
2203 ULONG dwSizeOfData = 0;
2205 // We don't know how big the signature is, so we'll just say that it's big enough
2206 if (FAILED(CorSigUncompressData(pData, 0xff, pDataOut, &dwSizeOfData)))
2212 return dwSizeOfData;
2216 #if !defined(SELECTANY)
2217 #define SELECTANY extern __declspec(selectany)
2220 SELECTANY const mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};
2222 // uncompress a token
2223 inline mdToken CorSigUncompressToken( // return the token.
2224 PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
2229 tk = CorSigUncompressData(pData);
2230 tkType = g_tkCorEncodeToken[tk & 0x3];
2231 tk = TokenFromRid(tk >> 2, tkType);
2236 inline ULONG CorSigUncompressToken( // return number of bytes of that compressed data occupied in pData
2237 PCCOR_SIGNATURE pData, // [IN] compressed data
2238 mdToken * pToken) // [OUT] the expanded *pData
2244 cb = CorSigUncompressData(pData, (ULONG *)&tk);
2245 tkType = g_tkCorEncodeToken[tk & 0x3];
2246 tk = TokenFromRid(tk >> 2, tkType);
2251 inline HRESULT CorSigUncompressToken(
2252 PCCOR_SIGNATURE pData, // [IN] compressed data
2253 DWORD dwLen, // [IN] Remaining length of sigature
2254 mdToken * pToken, // [OUT] the expanded *pData
2255 DWORD * dwTokenLength) // [OUT] The length of the token in the sigature
2260 HRESULT hr = CorSigUncompressData(pData, dwLen, (ULONG *)&tk, dwTokenLength);
2264 tkType = g_tkCorEncodeToken[tk & 0x3];
2265 tk = TokenFromRid(tk >> 2, tkType);
2270 *pToken = mdTokenNil;
2277 FORCEINLINE ULONG CorSigUncompressCallingConv(
2278 PCCOR_SIGNATURE & pData) // [IN,OUT] Compressed data
2283 FORCEINLINE HRESULT CorSigUncompressCallingConv(
2284 PCCOR_SIGNATURE pData, // [IN] Signature
2285 DWORD dwLen, // [IN] Length of signature
2286 ULONG * data) // [OUT] Compressed data
2296 return META_E_BAD_SIGNATURE;
2302 SIGN_MASK_ONEBYTE = 0xffffffc0, // Mask the same size as the missing bits.
2303 SIGN_MASK_TWOBYTE = 0xffffe000, // Mask the same size as the missing bits.
2304 SIGN_MASK_FOURBYTE = 0xf0000000, // Mask the same size as the missing bits.
2307 // uncompress a signed integer
2308 inline ULONG CorSigUncompressSignedInt( // return number of bytes of that compressed data occupied in pData
2309 PCCOR_SIGNATURE pData, // [IN] compressed data
2310 int * pInt) // [OUT] the expanded *pInt
2316 cb = CorSigUncompressData(pData, &iData);
2317 if (cb == (ULONG) -1) return cb;
2318 ulSigned = iData & 0x1;
2324 iData |= SIGN_MASK_ONEBYTE;
2328 iData |= SIGN_MASK_TWOBYTE;
2332 iData |= SIGN_MASK_FOURBYTE;
2340 // uncompress encoded element type
2341 FORCEINLINE CorElementType CorSigUncompressElementType( // Element type
2342 PCCOR_SIGNATURE & pData) // [IN,OUT] Compressed data
2344 return (CorElementType)*pData++;
2347 inline ULONG CorSigUncompressElementType( // Return number of bytes of that compressed data occupied in pData
2348 PCCOR_SIGNATURE pData, // [IN] Compressed data
2349 CorElementType * pElementType) // [OUT] The expanded *pData
2351 *pElementType = (CorElementType)(*pData & 0x7f);
2356 /////////////////////////////////////////////////////////////////////////////////////////////
2358 // Given an uncompressed unsigned integer (iLen), Store it to pDataOut in a compressed format.
2359 // Return value is the number of bytes that the integer occupies in the compressed format.
2360 // It is caller's responsibilityt to ensure *pDataOut has at least 4 bytes to write to.
2362 // Note that this function returns -1 if iLen is too big to be compressed. We currently can
2363 // only represent to 0x1FFFFFFF.
2365 /////////////////////////////////////////////////////////////////////////////////////////////
2366 inline ULONG CorSigCompressData( // return number of bytes that compressed form of iLen will take
2367 ULONG iLen, // [IN] given uncompressed data
2368 void * pDataOut) // [OUT] buffer where iLen will be compressed and stored.
2370 BYTE *pBytes = reinterpret_cast<BYTE *>(pDataOut);
2374 *pBytes = BYTE(iLen);
2380 *pBytes = BYTE((iLen >> 8) | 0x80);
2381 *(pBytes+1) = BYTE(iLen & 0xff);
2385 if (iLen <= 0x1FFFFFFF)
2387 *pBytes = BYTE((iLen >> 24) | 0xC0);
2388 *(pBytes+1) = BYTE((iLen >> 16) & 0xff);
2389 *(pBytes+2) = BYTE((iLen >> 8) & 0xff);
2390 *(pBytes+3) = BYTE(iLen & 0xff);
2397 // The least significant bit of the first compress byte will indicate the token type.
2399 inline ULONG CorSigCompressToken( // return number of bytes that compressed form of the token will take
2400 mdToken tk, // [IN] given token
2401 void * pDataOut) // [OUT] buffer where the token will be compressed and stored.
2403 RID rid = RidFromToken(tk);
2404 ULONG32 ulTyp = TypeFromToken(tk);
2406 if (rid > 0x3FFFFFF)
2407 // token is too big to be compressed
2412 // TypeDef is encoded with low bits 00
2413 // TypeRef is encoded with low bits 01
2414 // TypeSpec is encoded with low bits 10
2415 // BaseType is encoded with low bit 11
2417 if (ulTyp == g_tkCorEncodeToken[1])
2419 // make the last two bits 01
2422 else if (ulTyp == g_tkCorEncodeToken[2])
2424 // make last two bits 0
2427 else if (ulTyp == g_tkCorEncodeToken[3])
2431 return CorSigCompressData((ULONG)rid, pDataOut);
2434 // compress a signed integer
2435 // The least significant bit of the first compress byte will be the signed bit.
2437 inline ULONG CorSigCompressSignedInt( // return number of bytes that compressed form of iData will take
2438 int iData, // [IN] given integer
2439 void * pDataOut) // [OUT] buffer where iLen will be compressed and stored.
2442 BYTE *pBytes = reinterpret_cast<BYTE *>(pDataOut);
2447 // Note that we cannot use code:CorSigCompressData to pack the iData value, because of negative values
2448 // like: 0xffffe000 (-8192) which has to be encoded as 1 in 2 bytes, i.e. 0x81 0x00
2449 // However CorSigCompressedData would store value 1 as 1 byte: 0x01
2450 if ((iData & SIGN_MASK_ONEBYTE) == 0 || (iData & SIGN_MASK_ONEBYTE) == SIGN_MASK_ONEBYTE)
2452 iData = (int)((iData & ~SIGN_MASK_ONEBYTE) << 1 | isSigned);
2453 //_ASSERTE(iData <= 0x7f);
2454 *pBytes = BYTE(iData);
2457 else if ((iData & SIGN_MASK_TWOBYTE) == 0 || (iData & SIGN_MASK_TWOBYTE) == SIGN_MASK_TWOBYTE)
2459 iData = (int)((iData & ~SIGN_MASK_TWOBYTE) << 1 | isSigned);
2460 //_ASSERTE(iData <= 0x3fff);
2461 *pBytes = BYTE((iData >> 8) | 0x80);
2462 *(pBytes + 1) = BYTE(iData & 0xff);
2465 else if ((iData & SIGN_MASK_FOURBYTE) == 0 || (iData & SIGN_MASK_FOURBYTE) == SIGN_MASK_FOURBYTE)
2467 iData = (int)((iData & ~SIGN_MASK_FOURBYTE) << 1 | isSigned);
2468 //_ASSERTE(iData <= 0x1FFFFFFF);
2469 *pBytes = BYTE((iData >> 24) | 0xC0);
2470 *(pBytes + 1) = BYTE((iData >> 16) & 0xff);
2471 *(pBytes + 2) = BYTE((iData >> 8) & 0xff);
2472 *(pBytes + 3) = BYTE(iData & 0xff);
2475 // Out of compressable range
2477 } // CorSigCompressSignedInt
2480 // uncompress encoded element type
2481 inline ULONG CorSigCompressElementType( // return number of bytes of that compressed data occupied in pData
2482 CorElementType et, // [OUT] the expanded *pData
2483 void * pData) // [IN] compressed data
2485 BYTE *pBytes = (BYTE *)(pData);
2491 // Compress a pointer (used for internal element types only, never for persisted
2493 inline ULONG CorSigCompressPointer( // return number of bytes of that compressed data occupied
2494 void * pvPointer, // [IN] given uncompressed data
2495 void * pData) // [OUT] buffer where iLen will be compressed and stored.
2497 *((void * UNALIGNED *)pData) = pvPointer;
2498 return sizeof(void *);
2501 // Uncompress a pointer (see above for comments).
2502 inline ULONG CorSigUncompressPointer( // return number of bytes of that compressed data occupied
2503 PCCOR_SIGNATURE pData, // [IN] compressed data
2504 void ** ppvPointer) // [OUT] the expanded *pData
2506 *ppvPointer = *(void * const UNALIGNED *)pData;
2507 return sizeof(void *);
2510 #endif // __cplusplus
2512 #undef DEPRECATED_CLR_STDAPI_
2513 #undef DEPRECATED_CLR_STDAPI
2514 #undef DECLARE_DEPRECATED
2515 #undef DEPRECATED_CLR_API_MESG
2518 // EOF =======================================================================