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

  1. /*****************************************************************************
  2.  **                                                                         **
  3.  ** CorHdr.h - contains definitions for the Runtime structures,             **
  4.  **            needed to work with metadata.                                **
  5.  **                                                                         **
  6.  ** Copyright (c) 1996-2000 Microsoft Corporation.  All Rights Reserved.    **
  7.  **                                                                         **
  8.  *****************************************************************************/
  9.  
  10.  
  11. #ifndef __CORHDR_H__
  12. #define __CORHDR_H__
  13.  
  14.  
  15. #pragma warning(disable:4200) // nonstandard extension used : zero-sized array in struct/union.
  16. typedef ULONG32 mdScope;                // Why is this still needed?
  17. typedef ULONG32 mdToken;                // Generic token
  18.  
  19.  
  20. // Token  definitions
  21.  
  22.  
  23. typedef mdToken mdModule;               // Module token (roughly, a scope)
  24. typedef mdToken mdTypeRef;              // TypeRef reference (this or other scope)
  25. typedef mdToken mdTypeDef;              // TypeDef in this scope
  26. typedef mdToken mdFieldDef;             // Field in this scope  
  27. typedef mdToken mdMethodDef;            // Method in this scope 
  28. typedef mdToken mdParamDef;             // param token  
  29. typedef mdToken mdInterfaceImpl;        // interface implementation token
  30.  
  31. typedef mdToken mdMemberRef;            // MemberRef (this or other scope)  
  32. typedef mdToken mdCustomAttribute;      // attribute token
  33. typedef mdCustomAttribute mdCustomValue;// attribute token
  34. typedef mdToken mdPermission;           // DeclSecurity 
  35.  
  36. typedef mdToken mdSignature;            // Signature object 
  37. typedef mdToken mdEvent;                // event token  
  38. typedef mdToken mdProperty;             // property token   
  39.  
  40. typedef mdToken mdModuleRef;            // Module reference (for the imported modules)  
  41.  
  42. // Assembly tokens.
  43. typedef mdToken mdAssembly;             // Assembly token.
  44. typedef mdToken mdAssemblyRef;          // AssemblyRef token.
  45. typedef mdToken mdFile;                 // File token.
  46. typedef mdToken mdComType;              // ComType token.
  47. typedef mdToken mdManifestResource;     // ManifestResource token.
  48. typedef mdToken mdLocalizedResource;    // LocalizedManifestResource token.
  49. typedef mdToken mdExecutionLocation;    // Execution location token.
  50.  
  51. typedef mdToken mdTypeSpec;             // TypeSpec object 
  52.  
  53. // Debugger support tokens - deprecated.
  54. typedef mdToken mdSourceFile;           // source file token    
  55. typedef mdToken mdLocalVarScope;        // local variable scope token   
  56. typedef mdToken mdLocalVar;             // local variable token 
  57.  
  58. // Application string.
  59. typedef mdToken mdString;               // User literal string token.
  60.  
  61. typedef mdToken mdCPToken;              // constantpool token   
  62.  
  63. #ifndef MACROS_NOT_SUPPORTED
  64. typedef unsigned long RID;              //@todo: this goes away with 9/29 integration when complib is nuked.
  65. #else
  66. typedef unsigned RID;
  67. #endif
  68.  
  69.  
  70. typedef enum ReplacesGeneralNumericDefines
  71. {
  72. // Directory entry macro for COM+ data.
  73. #ifndef IMAGE_DIRECTORY_ENTRY_COMHEADER
  74.     IMAGE_DIRECTORY_ENTRY_COMHEADER     =14,
  75. #endif // IMAGE_DIRECTORY_ENTRY_COMHEADER
  76.  
  77.     _NEW_FLAGS_IMPLEMENTED              =1,
  78.     __NEW_FLAGS_IMPLEMENTED             =1,
  79. } ReplacesGeneralNumericDefines;
  80.  
  81.  
  82. #ifndef __IMAGE_COR20_HEADER_DEFINED__
  83. #define __IMAGE_COR20_HEADER_DEFINED__
  84.  
  85. typedef enum ReplacesCorHdrNumericDefines
  86. {
  87. // COM+ Header entry point flags.
  88.     COMIMAGE_FLAGS_ILONLY               =0x00000001,
  89.     COMIMAGE_FLAGS_32BITREQUIRED        =0x00000002,
  90.     COMIMAGE_FLAGS_IL_LIBRARY           =0x00000004,
  91.     COMIMAGE_FLAGS_TRACKDEBUGDATA       =0x00010000,
  92.  
  93. // Version flags for image.
  94.     COR_VERSION_MAJOR_V2                =2,
  95.     COR_VERSION_MAJOR                   =COR_VERSION_MAJOR_V2,
  96.     COR_VERSION_MINOR                   =0,
  97.     COR_DELETED_NAME_LENGTH             =8,
  98.     COR_VTABLEGAP_NAME_LENGTH           =8,
  99.  
  100. // Maximum size of a NativeType descriptor.
  101.     NATIVE_TYPE_MAX_CB                  =1,   
  102.     COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,
  103.  
  104. // #defines for the MIH FLAGS
  105.     IMAGE_COR_MIH_METHODRVA             =0x01,
  106.     IMAGE_COR_MIH_EHRVA                 =0x02,    
  107.     IMAGE_COR_MIH_BASICBLOCK            =0x08,
  108.  
  109. // V-table constants
  110.     COR_VTABLE_32BIT                    =0x01,          // V-table slots are 32-bits in size.   
  111.     COR_VTABLE_64BIT                    =0x02,          // V-table slots are 64-bits in size.   
  112.     COR_VTABLE_FROM_UNMANAGED           =0x04,          // If set, transition from unmanaged.
  113.     COR_VTABLE_CALL_MOST_DERIVED        =0x10,          // Call most derived method described by
  114.  
  115. // EATJ constants
  116.     IMAGE_COR_EATJ_THUNK_SIZE           =32,            // Size of a jump thunk reserved range.
  117.  
  118. // JIT/FJIT codegen constants (these may be OS dependant)
  119.     MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT=(32*1024)-1,   // when generating JIT code 
  120.  
  121. // Max name lengths    
  122.     MAX_CLASS_NAME                      =255,
  123.     MAX_PACKAGE_NAME                    =255,
  124. } ReplacesCorHdrNumericDefines;
  125.  
  126. // COM+ 2.0 header structure.
  127. typedef struct IMAGE_COR20_HEADER
  128. {
  129.     // Header versioning
  130.     ULONG                   cb;              
  131.     USHORT                  MajorRuntimeVersion;
  132.     USHORT                  MinorRuntimeVersion;
  133.     
  134.     // Symbol table and startup information
  135.     IMAGE_DATA_DIRECTORY    MetaData;        
  136.     ULONG                   Flags;           
  137.     ULONG                   EntryPointToken;
  138.     
  139.     // Binding information
  140.     IMAGE_DATA_DIRECTORY    Resources;
  141.     IMAGE_DATA_DIRECTORY    StrongNameSignature;
  142.  
  143.     // Regular fixup and binding information
  144.     IMAGE_DATA_DIRECTORY    CodeManagerTable;
  145.     IMAGE_DATA_DIRECTORY    VTableFixups;
  146.     IMAGE_DATA_DIRECTORY    ExportAddressTableJumps;
  147.  
  148.     // Precompiled image info (internal use only - set to zero)
  149.     IMAGE_DATA_DIRECTORY    ManagedNativeHeader;
  150.     
  151. } IMAGE_COR20_HEADER;
  152.  
  153. #endif // __IMAGE_COR20_HEADER_DEFINED__
  154.  
  155. // The most recent version.
  156.  
  157. #define COR_CTOR_METHOD_NAME        ".ctor"
  158. #define COR_CTOR_METHOD_NAME_W      L".ctor"
  159. #define COR_CCTOR_METHOD_NAME       ".cctor"
  160. #define COR_CCTOR_METHOD_NAME_W     L".cctor"
  161.  
  162. // The predefined name for deleting a typeDef,MethodDef, FieldDef, Property and Event
  163. #define COR_DELETED_NAME_A          "_Deleted"
  164. #define COR_DELETED_NAME_W          L"_Deleted"
  165. #define COR_VTABLEGAP_NAME_A        "_VtblGap"
  166. #define COR_VTABLEGAP_NAME_W        L"_VtblGap"
  167.  
  168. // We intentionally use strncmp so that we will ignore any suffix 
  169. #define IsDeletedName(strName)      (strncmp(strName, COR_DELETED_NAME_A, COR_DELETED_NAME_LENGTH) == 0)
  170. #define IsVtblGapName(strName)      (strncmp(strName, COR_VTABLEGAP_NAME_A, COR_VTABLEGAP_NAME_LENGTH) == 0)
  171.  
  172. // TypeDef/ComType attr bits, used by DefineTypeDef.
  173. typedef enum CorTypeAttr
  174. {
  175.     // Use this mask to retrieve the type visibility information.
  176.     tdVisibilityMask        =   0x00000007,
  177.     tdNotPublic             =   0x00000000,     // Class is not public scope.
  178.     tdPublic                =   0x00000001,     // Class is public scope.
  179.     tdNestedPublic          =   0x00000002,     // Class is nested with public visibility.
  180.     tdNestedPrivate         =   0x00000003,     // Class is nested with private visibility.
  181.     tdNestedFamily          =   0x00000004,     // Class is nested with family visibility.
  182.     tdNestedAssembly        =   0x00000005,     // Class is nested with assembly visibility.
  183.     tdNestedFamANDAssem     =   0x00000006,     // Class is nested with family and assembly visibility.
  184.     tdNestedFamORAssem      =   0x00000007,     // Class is nested with family or assembly visibility.
  185.  
  186.     // Use this mask to retrieve class layout information
  187.     tdLayoutMask            =   0x00000018,
  188.     tdAutoLayout            =   0x00000000,     // Class fields are auto-laid out
  189.     tdLayoutSequential      =   0x00000008,     // Class fields are laid out sequentially
  190.     tdExplicitLayout        =   0x00000010,     // Layout is supplied explicitly
  191.     // end layout mask
  192.  
  193.     // Use this mask to retrieve class semantics information.
  194.     tdClassSemanticsMask    =   0x00000060,
  195.     tdClass                 =   0x00000000,     // Type is a class.
  196.     tdInterface             =   0x00000020,     // Type is an interface.
  197.     tdValueType             =   0x00000040,     // Type is a managed value type.
  198.     tdUnmanagedValueType    =   0x00000060,     // It is a value type that can not live in the GC heap.
  199.     // end semantics mask
  200.  
  201.     // Special semantics in addition to class semantics.
  202.     tdAbstract              =   0x00000080,     // Class is abstract
  203.     tdSealed                =   0x00000100,     // Class is concrete and may not be extended
  204.     tdEnum                  =   0x00000200,     // Class is an enum; static final values only
  205.     tdSpecialName           =   0x00000400,     // Class name is special.  Name describes how.
  206.  
  207.     // Implementation attributes.
  208.     tdImport                =   0x00001000,     // Class / interface is imported
  209.     tdSerializable          =   0x00002000,     // The class is Serializable.
  210.  
  211.     // Use tdStringFormatMask to retrieve string information for native interop
  212.     tdStringFormatMask      =   0x00030000,     
  213.     tdAnsiClass             =   0x00000000,     // LPTSTR is interpreted as ANSI in this class
  214.     tdUnicodeClass          =   0x00010000,     // LPTSTR is interpreted as UNICODE
  215.     tdAutoClass             =   0x00020000,     // LPTSTR is interpreted automatically
  216.     // end string format mask
  217.  
  218.     tdLateInit              =   0x00080000,     // Initialize the class lazily.
  219.  
  220.     // Flags reserved for runtime use.
  221.     tdReservedMask          =   0x00040800,
  222.     tdRTSpecialName         =   0x00000800,     // Runtime should check name encoding.
  223.     tdHasSecurity           =   0x00040000,     // Class has security associate with it.
  224. } CorTypeAttr;
  225.  
  226.  
  227. // Macros for accessing the members of the CorTypeAttr.
  228. #define IsTdNotPublic(x)                    (((x) & tdVisibilityMask) == tdNotPublic)
  229. #define IsTdPublic(x)                       (((x) & tdVisibilityMask) == tdPublic)
  230. #define IsTdNestedPublic(x)                 (((x) & tdVisibilityMask) == tdNestedPublic)
  231. #define IsTdNestedPrivate(x)                (((x) & tdVisibilityMask) == tdNestedPrivate)
  232. #define IsTdNestedFamily(x)                 (((x) & tdVisibilityMask) == tdNestedFamily)
  233. #define IsTdNestedAssembly(x)               (((x) & tdVisibilityMask) == tdNestedAssembly)
  234. #define IsTdNestedFamANDAssem(x)            (((x) & tdVisibilityMask) == tdNestedFamANDAssem)
  235. #define IsTdNestedFamORAssem(x)             (((x) & tdVisibilityMask) == tdNestedFamORAssem)
  236. #define IsTdNested(x)                       (((x) & tdVisibilityMask) >= tdNestedPublic)
  237.  
  238. #define IsTdAutoLayout(x)                   (((x) & tdLayoutMask) == tdAutoLayout)
  239. #define IsTdLayoutSequential(x)             (((x) & tdLayoutMask) == tdLayoutSequential)
  240. #define IsTdExplicitLayout(x)               (((x) & tdLayoutMask) == tdExplicitLayout)
  241.  
  242. #define IsTdClass(x)                        (((x) & tdClassSemanticsMask) == tdClass)
  243. #define IsTdInterface(x)                    (((x) & tdClassSemanticsMask) == tdInterface)
  244. #define IsTdUnmanagedValueType(x)           (((x) & tdClassSemanticsMask) == tdUnmanagedValueType)
  245. #define IsTdValueType(x)                    ((x) & tdValueType) // This can be either tdManagedValueType or tdUnmanagedValueType
  246.  
  247. #define IsTdAbstract(x)                     ((x) & tdAbstract)
  248. #define IsTdSealed(x)                       ((x) & tdSealed)
  249. #define IsTdEnum(x)                         ((x) & tdEnum)
  250. #define IsTdSpecialName(x)                  ((x) & tdSpecialName)
  251.  
  252. #define IsTdImport(x)                       ((x) & tdImport)
  253. #define IsTdSerializable(x)                 ((x) & tdSerializable)
  254.  
  255. #define IsTdAnsiClass(x)                    (((x) & tdStringFormatMask) == tdAnsiClass)
  256. #define IsTdUnicodeClass(x)                 (((x) & tdStringFormatMask) == tdUnicodeClass)
  257. #define IsTdAutoClass(x)                    (((x) & tdStringFormatMask) == tdAutoClass)
  258.  
  259. #define IsTdLateInit(x)                     ((x) &tdLateInit)
  260.  
  261. #define IsTdRTSpecialName(x)                ((x) & tdRTSpecialName)
  262. #define IsTdHasSecurity(x)                  ((x) & tdHasSecurity)
  263.  
  264. // MethodDef attr bits, Used by DefineMethod.
  265. typedef enum CorMethodAttr
  266. {
  267.     // member access mask - Use this mask to retrieve accessibility information.
  268.     mdMemberAccessMask          =   0x0007,
  269.     mdPrivateScope              =   0x0000,     // Member not referenceable.
  270.     mdPrivate                   =   0x0001,     // Accessible only by the parent type.  
  271.     mdFamANDAssem               =   0x0002,     // Accessible by sub-types only in this Assembly.
  272.     mdAssem                     =   0x0003,     // Accessibly by anyone in the Assembly.
  273.     mdFamily                    =   0x0004,     // Accessible only by type and sub-types.    
  274.     mdFamORAssem                =   0x0005,     // Accessibly by sub-types anywhere, plus anyone in assembly.
  275.     mdPublic                    =   0x0006,     // Accessibly by anyone who has visibility to this scope.    
  276.     // end member access mask
  277.  
  278.     // method contract attributes.
  279.     mdStatic                    =   0x0010,     // Defined on type, else per instance.
  280.     mdFinal                     =   0x0020,     // Method may not be overridden.
  281.     mdVirtual                   =   0x0040,     // Method virtual.
  282.     mdHideBySig                 =   0x0080,     // Method hides by name+sig, else just by name.
  283.  
  284.     // vtable layout mask - Use this mask to retrieve vtable attributes.
  285.     mdVtableLayoutMask          =   0x0100,
  286.     mdReuseSlot                 =   0x0000,     // The default.
  287.     mdNewSlot                   =   0x0100,     // Method always gets a new slot in the vtable.
  288.     // end vtable layout mask
  289.  
  290.     // method implementation attributes.
  291.     mdAbstract                  =   0x0400,     // Method does not provide an implementation.
  292.     mdSpecialName               =   0x0800,     // Method is special.  Name describes how.
  293.     
  294.     // interop attributes
  295.     mdPinvokeImpl               =   0x2000,     // Implementation is forwarded through pinvoke.
  296.     mdUnmanagedExport           =   0x0008,     // Managed method exported via thunk to unmanaged code.
  297.  
  298.     // Reserved flags for runtime use only.
  299.     mdReservedMask              =   0xd000,
  300.     mdRTSpecialName             =   0x1000,     // Runtime should check name encoding.
  301.     mdHasSecurity               =   0x4000,     // Method has security associate with it.
  302.     mdRequireSecObject          =   0x8000,     // Method calls another method containing security code.
  303.  
  304. } CorMethodAttr;
  305.  
  306. // Macros for accessing the members of CorMethodAttr.
  307. #define IsMdPrivateScope(x)                 (((x) & mdMemberAccessMask) == mdPrivateScope)
  308. #define IsMdPrivate(x)                      (((x) & mdMemberAccessMask) == mdPrivate)
  309. #define IsMdFamANDAssem(x)                  (((x) & mdMemberAccessMask) == mdFamANDAssem)
  310. #define IsMdAssem(x)                        (((x) & mdMemberAccessMask) == mdAssem)
  311. #define IsMdFamily(x)                       (((x) & mdMemberAccessMask) == mdFamily)
  312. #define IsMdFamORAssem(x)                   (((x) & mdMemberAccessMask) == mdFamORAssem)
  313. #define IsMdPublic(x)                       (((x) & mdMemberAccessMask) == mdPublic)
  314.  
  315. #define IsMdStatic(x)                       ((x) & mdStatic)
  316. #define IsMdFinal(x)                        ((x) & mdFinal)
  317. #define IsMdVirtual(x)                      ((x) & mdVirtual)
  318. #define IsMdHideBySig(x)                    ((x) & mdHideBySig)
  319.  
  320. #define IsMdReuseSlot(x)                    (((x) & mdVtableLayoutMask) == mdReuseSlot)
  321. #define IsMdNewSlot(x)                      (((x) & mdVtableLayoutMask) == mdNewSlot)
  322.  
  323. #define IsMdAbstract(x)                     ((x) & mdAbstract)
  324. #define IsMdSpecialName(x)                  ((x) & mdSpecialName)
  325.  
  326. #define IsMdPinvokeImpl(x)                  ((x) & mdPinvokeImpl)
  327. #define IsMdUnmanagedExport(x)              ((x) & mdUnmanagedExport)
  328.  
  329. #define IsMdRTSpecialName(x)                ((x) & mdRTSpecialName)
  330. #define IsMdInstanceInitializer(x, str)     (((x) & mdRTSpecialName) && !strcmp((str), COR_CTOR_METHOD_NAME))
  331. #define IsMdInstanceInitializerW(x, str)    (((x) & mdRTSpecialName) && !wcscmp((str), COR_CTOR_METHOD_NAME_W))
  332. #define IsMdClassConstructor(x, str)        (((x) & mdRTSpecialName) && !strcmp((str), COR_CCTOR_METHOD_NAME))
  333. #define IsMdClassConstructorW(x, str)       (((x) & mdRTSpecialName) && !wcscmp((str), COR_CCTOR_METHOD_NAME_W))
  334. #define IsMdHasSecurity(x)                  ((x) & mdHasSecurity)
  335. #define IsMdRequireSecObject(x)             ((x) & mdRequireSecObject)
  336.  
  337. // FieldDef attr bits, used by DefineField.
  338. typedef enum CorFieldAttr
  339. {
  340.     // member access mask - Use this mask to retrieve accessibility information.
  341.     fdFieldAccessMask           =   0x0007,
  342.     fdPrivateScope              =   0x0000,     // Member not referenceable.
  343.     fdPrivate                   =   0x0001,     // Accessible only by the parent type.  
  344.     fdFamANDAssem               =   0x0002,     // Accessible by sub-types only in this Assembly.
  345.     fdAssembly                  =   0x0003,     // Accessibly by anyone in the Assembly.
  346.     fdFamily                    =   0x0004,     // Accessible only by type and sub-types.    
  347.     fdFamORAssem                =   0x0005,     // Accessibly by sub-types anywhere, plus anyone in assembly.
  348.     fdPublic                    =   0x0006,     // Accessibly by anyone who has visibility to this scope.    
  349.     // end member access mask
  350.  
  351.     // field contract attributes.
  352.     fdStatic                    =   0x0010,     // Defined on type, else per instance.
  353.     fdInitOnly                  =   0x0020,     // Field may only be initialized, not written to after init.
  354.     fdLiteral                   =   0x0040,     // Value is compile time constant.
  355.     fdNotSerialized             =   0x0080,     // Field does not have to be serialized when type is remoted.
  356.  
  357.     fdSpecialName               =   0x0200,     // field is special.  Name describes how.
  358.     
  359.     // interop attributes
  360.     fdPinvokeImpl               =   0x2000,     // Implementation is forwarded through pinvoke.
  361.  
  362.     // Reserved flags for runtime use only.
  363.     fdReservedMask              =   0xd500,
  364.     fdRTSpecialName             =   0x0400,     // Runtime(metadata internal APIs) should check name encoding.
  365.     fdHasFieldMarshal           =   0x1000,     // Field has marshalling information.
  366.     fdHasSecurity               =   0x4000,     // Field has a security associate.
  367.     fdHasDefault                =   0x8000,     // Field has default.
  368.     fdHasFieldRVA               =   0x0100,     // Field has RVA.
  369. } CorFieldAttr;
  370.  
  371. // Macros for accessing the members of CorFieldAttr.
  372. #define IsFdPrivateScope(x)                 (((x) & fdFieldAccessMask) == fdPrivateScope)
  373. #define IsFdPrivate(x)                      (((x) & fdFieldAccessMask) == fdPrivate)
  374. #define IsFdFamANDAssem(x)                  (((x) & fdFieldAccessMask) == fdFamANDAssem)
  375. #define IsFdAssembly(x)                     (((x) & fdFieldAccessMask) == fdAssembly)
  376. #define IsFdFamily(x)                       (((x) & fdFieldAccessMask) == fdFamily)
  377. #define IsFdFamORAssem(x)                   (((x) & fdFieldAccessMask) == fdFamORAssem)
  378. #define IsFdPublic(x)                       (((x) & fdFieldAccessMask) == fdPublic)
  379.  
  380. #define IsFdStatic(x)                       ((x) & fdStatic)
  381. #define IsFdInitOnly(x)                     ((x) & fdInitOnly)
  382. #define IsFdLiteral(x)                      ((x) & fdLiteral)
  383. #define IsFdNotSerialized(x)                ((x) & fdNotSerialized)
  384.  
  385. #define IsFdPinvokeImpl(x)                  ((x) & fdPinvokeImpl)
  386. #define IsFdSpecialName(x)                  ((x) & fdSpecialName)
  387. #define IsFdHasFieldRVA(x)                  ((x) & fdHasFieldRVA)
  388.  
  389. #define IsFdRTSpecialName(x)                ((x) & fdRTSpecialName)
  390. #define IsFdHasFieldMarshal(x)              ((x) & fdHasFieldMarshal)
  391. #define IsFdHasSecurity(x)                  ((x) & fdHasSecurity)
  392. #define IsFdHasDefault(x)                   ((x) & fdHasDefault)
  393. #define IsFdHasFieldRVA(x)                  ((x) & fdHasFieldRVA)
  394.  
  395. // Param attr bits, used by DefineParam. 
  396. typedef enum CorParamAttr
  397. {
  398.     pdIn                        =   0x0001,     // Param is [In]    
  399.     pdOut                       =   0x0002,     // Param is [out]   
  400.     pdLcid                      =   0x0004,     // Param is [lcid]  
  401.     pdRetval                    =   0x0008,     // Param is [Retval]    
  402.     pdOptional                  =   0x0010,     // Param is optional    
  403.  
  404.     // Reserved flags for Runtime use only.
  405.     pdReservedMask              =   0xf000,
  406.     pdHasDefault                =   0x1000,     // Param has default value.
  407.     pdHasFieldMarshal           =   0x2000,     // Param has FieldMarshal.
  408.     pdReserved3                 =   0x4000,     // reserved bit
  409.     pdReserved4                 =   0x8000      // reserved bit 
  410. } CorParamAttr;
  411.  
  412. // Macros for accessing the members of CorParamAttr.
  413. #define IsPdIn(x)                           ((x) & pdIn)
  414. #define IsPdOut(x)                          ((x) & pdOut)
  415. #define IsPdLcid(x)                         ((x) & pdLcid)
  416. #define IsPdRetval(x)                       ((x) & pdRetval)
  417. #define IsPdOptional(x)                     ((x) & pdOptional)
  418.  
  419. #define IsPdHasDefault(x)                   ((x) & pdHasDefault)
  420. #define IsPdHasFieldMarshal(x)              ((x) & pdHasFieldMarshal)
  421.  
  422.  
  423. // Property attr bits, used by DefineProperty.
  424. typedef enum CorPropertyAttr
  425. {
  426.     prSpecialName           =   0x0200,     // property is special.  Name describes how.
  427.  
  428.     // Reserved flags for Runtime use only.
  429.     prReservedMask          =   0xf400,
  430.     prRTSpecialName         =   0x0400,     // Runtime(metadata internal APIs) should check name encoding.
  431.     prHasDefault            =   0x1000,     // Property has default 
  432.     prReserved2             =   0x2000,     // reserved bit
  433.     prReserved3             =   0x4000,     // reserved bit 
  434.     prReserved4             =   0x8000      // reserved bit 
  435. } CorPropertyAttr;
  436.  
  437. // Macros for accessing the members of CorPropertyAttr.
  438. #define IsPrSpecialName(x)                  ((x) & prSpecialName)
  439.  
  440. #define IsPrRTSpecialName(x)                ((x) & prRTSpecialName)
  441. #define IsPrHasDefault(x)                   ((x) & prHasDefault)
  442.  
  443. // Event attr bits, used by DefineEvent.
  444. typedef enum CorEventAttr
  445. {
  446.     evSpecialName           =   0x0200,     // event is special.  Name describes how.
  447.  
  448.     // Reserved flags for Runtime use only.
  449.     evReservedMask          =   0x0400,
  450.     evRTSpecialName         =   0x0400,     // Runtime(metadata internal APIs) should check name encoding.
  451. } CorEventAttr;
  452.  
  453. // Macros for accessing the members of CorEventAttr.
  454. #define IsEvSpecialName(x)                  ((x) & evSpecialName)
  455.  
  456. #define IsEvRTSpecialName(x)                ((x) & evRTSpecialName)
  457.  
  458.  
  459. // MethodSemantic attr bits, used by DefineProperty, DefineEvent.
  460. typedef enum CorMethodSemanticsAttr
  461. {
  462.     msSetter    =   0x0001,     // Setter for property  
  463.     msGetter    =   0x0002,     // Getter for property  
  464.     msOther     =   0x0004,     // other method for property or event   
  465.     msAddOn     =   0x0008,     // AddOn method for event   
  466.     msRemoveOn  =   0x0010,     // RemoveOn method for event    
  467.     msFire      =   0x0020,     // Fire method for event    
  468. } CorMethodSemanticsAttr;
  469.  
  470. // Macros for accessing the members of CorMethodSemanticsAttr.
  471. #define IsMsSetter(x)                       ((x) & msSetter)
  472. #define IsMsGetter(x)                       ((x) & msGetter)
  473. #define IsMsOther(x)                        ((x) & msOther)
  474. #define IsMsAddOn(x)                        ((x) & msAddOn)
  475. #define IsMsRemoveOn(x)                     ((x) & msRemoveOn)
  476. #define IsMsFire(x)                         ((x) & msFire)
  477.  
  478.  
  479. // DeclSecurity attr bits, used by DefinePermissionSet.
  480. typedef enum CorDeclSecurity
  481. {
  482.     dclActionMask       =   0x000f,     // Mask allows growth of enum.
  483.     dclActionNil        =   0x0000, 
  484.     dclRequest          =   0x0001,     //  
  485.     dclDemand           =   0x0002,     //  
  486.     dclAssert           =   0x0003,     //  
  487.     dclDeny             =   0x0004,     //  
  488.     dclPermitOnly       =   0x0005,     //  
  489.     dclLinktimeCheck    =   0x0006,     //  
  490.     dclInheritanceCheck =   0x0007,     //  
  491.     dclRequestMinimum   =   0x0008,     //
  492.     dclRequestOptional  =   0x0009,     //
  493.     dclRequestRefuse    =   0x000a,     //
  494.     dclPrejitGrant      =   0x000b,     // Persisted grant set at prejit time
  495.     dclPrejitDenied     =   0x000c,     // Persisted denied set at prejit time
  496.     dclNonCasDemand     =   0x000d,     //
  497.     dclNonCasLinkDemand =   0x000e,
  498.     dclNonCasInheritance=   0x000f,
  499.     dclMaximumValue     =   0x000f,     // Maximum legal value  
  500. } CorDeclSecurity;
  501.  
  502. // Macros for accessing the members of CorDeclSecurity.
  503. #define IsDclActionNil(x)                   (((x) & dclActionMask) == dclActionNil)
  504. #define IsDclRequest(x)                     (((x) & dclActionMask) == dclRequest)
  505. #define IsDclDemand(x)                      (((x) & dclActionMask) == dclDemand)
  506. #define IsDclAssert(x)                      (((x) & dclActionMask) == dclAssert)
  507. #define IsDclDeny(x)                        (((x) & dclActionMask) == dclDeny)
  508. #define IsDclPermitOnly(x)                  (((x) & dclActionMask) == dclPermit)
  509. #define IsDclLinktimeCheck(x)               (((x) & dclActionMask) == dclLinktimeCheck)
  510. #define IsDclInheritanceCheck(x)            (((x) & dclActionMask) == dclInheritanceCheck)
  511. #define IsDclMaximumValue(x)                (((x) & dclActionMask) == dclMaximumValue)
  512.  
  513.  
  514. // MethodImpl attr bits, used by DefineMethodImpl.
  515. typedef enum CorMethodImpl
  516. {
  517.     // code impl mask
  518.     miCodeTypeMask      =   0x0003,   // Flags about code type.   
  519.     miIL                =   0x0000,   // Method impl is IL.   
  520.     miNative            =   0x0001,   // Method impl is native.     
  521.     miOPTIL             =   0x0002,   // Method impl is OPTIL 
  522.     miRuntime           =   0x0003,   // Method impl is provided by the runtime.
  523.     // end code impl mask
  524.  
  525.     // managed mask
  526.     miManagedMask       =   0x0004,   // Flags specifying whether the code is managed or unmanaged.
  527.     miUnmanaged         =   0x0004,   // Method impl is unmanaged, otherwise managed.
  528.     miManaged           =   0x0000,   // Method impl is managed.
  529.     // end managed mask
  530.  
  531.     // implementation info and interop
  532.     miForwardRef        =   0x0010,   // Indicates method is defined; used primarily in merge scenarios.
  533.     miOLE               =   0x0080,   // Indicates method sig is mangled to return HRESULT, with retval as param 
  534.  
  535.     miInternalCall      =   0x1000,   // Reserved for internal use.
  536.  
  537.     miSynchronized      =   0x0020,   // Method is single threaded through the body.
  538.     miNoInlining        =   0x0008,   // Method may not be inlined.                                      
  539.     miMaxMethodImplVal  =   0xffff,   // Range check value    
  540. } CorMethodImpl; 
  541.  
  542. // Macros for accesing the members of CorMethodImpl.
  543. #define IsMiIL(x)                           (((x) & miCodeTypeMask) == miIL)
  544. #define IsMiNative(x)                       (((x) & miCodeTypeMask) == miNative)
  545. #define IsMiOPTIL(x)                        (((x) & miCodeTypeMask) == miOPTIL)
  546. #define IsMiRuntime(x)                      (((x) & miCodeTypeMask) == miRuntime)
  547.  
  548. #define IsMiUnmanaged(x)                    (((x) & miManagedMask) == miUnmanaged)
  549. #define IsMiManaged(x)                      (((x) & miManagedMask) == miManaged)
  550.  
  551. #define IsMiForwardRef(x)                   ((x) & miForwardRef)
  552. #define IsMiOLE(x)                          ((x) & miOLE)
  553.  
  554. #define IsMiInternalCall(x)                 ((x) & miInternalCall)
  555.  
  556. #define IsMiSynchronized(x)                 ((x) & miSynchronized)
  557. #define IsMiNoInlining(x)                   ((x) & miNoInlining)
  558.  
  559.  
  560. // PinvokeMap attr bits, used by DefinePinvokeMap.
  561. typedef enum  CorPinvokeMap
  562.     pmNoMangle          = 0x0001,   // Pinvoke is to use the member name as specified.
  563.  
  564.     // Use this mask to retrieve the CharSet information.
  565.     pmCharSetMask       = 0x0006,
  566.     pmCharSetNotSpec    = 0x0000,
  567.     pmCharSetAnsi       = 0x0002, 
  568.     pmCharSetUnicode    = 0x0004,
  569.     pmCharSetAuto       = 0x0006,
  570.  
  571.     pmPinvokeOLE        = 0x0020,   // Heuristic: pinvoke will return hresult, with return value becoming the retval param. Not relevant for fields. 
  572.     pmSupportsLastError = 0x0040,   // Information about target function. Not relevant for fields.
  573.  
  574.     // None of the calling convention flags is relevant for fields.
  575.     pmCallConvMask      = 0x0700,
  576.     pmCallConvWinapi    = 0x0100,   // Pinvoke will use native callconv appropriate to target windows platform.
  577.     pmCallConvCdecl     = 0x0200,
  578.     pmCallConvStdcall   = 0x0300,
  579.     pmCallConvThiscall  = 0x0400,   // In M9, pinvoke will raise exception.
  580.     pmCallConvFastcall  = 0x0500,
  581. } CorPinvokeMap;
  582.  
  583. // Macros for accessing the members of CorPinvokeMap
  584. #define IsPmNoMangle(x)                     ((x) & pmNoMangle)
  585.  
  586. #define IsPmCharSetNotSpec(x)               (((x) & pmCharSetMask) == pmCharSetNotSpec)
  587. #define IsPmCharSetAnsi(x)                  (((x) & pmCharSetMask) == pmCharSetAnsi)
  588. #define IsPmCharSetUnicode(x)               (((x) & pmCharSetMask) == pmCharSetUnicode)
  589. #define IsPmCharSetAuto(x)                  (((x) & pmCharSetMask) == pmCharSetAuto)
  590.  
  591. #define IsPmPinvokeOLE(x)                   ((x) & pmPinvokeOLE)
  592. #define IsPmSupportsLastError(x)            ((x) & pmSupportsLastError)
  593.  
  594. #define IsPmCallConvWinapi(x)               (((x) & pmCallConvMask) == pmCallConvWinapi)
  595. #define IsPmCallConvCdecl(x)                (((x) & pmCallConvMask) == pmCallConvCdecl)
  596. #define IsPmCallConvStdcall(x)              (((x) & pmCallConvMask) == pmCallConvStdcall)
  597. #define IsPmCallConvThiscall(x)             (((x) & pmCallConvMask) == pmCallConvThiscall)
  598. #define IsPmCallConvFastcall(x)             (((x) & pmCallConvMask) == pmCallConvFastcall)
  599.  
  600.  
  601. // Assembly attr bits, used by DefineAssembly.
  602. typedef enum CorAssemblyFlags
  603. {
  604.     afImplicitComTypes      =   0x0001,     // ComType definitions are implicit within the files.
  605.     afImplicitResources     =   0x0002,     // Resource definitions are implicit within the files.
  606.  
  607.     afCompatibilityMask     =   0x0070,
  608.     afSideBySideCompatible  =   0x0000,      // The assembly is side by side compatible.
  609.     afNonSideBySideAppDomain=   0x0010,     // The assembly cannot execute with other versions if
  610.                                             // they are executing in the same application domain.
  611.     afNonSideBySideProcess  =   0x0020,     // The assembly cannot execute with other versions if
  612.                                             // they are executing in the same process.
  613.     afNonSideBySideMachine  =   0x0030,     // The assembly cannot execute with other versions if
  614.                                             // they are executing on the same machine.
  615. } CorAssemblyFlags;
  616.  
  617. // Macros for accessing the members of CorAssemblyFlags.
  618. #define IsAfImplicitComTypes(x)             ((x) & afImplicitComTypes)
  619. #define IsAfImplicitResources(x)            ((x) & afImplicitResources)
  620. #define IsAfSideBySideCompatible(x)         (((x) & afCompatibilityMask) == afSideBySideCompatible)
  621. #define IsAfNonSideBySideAppDomain(x)       (((x) & afCompatibilityMask) == afNonSideBySideAppDomain)
  622. #define IsAfNonSideBySideProcess(x)         (((x) & afCompatibilityMask) == afNonSideBySideProcess)
  623. #define IsAfNonSideBySideMachine(x)         (((x) & afCompatibilityMask) == afNonSideBySideMachine)
  624.  
  625.  
  626. // AssemblyRef attr bits, used by DefineAssemblyRef.
  627. typedef enum CorAssemblyRefFlags
  628. {
  629.     arFullOriginator        =   0x0001,     // The assembly ref holds the full (unhashed) originator.
  630. } CorAssemblyRefFlags;
  631.  
  632. // Macros for accessing the members of CorAssemblyRefFlags.
  633. #define IsArFullOriginator(x)               ((x) & arFullOriginator)
  634.  
  635.  
  636. // ManifestResource attr bits, used by DefineManifestResource.
  637. typedef enum CorManifestResourceFlags
  638. {
  639.     mrVisibilityMask        =   0x0007,
  640.     mrPublic                =   0x0001,     // The Resource is exported from the Assembly.
  641.     mrPrivate               =   0x0002,     // The Resource is private to the Assembly.
  642. } CorManifestResourceFlags;
  643.  
  644. // Macros for accessing the members of CorManifestResourceFlags.
  645. #define IsMrPublic(x)                       (((x) & mrVisibilityMask) == mrPublic)
  646. #define IsMrPrivate(x)                      (((x) & mrVisibilityMask) == mrPrivate)
  647.  
  648.  
  649. // File attr bits, used by DefineFile.
  650. typedef enum CorFileFlags
  651. {
  652.     ffContainsMetaData      =   0x0000,     // This is not a resource file
  653.     ffContainsNoMetaData    =   0x0001,     // This is a resource file or other non-metadata-containing file
  654.     ffWriteable             =   0x0002,     // The file is writeable post-build.
  655. } CorFileFlags;
  656.  
  657. // Macros for accessing the members of CorFileFlags.
  658. #define IsFfContainsMetaData(x)             (!((x) & ffContainsNoMetaData))
  659. #define IsFfContainsNoMetaData(x)           ((x) & ffContainsNoMetaData)
  660. #define IsFfWriteable(x)                    ((x) & ffWriteable)
  661.  
  662.  
  663. // structures and enums moved from COR.H
  664. typedef unsigned __int8 COR_SIGNATURE;
  665.  
  666. typedef COR_SIGNATURE* PCOR_SIGNATURE;      // pointer to a cor sig.  Not void* so that 
  667.                                             // the bytes can be incremented easily  
  668. typedef const COR_SIGNATURE* PCCOR_SIGNATURE;
  669.  
  670.  
  671. typedef const char * MDUTF8CSTR;
  672. typedef char * MDUTF8STR;
  673.  
  674. //*****************************************************************************
  675. //
  676. // Element type for Cor signature
  677. //
  678. //*****************************************************************************
  679.  
  680. typedef enum CorElementType
  681. {
  682.     ELEMENT_TYPE_END            = 0x0,  
  683.     ELEMENT_TYPE_VOID           = 0x1,  
  684.     ELEMENT_TYPE_BOOLEAN        = 0x2,  
  685.     ELEMENT_TYPE_CHAR           = 0x3,  
  686.     ELEMENT_TYPE_I1             = 0x4,  
  687.     ELEMENT_TYPE_U1             = 0x5, 
  688.     ELEMENT_TYPE_I2             = 0x6,  
  689.     ELEMENT_TYPE_U2             = 0x7,  
  690.     ELEMENT_TYPE_I4             = 0x8,  
  691.     ELEMENT_TYPE_U4             = 0x9,  
  692.     ELEMENT_TYPE_I8             = 0xa,  
  693.     ELEMENT_TYPE_U8             = 0xb,  
  694.     ELEMENT_TYPE_R4             = 0xc,  
  695.     ELEMENT_TYPE_R8             = 0xd,  
  696.     ELEMENT_TYPE_STRING         = 0xe,  
  697.  
  698.     // every type above PTR will be simple type 
  699.     ELEMENT_TYPE_PTR            = 0xf,      // PTR <type>   
  700.     ELEMENT_TYPE_BYREF          = 0x10,     // BYREF <type> 
  701.  
  702.     // Please use ELEMENT_TYPE_VALUETYPE. ELEMENT_TYPE_VALUECLASS is deprecated.
  703.     ELEMENT_TYPE_VALUETYPE      = 0x11,     // VALUETYPE <class Token> 
  704.     ELEMENT_TYPE_VALUECLASS     = ELEMENT_TYPE_VALUETYPE, 
  705.     ELEMENT_TYPE_CLASS          = 0x12,     // CLASS <class Token>  
  706.  
  707.     ELEMENT_TYPE_UNUSED1        = 0x13,
  708.     ELEMENT_TYPE_ARRAY          = 0x14,     // MDARRAY <type> <rank> <bcount> <bound1> ... <lbcount> <lb1> ...  
  709.  
  710.     ELEMENT_TYPE_COPYCTOR       = 0x15,     // COPYCTOR <type>      // copy construct the argument
  711.     ELEMENT_TYPE_TYPEDBYREF     = 0x16,     // This is a simple type.   
  712.  
  713.     ELEMENT_TYPE_VALUEARRAY     = 0x17,     // VALUEARRAY <type> <bound>    
  714.     ELEMENT_TYPE_I              = 0x18,     // native integer size  
  715.     ELEMENT_TYPE_U              = 0x19,     // native unsigned integer size 
  716.     ELEMENT_TYPE_R              = 0x1A,     // native real size 
  717.     ELEMENT_TYPE_FNPTR          = 0x1B,     // FNPTR <complete sig for the function including calling convention>
  718.     ELEMENT_TYPE_OBJECT         = 0x1C,     // Shortcut for System.Object
  719.     ELEMENT_TYPE_SZARRAY        = 0x1D,     // Shortcut for single dimension zero lower bound array
  720.                                             // SZARRAY <type>
  721.     ELEMENT_TYPE_GENERICARRAY   = 0x1E,     // Array with unknown rank
  722.                                             // GZARRAY <type>
  723.  
  724.     // This is only for binding
  725.     ELEMENT_TYPE_CMOD_REQD      = 0x1F,     // required C modifier : E_T_CMOD_REQD <mdTypeRef/mdTypeDef>
  726.     ELEMENT_TYPE_CMOD_OPT       = 0x20,     // optional C modifier : E_T_CMOD_OPT <mdTypeRef/mdTypeDef>
  727.  
  728.     // Note that this is the max of base type excluding modifiers   
  729.     ELEMENT_TYPE_MAX            = 0x21,     // first invalid element type   
  730.  
  731.     // These are experimental for internal use only
  732.     ELEMENT_TYPE_VAR            = ELEMENT_TYPE_MAX + 1,     // a type variable VAR <U1> 
  733.     ELEMENT_TYPE_NAME           = ELEMENT_TYPE_MAX + 2,     // class by name NAME <count> <chars>
  734.                                                             // should remove after 9/27/99
  735.  
  736.     ELEMENT_TYPE_MODIFIER       = 0x40, 
  737.     ELEMENT_TYPE_SENTINEL       = 0x01 | ELEMENT_TYPE_MODIFIER, // sentinel for varargs
  738.     ELEMENT_TYPE_PINNED         = 0x05 | ELEMENT_TYPE_MODIFIER,
  739.  
  740. } CorElementType;
  741.  
  742.  
  743. //*****************************************************************************
  744. //
  745. // Serialization types for Custom attribute support
  746. //
  747. //*****************************************************************************
  748.  
  749. typedef enum CorSerializationType
  750. {
  751.     SERIALIZATION_TYPE_BOOLEAN      = ELEMENT_TYPE_BOOLEAN,
  752.     SERIALIZATION_TYPE_CHAR         = ELEMENT_TYPE_CHAR,
  753.     SERIALIZATION_TYPE_I1           = ELEMENT_TYPE_I1, 
  754.     SERIALIZATION_TYPE_U1           = ELEMENT_TYPE_U1, 
  755.     SERIALIZATION_TYPE_I2           = ELEMENT_TYPE_I2,  
  756.     SERIALIZATION_TYPE_U2           = ELEMENT_TYPE_U2,  
  757.     SERIALIZATION_TYPE_I4           = ELEMENT_TYPE_I4,  
  758.     SERIALIZATION_TYPE_U4           = ELEMENT_TYPE_U4,  
  759.     SERIALIZATION_TYPE_I8           = ELEMENT_TYPE_I8, 
  760.     SERIALIZATION_TYPE_U8           = ELEMENT_TYPE_U8,  
  761.     SERIALIZATION_TYPE_R4           = ELEMENT_TYPE_R4,  
  762.     SERIALIZATION_TYPE_R8           = ELEMENT_TYPE_R8,  
  763.     SERIALIZATION_TYPE_STRING       = ELEMENT_TYPE_STRING, 
  764.     SERIALIZATION_TYPE_SZARRAY      = ELEMENT_TYPE_SZARRAY, // Shortcut for single dimension zero lower bound array 
  765.     SERIALIZATION_TYPE_TYPE         = 0x50,
  766.     SERIALIZATION_TYPE_VARIANT      = 0x51,
  767.     SERIALIZATION_TYPE_FIELD        = 0x53,
  768.     SERIALIZATION_TYPE_PROPERTY     = 0x54,
  769.     SERIALIZATION_TYPE_ENUM         = 0x55    
  770. } CorSerializationType;
  771.  
  772. //
  773. // Calling convention flags.
  774. //
  775.  
  776.  
  777. typedef enum CorCallingConvention
  778. {
  779.     IMAGE_CEE_CS_CALLCONV_DEFAULT   = 0x0,  
  780.  
  781.     IMAGE_CEE_CS_CALLCONV_VARARG    = 0x5,  
  782.     IMAGE_CEE_CS_CALLCONV_FIELD     = 0x6,  
  783.     IMAGE_CEE_CS_CALLCONV_LOCAL_SIG = 0x7,
  784.     IMAGE_CEE_CS_CALLCONV_PROPERTY  = 0x8,
  785.     IMAGE_CEE_CS_CALLCONV_UNMGD     = 0x9,
  786.     IMAGE_CEE_CS_CALLCONV_MAX       = 0x10,  // first invalid calling convention    
  787.  
  788.  
  789.         // The high bits of the calling convention convey additional info   
  790.     IMAGE_CEE_CS_CALLCONV_MASK      = 0x0f,  // Calling convention is bottom 4 bits 
  791.     IMAGE_CEE_CS_CALLCONV_HASTHIS   = 0x20,  // Top bit indicates a 'this' parameter    
  792.     IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS = 0x40,  // This parameter is explicitly in the signature
  793. } CorCallingConvention;
  794.  
  795.  
  796. typedef enum CorUnmanagedCallingConvention
  797. {
  798.     IMAGE_CEE_UNMANAGED_CALLCONV_C         = 0x1,  
  799.     IMAGE_CEE_UNMANAGED_CALLCONV_STDCALL   = 0x2,  
  800.     IMAGE_CEE_UNMANAGED_CALLCONV_THISCALL  = 0x3,  
  801.     IMAGE_CEE_UNMANAGED_CALLCONV_FASTCALL  = 0x4,  
  802.  
  803.     IMAGE_CEE_CS_CALLCONV_C         = IMAGE_CEE_UNMANAGED_CALLCONV_C,  
  804.     IMAGE_CEE_CS_CALLCONV_STDCALL   = IMAGE_CEE_UNMANAGED_CALLCONV_STDCALL,  
  805.     IMAGE_CEE_CS_CALLCONV_THISCALL  = IMAGE_CEE_UNMANAGED_CALLCONV_THISCALL,  
  806.     IMAGE_CEE_CS_CALLCONV_FASTCALL  = IMAGE_CEE_UNMANAGED_CALLCONV_FASTCALL,  
  807.  
  808. } CorUnmanagedCallingConvention;
  809.  
  810.  
  811. typedef enum CorArgType
  812. {
  813.     IMAGE_CEE_CS_END        = 0x0,
  814.     IMAGE_CEE_CS_VOID       = 0x1,
  815.     IMAGE_CEE_CS_I4         = 0x2,
  816.     IMAGE_CEE_CS_I8         = 0x3,
  817.     IMAGE_CEE_CS_R4         = 0x4,
  818.     IMAGE_CEE_CS_R8         = 0x5,
  819.     IMAGE_CEE_CS_PTR        = 0x6,
  820.     IMAGE_CEE_CS_OBJECT     = 0x7,
  821.     IMAGE_CEE_CS_STRUCT4    = 0x8,
  822.     IMAGE_CEE_CS_STRUCT32   = 0x9,
  823.     IMAGE_CEE_CS_BYVALUE    = 0xA,
  824. } CorArgType;
  825.  
  826.  
  827. //*****************************************************************************
  828. //
  829. // Native type for N-Direct
  830. //
  831. //*****************************************************************************
  832.  
  833. typedef enum CorNativeType
  834. {
  835.     NATIVE_TYPE_END         = 0x0,    //DEPRECATED
  836.     NATIVE_TYPE_VOID        = 0x1,    //DEPRECATED
  837.     NATIVE_TYPE_BOOLEAN     = 0x2,    // (4 byte boolean value: TRUE = non-zero, FALSE = 0)
  838.     NATIVE_TYPE_I1          = 0x3,  
  839.     NATIVE_TYPE_U1          = 0x4,  
  840.     NATIVE_TYPE_I2          = 0x5,  
  841.     NATIVE_TYPE_U2          = 0x6,  
  842.     NATIVE_TYPE_I4          = 0x7,  
  843.     NATIVE_TYPE_U4          = 0x8,  
  844.     NATIVE_TYPE_I8          = 0x9,  
  845.     NATIVE_TYPE_U8          = 0xa,  
  846.     NATIVE_TYPE_R4          = 0xb,  
  847.     NATIVE_TYPE_R8          = 0xc,  
  848.     NATIVE_TYPE_SYSCHAR     = 0xd,    //DEPRECATED 
  849.     NATIVE_TYPE_VARIANT     = 0xe,    //DEPRECATED
  850.     NATIVE_TYPE_CURRENCY    = 0xf,    //DEPRECATED
  851.     NATIVE_TYPE_PTR         = 0x10,   //DEPRECATED  
  852.  
  853.     NATIVE_TYPE_DECIMAL     = 0x11,   //DEPRECATED
  854.     NATIVE_TYPE_DATE        = 0x12,   //DEPRECATED
  855.     NATIVE_TYPE_BSTR        = 0x13, 
  856.     NATIVE_TYPE_LPSTR       = 0x14, 
  857.     NATIVE_TYPE_LPWSTR      = 0x15, 
  858.     NATIVE_TYPE_LPTSTR      = 0x16, 
  859.     NATIVE_TYPE_FIXEDSYSSTRING  = 0x17, 
  860.     NATIVE_TYPE_OBJECTREF   = 0x18,   //DEPRECATED
  861.     NATIVE_TYPE_IUNKNOWN    = 0x19,
  862.     NATIVE_TYPE_IDISPATCH   = 0x1a,
  863.     NATIVE_TYPE_STRUCT      = 0x1b, 
  864.     NATIVE_TYPE_INTF        = 0x1c, 
  865.     NATIVE_TYPE_SAFEARRAY   = 0x1d, 
  866.     NATIVE_TYPE_FIXEDARRAY  = 0x1e, 
  867.     NATIVE_TYPE_INT         = 0x1f, 
  868.     NATIVE_TYPE_UINT        = 0x20, 
  869.  
  870.     //@todo: sync up the spec   
  871.     NATIVE_TYPE_NESTEDSTRUCT  = 0x21, //DEPRECATED (use NATIVE_TYPE_STRUCT)   
  872.  
  873.     NATIVE_TYPE_BYVALSTR    = 0x22,
  874.                               
  875.     NATIVE_TYPE_ANSIBSTR    = 0x23,
  876.  
  877.     NATIVE_TYPE_TBSTR       = 0x24, // select BSTR or ANSIBSTR depending on platform
  878.  
  879.  
  880.     NATIVE_TYPE_VARIANTBOOL = 0x25, // (2-byte boolean value: TRUE = -1, FALSE = 0)
  881.     NATIVE_TYPE_FUNC        = 0x26,
  882.     NATIVE_TYPE_LPVOID      = 0x27, // blind pointer (no deep marshaling)
  883.  
  884.     NATIVE_TYPE_ASANY       = 0x28,
  885.     NATIVE_TYPE_R           = 0x29, // agnostic floating point
  886.  
  887.     NATIVE_TYPE_ARRAY       = 0x2a,
  888.     NATIVE_TYPE_LPSTRUCT    = 0x2b,
  889.  
  890.     NATIVE_TYPE_CUSTOMMARSHALER = 0x2c,  // Custom marshaler native type. This must be followed 
  891.                                          // by a string of the following format:
  892.                                          // "Native type name/0Custom marshaler type name/0Optional cookie/0"
  893.                                          // Or
  894.                                          // "{Native type GUID}/0Custom marshaler type name/0Optional cookie/0"
  895.  
  896.     NATIVE_TYPE_ERROR       = 0x2d, // This native type coupled with ELEMENT_TYPE_I4 will map to VT_HRESULT
  897.  
  898.     NATIVE_TYPE_MAX         = 0x50, // first invalid element type   
  899. } CorNativeType;
  900.  
  901.  
  902. enum 
  903. {
  904.     DESCR_GROUP_METHODDEF = 0,          // DESCR group for MethodDefs   
  905.     DESCR_GROUP_METHODIMPL,             // DESCR group for MethodImpls  
  906. };
  907.  
  908. /***********************************************************************************/
  909. // a COR_ILMETHOD_SECT is a generic container for attributes that are private
  910. // to a particular method.  The COR_ILMETHOD structure points to one of these
  911. // (see GetSect()).  COR_ILMETHOD_SECT can decode the Kind of attribute (but not
  912. // its internal data layout, and can skip past the current attibute to find the
  913. // Next one.   The overhead for COR_ILMETHOD_SECT is a minimum of 2 bytes.  
  914.  
  915. typedef enum CorILMethodSect                             // codes that identify attributes   
  916. {
  917.     CorILMethod_Sect_Reserved    = 0,   
  918.     CorILMethod_Sect_EHTable     = 1,   
  919.     CorILMethod_Sect_OptILTable  = 2,   
  920.  
  921.     CorILMethod_Sect_KindMask    = 0x3F,        // The mask for decoding the type code  
  922.     CorILMethod_Sect_FatFormat   = 0x40,        // fat format   
  923.     CorILMethod_Sect_MoreSects   = 0x80,        // there is another attribute after this one    
  924. } CorILMethodSect;
  925.  
  926. /************************************/
  927. /* NOTE this structure must be DWORD aligned!! */
  928.  
  929. typedef struct IMAGE_COR_ILMETHOD_SECT_SMALL 
  930. {
  931.     BYTE Kind;  
  932.     BYTE DataSize;  
  933. } IMAGE_COR_ILMETHOD_SECT_SMALL;
  934.  
  935.  
  936.  
  937. /************************************/
  938. /* NOTE this structure must be DWORD aligned!! */
  939. typedef struct IMAGE_COR_ILMETHOD_SECT_FAT 
  940. {
  941.     unsigned Kind : 8;  
  942.     unsigned DataSize : 24; 
  943. } IMAGE_COR_ILMETHOD_SECT_FAT;
  944.  
  945.  
  946.  
  947. /***********************************************************************************/
  948. /* If COR_ILMETHOD_SECT_HEADER::Kind() = CorILMethod_Sect_EHTable then the attribute
  949.    is a list of exception handling clauses.  There are two formats, fat or small
  950. */
  951. typedef enum CorExceptionFlag                       // defintitions for the Flags field below (for both big and small)  
  952. {
  953.     COR_ILEXCEPTION_CLAUSE_NONE,                    // This is a typed handler
  954.     COR_ILEXCEPTION_CLAUSE_OFFSETLEN = 0x0000,      // Deprecated
  955.     COR_ILEXCEPTION_CLAUSE_DEPRECATED = 0x0000,     // Deprecated
  956.     COR_ILEXCEPTION_CLAUSE_FILTER  = 0x0001,        // If this bit is on, then this EH entry is for a filter    
  957.     COR_ILEXCEPTION_CLAUSE_FINALLY = 0x0002,        // This clause is a finally clause  
  958.     COR_ILEXCEPTION_CLAUSE_FAULT = 0x0004,          // Fault clause (finally that is called on exception only)
  959. } CorExceptionFlag;
  960.  
  961. /***********************************/
  962. typedef struct IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT
  963. {
  964.     CorExceptionFlag    Flags;  
  965.     DWORD               TryOffset;    
  966.     DWORD               TryLength;      // relative to start of try block
  967.     DWORD               HandlerOffset;
  968.     DWORD               HandlerLength;  // relative to start of handler
  969.     union {
  970.         DWORD           ClassToken;     // use for type-based exception handlers    
  971.         DWORD           FilterOffset;   // use for filter-based exception handlers (COR_ILEXCEPTION_FILTER is set)  
  972.     };
  973. } IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT;
  974.  
  975. typedef struct IMAGE_COR_ILMETHOD_SECT_EH_FAT
  976. {
  977.     IMAGE_COR_ILMETHOD_SECT_FAT   SectFat;
  978.     IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT Clauses[1];     // actually variable size   
  979. } IMAGE_COR_ILMETHOD_SECT_EH_FAT;
  980.  
  981. /***********************************/
  982. typedef struct IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL
  983. {
  984. #ifdef _WIN64
  985.     unsigned            Flags         : 16;
  986. #else // !_WIN64
  987.     CorExceptionFlag    Flags         : 16;
  988. #endif
  989.     unsigned            TryOffset     : 16; 
  990.     unsigned            TryLength     : 8;  // relative to start of try block
  991.     unsigned            HandlerOffset : 16;
  992.     unsigned            HandlerLength : 8;  // relative to start of handler
  993.     union {
  994.         DWORD       ClassToken;
  995.         DWORD       FilterOffset; 
  996.     };
  997. } IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL;
  998.  
  999. /***********************************/
  1000. typedef struct IMAGE_COR_ILMETHOD_SECT_EH_SMALL
  1001. {
  1002.     IMAGE_COR_ILMETHOD_SECT_SMALL SectSmall;
  1003.     WORD Reserved;
  1004.     IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL Clauses[1];   // actually variable size   
  1005. } IMAGE_COR_ILMETHOD_SECT_EH_SMALL;
  1006.  
  1007.  
  1008.  
  1009. typedef union IMAGE_COR_ILMETHOD_SECT_EH
  1010. {
  1011.     IMAGE_COR_ILMETHOD_SECT_EH_SMALL Small;   
  1012.     IMAGE_COR_ILMETHOD_SECT_EH_FAT Fat;   
  1013. } IMAGE_COR_ILMETHOD_SECT_EH;
  1014.  
  1015.  
  1016. /***********************************************************************************/
  1017. typedef enum CorILMethodFlags
  1018.     CorILMethod_InitLocals      = 0x0010,           // call default constructor on all local vars   
  1019.     CorILMethod_MoreSects       = 0x0008,           // there is another attribute after this one    
  1020.  
  1021.     CorILMethod_CompressedIL    = 0x0040,           // FIX Remove this and do it on a per Module basis  
  1022.  
  1023.         // Indicates the format for the COR_ILMETHOD header 
  1024.     CorILMethod_FormatShift     = 3,    
  1025.     CorILMethod_FormatMask      = ((1 << CorILMethod_FormatShift) - 1), 
  1026.     CorILMethod_TinyFormat      = 0x0002,         // use this code if the code size is even 
  1027.     CorILMethod_SmallFormat     = 0x0000,           
  1028.     CorILMethod_FatFormat       = 0x0003,   
  1029.     CorILMethod_TinyFormat1     = 0x0006,         // use this code if the code size is odd  
  1030. } CorILMethodFlags;
  1031.  
  1032. /***************************************************************************/
  1033. /* Used when the method is tiny (< 64 bytes), and there are no local vars */
  1034. typedef struct IMAGE_COR_ILMETHOD_TINY
  1035. {
  1036.     BYTE Flags_CodeSize;    
  1037. } IMAGE_COR_ILMETHOD_TINY;
  1038.  
  1039. /************************************/
  1040. // This strucuture is the 'fat' layout, where no compression is attempted. 
  1041. // Note that this structure can be added on at the end, thus making it extensible
  1042. typedef struct IMAGE_COR_ILMETHOD_FAT
  1043. {
  1044.     unsigned Flags    : 12;     // Flags    
  1045.     unsigned Size     :  4;     // size in DWords of this structure (currently 3)   
  1046.     unsigned MaxStack : 16;     // maximum number of items (I4, I, I8, obj ...), on the operand stack   
  1047.     DWORD   CodeSize;           // size of the code 
  1048.     mdSignature   LocalVarSigTok;     // token that indicates the signature of the local vars (0 means none)  
  1049. } IMAGE_COR_ILMETHOD_FAT;
  1050.  
  1051. typedef union IMAGE_COR_ILMETHOD
  1052. {
  1053.     IMAGE_COR_ILMETHOD_TINY       Tiny;   
  1054.     IMAGE_COR_ILMETHOD_FAT        Fat;    
  1055. } IMAGE_COR_ILMETHOD;
  1056.  
  1057. //
  1058. // Native method descriptor.
  1059. //
  1060.  
  1061. typedef struct IMAGE_COR_NATIVE_DESCRIPTOR
  1062. {
  1063.     DWORD       GCInfo; 
  1064.     DWORD       EHInfo; 
  1065. } IMAGE_COR_NATIVE_DESCRIPTOR;
  1066.  
  1067. //@Todo:  this structure is obsoleted by the pdata version right behind it.
  1068. // This needs to get deleted as soon as VC/COR are sync'd up.
  1069. typedef struct COR_IPMAP_ENTRY
  1070. {
  1071.     ULONG MethodRVA;    
  1072.     ULONG MIHRVA;   
  1073. } COR_IPMAP_ENTRY;
  1074.  
  1075. typedef struct IMAGE_COR_X86_RUNTIME_FUNCTION_ENTRY 
  1076. {
  1077.     ULONG       BeginAddress;           // RVA of start of function
  1078.     ULONG       EndAddress;             // RVA of end of function
  1079.     ULONG       MIH;                    // Associated MIH
  1080. } IMAGE_COR_X86_RUNTIME_FUNCTION_ENTRY;
  1081.  
  1082. typedef struct IMAGE_COR_MIH_ENTRY
  1083. {
  1084.     ULONG   EHRVA;  
  1085.     ULONG   MethodRVA;  
  1086.     mdToken Token;  
  1087.     BYTE    Flags;  
  1088.     BYTE    CodeManager;    
  1089.     BYTE    MIHData[0]; 
  1090. } IMAGE_COR_MIH_ENTRY;
  1091.  
  1092. //*****************************************************************************
  1093. // Non VOS v-table entries.  Define an array of these pointed to by 
  1094. // IMAGE_COR20_HEADER.VTableFixups.  Each entry describes a contiguous array of
  1095. // v-table slots.  The slots start out initialized to the meta data token value
  1096. // for the method they need to call.  At image load time, the COM+ Loader will
  1097. // turn each entry into a pointer to machine code for the CPU and can be
  1098. // called directly.
  1099. //*****************************************************************************
  1100.  
  1101. typedef struct IMAGE_COR_VTABLEFIXUP
  1102. {
  1103.     ULONG       RVA;                    // Offset of v-table array in image.    
  1104.     USHORT      Count;                  // How many entries at location.    
  1105.     USHORT      Type;                   // COR_VTABLE_xxx type of entries.  
  1106. } IMAGE_COR_VTABLEFIXUP;
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112. //*****************************************************************************
  1113. //*****************************************************************************
  1114. //
  1115. // M E T A - D A T A    D E C L A R A T I O N S 
  1116. //
  1117. //*****************************************************************************
  1118. //*****************************************************************************
  1119.  
  1120. //*****************************************************************************
  1121. //
  1122. // Enums for SetOption API.
  1123. //
  1124. //*****************************************************************************
  1125.  
  1126. // flags for MetaDataCheckDuplicatesFor
  1127. typedef enum CorCheckDuplicatesFor
  1128. {
  1129.     MDDupAll                = 0xffffffff,
  1130.     MDDupENC                = MDDupAll,
  1131.     MDNoDupChecks           = 0x00000000,
  1132.     MDDupTypeDef            = 0x00000001,
  1133.     MDDupInterfaceImpl      = 0x00000002,
  1134.     MDDupMethodDef          = 0x00000004,
  1135.     MDDupTypeRef            = 0x00000008,
  1136.     MDDupMemberRef          = 0x00000010,
  1137.     MDDupCustomValue        = 0x00000020,
  1138.     MDDupCustomAttribute    = 0x00000020,   // Alias for custom value.
  1139.     MDDupParamDef           = 0x00000040,
  1140.     MDDupPermission         = 0x00000080,
  1141.     MDDupProperty           = 0x00000100,
  1142.     MDDupEvent              = 0x00000200,
  1143.     MDDupFieldDef           = 0x00000400,
  1144.     MDDupSignature          = 0x00000800,
  1145.     MDDupModuleRef          = 0x00001000,
  1146.     MDDupTypeSpec           = 0x00002000,
  1147.     MDDupImplMap            = 0x00004000,
  1148.     MDDupAssemblyRef        = 0x00008000,
  1149.     MDDupFile               = 0x00010000,
  1150.     MDDupComType            = 0x00020000,
  1151.     MDDupManifestResource   = 0x00040000,
  1152.     MDDupExecutionLocation  = 0x00080000,
  1153.     // gap for debug junk
  1154.     MDDupAssembly           = 0x10000000,
  1155.  
  1156.     // @todo: These will go away once the MetaData debug tables are gone.
  1157.     MDDupSourceFile         = 0x01000000,
  1158.     MDDupBlock              = 0x02000000,
  1159.     MDDupLocalVarScope      = 0x04000000,
  1160.     MDDupLocalVar           = 0x08000000,
  1161.  
  1162.     // This is the default behavior on metadata. It will check duplicates for TypeRef, MemberRef, Signature, and TypeSpec
  1163.     MDDupDefault = MDNoDupChecks | MDDupTypeRef | MDDupMemberRef | MDDupSignature | MDDupTypeSpec,
  1164. } CorCheckDuplicatesFor;
  1165.  
  1166. // flags for MetaDataRefToDefCheck
  1167. typedef enum CorRefToDefCheck
  1168. {
  1169.     // default behavior is to always perform TypeRef to TypeDef and MemberRef to MethodDef/FieldDef optimization
  1170.     MDRefToDefDefault       = 0x00000003,
  1171.     MDRefToDefAll           = 0xffffffff,
  1172.     MDRefToDefNone          = 0x00000000,
  1173.     MDTypeRefToDef          = 0x00000001,
  1174.     MDMemberRefToDef        = 0x00000002
  1175. } CorRefToDefCheck;
  1176.  
  1177.  
  1178. // MetaDataNotificationForTokenMovement
  1179. typedef enum CorNotificationForTokenMovement
  1180. {
  1181.     // default behavior is to notify TypeRef, MethodDef, MemberRef, and FieldDef token remaps
  1182.     MDNotifyDefault         = 0x0000000f,
  1183.     MDNotifyAll             = 0xffffffff,
  1184.     MDNotifyNone            = 0x00000000,
  1185.     MDNotifyMethodDef       = 0x00000001,
  1186.     MDNotifyMemberRef       = 0x00000002,
  1187.     MDNotifyFieldDef        = 0x00000004,
  1188.     MDNotifyTypeRef         = 0x00000008,
  1189.  
  1190.     MDNotifyTypeDef         = 0x00000010,
  1191.     MDNotifyParamDef        = 0x00000020,
  1192.     MDNotifyInterfaceImpl   = 0x00000040,
  1193.     MDNotifyProperty        = 0x00000080,
  1194.     MDNotifyEvent           = 0x00000100,
  1195.     MDNotifySignature       = 0x00000200,
  1196.     MDNotifyTypeSpec        = 0x00000400,
  1197.     MDNotifyCustomValue     = 0x00000800,
  1198.     MDNotifyCustomAttribute = 0x00001000,   // Alias for custom value
  1199.     MDNotifySecurityValue   = 0x00002000,
  1200.     MDNotifyPermission      = 0x00004000,
  1201.     MDNotifyModuleRef       = 0x00008000,
  1202.     
  1203.     MDNotifyNameSpace       = 0x00010000,
  1204.     MDNotifyDebugTokens     = 0x00800000,   // This covers all Debug tokens, bits are expensive :-)
  1205.  
  1206.     MDNotifyAssemblyRef     = 0x01000000,
  1207.     MDNotifyFile            = 0x02000000,
  1208.     MDNotifyComType         = 0x04000000,
  1209.     MDNotifyResource        = 0x08000000,
  1210.     MDNotifyExecutionLocation = 0x10000000,
  1211. } CorNotificationForTokenMovement;
  1212.  
  1213.  
  1214. typedef enum CorSetENC
  1215. {
  1216.     MDSetENCOn              = 0x00000001,   // Deprecated name.
  1217.     MDSetENCOff             = 0x00000002,   // Deprecated name.
  1218.  
  1219.     MDUpdateENC             = 0x00000001,   // ENC mode.  Tokens don't move; can be updated.
  1220.     MDUpdateFull            = 0x00000002,   // "Normal" update mode.
  1221.     MDUpdateExtension       = 0x00000003,   // Extension mode.  Tokens don't move, adds only.
  1222.     MDUpdateIncremental     = 0x00000004,   // Incremental compilation
  1223.     MDUpdateMask            = 0x00000007,
  1224.  
  1225.     MDUpdateDelta           = 0x00000008,   // If ENC on, save only deltas.
  1226.  
  1227. } CorSetENC;
  1228.  
  1229.  
  1230. // flags used in SetOption when pair with MetaDataErrorIfEmitOutOfOrder guid
  1231. typedef enum CorErrorIfEmitOutOfOrder
  1232. {
  1233.     MDErrorOutOfOrderDefault = 0x00000000,  // default not to generate any error
  1234.     MDErrorOutOfOrderNone   = 0x00000000,   // do not generate error for out of order emit
  1235.     MDErrorOutOfOrderAll    = 0xffffffff,   // generate out of order emit for method, field, param, property, and event
  1236.     MDMethodOutOfOrder      = 0x00000001,   // generate error when methods are emitted out of order
  1237.     MDFieldOutOfOrder       = 0x00000002,   // generate error when fields are emitted out of order
  1238.     MDParamOutOfOrder       = 0x00000004,   // generate error when params are emitted out of order
  1239.     MDPropertyOutOfOrder    = 0x00000008,   // generate error when properties are emitted out of order
  1240.     MDEventOutOfOrder       = 0x00000010,   // generate error when events are emitted out of order
  1241. } CorErrorIfEmitOutOfOrder;
  1242.  
  1243.  
  1244. // flags used in SetOption when pair with MetaDataImportOption guid
  1245. typedef enum CorImportOptions
  1246. {
  1247.     MDImportOptionDefault       = 0x00000000,   // default to skip over deleted records
  1248.     MDImportOptionAll           = 0xFFFFFFFF,   // Enumerate everything
  1249.     MDImportOptionAllTypeDefs   = 0x00000001,   // all of the typedefs including the deleted typedef
  1250.     MDImportOptionAllMethodDefs = 0x00000002,   // all of the methoddefs including the deleted ones
  1251.     MDImportOptionAllFieldDefs  = 0x00000004,   // all of the fielddefs including the deleted ones
  1252.     MDImportOptionAllProperties = 0x00000008,   // all of the properties including the deleted ones
  1253.     MDImportOptionAllEvents     = 0x00000010,   // all of the events including the deleted ones
  1254.     MDImportOptionAllCustomValues = 0x00000020, // all of the customvalues including the deleted ones
  1255.     MDImportOptionAllCustomAttributes = 0x00000020, // all of the customvalues including the deleted ones
  1256.     MDImportOptionAllComTypes   = 0x00000040,   // all of the ComTypes including the deleted ones
  1257.  
  1258. } CorImportOptions;
  1259.  
  1260.  
  1261. // flags for MetaDataThreadSafetyOptions
  1262. typedef enum CorThreadSafetyOptions
  1263. {
  1264.     // default behavior is to have thread safety turn off. This means that MetaData APIs will not take reader/writer
  1265.     // lock. Clients is responsible to make sure the properly thread synchornization when using MetaData APIs.
  1266.     MDThreadSafetyDefault   = 0x00000000,
  1267.     MDThreadSafetyOff       = 0x00000000,
  1268.     MDThreadSafetyOn        = 0x00000001,
  1269. } CorThreadSafetyOptions;
  1270.  
  1271.  
  1272. // 
  1273. // struct used to retrieve field offset
  1274. // used by GetClassLayout and SetClassLayout
  1275. //
  1276. typedef struct COR_FIELD_OFFSET
  1277. {
  1278.     mdFieldDef  ridOfField; 
  1279.     ULONG       ulOffset;   
  1280. } COR_FIELD_OFFSET;
  1281.  
  1282. typedef struct IMAGE_COR_FIXUPENTRY
  1283. {
  1284.     ULONG ulRVA;    
  1285.     ULONG Count;    
  1286. } IMAGE_COR_FIXUPENTRY;
  1287.  
  1288.  
  1289. //
  1290. // Token tags.
  1291. //
  1292. typedef enum CorTokenType
  1293. {
  1294.     mdtModule               = 0x00000000,       //          
  1295.     mdtTypeRef              = 0x01000000,       //          
  1296.     mdtTypeDef              = 0x02000000,       //          
  1297.     mdtFieldDef             = 0x04000000,       //           
  1298.     mdtMethodDef            = 0x06000000,       //       
  1299.     mdtParamDef             = 0x08000000,       //           
  1300.     mdtInterfaceImpl        = 0x09000000,       //  
  1301.     mdtMemberRef            = 0x0a000000,       //       
  1302.     mdtCustomAttribute      = 0x0c000000,       //      
  1303.     mdtCustomValue          = mdtCustomAttribute,       //      
  1304.     mdtPermission           = 0x0e000000,       //       
  1305.     mdtSignature            = 0x11000000,       //       
  1306.     mdtEvent                = 0x14000000,       //           
  1307.     mdtProperty             = 0x17000000,       //           
  1308.     mdtModuleRef            = 0x1a000000,       //       
  1309.     mdtTypeSpec             = 0x1b000000,       //           
  1310.     mdtAssembly             = 0x20000000,       //
  1311.     mdtAssemblyRef          = 0x23000000,       //
  1312.     mdtFile                 = 0x26000000,       //
  1313.     mdtComType              = 0x27000000,       //
  1314.     mdtManifestResource     = 0x28000000,       //
  1315.     mdtExecutionLocation    = 0x29000000,       //
  1316.  
  1317.     mdtSourceFile           = 0x2a000000,       //       
  1318.     mdtLocalVarScope        = 0x2c000000,       //   
  1319.     mdtLocalVar             = 0x2d000000,       //           
  1320.  
  1321.     mdtString               = 0x70000000,       //          
  1322.     mdtName                 = 0x71000000,       //
  1323.     mdtBaseType             = 0x72000000,       // Leave this on the high end value. This does not correspond to metadata table
  1324. } CorTokenType;
  1325.  
  1326. //
  1327. // Build / decompose tokens.
  1328. //
  1329. #define RidToToken(rid,tktype) ((rid) |= (tktype))
  1330. #define TokenFromRid(rid,tktype) ((rid) | (tktype))
  1331. #define RidFromToken(tk) ((RID) ((tk) & 0x00ffffff))
  1332. #define TypeFromToken(tk) ((ULONG32)((tk) & 0xff000000))
  1333. #define IsNilToken(tk) ((RidFromToken(tk)) == 0)
  1334.  
  1335. //
  1336. // Nil tokens
  1337. //
  1338. #define mdTokenNil                  ((mdToken)0)
  1339. #define mdModuleNil                 ((mdModule)mdtModule)               
  1340. #define mdTypeRefNil                ((mdTypeRef)mdtTypeRef)             
  1341. #define mdTypeDefNil                ((mdTypeDef)mdtTypeDef)             
  1342. #define mdFieldDefNil               ((mdFieldDef)mdtFieldDef)           
  1343. #define mdMethodDefNil              ((mdMethodDef)mdtMethodDef)         
  1344. #define mdParamDefNil               ((mdParamDef)mdtParamDef)           
  1345. #define mdInterfaceImplNil          ((mdInterfaceImpl)mdtInterfaceImpl)     
  1346. #define mdMemberRefNil              ((mdMemberRef)mdtMemberRef)         
  1347. #define mdCustomAttributeNil        ((mdCustomValue)mdtCustomAttribute)         
  1348. #define mdCustomValueNil            ((mdCustomAttribute)mdtCustomAttribute)         
  1349. #define mdPermissionNil             ((mdPermission)mdtPermission)           
  1350. #define mdSignatureNil              ((mdSignature)mdtSignature)         
  1351. #define mdEventNil                  ((mdEvent)mdtEvent)             
  1352. #define mdPropertyNil               ((mdProperty)mdtProperty)           
  1353. #define mdModuleRefNil              ((mdModuleRef)mdtModuleRef)         
  1354. #define mdTypeSpecNil               ((mdTypeSpec)mdtTypeSpec)           
  1355. #define mdAssemblyNil               ((mdAssembly)mdtAssembly)
  1356. #define mdAssemblyRefNil            ((mdAssemblyRef)mdtAssemblyRef)
  1357. #define mdFileNil                   ((mdFile)mdtFile)
  1358. #define mdComTypeNil                ((mdComType)mdtComType)
  1359. #define mdManifestResourceNil       ((mdManifestResource)mdtManifestResource)
  1360. #define mdExecutionLocationNil      ((mdExecutionLocation)mdtExecutionLocation)
  1361.  
  1362. #define mdSourceFileNil             ((mdSourceFile)mdtSourceFile)           
  1363. #define mdLocalVarScopeNil          ((mdLocalVarScope)mdtLocalVarScope)     
  1364. #define mdLocalVarNil               ((mdLocalVar)mdtLocalVar)           
  1365.  
  1366. #define mdStringNil                 ((mdString)mdtString)               
  1367.  
  1368. //
  1369. // Open bits.
  1370. //
  1371. typedef enum CorOpenFlags
  1372. {
  1373.     ofRead      =   0x00000000,     // Open scope for read
  1374.     ofWrite     =   0x00000001,     // Open scope for write.
  1375.     ofCopyMemory =  0x00000002,     // Open scope with memory. Ask metadata to maintain its own copy of memory.
  1376.     ofCacheImage =  0x00000004,     // EE maps but does not do relocations or verify image
  1377. } CorOpenFlags;
  1378.  
  1379.  
  1380. typedef enum CorBaseType    // TokenFromRid(X,Y) replaced with (X | Y)
  1381. {
  1382.     mdtBaseType_BOOLEAN        = ( ELEMENT_TYPE_BOOLEAN | mdtBaseType ),  
  1383.     mdtBaseType_CHAR           = ( ELEMENT_TYPE_CHAR    | mdtBaseType ),
  1384.     mdtBaseType_I1             = ( ELEMENT_TYPE_I1      | mdtBaseType ), 
  1385.     mdtBaseType_U1             = ( ELEMENT_TYPE_U1      | mdtBaseType ),
  1386.     mdtBaseType_I2             = ( ELEMENT_TYPE_I2      | mdtBaseType ),  
  1387.     mdtBaseType_U2             = ( ELEMENT_TYPE_U2      | mdtBaseType ),  
  1388.     mdtBaseType_I4             = ( ELEMENT_TYPE_I4      | mdtBaseType ),  
  1389.     mdtBaseType_U4             = ( ELEMENT_TYPE_U4      | mdtBaseType ),  
  1390.     mdtBaseType_I8             = ( ELEMENT_TYPE_I8      | mdtBaseType ),  
  1391.     mdtBaseType_U8             = ( ELEMENT_TYPE_U8      | mdtBaseType ),  
  1392.     mdtBaseType_R4             = ( ELEMENT_TYPE_R4      | mdtBaseType ),  
  1393.     mdtBaseType_R8             = ( ELEMENT_TYPE_R8      | mdtBaseType ),  
  1394.     mdtBaseType_STRING         = ( ELEMENT_TYPE_STRING  | mdtBaseType ),
  1395.     mdtBaseType_I              = ( ELEMENT_TYPE_I       | mdtBaseType ),    
  1396.     mdtBaseType_U              = ( ELEMENT_TYPE_U       | mdtBaseType ),    
  1397.     mdtBaseType_R              = ( ELEMENT_TYPE_R       | mdtBaseType ),    
  1398. } CorBaseType;
  1399.  
  1400.  
  1401. typedef CorTypeAttr CorRegTypeAttr;
  1402.  
  1403. //
  1404. // Opaque type for an enumeration handle.
  1405. //
  1406. typedef void *HCORENUM;
  1407.  
  1408.  
  1409. // Note that this must be kept in sync with System.AttributeTargets.
  1410. typedef enum CorAttributeTargets
  1411. {
  1412.     catAssembly      = 0x0001,
  1413.     catModule        = 0x0002,
  1414.     catClass         = 0x0004,
  1415.     catStruct        = 0x0008,
  1416.     catEnum          = 0x0010,
  1417.     catConstructor   = 0x0020,
  1418.     catMethod        = 0x0040,
  1419.     catProperty      = 0x0080,
  1420.     catField         = 0x0100,
  1421.     catEvent         = 0x0200,
  1422.     catInterface     = 0x0400,
  1423.     catParameter     = 0x0800,
  1424.     catDelegate      = 0x1000,
  1425.  
  1426.     catAll           = catAssembly | catModule | catClass | catStruct | catEnum | catConstructor | 
  1427.                     catMethod | catProperty | catField | catEvent | catInterface | catParameter | catDelegate,
  1428.     catClassMembers  = catClass | catStruct | catEnum | catConstructor | catMethod | catProperty | catField | catEvent | catDelegate | catInterface,
  1429.     
  1430. } CorAttributeTargets;
  1431.  
  1432. //
  1433. // Some well-known custom attributes 
  1434. //
  1435. #ifndef MACROS_NOT_SUPPORTED
  1436.  
  1437.  #ifndef IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS
  1438.   #define IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS (IMAGE_CEE_CS_CALLCONV_DEFAULT | IMAGE_CEE_CS_CALLCONV_HASTHIS)
  1439.  #endif
  1440.  
  1441. #define INTEROP_DISPID_TYPE_W                   L"System.Runtime.InteropServices.DispIdAttribute"
  1442. #define INTEROP_DISPID_TYPE                     "System.Runtime.InteropServices.DispIdAttribute"
  1443. #define INTEROP_DISPID_SIG                      {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I4}
  1444.  
  1445. #define INTEROP_INTERFACETYPE_TYPE_W            L"System.Runtime.InteropServices.InterfaceTypeAttribute"
  1446. #define INTEROP_INTERFACETYPE_TYPE              "System.Runtime.InteropServices.InterfaceTypeAttribute"
  1447. #define INTEROP_INTERFACETYPE_SIG               {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
  1448.  
  1449. #define INTEROP_HASDEFAULTIFACE_TYPE_W          L"System.Runtime.InteropServices.HasDefaultInterfaceAttribute"
  1450. #define INTEROP_HASDEFAULTIFACE_TYPE            "System.Runtime.InteropServices.HasDefaultInterfaceAttribute"
  1451. #define INTEROP_HASDEFAULTIFACE_SIG             {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1452.  
  1453. #define INTEROP_COMVISIBLE_TYPE_W               L"System.Runtime.InteropServices.ComVisibleAttribute"
  1454. #define INTEROP_COMVISIBLE_TYPE                 "System.Runtime.InteropServices.ComVisibleAttribute"
  1455. #define INTEROP_COMVISIBLE_SIG                  {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_BOOLEAN}
  1456.  
  1457. #define INTEROP_NOCOMREGISTRATION_TYPE_W        L"System.Runtime.InteropServices.NoComRegistrationAttribute"
  1458. #define INTEROP_NOCOMREGISTRATION_TYPE          "System.Runtime.InteropServices.NoComRegistrationAttribute"
  1459. #define INTEROP_NOCOMREGISTRATION_SIG           {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1460.  
  1461. #define INTEROP_COMREGISTERFUNCTION_TYPE_W      L"System.Runtime.InteropServices.ComRegisterFunctionAttribute"
  1462. #define INTEROP_COMREGISTERFUNCTION_TYPE        "System.Runtime.InteropServices.ComRegisterFunctionAttribute"
  1463. #define INTEROP_COMREGISTERFUNCTION_SIG         {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1464.  
  1465. #define INTEROP_COMUNREGISTERFUNCTION_TYPE_W    L"System.Runtime.InteropServices.ComUnregisterFunctionAttribute"
  1466. #define INTEROP_COMUNREGISTERFUNCTION_TYPE      "System.Runtime.InteropServices.ComUnregisterFunctionAttribute"
  1467. #define INTEROP_COMUNREGISTERFUNCTION_SIG       {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1468.  
  1469. #define INTEROP_IMPORTEDFROMTYPELIB_TYPE_W      L"System.Runtime.InteropServices.ImportedFromTypeLibAttribute"
  1470. #define INTEROP_IMPORTEDFROMTYPELIB_TYPE        "System.Runtime.InteropServices.ImportedFromTypeLibAttribute"
  1471. #define INTEROP_IMPORTEDFROMTYPELIB_SIG         {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1472.  
  1473. #define INTEROP_NOIDISPATCH_TYPE_W              L"System.Runtime.InteropServices.NoIDispatchAttribute"
  1474. #define INTEROP_NOIDISPATCH_TYPE                "System.Runtime.InteropServices.NoIDispatchAttribute"
  1475. #define INTEROP_NOIDISPATCH_SIG                 {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1476.  
  1477. #define INTEROP_IDISPATCHIMPL_TYPE_W            L"System.Runtime.InteropServices.IDispatchImplAttribute"
  1478. #define INTEROP_IDISPATCHIMPL_TYPE              "System.Runtime.InteropServices.IDispatchImplAttribute"
  1479. #define INTEROP_IDISPATCHIMPL_SIG               {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
  1480.  
  1481. #define INTEROP_COMSOURCEINTERFACES_TYPE_W      L"System.Runtime.InteropServices.ComSourceInterfacesAttribute"
  1482. #define INTEROP_COMSOURCEINTERFACES_TYPE        "System.Runtime.InteropServices.ComSourceInterfacesAttribute"
  1483. #define INTEROP_COMSOURCEINTERFACES_SIG         {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
  1484.  
  1485. #define INTEROP_COMCONVERSIONLOSS_TYPE_W        L"System.Runtime.InteropServices.ComConversionLossAttribute"
  1486. #define INTEROP_COMCONVERSIONLOSS_TYPE          "System.Runtime.InteropServices.ComConversionLossAttribute"
  1487. #define INTEROP_COMCONVERSIONLOSS_SIG           {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1488.  
  1489. //@todo: remove this definition, also from BCL
  1490. #define INTEROP_GLOBALOBJECT_TYPE_W             L"System.Runtime.InteropServices.GlobalObjectAttribute"
  1491. #define INTEROP_GLOBALOBJECT_TYPE               "System.Runtime.InteropServices.GlobalObjectAttribute"
  1492. #define INTEROP_GLOBALOBJECT_SIG                {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1493.  
  1494. //@todo: remove this definition, also from BCL
  1495. #define INTEROP_PREDECLARED_TYPE_W              L"System.Runtime.InteropServices.PredeclaredAttribute"
  1496. #define INTEROP_PREDECLARED_TYPE                "System.Runtime.InteropServices.PredeclaredAttribute"
  1497. #define INTEROP_PREDECLARED_SIG                 {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1498.  
  1499. #define INTEROP_TYPELIBTYPE_TYPE_W              L"System.Runtime.InteropServices.TypeLibTypeAttribute"
  1500. #define INTEROP_TYPELIBTYPE_TYPE                "System.Runtime.InteropServices.TypeLibTypeAttribute"
  1501. #define INTEROP_TYPELIBTYPE_SIG                 {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
  1502.  
  1503. #define INTEROP_TYPELIBFUNC_TYPE_W              L"System.Runtime.InteropServices.TypeLibFuncAttribute"
  1504. #define INTEROP_TYPELIBFUNC_TYPE                "System.Runtime.InteropServices.TypeLibFuncAttribute"
  1505. #define INTEROP_TYPELIBFUNC_SIG                 {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
  1506.  
  1507. #define INTEROP_TYPELIBVAR_TYPE_W               L"System.Runtime.InteropServices.TypeLibVarAttribute"
  1508. #define INTEROP_TYPELIBVAR_TYPE                 "System.Runtime.InteropServices.TypeLibVarAttribute"
  1509. #define INTEROP_TYPELIBVAR_SIG                  {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
  1510.  
  1511. #define INTEROP_MARSHALAS_TYPE_W                L"System.Runtime.InteropServices.MarshalAsAttribute"
  1512. #define INTEROP_MARSHALAS_TYPE                  "System.Runtime.InteropServices.MarshalAsAttribute"
  1513. #define INTEROP_MARSHALAS_SIG                   {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
  1514.  
  1515. #define INTEROP_COMIMPORT_TYPE_W                L"System.Runtime.InteropServices.ComImportAttribute"
  1516. #define INTEROP_COMIMPORT_TYPE                  "System.Runtime.InteropServices.ComImportAttribute"
  1517. #define INTEROP_COMIMPORT_SIG                   {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1518.  
  1519. #define INTEROP_GUID_TYPE_W                     L"System.Runtime.InteropServices.GuidAttribute"
  1520. #define INTEROP_GUID_TYPE                       "System.Runtime.InteropServices.GuidAttribute"
  1521. #define INTEROP_GUID_SIG                        {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
  1522.  
  1523. #define INTEROP_DEFAULTMEMBER_TYPE_W            L"System.Reflection.DefaultMemberAttribute"
  1524. #define INTEROP_DEFAULTMEMBER_TYPE              "System.Reflection.DefaultMemberAttribute"
  1525. #define INTEROP_DEFAULTMEMBER_SIG               {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
  1526.  
  1527. #define INTEROP_COMEMULATE_TYPE_W               L"System.Runtime.InteropServices.ComEmulateAttribute"
  1528. #define INTEROP_COMEMULATE_TYPE                 "System.Runtime.InteropServices.ComEmulateAttribute"
  1529. #define INTEROP_COMEMULATE_SIG                  {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
  1530.  
  1531. #define INTEROP_EXPOSEHRESULT_TYPE_W            L"System.Runtime.InteropServices.ExposeHResultAttribute"
  1532. #define INTEROP_EXPOSEHRESULT_TYPE              "System.Runtime.InteropServices.ExposeHResultAttribute"
  1533. #define INTEROP_EXPOSEHRESULT_SIG               {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_BOOLEAN}
  1534.  
  1535. #define INTEROP_PRESERVESIG_TYPE_W              L"System.Runtime.InteropServices.PreserveSigAttribure"
  1536. #define INTEROP_PRESERVESIG_TYPE                "System.Runtime.InteropServices.PreserveSigAttribure"
  1537. #define INTEROP_PRESERVESIG_SIG                 {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_BOOLEAN}
  1538.  
  1539. #define INTEROP_IN_TYPE_W                       L"System.Runtime.InteropServices.InAttribute"
  1540. #define INTEROP_IN_TYPE                         "System.Runtime.InteropServices.InAttribute"
  1541. #define INTEROP_IN_SIG                          {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1542.  
  1543. #define INTEROP_OUT_TYPE_W                      L"System.Runtime.InteropServices.OutAttribute"
  1544. #define INTEROP_OUT_TYPE                        "System.Runtime.InteropServices.OutAttribute"
  1545. #define INTEROP_OUT_SIG                         {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1546.  
  1547. #define INTEROP_COMALIASNAME_TYPE_W             L"System.Runtime.InteropServices.ComAliasNameAttribute"
  1548. #define INTEROP_COMALIASNAME_TYPE               "System.Runtime.InteropServices.ComAliasNameAttribute"
  1549. #define INTEROP_COMALIASNAME_SIG                {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
  1550.  
  1551. #define INTEROP_PARAMARRAY_TYPE_W               L"System.ParamArrayAttribute"
  1552. #define INTEROP_PARAMARRAY_TYPE                 "System.ParamArrayAttribute"
  1553. #define INTEROP_PARAMARRAY_SIG                  {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
  1554.  
  1555. #define CMOD_CALLCONV_NAMESPACE                 "System.Runtime.InteropServices"
  1556. #define CMOD_CALLCONV_NAME_CDECL                "CallConvCdecl"
  1557. #define CMOD_CALLCONV_NAME_STDCALL              "CallConvStdcall"
  1558. #define CMOD_CALLCONV_NAME_THISCALL             "CallConvThiscall"
  1559. #define CMOD_CALLCONV_NAME_FASTCALL             "CallConvFastcall"
  1560.  
  1561. #endif // MACROS_NOT_SUPPORTED
  1562.  
  1563. //
  1564. // GetSaveSize accuracy
  1565. //
  1566. #ifndef _CORSAVESIZE_DEFINED_
  1567. #define _CORSAVESIZE_DEFINED_
  1568. typedef enum CorSaveSize
  1569. {
  1570.     cssAccurate             = 0x0000,               // Find exact save size, accurate but slower.
  1571.     cssQuick                = 0x0001,               // Estimate save size, may pad estimate, but faster.
  1572.     cssDiscardTransientCAs  = 0x0002,               // remove all of the CAs of discardable types
  1573. } CorSaveSize;
  1574. #endif
  1575.  
  1576. typedef unsigned __int64 CLASSVERSION;
  1577.  
  1578. #define COR_IS_METHOD_MANAGED_IL(flags)         ((flags & 0xf) == (miIL | miManaged))   
  1579. #define COR_IS_METHOD_MANAGED_OPTIL(flags)      ((flags & 0xf) == (miOPTIL | miManaged))    
  1580. #define COR_IS_METHOD_MANAGED_NATIVE(flags)     ((flags & 0xf) == (miNative | miManaged))   
  1581. #define COR_IS_METHOD_UNMANAGED_NATIVE(flags)   ((flags & 0xf) == (miNative | miUnmanaged)) 
  1582. #define COR_IS_METHOD_IAT(flags)                (flags & miIAT) 
  1583.  
  1584.  
  1585. //
  1586. // Opaque types for security properties and values.
  1587. //
  1588. typedef void  *  PSECURITY_PROPS ;
  1589. typedef void  *  PSECURITY_VALUE ;
  1590. typedef void ** PPSECURITY_PROPS ;
  1591. typedef void ** PPSECURITY_VALUE ;
  1592.  
  1593.  
  1594. #endif // __CORHDR_H__
  1595.  
  1596.