using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
namespace ClrDebug
{
///
/// Provides methods for importing and manipulating existing metadata from a portable executable (PE) file or other source, such as a type library or a stand-alone, run-time metadata binary.
///
///
/// The design of the interface is intended primarily to be used by tools and services that will be
/// importing type information (for example, development tools) or managing deployed components (for example, resolution/activation
/// services). The methods in fall into the following task categories:
///
#if !NETSTANDARD
[System.Runtime.InteropServices.Marshalling.GeneratedComInterfaceAttribute]
#endif
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("7DAC8207-D3AE-4C75-9B67-92801A497D44")]
public partial interface IMetaDataImport
{
///
/// Closes the enumerator that is identified by the specified handle.
///
/// [in] The handle for the enumerator to close.
///
/// The handle specified by hEnum is obtained from a previous EnumName call (for example, ).
///
[PreserveSig]
void CloseEnum(
[In] IntPtr hEnum);
///
/// Gets the number of elements in the enumeration that was retrieved by the specified enumerator.
///
/// [in] The handle for the enumerator.
/// [out] The number of elements enumerated.
///
/// The handle specified by hEnum is obtained from a previous EnumName call (for example, ).
///
[PreserveSig]
HRESULT CountEnum(
[In] IntPtr hEnum,
[Out] out int pulCount);
///
/// Resets the specified enumerator to the specified position.
///
/// [in] The enumerator to reset.
/// [in] The new position at which to place the enumerator.
[PreserveSig]
HRESULT ResetEnum(
[In] IntPtr hEnum,
[In] int ulPos);
///
/// Enumerates TypeDef tokens representing all types within the current scope.
///
/// [out] A pointer to the new enumerator. This must be NULL for the first call of this method.
/// [in] The array used to store the TypeDef tokens.
/// [in] The maximum size of the rTypeDefs array.
/// [out] The number of TypeDef tokens returned in rTypeDefs.
///
/// | HRESULT | Description |
/// | ------- | ------------------------------------------------------------------- |
/// | S_OK | EnumTypeDefs returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTypeDefs is zero. |
///
///
/// The TypeDef token represents a type such as a class or an interface, as well as any type added via an extensibility
/// mechanism.
///
[PreserveSig]
HRESULT EnumTypeDefs(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdTypeDef[] typeDefs,
[In] int cMax,
[Out] out int pcTypeDefs);
///
/// Enumerates all interfaces implemented by the specified TypeDef.
///
/// [in, out] A pointer to the enumerator.
/// [in] The token of the TypeDef whose MethodDef tokens representing interface implementations are to be enumerated.
/// [out] The array used to store the MethodDef tokens.
/// [in] The maximum length of the rImpls array.
/// [out] The actual number of tokens returned in rImpls.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------------------- |
/// | S_OK | EnumInterfaceImpls returned successfully. |
/// | S_FALSE | There are no MethodDef tokens to enumerate. In that case, pcImpls is set to zero. |
///
///
/// The enumeration returns a collection of tokens for each interface implemented by the specified
/// TypeDef. Interface tokens are returned in the order the interfaces were specified (through DefineTypeDef or SetTypeDefProps).
/// Properties of the returned tokens can be queried using .
///
[PreserveSig]
HRESULT EnumInterfaceImpls(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef td,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdInterfaceImpl[] rImpls,
[In] int cMax,
[Out] out int pcImpls);
///
/// Enumerates TypeRef tokens defined in the current metadata scope.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [out] The array used to store the TypeRef tokens.
/// [in] The maximum size of the rTypeRefs array.
/// [out] A pointer to the number of TypeRef tokens returned in rTypeRefs.
///
/// | HRESULT | Description |
/// | ------- | ------------------------------------------------------------------- |
/// | S_OK | EnumTypeRefs returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTypeRefs is zero. |
///
///
/// A TypeRef token represents a reference to a type.
///
[PreserveSig]
HRESULT EnumTypeRefs(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdTypeRef[] rTypeRefs,
[In] int cMax,
[Out] out int pcTypeRefs);
///
/// Gets a pointer to the TypeDef metadata token for the with the specified name.
///
/// [in] The name of the type for which to get the TypeDef token.
/// [in] A TypeDef or TypeRef token representing the enclosing class. If the type to find is not a nested class, set this value to NULL.
/// [out] A pointer to the matching TypeDef token.
[PreserveSig]
HRESULT FindTypeDefByName(
[MarshalAs(UnmanagedType.LPWStr), In] string szTypeDef,
[In] mdToken tkEnclosingClass,
[Out] out mdTypeDef typeDef);
///
/// Gets the name and optionally the version identifier of the assembly or module in the current metadata scope.
///
/// [out] A buffer for the assembly or module name.
/// [in] The size in wide characters of szName.
/// [out] The number of wide characters returned in szName.
/// [out, optional] A pointer to a GUID that uniquely identifies the version of the assembly or module.
///
/// The method is used to set these properties.
///
[PreserveSig]
HRESULT GetScopeProps(
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szName,
[In] int cchName,
[Out] out int pchName,
[Out] out Guid pmvid);
///
/// Gets a metadata token for the module referenced in the current metadata scope.
///
/// [out] A pointer to the token representing the module referenced in the current metadata scope.
[PreserveSig]
HRESULT GetModuleFromScope(
[Out] out mdModule pmd);
///
/// Returns metadata information for the represented by the specified TypeDef token.
///
/// [in] The TypeDef token that represents the type to return metadata for.
/// [out] A buffer containing the type name.
/// [in] The size in wide characters of szTypeDef.
/// [out] The number of wide characters returned in szTypeDef.
/// [out] A pointer to any flags that modify the type definition. This value is a bitmask from the enumeration.
/// [out] A TypeDef or TypeRef metadata token that represents the base type of the requested type.
[PreserveSig]
HRESULT GetTypeDefProps(
[In] mdTypeDef td,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szTypeDef,
[In] int cchTypeDef,
[Out] out int pchTypeDef,
[Out] out CorTypeAttr pdwTypeDefFlags,
[Out] out mdToken ptkExtends);
///
/// Gets a pointer to the metadata tokens for the that implements the specified method, and for the interface that declares that method.
///
/// [in] The metadata token representing the method to return the class and interface tokens for.
/// [out] The metadata token representing the class that implements the method.
/// [out] The metadata token representing the interface that defines the implemented method.
///
/// You obtain the value for iImpl by calling the method. For example, suppose that
/// a class has an token value of 0x02000007 and that it implements three interfaces whose types have tokens:
/// Conceptually, this information is stored into an interface implementation table as: Recall, the token is a 4-byte
/// value: GetInterfaceImplProps returns the information held in the row whose token you provide in the iImpl argument.
///
[PreserveSig]
HRESULT GetInterfaceImplProps(
[In] mdInterfaceImpl iiImpl,
[Out] out mdTypeDef pClass,
[Out] out mdToken ptkIface);
///
/// Gets the metadata associated with the referenced by the specified TypeRef token.
///
/// [in] The TypeRef token that represents the type to return metadata for.
/// [out] A pointer to the scope in which the reference is made. This value is an AssemblyRef or ModuleRef token.
/// [out] A buffer containing the type name.
/// [in] The requested size in wide characters of szName.
/// [out] The returned size in wide characters of szName.
[PreserveSig]
HRESULT GetTypeRefProps(
[In] mdTypeRef tr,
[Out] out mdToken ptkResolutionScope,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
[In] int cchName,
[Out] out int pchName);
///
/// Resolves a reference represented by the specified TypeRef token.
///
/// [in] The TypeRef metadata token to return the referenced type information for.
/// [in] The IID of the interface to return in ppIScope. Typically, this would be IID_IMetaDataImport.
/// [out] An interface to the module scope in which the referenced type is defined.
/// [out] A pointer to a TypeDef token that represents the referenced type.
///
/// The ResolveTypeRef method searches for the type definition in other modules. If the type definition is found, ResolveTypeRef
/// returns an interface to that module scope as well as the TypeDef token for the type. If the type reference to be
/// resolved has a resolution scope of AssemblyRef, the ResolveTypeRef method searches for a match only in the metadata
/// scopes that have already been opened with calls to either the method
/// or the method. This is because ResolveTypeRef cannot determine
/// from only the AssemblyRef scope where on disk or in the global assembly cache the assembly is stored.
///
[Obsolete("This method no longer appears to exist in the IMetaDataImport vtable.")]
[PreserveSig]
HRESULT ResolveTypeRef(
[In] mdTypeRef tr,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
[MarshalAs(UnmanagedType.IUnknown), Out] out object ppIScope,
[Out] out mdTypeDef ptd);
///
/// Enumerates MemberDef tokens representing members of the specified type.
///
/// [in, out] A pointer to the enumerator.
/// [in] A TypeDef token representing the type whose members are to be enumerated.
/// [out] The array used to hold the MemberDef tokens.
/// [in] The maximum size of the rMembers array.
/// [out] The actual number of MemberDef tokens returned in rMembers.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------------- |
/// | S_OK | EnumMembers returned successfully. |
/// | S_FALSE | There are no MemberDef tokens to enumerate. In that case, pcTokens is zero. |
///
///
/// When enumerating collections of members for a class, EnumMembers returns only members (fields and methods, but
/// not properties or events) defined directly on the class. It does not return any members that the class inherits,
/// even if the class provides an implementation for those inherited members. To enumerate inherited members, the caller
/// must explicitly walk the inheritance chain. Note that the rules for the inheritance chain may vary depending on
/// the language or compiler that emitted the original metadata. Properties and events are not enumerated by EnumMembers.
/// To enumerate those, use or .
///
[PreserveSig]
HRESULT EnumMembers(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef cl,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdToken[] rMembers,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates MemberDef tokens representing members of the specified type with the specified name.
///
/// [in, out] A pointer to the enumerator.
/// [in] A TypeDef token representing the type with members to enumerate.
/// [in] The member name that limits the scope of the enumerator.
/// [out] The array used to store the MemberDef tokens.
/// [in] The maximum size of the rMembers array.
/// [out] The actual number of MemberDef tokens returned in rMembers.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------------- |
/// | S_OK | EnumTypeDefs returned successfully. |
/// | S_FALSE | There are no MemberDef tokens to enumerate. In that case, pcTokens is zero. |
///
///
/// This method enumerates fields and methods, but not properties or events. Unlike , EnumMembersWithName
/// discards all field and member tokens that do not have the specified name.
///
[PreserveSig]
HRESULT EnumMembersWithName(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef cl,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdToken[] rMembers,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates MethodDef tokens representing methods of the specified type.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A TypeDef token representing the type with the methods to enumerate.
/// [out] The array to store the MethodDef tokens.
/// [in] The maximum size of the MethodDef rMethods array.
/// [out] The number of MethodDef tokens returned in rMethods.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------------- |
/// | S_OK | EnumMethods returned successfully. |
/// | S_FALSE | There are no MethodDef tokens to enumerate. In that case, pcTokens is zero. |
///
[PreserveSig]
HRESULT EnumMethods(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef cl,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdMethodDef[] rMethods,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates methods that have the specified name and that are defined by the type referenced by the specified TypeDef token.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A TypeDef token representing the type whose methods to enumerate.
/// [in] The name that limits the scope of the enumeration.
/// [out] The array used to store the MethodDef tokens.
/// [in] The maximum size of the rMethods array.
/// [out] The number of MethodDef tokens returned in rMethods.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumMethodsWithName returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTokens is zero. |
///
///
/// This method enumerates fields and methods, but not properties or events. Unlike , EnumMethodsWithName
/// discards all method tokens that do not have the specified name.
///
[PreserveSig]
HRESULT EnumMethodsWithName(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef cl,
[In, MarshalAs(UnmanagedType.LPWStr)] string szName,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdMethodDef[] rMethods,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates FieldDef tokens for the type referenced by the specified TypeDef token.
///
/// [in, out] A pointer to the enumerator.
/// [in] The TypeDef token of the class whose fields are to be enumerated.
/// [out] The list of FieldDef tokens.
/// [in] The maximum size of the rFields array.
/// [out] The actual number of FieldDef tokens returned in rFields.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumFields returned successfully. |
/// | S_FALSE | There are no fields to enumerate. In that case, pcTokens is zero. |
///
[PreserveSig]
HRESULT EnumFields(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef cl,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdFieldDef[] rFields,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates FieldDef tokens of the specified type with the specified name.
///
/// [in, out] A pointer to the enumerator.
/// [in] The token of the type whose fields are to be enumerated.
/// [in] The field name that limits the scope of the enumeration.
/// [out] Array used to store the FieldDef tokens.
/// [in] The maximum size of the rFields array.
/// [out] The actual number of FieldDef tokens returned in rFields.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumFieldsWithName returned successfully. |
/// | S_FALSE | There are no fields to enumerate. In that case, pcTokens is zero. |
///
///
/// Unlike , EnumFieldsWithName discards all field tokens that do not have the specified name.
///
[PreserveSig]
HRESULT EnumFieldsWithName(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef cl,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdFieldDef[] rFields,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates ParamDef tokens representing the parameters of the method referenced by the specified MethodDef token.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A MethodDef token representing the method with the parameters to enumerate.
/// [out] The array used to store the ParamDef tokens.
/// [in] The maximum size of the rParams array.
/// [out] The number of ParamDef tokens returned in rParams.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumParams returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTokens is zero. |
///
[PreserveSig]
HRESULT EnumParams(
[In, Out] ref IntPtr phEnum,
[In] mdMethodDef mb,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdParamDef[] rParams,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates MemberRef tokens representing members of the specified type.
///
/// [in, out] A pointer to the enumerator.
/// [in] A TypeDef, TypeRef, MethodDef, or ModuleRef token for the type whose members are to be enumerated.
/// [out] The array used to store MemberRef tokens.
/// [in] The maximum size of the rMemberRefs array.
/// [out] The actual number of MemberRef tokens returned in rMemberRefs.
///
/// | HRESULT | Description |
/// | ------- | ------------------------------------------------------------------------------ |
/// | S_OK | EnumMemberRefs returned successfully. |
/// | S_FALSE | There are no MemberRef tokens to enumerate. In that case, pcTokens is to zero. |
///
[PreserveSig]
HRESULT EnumMemberRefs(
[In, Out] ref IntPtr phEnum,
[In] mdToken tkParent,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdMemberRef[] rMemberRefs,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates MethodBody and MethodDeclaration tokens representing methods of the specified type.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A TypeDef token for the type whose method implementations to enumerate.
/// [out] The array to store the MethodBody tokens.
/// [out] The array to store the MethodDeclaration tokens.
/// [in] The maximum size of the rMethodBody and rMethodDecl arrays.
/// [in] The actual number of methods returned in rMethodBody and rMethodDecl.
///
/// | HRESULT | Description |
/// | ------- | ------------------------------------------------------------------------ |
/// | S_OK | EnumMethodImpls returned successfully. |
/// | S_FALSE | There are no method tokens to enumerate. In that case, pcTokens is zero. |
///
[PreserveSig]
HRESULT EnumMethodImpls(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef td,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdToken[] rMethodBody,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdToken[] rMethodDecl,
[In] int cMax,
[Out] out int pcTokens);
///
/// Enumerates permissions for the objects in a specified metadata scope.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A metadata token that limits the scope of the search, or NULL to search the widest scope possible.
/// [in] Flags representing the security action values to include in rPermission, or zero to return all actions.
/// [out] The array used to store the Permission tokens.
/// [in] The maximum size of the rPermission array.
/// [out] The number of Permission tokens returned in rPermission.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumPermissionSets returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTokens is zero. |
///
[PreserveSig]
HRESULT EnumPermissionSets(
[In, Out] ref IntPtr phEnum,
[In] mdToken tk,
[In] CorDeclSecurity dwActions,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdPermission[] rPermission,
[In] int cMax,
[Out] out int pcTokens);
///
/// Gets a pointer to the MemberDef token for field or method that is enclosed by the specified and that has the specified name and metadata signature.
///
/// [in] The TypeDef token for the class or interface that encloses the member to search for. If this value is mdTokenNil, the lookup is done for a global-variable or global-function.
/// [in] The name of the member to search for.
/// [in] A pointer to the binary metadata signature of the member.
/// [in] The size in bytes of pvSigBlob.
/// [out] A pointer to the matching MemberDef token.
///
/// You specify the member using its enclosing class or interface (td), its name (szName), and optionally its signature
/// (pvSigBlob). There might be multiple members with the same name in a class or interface. In that case, pass the
/// member's signature to find the unique match. The signature passed to FindMember must have been generated in the
/// current scope, because signatures are bound to a particular scope. A signature can embed a token that identifies
/// the enclosing class or value type. The token is an index into the local TypeDef table. You cannot build a run-time
/// signature outside the context of the current scope and use that signature as input to input to FindMember. FindMember
/// finds only members that were defined directly in the class or interface; it does not find inherited members.
///
[PreserveSig]
HRESULT FindMember(
[In] mdToken td,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[In] IntPtr pvSigBlob,
[In] int cbSigBlob,
[Out] out mdToken pmb);
///
/// Gets a pointer to the MethodDef token for the method that is enclosed by the specified and that has the specified name and metadata signature.
///
/// [in] The token for the type (a class or interface) that encloses the member to search for. If this value is mdTokenNil, then the lookup is done for a global function.
/// [in] The name of the method to search for.
/// [in] A pointer to the binary metadata signature of the method.
/// [in] The size in bytes of pvSigBlob.
/// [out] A pointer to the matching MethodDef token.
///
/// You specify the method using its enclosing class or interface (td), its name (szName), and optionally its signature
/// (pvSigBlob). There might be multiple methods with the same name in a class or interface. In that case, pass the
/// method's signature to find the unique match. The signature passed to FindMethod must have been generated in the
/// current scope, because signatures are bound to a particular scope. A signature can embed a token that identifies
/// the enclosing class or value type. The token is an index into the local TypeDef table. You cannot build a run-time
/// signature outside the context of the current scope and use that signature as input to input to FindMethod. FindMethod
/// finds only methods that were defined directly in the class or interface; it does not find inherited methods.
///
[PreserveSig]
HRESULT FindMethod(
[In] mdToken td,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[In] IntPtr pvSigBlob,
[In] int cbSigBlob,
[Out] out mdMethodDef pmb);
///
/// Gets a pointer to the FieldDef token for the field that is enclosed by the specified and that has the specified name and metadata signature.
///
/// [in] The TypeDef token for the class or interface that encloses the field to search for. If this value is mdTokenNil, the lookup is done for a global variable.
/// [in] The name of the field to search for.
/// [in] A pointer to the binary metadata signature of the field.
/// [in] The size in bytes of pvSigBlob.
/// [out] A pointer to the matching FieldDef token.
///
/// You specify the field using its enclosing class or interface (td), its name (szName), and optionally its signature
/// (pvSigBlob). The signature passed to FindField must have been generated in the current scope, because signatures
/// are bound to a particular scope. A signature can embed a token that identifies the enclosing class or value type.
/// (The token is an index into the local TypeDef table). You cannot build a run-time signature outside the context
/// of the current scope and use that signature as input to FindField. FindField finds only fields that were defined
/// directly in the class or interface; it does not find inherited fields.
///
[PreserveSig]
HRESULT FindField(
[In] mdToken td,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[In] IntPtr pvSigBlob,
[In] int cbSigBlob,
[Out] out mdFieldDef pmb);
///
/// Gets a pointer to the MemberRef token for the member reference that is enclosed by the specified and that has the specified name and metadata signature.
///
/// [in] The TypeRef token for the class or interface that encloses the member reference to search for. If this value is mdTokenNil, the lookup is done for a global variable or a global-function reference.
/// [in] The name of the member reference to search for.
/// [in] A pointer to the binary metadata signature of the member reference.
/// [in] The size in bytes of pvSigBlob.
/// [out] A pointer to the matching MemberRef token.
///
/// You specify the member using its enclosing class or interface (td), its name (szName), and optionally its signature
/// (pvSigBlob). The signature passed to FindMemberRef must have been generated in the current scope, because signatures
/// are bound to a particular scope. A signature can embed a token that identifies the enclosing class or value type.
/// The token is an index into the local TypeDef table. You cannot build a run-time signature outside the context of
/// the current scope and use that signature as input to FindMemberRef. FindMemberRef finds only member references
/// that were defined directly in the class or interface; it does not find inherited member references.
///
[PreserveSig]
HRESULT FindMemberRef(
[In] mdToken td,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[In] IntPtr pvSigBlob,
[In] int cbSigBlob,
[Out] out mdMemberRef pmr);
///
/// Gets the metadata associated with the method referenced by the specified MethodDef token.
///
/// [in] The MethodDef token that represents the method to return metadata for.
/// [out] A Pointer to a TypeDef token that represents the type that implements the method.
/// [out] A Pointer to a buffer that has the method's name.
/// [in] The requested size of szMethod.
/// [out] A Pointer to the size in wide characters of szMethod, or in the case of truncation, the actual number of wide characters in the method name.
/// [out] A pointer to any flags associated with the method.
/// [out] A pointer to the binary metadata signature of the method.
/// [out] A Pointer to the size in bytes of ppvSigBlob.
/// [out] A pointer to the relative virtual address of the method.
/// [out] A pointer to any implementation flags for the method.
[PreserveSig]
HRESULT GetMethodProps(
[In] mdMethodDef mb,
[Out] out mdTypeDef pClass,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szMethod,
[In] int cchMethod,
[Out] out int pchMethod,
[Out] out CorMethodAttr pdwAttr,
[Out] out IntPtr ppvSigBlob,
[Out] out int pcbSigBlob,
[Out] out int pulCodeRVA,
[Out] out CorMethodImpl pdwImplFlags);
///
/// Gets metadata associated with the member referenced by the specified token.
///
/// [in] The MemberRef token to return associated metadata for.
/// [out] A TypeDef or TypeRef, or TypeSpec token that represents the class that declares the member, or a ModuleRef token that represents the module class that declares the member, or a MethodDef that represents the member.
/// [out] A string buffer for the member's name.
/// [in] The requested size in wide characters of szMember.
/// [out] The returned size in wide characters of szMember.
/// [out] A pointer to the binary metadata signature for the member.
/// [out] The size in bytes of ppvSigBlob.
[PreserveSig]
HRESULT GetMemberRefProps(
[In] mdMemberRef mr,
[Out] out mdToken ptk,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szMember,
[In] int cchMember,
[Out] out int pchMember,
[Out] out IntPtr ppvSigBlob,
[Out] out int pbSig);
///
/// Enumerates PropertyDef tokens representing the properties of the type referenced by the specified TypeDef token.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A TypeDef token representing the type with properties to enumerate.
/// [out] The array used to store the PropertyDef tokens.
/// [in] The maximum size of the rProperties array.
/// [out] The number of PropertyDef tokens returned in rProperties.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------- |
/// | S_OK | EnumProperties returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcProperties is zero. |
///
[PreserveSig]
HRESULT EnumProperties(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef td,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdProperty[] rProperties,
[In] int cMax,
[Out] out int pcProperties);
///
/// Enumerates event definition tokens for the specified TypeDef token.
///
/// [in, out] A pointer to the enumerator.
/// [in] The TypeDef token whose event definitions are to be enumerated.
/// [out] The array of returned events.
/// [in] The maximum size of the rEvents array.
/// [out] The actual number of events returned in rEvents.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumEvents returned successfully. |
/// | S_FALSE | There are no events to enumerate. In that case, pcEvents is zero. |
///
[PreserveSig]
HRESULT EnumEvents(
[In, Out] ref IntPtr phEnum,
[In] mdTypeDef td,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdEvent[] rEvents,
[In] int cMax,
[Out] out int pcEvents);
///
/// Gets metadata information for the event represented by the specified event token, including the declaring type, the add and remove methods for delegates, and any flags and other associated data.
///
/// [in] The event metadata token representing the event to get metadata for.
/// [out] A pointer to the TypeDef token representing the class that declares the event.
/// [out] The name of the event referenced by ev.
/// [in] The requested length in wide characters of szEvent.
/// [out] The returned length in wide characters of szEvent.
/// [out] A pointer to the event flags of the event.
/// [out] A pointer to a TypeRef or TypeDef metadata token representing the System.Delegate type of the event.
/// [out] A pointer to the metadata token representing the method that adds handlers for the event.
/// [out] A pointer to the metadata token representing the method that removes handlers for the event.
/// [out] A pointer to the metadata token representing the method that raises the event.
/// [out] An array of token pointers to other methods associated with the event.
/// [in] The maximum size of the rmdOtherMethod array.
/// [out] The number of tokens returned in rmdOtherMethod.
[PreserveSig]
HRESULT GetEventProps(
[In] mdEvent ev,
[Out] out mdTypeDef pClass,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szEvent,
[In] int cchEvent,
[Out] out int pchEvent,
[Out] out CorEventAttr pdwEventFlags,
[Out] out mdToken ptkEventType,
[Out] out mdMethodDef pmdAddOn,
[Out] out mdMethodDef pmdRemoveOn,
[Out] out mdMethodDef pmdFire,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 11)] mdMethodDef[] rmdOtherMethod,
[In] int cMax,
[Out] out int pcOtherMethod);
///
/// Enumerates the properties and the property-change events to which the specified method is related.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [in] A MethodDef token that limits the scope of the enumeration.
/// [out] The array used to store the events or properties.
/// [in] The maximum size of the rEventProp array.
/// [out] The number of events or properties returned in rEventProp.
///
/// | HRESULT | Description |
/// | ------- | ---------------------------------------------------------------------------------- |
/// | S_OK | EnumMethodSemantics returned successfully. |
/// | S_FALSE | There are no events or properties to enumerate. In that case, pcEventProp is zero. |
///
///
/// Many common language runtime types define PropertyChanged events and OnPropertyChanged methods related to their
/// properties. For example, the System.Windows.Forms.Control type defines a System.Windows.Forms.Control.Font property,
/// a System.Windows.Forms.Control.FontChanged event, and an System.Windows.Forms.Control.OnFontChanged method. The
/// set accessor method of the System.Windows.Forms.Control.Font property calls System.Windows.Forms.Control.OnFontChanged
/// method, which in turn raises the System.Windows.Forms.Control.FontChanged event. You would call EnumMethodSemantics
/// using the MethodDef for System.Windows.Forms.Control.OnFontChanged to get references to the System.Windows.Forms.Control.Font
/// property and the System.Windows.Forms.Control.FontChanged event.
///
[PreserveSig]
HRESULT EnumMethodSemantics(
[In, Out] ref IntPtr phEnum,
[In] mdMethodDef mb,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] mdToken[] rEventProp,
[In] int cMax,
[Out] out int pcEventProp);
///
/// Gets flags indicating the relationship between the method referenced by the specified MethodDef token and the paired property and event referenced by the specified EventProp token.
///
/// [in] A MethodDef token representing the method to get the semantic role information for.
/// [in] A token representing the paired property and event for which to get the method's role.
/// [out] A pointer to the associated semantics flags. This value is a bitmask from the enumeration.
///
/// The method sets a method's semantics flags.
///
[PreserveSig]
HRESULT GetMethodSemantics(
[In] mdMethodDef mb,
[In] mdToken tkEventProp,
[Out] out CorMethodSemanticsAttr pdwSemanticsFlags);
///
/// Gets layout information for the class referenced by the specified TypeDef token.
///
/// [in] The TypeDef token for the class with the layout to return.
/// [out] One of the values 1, 2, 4, 8, or 16, representing the pack size of the class.
/// [out] An array of values.
/// [in] The maximum size of the rFieldOffset array.
/// [out] The number of elements returned in rFieldOffset.
/// [out] The size in bytes of the class represented by td.
[PreserveSig]
HRESULT GetClassLayout(
[In] mdTypeDef td,
[Out] out int pdwPackSize,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3), Out] COR_FIELD_OFFSET[] rFieldOffset,
[In] int cMax,
[Out] out int pcFieldOffset,
[Out] out int pulClassSize);
///
/// Gets a pointer to the native, unmanaged type of the field represented by the specified field metadata token.
///
/// [in] The metadata token that represents the field to get interop marshalling information for.
/// [out] A pointer to the metadata signature of the field's native type.
/// [out] The size in bytes of ppvNativeType.
[PreserveSig]
HRESULT GetFieldMarshal(
[In] mdToken tk,
[Out] out IntPtr ppvNativeType,
[Out] out int pcbNativeType);
///
/// Gets the relative virtual address (RVA) and the implementation flags of the method or field represented by the specified token.
///
/// [in] A MethodDef or FieldDef metadata token that represents the code object to return the RVA for. If the token is a FieldDef, the field must be a global variable.
/// [out] A pointer to the relative virtual address of the code object represented by the token.
/// [out] A pointer to the implementation flags for the method. This value is a bitmask from the enumeration.
/// The value of pdwImplFlags is valid only if tk is a MethodDef token.
[PreserveSig]
HRESULT GetRVA(
[In] mdToken tk,
[Out] out int pulCodeRVA,
[Out] out CorMethodImpl pdwImplFlags);
///
/// Gets the metadata associated with the System.Security.PermissionSet represented by the specified Permission token.
///
/// [in] The Permission metadata token that represents the permission set to get the metadata properties for.
/// [out] A pointer to the permission set.
/// [out] A pointer to the binary metadata signature of the permission set.
/// [out] The size in bytes of ppvPermission.
[PreserveSig]
HRESULT GetPermissionSetProps(
[In] mdPermission pm,
[Out] out CorDeclSecurity pdwAction,
[Out] out IntPtr ppvPermission,
[Out] out int pcbPermission);
///
/// Gets the binary metadata signature associated with the specified token.
///
/// [in] The token to return the binary metadata signature for.
/// [out] A pointer to the returned metadata signature.
/// [out] The size in bytes of the binary metadata signature.
[PreserveSig]
HRESULT GetSigFromToken(
[In] mdSignature mdSig,
[Out] out IntPtr ppvSig,
[Out] out int pcbSig);
///
/// Gets the name of the module referenced by the specified metadata token.
///
/// [in] The ModuleRef metadata token that references the module to get metadata information for.
/// [out] A buffer to hold the module name.
/// [in] The requested size of szName in wide characters.
/// [out] The returned size of szName in wide characters.
[PreserveSig]
HRESULT GetModuleRefProps(
[In] mdModuleRef mur,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szName,
[In] int cchName,
[Out] out int pchName);
///
/// Enumerates ModuleRef tokens that represent imported modules.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [out] The array used to store the ModuleRef tokens.
/// [in] The maximum size of the rModuleRefs array.
/// [out] The number of ModuleRef tokens returned in rModuleRefs.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------- |
/// | S_OK | EnumModuleRefs returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcModuleRefs is zero. |
///
[PreserveSig]
HRESULT EnumModuleRefs(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdModuleRef[] rModuleRefs,
[In] int cmax,
[Out] out int pcModuleRefs);
///
/// Gets the binary metadata signature of the type specification represented by the specified token.
///
/// [in] The TypeSpec token associated with the requested metadata signature.
/// [out] A pointer to the binary metadata signature.
/// [out] The size, in bytes, of the metadata signature.
/// An that indicates success or failure. Failures can be tested with the FAILED macro.
[PreserveSig]
HRESULT GetTypeSpecFromToken(
[In] mdTypeSpec typespec,
[Out] out IntPtr ppvSig,
[Out] out int pcbSig);
///
/// Gets the UTF-8 name of the object referenced by the specified metadata token. This method is obsolete.
///
/// [in] The token representing the object to return the name for.
/// [out] A pointer to the UTF-8 object name in the heap.
///
/// GetNameFromToken is obsolete. As an alternative, call a method to get the properties of the particular type of
/// token required, such as GetFieldProps for a field or GetMethodProps for a method.
///
[Obsolete]
[PreserveSig]
HRESULT GetNameFromToken(
[In] mdToken tk,
[Out] out IntPtr pszUtf8NamePtr);
///
/// Enumerates MemberDef tokens representing the unresolved methods in the current metadata scope.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [out] The array used to store the MemberDef tokens.
/// [in] The maximum size of the rMethods array.
/// [out] The number of MemberDef tokens returned in rMethods.
///
/// | HRESULT | Description |
/// | ------- | ----------------------------------------------------------------- |
/// | S_OK | EnumUnresolvedMethods returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTokens is zero. |
///
///
/// An unresolved method is one that has been declared but not implemented. A method is included in the enumeration
/// if the method is marked miForwardRef and either mdPinvokeImpl or miRuntime is set to zero. In other words, an unresolved
/// method is a class method that is marked miForwardRef but which is not implemented in unmanaged code (reached via
/// PInvoke) nor implemented internally by the runtime itself The enumeration excludes all methods that are defined
/// either at module scope (globals) or in interfaces or abstract classes.
///
[PreserveSig]
HRESULT EnumUnresolvedMethods(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdToken[] rMethods,
[In] int cMax,
[Out] out int pcTokens);
///
/// Gets the literal string represented by the specified metadata token.
///
/// [in] The String token to return the associated string for.
/// [out] A copy of the requested string.
/// [in] The maximum size in wide characters of the requested szString.
/// [out] The size in wide characters of the returned szString.
[PreserveSig]
HRESULT GetUserString(
[In] mdString stk,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szString,
[In] int cchString,
[Out] out int pchString);
///
/// Gets a ModuleRef token to represent the target assembly of a PInvoke call.
///
/// [in] A FieldDef or MethodDef token to get the PInvoke mapping metadata for.
/// [out] A pointer to flags used for mapping. This value is a bitmask from the enumeration.
/// [out] The name of the unmanaged target DLL.
/// [in] The size in wide characters of szImportName.
/// [out] The number of wide characters returned in szImportName.
/// [out] A pointer to a ModuleRef token that represents the unmanaged target object library.
[PreserveSig]
HRESULT GetPinvokeMap(
[In] mdToken tk,
[Out] out CorPinvokeMap pdwMappingFlags,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szImportName,
[In] int cchImportName,
[Out] out int pchImportName,
[Out] out mdModuleRef pmrImportDLL);
///
/// Enumerates Signature tokens representing stand-alone signatures in the current scope.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [out] The array used to store the Signature tokens.
/// [in] The maximum size of the rSignatures array.
/// [out] The number of Signature tokens returned in rSignatures.
///
/// | HRESULT | Description |
/// | ------- | --------------------------------------------------------------------- |
/// | S_OK | EnumSignatures returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcSignatures is zero. |
///
///
/// The Signature tokens are created by the method.
///
[PreserveSig]
HRESULT EnumSignatures(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdSignature[] rSignatures,
[In] int cmax,
[Out] out int pcSignatures);
///
/// Enumerates TypeSpec tokens defined in the current metadata scope.
///
/// [in, out] A pointer to the enumerator. This value must be NULL for the first call of this method.
/// [out] The array used to store the TypeSpec tokens.
/// [in] The maximum size of the rTypeSpecs array.
/// [out] The number of TypeSpec tokens returned in rTypeSpecs.
///
/// | HRESULT | Description |
/// | ------- | -------------------------------------------------------------------- |
/// | S_OK | EnumTypeSpecs returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcTypeSpecs is zero. |
///
///
/// The TypeSpec tokens are created by the method.
///
[PreserveSig]
HRESULT EnumTypeSpecs(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdTypeSpec[] rTypeSpecs,
[In] int cmax,
[Out] out int pcTypeSpecs);
///
/// Enumerates String tokens representing hard-coded strings in the current metadata scope.
///
/// [in, out] A pointer to the enumerator. This must be NULL for the first call of this method.
/// [out] The array used to store the String tokens.
/// [in] The maximum size of the rStrings array.
/// [out] The number of String tokens returned in rStrings.
///
/// | HRESULT | Description |
/// | ------- | ------------------------------------------------------------------ |
/// | S_OK | EnumUserStrings returned successfully. |
/// | S_FALSE | There are no tokens to enumerate. In that case, pcStrings is zero. |
///
///
/// The String tokens are created by the method. This method is designed
/// to be used by a metadata browser rather than by a compiler.
///
[PreserveSig]
HRESULT EnumUserStrings(
[In, Out] ref IntPtr phEnum,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] mdString[] rStrings,
[In] int cmax,
[Out] out int pcStrings);
///
/// Gets the token that represents a specified parameter of the method represented by the specified MethodDef token.
///
/// [in] A token that represents the method to return the parameter token for.
/// [in] The ordinal position in the parameter list where the requested parameter occurs. Parameters are numbered starting from one, with the method's return value in position zero.
/// [out] A pointer to a ParamDef token that represents the requested parameter.
[PreserveSig]
HRESULT GetParamForMethodIndex(
[In] mdMethodDef md,
[In] int ulParamSeq,
[Out] out mdParamDef ppd);
///
/// Enumerates custom attribute-definition tokens associated with the specified type or member.
///
/// [in, out] A pointer to the returned enumerator.
/// [in] A token for the scope of the enumeration, or zero for all custom attributes.
/// [in] A token for the constructor of the type of the attributes to be enumerated, or null for all types.
/// [out] An array of custom attribute tokens.
/// [in] The maximum size of the rCustomAttributes array.
/// [out, optional] The actual number of token values returned in rCustomAttributes.
///
/// | HRESULT | Description |
/// | ------- | -------------------------------------------------------------------------------------- |
/// | S_OK | EnumCustomAttributes returned successfully. |
/// | S_FALSE | There are no custom attributes to enumerate. In that case, pcCustomAttributes is zero. |
///
[PreserveSig]
HRESULT EnumCustomAttributes(
[In, Out] ref IntPtr phEnum,
[In] mdToken tk,
[In] mdToken tkType,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] mdCustomAttribute[] rCustomAttributes,
[In] int cMax,
[Out] out int pcCustomAttributes);
///
/// Gets the value of the custom attribute, given its metadata token.
///
/// [in] A metadata token that represents the custom attribute to be retrieved.
/// [out, optional] A metadata token representing the object that the custom attribute modifies. This value can be any type of metadata token except .
/// [out, optional] An or metadata token representing the of the returned custom attribute.
/// [out, optional] A pointer to an array of data that is the value of the custom attribute.
/// [out, optional] The size in bytes of the data returned in *ppBlob.
///
/// A custom attribute is stored as an array of data, the format which is understood by the metadata engine.
///
[PreserveSig]
HRESULT GetCustomAttributeProps(
[In] mdCustomAttribute cv,
[Out] out mdToken ptkObj,
[Out] out mdToken ptkType,
[Out] out IntPtr ppBlob,
[Out] out int pcbSize);
///
/// Gets a pointer to the TypeRef token for the reference that is in the specified scope and that has the specified name.
///
/// [in] A ModuleRef, AssemblyRef, or TypeRef token that specifies the module, assembly, or type, respectively, in which the type reference is defined.
/// [in] The name of the type reference to search for.
/// [out] A pointer to the matching TypeRef token.
[PreserveSig]
HRESULT FindTypeRef(
[In] mdToken tkResolutionScope,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[Out] out mdTypeRef ptr);
///
/// Gets information stored in the metadata for a specified member definition, including the name, binary signature, and relative virtual address, of the member referenced by the specified metadata token.
/// This is a simple helper method: if mb is a MethodDef, then GetMethodProps is called; if mb is a FieldDef, then GetFieldProps is called.
/// See these other methods for details.
///
/// [in] The token that references the member to get the associated metadata for.
/// [out] A pointer to the metadata token that represents the class of the member.
/// [out] The name of the member.
/// [in] The size in wide characters of the szMember buffer.
/// [out] The size in wide characters of the returned name.
/// [out] Any flag values applied to the member. If the member is a this value is a bitwise combination of values. Otherwise, it is a bitwise combination of values.
/// [out] A pointer to the binary metadata signature of the member.
/// [out] The size in bytes of ppvSigBlob.
/// [out] A pointer to the relative virtual address of the member.
/// [out] Any method implementation flags associated with the member. If the member is an these flags are a bitwise combination of values.
/// [out] A flag that marks a . It is one of the ELEMENT_TYPE_* values.
/// [out] A constant string value returned by this member.
/// [out] The size in characters of ppValue, or zero if ppValue does not hold a string.
[PreserveSig]
HRESULT GetMemberProps(
[In] mdToken mb,
[Out] out mdTypeDef pClass,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szMember,
[In] int cchMember,
[Out] out int pchMember,
[Out] out int pdwAttr,
[Out] out IntPtr ppvSigBlob,
[Out] out int pcbSigBlob,
[Out] out int pulCodeRVA,
[Out] out int pdwImplFlags,
[Out] out CorElementType pdwCPlusTypeFlag,
[Out] out IntPtr ppValue,
[Out] out int pcchValue);
///
/// Gets metadata associated with the field referenced by the specified FieldDef token.
///
/// [in] A FieldDef token that represents the field to get associated metadata for.
/// [out] A pointer to a TypeDef token that represents the type of the class that the field belongs to.
/// [out] The name of the field.
/// [in] The size in wide characters of the buffer for szField.
/// [out] The actual size of the returned buffer.
/// [out] Flags associated with the field's metadata.
/// [out] A pointer to the binary metadata value that describes the field.
/// [out] The size in bytes of ppvSigBlob.
/// [out] A flag that specifies the value type of the field.
/// [out] A constant value for the field.
/// [out] The size in chars of ppValue, or zero if no string exists.
[PreserveSig]
HRESULT GetFieldProps(
[In] mdFieldDef mb,
[Out] out mdTypeDef pClass,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szField,
[In] int cchField,
[Out] out int pchField,
[Out] out CorFieldAttr pdwAttr,
[Out] out IntPtr ppvSigBlob,
[Out] out int pcbSigBlob,
[Out] out CorElementType pdwCPlusTypeFlag,
[Out] out IntPtr ppValue,
[Out] out int pcchValue);
///
/// Gets the metadata for the property represented by the specified token.
///
/// [in] A token that represents the property to return metadata for.
/// [out] A pointer to the TypeDef token that represents the type that implements the property.
/// [out] A buffer to hold the property name.
/// [in] The size in wide characters of szProperty.
/// [out] The number of wide characters returned in szProperty.
/// [out] A pointer to any attribute flags applied to the property. This value is a bitmask from the enumeration.
/// [out] A pointer to the metadata signature of the property.
/// [out] The number of bytes returned in ppvSig.
/// [out] A flag specifying the type of the constant that is the default value of the property. This value is from the enumeration.
/// [out] A pointer to the bytes that store the default value for this property.
/// [out] The size in wide characters of ppDefaultValue, if pdwCPlusTypeFlag is ELEMENT_TYPE_STRING; otherwise, this value is not relevant.
/// In that case, the length of ppDefaultValue is inferred from the type that is specified by pdwCPlusTypeFlag.
/// [out] A pointer to the MethodDef token that represents the set accessor method for the property.
/// [out] A pointer to the MethodDef token that represents the get accessor method for the property.
/// [out] An array of MethodDef tokens that represent other methods associated with the property.
/// [in] The maximum size of the rmdOtherMethod array. If you do not provide an array large enough to hold all the methods, they are skipped without warning.
/// [out] The number of MethodDef tokens returned in rmdOtherMethod.
[PreserveSig]
HRESULT GetPropertyProps(
[In] mdProperty prop,
[Out] out mdTypeDef pClass,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szProperty,
[In] int cchProperty,
[Out] out int pchProperty,
[Out] out CorPropertyAttr pdwPropFlags,
[Out] out IntPtr ppvSig,
[Out] out int pbSig,
[Out] out CorElementType pdwCPlusTypeFlag,
[Out] out IntPtr ppDefaultValue,
[Out] out int pcchDefaultValue,
[Out] out mdMethodDef pmdSetter,
[Out] out mdMethodDef pmdGetter,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 14)] mdMethodDef[] rmdOtherMethod,
[In] int cMax,
[Out] out int pcOtherMethod);
///
/// Gets metadata values for the parameter referenced by the specified ParamDef token.
///
/// [in] A ParamDef token that represents the parameter to return metadata for.
/// [out] A pointer to a MethodDef token representing the method that takes the parameter.
/// [out] The ordinal position of the parameter in the method argument list.
/// [out] A buffer to hold the name of the parameter.
/// [in] The requested size in wide characters of szName.
/// [out] The returned size in wide characters of szName.
/// [out] A pointer to any attribute flags associated with the parameter. This is a bitmask of values.
/// [out] A pointer to a flag specifying that the parameter is a .
/// [out] A pointer to a constant string returned by the parameter.
/// [out] The size of ppValue in wide characters, or zero if ppValue does not hold a string.
///
/// The sequence values in pulSequence begin with 1 for parameters. A return value has a sequence number of 0.
///
[PreserveSig]
HRESULT GetParamProps(
[In] mdParamDef tk,
[Out] out mdMethodDef pmd,
[Out] out int pulSequence,
[MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder szName,
[In] int cchName,
[Out] out int pchName,
[Out] out CorParamAttr pdwAttr,
[Out] out CorElementType pdwCPlusTypeFlag,
[Out] out IntPtr ppValue,
[Out] out IntPtr pcchValue);
///
/// Gets the custom attribute, given its name and owner.
///
/// [in] A metadata token representing the object that owns the custom attribute.
/// [in] The name of the custom attribute.
/// [out] A pointer to an array of data that is the value of the custom attribute.
/// [out] The size in bytes of the data returned in *ppData.
///
/// It is legal to define multiple custom attributes for the same owner; they may even have the same name. However,
/// GetCustomAttributeByName returns only one instance. (GetCustomAttributeByName returns the first instance that it
/// encounters.) To find all instances of a custom attribute, call the method.
///
[PreserveSig]
HRESULT GetCustomAttributeByName(
[In] mdToken tkObj,
[MarshalAs(UnmanagedType.LPWStr), In] string szName,
[Out] out IntPtr ppData,
[Out] out int pcbData);
///
/// Gets a value indicating whether the specified token holds a valid reference to a code object.
///
/// [in] The token to check the reference validity for.
/// true if tk is a valid metadata token within the current scope. Otherwise, false.
bool IsValidToken(
[In] mdToken tk);
///
/// Gets the TypeDef token for the parent of the specified nested type.
///
/// [in] A TypeDef token representing the to return the parent class token for.
/// [out] A pointer to the TypeDef token for the that tdNestedClass is nested in.
[PreserveSig]
HRESULT GetNestedClassProps(
[In] mdTypeDef tdNestedClass,
[Out] out mdTypeDef ptdEnclosingClass);
///
/// Gets the native calling convention for the method that is represented by the specified signature pointer.
///
/// [in] A pointer to the metadata signature of the method to return the calling convention for.
/// [in] The size in bytes of pvSig.
/// [out] A pointer to the native calling convention.
[PreserveSig]
HRESULT GetNativeCallConvFromSig(
[In] IntPtr pvSig,
[In] int cbSig,
[Out] out int pCallConv);
///
/// Gets a value indicating whether the field, method, or type represented by the specified metadata token has global scope.
///
/// [in] A metadata token that represents a type, field, or method.
/// [out] 1 if the object has global scope; otherwise, 0 (zero).
[PreserveSig]
HRESULT IsGlobal(
[In] mdToken pd,
[Out] out bool pbGlobal);
}
}