using System;
using System.Text;
using System.Runtime.InteropServices;
namespace AnticipatingMinds.PlatformServices.UnmanagedReflection{
/// <summary>Interface returned when IID_IMetaDataImport is passed to OpenScope and friends</summary>
[ComImport,GuidAttribute("7DAC8207-D3AE-4c75-9B67-92801A497D44"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMetaDataImport
{
// IMPORTANT: Order of methods in this interface is SIGNIFICANT
/// <summary>Close an enumeration of elements in the metadata</summary>
/// <param name="hEnum">An enumeration handle returned from one of the EnumXXXX methods</param>
void CloseEnum(uint hEnum);
/// <summary>Count the number of items available in an enumerations</summary>
/// <param name="hEnum">An enumeration handle returned from one of the EnumXXXX methods</param>
/// <param name="count">An output parameter which is filled with the item count</param>
/// <returns>The HRESULT from the COM method</returns>
uint CountEnum(uint hEnum, out int count);
/// <summary>Reset an enumeration to a specific position</summary>
/// <param name="hEnum">An enumeration handle returned from one of the EnumXXXX methods</param>
/// <param name="ulPos">The item position to reset to</param>
/// <returns>The HRESULT from the COM method</returns>
uint ResetEnum(uint hEnum,uint ulPos);
/// <summary>Tokens representing typedefs from an enumeration of typedefs in the metadata scope</summary>
/// <example>
/// <code>
/// int hEnum=0;
/// int[] toks=new int[5];
/// int enumCount;
/// try {
/// impScope.EnumTypeDefs(ref hEnum,toks,toks.Length,out enumCount);
/// char[] nameBuffer=new char[2048];
/// int nameLen=0;
/// int superType=0;
/// int typeFlags=0;
/// int global=0;
/// while(enumCount>0) {
/// for(int I=0;I<enumCount;I++) {
/// Console.Error.Write(toks[I].ToString("X8"));
/// impScope.GetTypeDefProps(toks[I],nameBuffer,nameBuffer.Length,out nameLen,out typeFlags,out superType);
/// impScope.IsGlobal(toks[I],out global);
/// Console.Error.WriteLine(" "+new String(nameBuffer,0,nameLen)+" "+typeFlags.ToString("X8")+" "+superType.ToString("X8")+" "+global);
/// }
///
/// impScope.EnumTypeDefs(ref hEnum,toks,toks.Length,out enumCount);
/// }
/// }
/// finally {
/// if(hEnum!=0) impScope.CloseEnum(hEnum);
/// }
/// </code>
/// </example>
/// <param name="phEnum">Output parameter which will be populated with the enum handle or which represents the enum handle to continue enumerating from</param>
/// <param name="rTypeDefs">An array into which the typedefs are returned</param>
/// <param name="cMax">Maximum number of items to return, size of the <paramref name="rTypeDefs"/> array. Use CountEnum to size this.</param>
/// <param name="pcTypeDefs">Actual number of items to returned in the <paramref name="rTypeDefs"/> array</param>
/// <returns>The HRESULT from the COM method</returns>
/// <seealso cref="EnumInterfaceImpls"/>
/// <seealso cref="EnumTypeRefs"/>
uint EnumTypeDefs(ref uint phEnum, [MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rTypeDefs, int cMax, out int pcTypeDefs);
/// <summary>Tokens representing interface implementations from an enumeration in the metadata scope</summary>
/// <example><see cref="EnumTypeDefs"/></example>
/// <param name="phEnum">Output parameter which will be populated with the enum handle or which represents the enum handle to continue enumerating from</param>
/// <param name="rTypeDefs">An array into which the typedefs are returned</param>
/// <param name="cMax">Maximum number of items to return, size of the <paramref name="rTypeDefs"/> array. Use CountEnum to size this.</param>
/// <param name="pcTypeDefs">Actual number of items to returned in the <paramref name="rTypeDefs"/> array</param>
/// <returns>The HRESULT from the COM method</returns>
/// <seealso cref="EnumTypeRefs"/>
/// <seealso cref="EnumTypeDefs"/>
uint EnumInterfaceImpls(ref uint phEnum, uint tdDef,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rTypeDefs, int cMax, out int pcTypeDefs);
/// <summary>Enumerate tokens represention type references from an enumeration in the metadata scope</summary>
/// <example><see cref="EnumTypeDefs"/></example>
/// <param name="phEnum">Output parameter which will be populated with the enum handle or which represents the enum handle to continue enumerating from</param>
/// <param name="rTypeDefs">An array into which the typedefs are returned</param>
/// <param name="cMax">Maximum number of items to return, size of the <paramref name="rTypeDefs"/> array. Use CountEnum to size this.</param>
/// <param name="pcTypeDefs">Actual number of items to returned in the <paramref name="rTypeDefs"/> array</param>
/// <returns>The HRESULT from the COM method</returns>
/// <seealso cref="EnumInterfaceImpls"/>
/// <seealso cref="EnumTypeDefs"/>
uint EnumTypeRefs(ref uint phEnum, [MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rTypeDefs, int cMax, out int pcTypeDefs);
/// <summary>Find a typedef token by the name of the type</summary>
/// <param name="szTypeDef">The name of the type</param>
/// <param name="tkEnclosingClass">The enclosing class for the type or 0 (token_null)</param>
/// <param name="ptd">The output parameter into which the typedef token will be written</param>
/// <returns>The HRESULT from the COM method</returns>
uint FindTypeDefByName([MarshalAs(UnmanagedType.LPWStr)] string szTypeDef,uint tkEnclosingClass,out uint ptd) ;
/// <summary>Get some properties from the scope - these are the module name and the module MVID unique GUID</summary>
/// <param name="szName">Char buffer into which the name is written</param>
/// <param name="cchName">Size of the buffer <paramref name="szName"/></param>
/// <param name="pchName">Output parameter of the number of characters actually written to <paramref name="szName"/></param>
/// <param name="mvid">Guid into which the MVID is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetScopeProps([MarshalAs(UnmanagedType.LPArray,SizeParamIndex=1)] char[] szName,int cchName,out int pchName,ref Guid mvid);
/// <summary>Get the metadata token for the module on which this scope was opened</summary>
/// <param name="pmd">The output parameter into which the module token is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetModuleFromScope(out uint pmd);
/// <summary>Get the name, flags and base class of a typedef (if appropriate)</summary>
/// <param name="td">Token to retrieve the properties from</param>
/// <param name="szTypeDef">Char buffer into which the name will be written</param>
/// <param name="cchTypeDef">Size of the buffer <paramref name="szTypeDef"/></param>
/// <param name="pchTypeDef">Output parameter for the actual number of characters written into the buffer <paramref name="szTypeDef"/></param>
/// <param name="pdwTypeDefFlags">Outpu parameter for the flags from this typedef</param>
/// <param name="ptkExtends">Output parameter for the base type token</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetTypeDefProps(uint td,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szTypeDef,int cchTypeDef,out int pchTypeDef,out uint pdwTypeDefFlags,out uint ptkExtends);
/// <summary>Get the interface implementation details</summary>
/// <param name="iiImpl">Interface implementation instance token from <see cref="EnumInterfaceImpls"/></param>
/// <param name="pClass">Output class token implementing interface</param>
/// <param name="ptkIface">Output interface token implemented by class</param>
/// <returns>The HRESULT from the COM method</returns>
/// <seealso cref="EnumInterfaceImpls"/>
uint GetInterfaceImplProps(uint iiImpl,out uint pClass,out uint ptkIface);
/// <summary>Get the properties from a typeref</summary>
/// <param name="tr">The typeref token to retrieve details from</param>
/// <param name="ptkResolutionScope">Output token for the resolution scope, either a moduleref or an assemblyref</param>
/// <param name="szName">Char buffer into which the name will be written</param>
/// <param name="cchName">Size of the buffer <paramref name="szName"/></param>
/// <param name="pchName">Output parameter for the actual number of characters written into the buffer <paramref name="szName"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint GetTypeRefProps(uint tr,out uint ptkResolutionScope,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,int cchName,out int pchName);
/// <summary>Return the scope and token for a typedef corresponding to a (possibly imported) typeref</summary>
/// <param name="tr">Typeref to resolve</param>
/// <param name="riid">Interface type GUID for the returned interface, normally IID_IMetaDataImport</param>
/// <param name="ppIScope">Output object which may be cast to the interface type specified in <paramref name="riid"/></param>
/// <param name="ptd">Output parameter into which the typedef token in the scope <paramref name="ppIScope"/> is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint ResolveTypeRef(uint tr,ref Guid riid,[MarshalAs(UnmanagedType.Interface)] out object ppIScope, out uint ptd);
/// <summary>Enumerate the members of a type</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMembers(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Enumerate the members of a type which match the specified name</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="szName">Name of the members to enumerate</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMembersWithName(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Enumerate the methods of a type</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMethods(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Enumerate the methods of a type which match the specified name</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="szName">Name of the members to enumerate</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMethodsWithName(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Enumerate the fields of a type</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumFields(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Enumerate the fields of a type which match the specified name</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="szName">Name of the members to enumerate</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumFieldsWithName(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Enumerate the parameters of a methods</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Typedef token to enumerate members from</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumParams(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Retrieve all of the member refs for a specified type within the scope</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="cl">Token to enumerate members from. Use 0 (token_null) for globals</param>
/// <param name="rMembers">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rMembers"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMembers"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMemberRefs(ref uint phEnum,uint cl,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rMembers,int cMax,out int pcTokens);
/// <summary>Retrieve all of the methods implementation details</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="td">Typedef to enumerate methods implementations from</param>
/// <param name="rMethodBody">Array into which the method body tokens are written</param>
/// <param name="rMethodDecl">Array into which the method interface declaration tokens are written</param>
/// <param name="cMax">Size of the arrays <paramref name="rMethodBody"/> and <paramref name="rMethodDecl"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rMethodBody"/> and <paramref name="rMethodDecl"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMethodImpls(ref uint phEnum,uint td,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rMethodBody,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rMethodDecl,int cMax,out int pcTokens);
/// <summary>Retrieve all of the permission sets for a specified type within the scope</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="tk">Token to enumerate members from</param>
/// <param name="dwActions">Mask of actions to return if non-zero</param>
/// <param name="rPermission">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rPermission"/></param>
/// <param name="pcTokens">Output parameter for the actual count of tokens written into <paramref name="rPermission"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumPermissionSets(ref uint phEnum,uint tk,uint dwActions,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rPermission,int cMax,out int pcTokens);
/// <summary>Find a member by name</summary>
/// <param name="td">Typedef to search</param>
/// <param name="szName">Member name</param>
/// <param name="pvSigBlob">Signature blob to filter names by</param>
/// <param name="cbSigBlob">Number of bytes in <paramref name="pvSigBlob"/></param>
/// <param name="pmb">Output parameter for the matched member</param>
/// <returns>The HRESULT from the COM method</returns>
uint FindMember(uint td,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] byte[] pvSigBlob,int cbSigBlob,out uint pmb);
/// <summary>Find a method by name</summary>
/// <param name="td">Typedef to search</param>
/// <param name="szName">Member name</param>
/// <param name="pvSigBlob">Signature blob to filter names by</param>
/// <param name="cbSigBlob">Number of bytes in <paramref name="pvSigBlob"/></param>
/// <param name="pmb">Output parameter for the matched member</param>
/// <returns>The HRESULT from the COM method</returns>
uint FindMethod(uint td,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] byte[] pvSigBlob,int cbSigBlob,out uint pmb);
/// <summary>Find a field by name</summary>
/// <param name="td">Typedef to search</param>
/// <param name="szName">Member name</param>
/// <param name="pvSigBlob">Signature blob to filter names by</param>
/// <param name="cbSigBlob">Number of bytes in <paramref name="pvSigBlob"/></param>
/// <param name="pmb">Output parameter for the matched member</param>
/// <returns>The HRESULT from the COM method</returns>
uint FindField(uint td,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] byte[] pvSigBlob,int cbSigBlob,out uint pmb);
/// <summary>Find a memberref by name</summary>
/// <param name="td">Typedef to search</param>
/// <param name="szName">Member name</param>
/// <param name="pvSigBlob">Signature blob to filter names by</param>
/// <param name="cbSigBlob">Number of bytes in <paramref name="pvSigBlob"/></param>
/// <param name="pmb">Output parameter for the matched member</param>
/// <returns>The HRESULT from the COM method</returns>
uint FindMemberRef(uint td,[MarshalAs(UnmanagedType.LPWStr)] string szName,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] byte[] pvSigBlob,int cbSigBlob,out uint pmb);
/// <summary>Retrieve the method detail for a method token</summary>
/// <param name="mb">The method token to retrieve properties from</param>
/// <param name="pClass">The output parameter for the token representing the class owning this method token</param>
/// <param name="szMethod">Char array into which the method name is written</param>
/// <param name="cchMethod">Size of the array <paramref name="szMethod"/><param>
/// <param name="pchMethod">Actual count written into the array <paramref name="szMethod"/><param>
/// <param name="pdwAttr">Output parameter for the method flags</param>
/// <param name="ppvSigBlob">Output parameters for the native pointer to the signature blob. Retrieve data using System.Marshal.Copy</param>
/// <param name="pcbSigBlob">Output parameter for number of bytes in the signature blob</param>
/// <param name="pulCodeRVA">Output parameter for relative virtual address in the assembly of the method's code</param>
/// <param name="pdwImplFlags">Output parameter for the method implementation flags</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetMethodProps(uint mb,out uint pClass,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szMethod,int cchMethod,out int pchMethod,out uint pdwAttr,out IntPtr ppvSigBlob,out int pcbSigBlob,out uint pulCodeRVA,out uint pdwImplFlags);
/// <summary>Retrieve the member detail for a memberref token</summary>
/// <param name="mr">The memberref token to retrieve properties from</param>
/// <param name="ptk">The output parameter for the token representing the class def or ref owning this member token</param>
/// <param name="szMember">Char array into which the member name is written</param>
/// <param name="cchMember">Size of the array <paramref name="szMember"/><param>
/// <param name="pchMember">Actual count written into the array <paramref name="szMember"/><param>
/// <param name="ppvSigBlob">Output parameters for the native pointer to the signature blob. Retrieve data using System.Marshal.Copy</param>
/// <param name="pcbSigBlob">Output parameter for number of bytes in the signature blob</param>
/// <returns>The HRESULT from the COM member</returns>
uint GetMemberRefProps(uint mr,out uint ptk,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szMember,int cchMember,out int pchMember,out IntPtr ppvSigBlob,out int pbSigBlob);
/// <summary>Enumerate the properties on a type</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="td">Token to enumerate properties from</param>
/// <param name="rProperties">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rProperties"/></param>
/// <param name="pcProperties">Output parameter for the actual count of tokens written into <paramref name="rProperties"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumProperties(ref uint phEnum,uint td,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rProperties,int cMax,out int pcProperties);
/// <summary>Enumerate the events on a type</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="td">Token to enumerate events from</param>
/// <param name="rEvents">Array into which the member tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rEvents"/></param>
/// <param name="pcEvents">Output parameter for the actual count of tokens written into <paramref name="rEvents"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumEvents(ref uint phEnum,uint td,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rEvents,int cMax,out int pcEvents);
/// <summary>Get the detail for an event</summary>
/// <param name="ev">Event token</param>
/// <param name="pClass">Type in which event is defined</param>
/// <param name="szEvent">Char buffer into which event name is written</param>
/// <param name="cchEvent">Buffer size of <paramref name="szEvent"/></param>
/// <param name="pchEvent">Output parameter for the actual number of characters written into <paramref name="szEvent"/></param>
/// <param name="pdwEventFlags">Output parameter for the event flags</param>
/// <param name="ptkEventType">Output parameter for the event typeref token</param>
/// <param name="pmdAddOn">Output parameter for the add method token</param>
/// <param name="pmdRemoveOn">Output parameter for the remove method token</param>
/// <param name="pmdFire">Output parameter for the fire method token</param>
/// <param name="rmdOtherMethod">Array into which other methods tokens associated with this event are written</param>
/// <param name="cMax">Size of the <paramref name="rmdOtherMethod"/> array</param>
/// <param name="pcOtherMethod">Output parameter for the actual count written into the <paramref name="rmdOtherMethod"/> array</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetEventProps(uint ev,out uint pClass,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szEvent,int cchEvent,out int pchEvent,out uint pdwEventFlags,out uint ptkEventType,out uint pmdAddOn,out uint pmdRemoveOn,out uint pmdFire,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=11)] uint[] rmdOtherMethod,int cMax,out int pcOtherMethod);
/// <summary>Return extended method semantics information</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="mb">Methoddef token for method of interest</param>
/// <param name="rEventProp">Array into which event or property with which this method is associated is written</param>
/// <param name="cMax">Size of the <paramref name="rEventProp"/> array</param>
/// <param name="pcEventProp">Output parameter for the actual count written into the <paramref name="rEventProp"/> array</param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumMethodSemantics(ref uint phEnum,uint mb,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] uint[] rEventProp,int cMax,out int pcEventProp);
/// <summary>Return the semantics bits for a method and the event or property with which it is associated</summary>
/// <param name="mb">Method token</param>
/// <param name="tkEventProp">Event or property token</param>
/// <param name="pdwSemanticsFlags">Output parameter of the semantics flags</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetMethodSemantics(uint mb,uint tkEventProp,out uint pdwSemanticsFlags);
/// <summary>Get the class layout (fixed field offsets) for a class</summary>
/// <param name="td">Typedef token for the class</param>
/// <param name="pdwPackSize">Output parameter for packing alignment in bytes</param>
/// <param name="rFieldOffset">Array of long ints into which the field offset information will be written. Each long int is a concatanation of the offset and the token for the field for which the offset is being defined</param>
/// <param name="cMax">Size of the array in <paramref name="rFieldOffset"/></param>
/// <param name="pcFieldOffset">Output parameter for the actual count of fields written into <paramref name="rFieldOffset"/></param>
/// <param name="pulClassSize">Output parameter for total class size</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetClassLayout(uint td,out uint pdwPackSize,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=3)] Int64[] rFieldOffset,int cMax,out int pcFieldOffset,out uint pulClassSize);
/// <summary>Get the field marshalling information</summary>
/// <param name="tk">Token to retrieve marshalling infomation for</param>
/// <param name="ppvNativeType">Output parameter for pointer to native type signature for marshalling</param>
/// <param name="pcbNativeType">Output parameter for the count of bytes for <paramref name="ppvNativeType"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint GetFieldMarshal(uint tk,out IntPtr ppvNativeType,out int pcbNativeType);
/// <summary>Get the Relative Virtual Address for data associated with a token</summary>
/// <param name="tk">Token to retrieve RVA infomation for</param>
/// <param name="pulCodeRVA">Output parameter for the RVA</param>
/// <param name="pdwImplFlags">Output parameter for the implementation flags</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetRVA(uint tk,out uint pulCodeRVA,out int pdwImplFlags);
/// <summary>Get the detail for a permission set</summary>
/// <param name="pm">Permission set token</param>
/// <param name="pdwAction">Output parameter for the action set mask</param>
/// <param name="ppvPermission">Output parameter for the native pointer to the permission blob</param>
/// <param name="pcbPermission">Output parameter for the byte count in <paramref name="ppvPermission"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint GetPermissionSetProps(uint pm,out uint pdwAction,out IntPtr ppvPermission,out int pcbPermission);
/// <summary>Get the signature blob associated with a token</summary>
/// <param name="mdSig">The token to retrieve the signature from</param>
/// <param name="ppvSig">Output parameter for the native pointer to the permission blob</param>
/// <param name="pcbSig">Output parameter for the byte count in <paramref name="ppvSig"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint GetSigFromToken(uint mdSig,out IntPtr ppvSig,out int pcbSig);
/// <summary>Retrive the detail of an imported module</summary>
/// <param name="mur">Module ref token</param>
/// <param name="szName">Char buffer into which the name is written</param>
/// <param name="cchName">Size of the buffer <paramref name="szName"/></param>
/// <param name="pchName">Output parameter of the number of characters actually written to <paramref name="szName"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint GetModuleRefProps(uint mur,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] char[] szName,int cchName,out int pchName);
/// <summary>Enumerate all of the module refs in this scope</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="rModuleRefs">Array into which the module refs are written</param>
/// <param name="cMax">Size of the array <paramref name="rModuleRefs"/></param>
/// <param name="pcModuleRefs">Output parameter for the actual count written into <paramref name="rModuleRefs"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumModuleRefs(ref uint phEnum,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rModuleRefs,int cMax,out int pcModuleRefs);
/// <summary>Get the type signature blob from a typespec token</summary>
/// <param name="typespec">Typespec token</param>
/// <param name="ppvSig">Output parameter for the native pointer to the signature blob</param>
/// <param name="pcbSig">Output parameter for the byte count in <paramref name="ppvSig"/></param>
uint GetTypeSpecFromToken(uint typespec,out IntPtr ppvSig,out int pcbSig);
/// <summary>DEPRECATED: Retrieve name from token</summary>
/// <param name="tk">Token to retrive name from. Must have a name</param>
/// <param name="pszUtf8NamePtr">Ouput parameter to populate with a native pointer to the name in UTF8 format</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetNameFromToken(uint tk,out IntPtr pszUtf8NamePtr);
/// <summary>Enumerate all methods which are not yet resolved</summary>
/// <remarks>See the unmanaged metadata API documentation for details</remarks>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="rMethods">Array into which the method refs are written</param>
/// <param name="cMax">Size of the array <paramref name="rMethods"/></param>
/// <param name="pcTokens">Output parameter for the actual count written into <paramref name="rMethods"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumUnresolvedMethods(ref uint phEnum,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rMethods,int cMax,out int pcTokens);
/// <summary>Get a string from the user heap</summary>
/// <param name="stk">Token for the string</param>
/// <param name="szString">Char array into which the string is written</param>
/// <param name="cchString">Size of the array <paramref name="szString"/></param>
/// <param name="pchString">Output parameter for the actual count of characters written into <paramref name="szString"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint GetUserString(uint stk,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] char[] szString,int cchString,out int pchString);
/// <summary>Get the extended information for a PInvoke method</summary>
/// <param name="tk">PInvoke field or method token</param>
/// <param name="pdwMappingFlags">Output parameter for the mapping flags</param>
/// <param name="szImportName">Char buffer into which the name will be written</param>
/// <param name="cchImportName">Size of the array <paramref name="szImportName"/></param>
/// <param name="pchImportName">Output parameter for the actual count of characters written into <paramref name="szImportName"/></param>
/// <param name="pmrImportDLL">Output parameter into which the token for the imported module is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetPinvokeMap(uint tk,out uint pdwMappingFlags,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szImportName,int cchImportName,out int pchImportName,out uint pmrImportDLL);
/// <summary>Enumerate over all the signatures in the assembly. What a pointless method</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="rSignatures">Array into which signature tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rSignatures"/></param>
/// <param name="pcSignatures">Output parameter for the actual count written into <paramref name="rSignatures"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumSignatures(ref uint phEnum,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rSignatures,int cMax,out int pcSignatures);
/// <summary>Enumerate over all the typespecs in the assembly.</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="rTypeSpecs">Array into which typespec tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rTypeSpecs"/></param>
/// <param name="pcTypeSpecs">Output parameter for the actual count written into <paramref name="rTypeSpecs"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumTypeSpecs(ref uint phEnum,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rTypeSpecs,int cMax,out int pcTypeSpecs);
/// <summary>Enumerate over all the user strings in the assembly.</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="rStrings">Array into which string tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rStrings"/></param>
/// <param name="pcStrings">Output parameter for the actual count written into <paramref name="rStrings"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumUserStrings(ref uint phEnum,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)] uint[] rStrings,int cMax,out int pcStrings);
/// <summary>Get the parameter token for a particular method parameter</summary>
/// <param name="md">Method token</param>
/// <param name="ulParamSeq">Parameter ordinal number</param>
/// <param name="ppd">Output parameter into which parameter token is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetParamForMethodIndex(uint md,int ulParamSeq,out uint ppd);
/// <summary>Enumerate over all the custom attributes in the assembly.</summary>
/// <param name="phEnum">Enumeration handle <see cref="EnumTypeDefs"/></param>
/// <param name="tk">Scope token or 0 (token_null) for all</param>
/// <param name="tkType">Type token or 0 (token_null) for all</param>
/// <param name="rCustomAttributes">Array into which attribute tokens are written</param>
/// <param name="cMax">Size of the array <paramref name="rCustomAttributes"/></param>
/// <param name="pcCustomAttributes">Output parameter for the actual count written into <paramref name="rCustomAttributes"/></param>
/// <returns>The HRESULT from the COM method</returns>
uint EnumCustomAttributes(ref uint phEnum,uint tk,uint tkType,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=4)] uint[] rCustomAttributes,int cMax,out int pcCustomAttributes);
/// <summary>Get the detail for a custom attribute</summary>
/// <param name="cv">Custom attribute token</param>
/// <param name="ptkObj">Object token attribute is associated with</param>
/// <param name="ptkType">Type token attribute is associated with</param>
/// <param name="ppBlob">Output parameter into which native attribute blob pointer is written</param>
/// <param name="pcbSize">Output parameter into which size of attribute blob is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetCustomAttributeProps(uint cv,out uint ptkObj,out uint ptkType,out IntPtr ppBlob,out int pcbSize);
/// <summary>Resolve a type by name</param>
/// <param name="tkResolutionScope">Token defining scope to be searched</param>
/// <param name="szName">Name of type to resolve</param>
/// <param name="ptr">Output parameter into which typeref token is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint FindTypeRef(uint tkResolutionScope,[MarshalAs(UnmanagedType.LPWStr)] string szName,out uint ptr);
/// <summary>Get the detailed properties for a member</summary>
/// <param name="mb">Member token to retrieve detail from</param>
/// <param name="pClass">Output parameter for class token owning member</param>
/// <param name="szMember">Char array into which member name will be written</param>
/// <param name="cchMember">Size of the <paramref name="szMember"/> array</param>
/// <param name="pchMember">Output parameter for the actual number of chars written into <paramref name="szMember"/></param>
/// <param name="pdwAttr">Output parameter for member flags</param>
/// <param name="ppvSigBlob">Output parameters for the native pointer to the signature blob. Retrieve data using System.Marshal.Copy</param>
/// <param name="pcbSigBlob">Output parameter for number of bytes in the signature blob</param>
/// <param name="pulCodeRVA">Output parameter for any associated relative virtual address</param>
/// <param name="pdwImplFlags">Output parameter for implementation flags</param>
/// <param name="pdwCPlusTypeFlag">Output parameter for element type for any associated constant value</param>
/// <param name="ppValue">Output parameter for native pointer to constant value data</param>
/// <param name="pcchValue">Output parameter for string size if constant value is a string</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetMemberProps(uint mb,out uint pClass,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szMember,int cchMember,out int pchMember,out int pdwAttr,out IntPtr ppvSigBlob,out int pcbSigBlob,out uint pulCodeRVA,out uint pdwImplFlags,out uint pdwCPlusTypeFlag,out IntPtr ppValue,out int pcchValue);
/// <summary>Get the detailed properties for a field</summary>
/// <param name="mb">Field token to retrieve detail from</param>
/// <param name="pClass">Output parameter for class token owning field</param>
/// <param name="szField">Char array into which field name will be written</param>
/// <param name="cchField">Size of the <paramref name="szField"/> array</param>
/// <param name="pchField">Output parameter for the actual number of chars written into <paramref name="szField"/></param>
/// <param name="pdwAttr">Output parameter for field flags</param>
/// <param name="ppvSigBlob">Output parameters for the native pointer to the signature blob. Retrieve data using System.Marshal.Copy</param>
/// <param name="pcbSigBlob">Output parameter for number of bytes in the signature blob</param>
/// <param name="pdwCPlusTypeFlag">Output parameter for element type for any associated constant value</param>
/// <param name="ppValue">Output parameter for native pointer to constant value data</param>
/// <param name="pcchValue">Output parameter for string size if constant value is a string</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetFieldProps(uint mb,out uint pClass,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szField,int cchField,out int pchField,out uint pdwAttr,out IntPtr ppvSigBlob,out int pcbSigBlob,out int pdwCPlusTypeFlag,out IntPtr ppValue,out int pcchValue);
/// <summary>Get the detailed properties for a property</summary>
/// <param name="prop">Property token to retrieve detail from</param>
/// <param name="pClass">Output parameter for class token owning property</param>
/// <param name="szProperty">Char array into which property name will be written</param>
/// <param name="cchProperty">Size of the <paramref name="szProperty"/> array</param>
/// <param name="pchProperty">Output parameter for the actual number of chars written into <paramref name="szProperty"/></param>
/// <param name="pdwPropFlags">Output parameter for property flags</param>
/// <param name="ppvSigBlob">Output parameters for the native pointer to the signature blob. Retrieve data using System.Marshal.Copy</param>
/// <param name="pcbSigBlob">Output parameter for number of bytes in the signature blob</param>
/// <param name="pdwCPlusTypeFlag">Output parameter for element type for any associated constant value</param>
/// <param name="ppDefaultValue">Output parameter for native pointer to constant value data</param>
/// <param name="pcchDefaultValue">Output parameter for string size if constant value is a string</param>
/// <param name="pmdSetter">Output parameter for the method token for the setter</param>
/// <param name="pmdGetter">Output parameter for the method token for the getter</param>
/// <param name="rmdOtherMethod">Array into which other methods tokens associated with this property are written</param>
/// <param name="cMax">Size of the <paramref name="rmdOtherMethod"/> array</param>
/// <param name="pcOtherMethod">Output parameter for the actual count written into the <paramref name="rmdOtherMethod"/> array</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetPropertyProps(uint prop, out uint pClass,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szProperty,int cchProperty,out int pchProperty,out uint pdwPropFlags,out IntPtr ppvSigBlob,out int pcbSigBlob,out int pdwCPlusTypeFlag,out IntPtr ppDefaultValue,out int pcchDefaultValue,out uint pmdSetter,out uint pmdGetter,[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=14)] uint[] rmdOtherMethod,int cMax,out int pcOtherMethod);
/// <summary>Get the detail for a parameter</summary>
/// <param name="tk">Parameter token</param>
/// <param name="pmd">Output parameter for the owning method token</param>
/// <param name="pulSequence">Output parameter for the ordinal position of this parameter</param>
/// <param name="szName">Char buffer into which the name is written</param>
/// <param name="cchName">Size of the buffer <paramref name="szName"/></param>
/// <param name="pchName">Output parameter of the number of characters actually written to <paramref name="szName"/></param>
/// <param name="pdwAttr">Output parameter for parameter flags</param>
/// <param name="pdwCPlusTypeFlag">Output parameter for element type for any associated constant value</param>
/// <param name="ppValue">Output parameter for native pointer to constant value data</param>
/// <param name="pcchValue">Output parameter for string size if constant value is a string</param>
uint GetParamProps(uint tk,out int pmd,out int pulSequence,[MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,int cchName,out int pchName,out uint pdwAttr,out uint pdwCPlusTypeFlag,out IntPtr ppValue,out int pcchValue);
/// <summary>Retrieve a custom attribute by type name</summary>
/// <param name="tkObj">Object token to which the attribute is attached</param>
/// <param name="szName">Name of the attribute to retrive</param>
/// <param name="ppData">Output parameter into which native pointer to custom attribute data will be written</param>
/// <param name="pcbData">Output parameter into which size of attribute data will be written</param>
uint GetCustomAttributeByName( // S_OK or error.
uint tkObj, // [IN] Object with Custom Attribute.
[MarshalAs(UnmanagedType.LPWStr)]string szName, // [IN] Name of desired Custom Attribute.
out IntPtr ppData, // [OUT] Put pointer to data here.
out int pcbData); // [OUT] Put size of data here.
/// <summary>Determine if a token is valid</summary>
/// <param name="tk">Token to test for validity</param>
/// <returns>A bool which is true if the token is valid</param>
bool IsValidToken(uint tk);
/// <summary>Get the containing class for a nested class</summary>
/// <param name="tdNestedClass">Token for the nested class</param>
/// <param name="ptdEnclosingClass">Output parameter into which the token for the enclosing class is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetNestedClassProps(uint tdNestedClass,out uint ptdEnclosingClass);
/// <summary>Decode the native calling convention from a signature</summary>
/// <param name="pvSig">A native pointer to the signature blob</param>
/// <param name="cbSig">Count of bytes in the signature</param>
/// <param name="pCallConv">Output parameter into which the calling convention is written</param>
/// <returns>The HRESULT from the COM method</returns>
uint GetNativeCallConvFromSig(IntPtr pvSig,int cbSig,out uint pCallConv);
/// <summary>Test a token to see if it is global</summary>
/// <param name="pd">Token to test</param>
/// <param name="pbGlobal">Output parameters which is 1 if global or zero if now</param>
/// <returns>The HRESULT from the COM method</returns>
uint IsGlobal(uint pd,out uint pbGlobal);
}
}
|