Пример #1
0
        public uint GetTypeDefProps(uint td, IntPtr szTypeDef, uint cchTypeDef, out uint pchTypeDef, IntPtr pdwTypeDefFlags)
        {
            CILAssemblyManipulator.API.CILType cilType;
            Int32 retVal;

            if (this._eArgs.MetadataInfo.TryGetTypeDefinitionForToken((Int32)td, out cilType))
            {
                pchTypeDef = PDBHelper.WriteStringUnmanaged(szTypeDef, cchTypeDef, cilType.Name);
                PDBHelper.WriteInt32Unmanaged(pdwTypeDefFlags, (Int32)cilType.Attributes);
                this._eArgs.MetadataInfo.TryGetTokenForTypeDefinition(cilType.BaseType, out retVal);
            }
            else
            {
                Marshal.WriteInt16(szTypeDef, 0);
                pchTypeDef = 1;
                retVal     = 0;
            }
            return((UInt32)retVal);
        }
Пример #2
0
        public uint GetMethodProps(uint mb, out uint pClass, IntPtr szMethod, uint cchMethod, out uint pchMethod, IntPtr pdwAttr, IntPtr ppvSigBlob, IntPtr pcbSigBlob, IntPtr pulCodeRVA)
        {
            CILAssemblyManipulator.API.CILMethodBase method;
            Int32 retVal;

            if (this._eArgs.MetadataInfo.TryGetMethodDefinitionForToken((Int32)mb, out method))
            {
                this._eArgs.MetadataInfo.TryGetTokenForTypeDefinition(method.DeclaringType, out retVal);
                pClass    = (UInt32)retVal;
                pchMethod = PDBHelper.WriteStringUnmanaged(szMethod, cchMethod, method.GetName());
                PDBHelper.WriteInt32Unmanaged(pdwAttr, (Int32)method.Attributes);
                PDBHelper.WriteInt32Unmanaged(pulCodeRVA, this._eArgs.MetadataInfo.MethodRVAs[method]);
                retVal = (Int32)method.ImplementationAttributes;
            }
            else
            {
                Marshal.WriteInt16(szMethod, 0);
                pchMethod = 1;
                pClass    = 0;
                retVal    = 0;
            }
            return((UInt32)retVal);
        }