예제 #1
0
 internal GenericParameter(GenericParameterRow *pRow, PEFile peFile, IGenericParameterScope parent) :
     base(TypeKind.GenericParameter)
 {
     m_pRow   = (GenericParameterRow *)FluentAsserts.CheckNotNull((void *)pRow, "pRow");
     m_peFile = peFile.CheckNotNull("peFile");
     m_parent = parent.CheckNotNull("parent");
 }
예제 #2
0
 internal GenericParameter(GenericParameterRow * pRow, PEFile peFile, IGenericParameterScope parent)
     : base(TypeKind.GenericParameter)
 {
     m_pRow = (GenericParameterRow *)FluentAsserts.CheckNotNull((void*) pRow, "pRow");
     m_peFile = peFile.CheckNotNull("peFile");
     m_parent = parent.CheckNotNull("parent");
 }
예제 #3
0
파일: Module.cs 프로젝트: scottwis/tiny
 private Module(Assembly assembly, ModuleRow* moduleRow, PEFile peFile)
 {
     m_lockObject = new object();
     m_assembly = assembly.CheckNotNull("assembly");
     m_pModuleRow = (ModuleRow *)FluentAsserts.CheckNotNull((void *)moduleRow, "moduleRow");
     m_peFile = peFile.CheckNotNull("peFile");
     m_containsMetadata = true;
 }
예제 #4
0
        internal unsafe MethodImplementation(MethodImplRow* pRow, PEFile peFile)
        {
            FluentAsserts.CheckNotNull((void *)pRow, "pRow");
            peFile.CheckNotNull("peFile");

            m_implementedMethod = new MethodReference(pRow->GetImplementedMethod(peFile));
            m_implementingMethod = new MethodReference(pRow->GetImplementingMethod(peFile));
        }
예제 #5
0
 private Module(Assembly assembly, ModuleRow *moduleRow, PEFile peFile)
 {
     m_lockObject       = new object();
     m_assembly         = assembly.CheckNotNull("assembly");
     m_pModuleRow       = (ModuleRow *)FluentAsserts.CheckNotNull((void *)moduleRow, "moduleRow");
     m_peFile           = peFile.CheckNotNull("peFile");
     m_containsMetadata = true;
 }
예제 #6
0
        internal unsafe MethodImplementation(MethodImplRow *pRow, PEFile peFile)
        {
            FluentAsserts.CheckNotNull((void *)pRow, "pRow");
            peFile.CheckNotNull("peFile");

            m_implementedMethod  = new MethodReference(pRow->GetImplementedMethod(peFile));
            m_implementingMethod = new MethodReference(pRow->GetImplementingMethod(peFile));
        }
 public OneBasedIndex GetOwner(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (GenericParameterConstraintRow* pThis = &this) {
         if (MetadataTable.GenericParam.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(ushort*) pThis);
         }
         return new OneBasedIndex(*(uint*) pThis);
     }
 }
예제 #8
0
파일: FieldRow.cs 프로젝트: scottwis/tiny
 public uint GetNameOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (FieldRow * pThis = &this) {
         if (StreamID.Strings.IndexSize(peFile) == 2) {
             return *(ushort*) pThis;
         }
         return *(uint*) pThis;
     }
 }
예제 #9
0
 public OneBasedIndex GetParent(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (EventMapRow * pThis = &this) {
         if (MetadataTable.TypeDef.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(ushort*) pThis);
         }
         return new OneBasedIndex(*(uint*) pThis);
     }
 }
예제 #10
0
 public OneBasedIndex GetFieldIndex(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (FieldLayoutRow * pThis = &this) {
         byte* pField = (byte *)pThis + 4;
         if (MetadataTable.Field.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(ushort *)pField);
         }
         return new OneBasedIndex(*(uint*) pField);
     }
 }
예제 #11
0
 public uint GetNameOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (GenericParameterRow* pThis = &this) {
         var pOwner = (byte*) pThis + 4 + CodedIndex.TypeOrMethodDef.IndexSize(peFile);
         if (StreamID.Strings.IndexSize(peFile) == 2) {
             return *(ushort*) pOwner;
         }
         return *(uint*) pOwner;
     }
 }
예제 #12
0
 public MethodDefOrRef GetImplementingMethod(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (MethodImplRow* pThis = &this) {
         var pImplementingMethod = (byte*) pThis + MetadataTable.TypeDef.IndexSize(peFile);
         if (CodedIndex.MethodDefOrRef.IndexSize(peFile) == 2) {
             return new MethodDefOrRef(new OneBasedIndex(*(ushort*) pImplementingMethod));
         }
         return new MethodDefOrRef(new OneBasedIndex(*(uint*) pImplementingMethod));
     }
 }
예제 #13
0
 public uint GetTypeSignatureOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (PropertyRow * pThis = & this) {
         var pType = (byte*) pThis + 2 + StreamID.Strings.IndexSize(peFile);
         if (StreamID.Blob.IndexSize(peFile) == 2) {
             return *(ushort*) pType;
         }
         return *(uint*) pType;
     }
 }
예제 #14
0
파일: ModuleRow.cs 프로젝트: scottwis/tiny
 public uint GetMvidOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (ModuleRow* pThis = &this) {
         var pMvid = (byte*) pThis + 2 + StreamID.Strings.IndexSize(peFile);
         if (StreamID.Guid.IndexSize(peFile) == 2) {
             return *(ushort*) pMvid;
         }
         return *(uint*) pMvid;
     }
 }
예제 #15
0
파일: ModuleRow.cs 프로젝트: scottwis/tiny
 public uint GetEncBaseId(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (ModuleRow* pThis = &this) {
         var pBaseId = (byte*) pThis + 2 + StreamID.Strings.IndexSize(peFile) + StreamID.Guid.IndexSize(peFile)*2;
         if (StreamID.Guid.IndexSize(peFile) == 2) {
             return *(ushort*) pBaseId;
         }
         return *(uint*) pBaseId;
     }
 }
예제 #16
0
 public uint GetSignatureOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (MethodDefRow * pThis = &this) {
         var pSignature = (byte *)pThis + 8 + StreamID.Strings.IndexSize(peFile);
         if (StreamID.Blob.IndexSize(peFile) == 2) {
             return *(ushort *)(pSignature);
         }
         return *(uint *)pSignature;
     }
 }
예제 #17
0
 public uint GetNativeTypeOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (FieldMarshalRow * pThis = &this) {
         var pNativeType = (byte*) pThis + CodedIndex.HasFieldMarshal.IndexSize(peFile);
         if (StreamID.Blob.IndexSize(peFile) == 2) {
             return *(ushort*) pNativeType;
         }
         return *(uint*) pNativeType;
     }
 }
예제 #18
0
 public OneBasedIndex GetEventListIndex(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (EventMapRow* pThis = &this) {
         var pEventList = (byte*) pThis + MetadataTable.TypeDef.IndexSize(peFile);
         if (MetadataTable.Event.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(ushort*) pEventList);
         }
         return new OneBasedIndex(*(uint*)pEventList);
     }
 }
예제 #19
0
 public OneBasedIndex GetEnclosingClass(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (NestedClassRow* pThis = &this) {
         var pEnclosingClass = (byte*) pThis + MetadataTable.TypeDef.IndexSize(peFile);
         if (MetadataTable.TypeDef.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(ushort*) pEnclosingClass);
         }
         return new OneBasedIndex(*(uint*) pEnclosingClass);
     }
 }
예제 #20
0
 public uint GetCultureOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (AssemblyRow* pThis = &this) {
         var pCulture = (byte*) pThis + 16 + StreamID.Blob.IndexSize(peFile) + StreamID.Strings.IndexSize(peFile);
         if (StreamID.Strings.IndexSize(peFile) == 2) {
             return *(ushort*) pCulture;
         }
         return *(uint*) pCulture;
     }
 }
예제 #21
0
 public uint GetNameOffset(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (MethodDefRow * pThis = &this) {
         var pName = (byte *)pThis +8;
         if (StreamID.Strings.IndexSize(peFile) == 2) {
             return *(ushort *)pName;
         }
         return *(uint *)pName;
     }
 }
예제 #22
0
        public uint GetNameIndex(PEFile peFile)
        {
            peFile.CheckNotNull("peFile");

            fixed(PropertyRow * pThis = &this) {
                var pName = (byte*) pThis + 2;
                if (StreamID.Strings.IndexSize(peFile) == 2) {
                    return *(ushort*) pName;
                }
                return *(uint*) pName;
            }
        }
예제 #23
0
 internal ModuleCollection(Assembly assembly, PEFile mainFile)
 {
     try {
         m_assembly     = assembly.CheckNotNull("assembly");
         m_mainFile     = mainFile.CheckNotNull("mainFile");
         m_otherModules = new object[MetadataTable.File.RowCount(m_mainFile)];
         m_lockObject   = new object();
     }
     catch {
         Dispose();
         throw;
     }
 }
예제 #24
0
 public HasCustomAttribute GetParent(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (CustomAttributeRow * pThis = &this) {
         uint index;
         if (CodedIndex.HasCustomAttribute.IndexSize(peFile) == 2) {
             index = *(ushort*) pThis;
         }
         else {
             index = *(uint*) pThis;
         }
         return new HasCustomAttribute(new OneBasedIndex(index));
     }
 }
예제 #25
0
 public HasFieldMarshal GetParent(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (FieldMarshalRow* pThis = &this) {
         uint index;
         if (CodedIndex.HasFieldMarshal.IndexSize(peFile) == 2) {
             index = *(ushort*) pThis;
         }
         else {
             index = *(uint*) pThis;
         }
         return new HasFieldMarshal(new OneBasedIndex(index));
     }
 }
예제 #26
0
 public TypeDefOrRef GetConstraint(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (GenericParameterConstraintRow* pThis = &this) {
         var pConstraint = (byte*) pThis + MetadataTable.GenericParam.IndexSize(peFile);
         uint index;
         if (CodedIndex.TypeDefOrRef.IndexSize(peFile) == 2) {
             index = *(ushort*) pConstraint;
         }
         else {
             index = *(uint*) pConstraint;
         }
         return new TypeDefOrRef(new OneBasedIndex(index));
     }
 }
예제 #27
0
파일: TypeDefRow.cs 프로젝트: scottwis/tiny
 public TypeDefOrRef GetExtendsToken(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (TypeDefRow* pThis = &this) {
         var pExtends = checked((byte*) pThis + 4 + 2*StreamID.Strings.IndexSize(peFile));
         uint index;
         if (CodedIndex.TypeDefOrRef.IndexSize(peFile) == 2) {
             index = *(ushort*) pExtends;
         }
         else {
             index = *(uint*) pExtends;
         }
         return new TypeDefOrRef(new OneBasedIndex(index));
     }
 }
예제 #28
0
파일: EventRow.cs 프로젝트: scottwis/tiny
 public TypeDefOrRef GetEventType(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (EventRow * pThis = &this) {
         var pType = (byte*) pThis + 2 + StreamID.Strings.IndexSize(peFile);
         uint index;
         if (CodedIndex.TypeDefOrRef.IndexSize(peFile) == 2) {
             index = *(ushort*) pType;
         }
         else {
             index = *(uint*) pType;
         }
         return new TypeDefOrRef(new OneBasedIndex(index));
     }
 }
예제 #29
0
        public uint GetValueOffset(PEFile peFile)
        {
            peFile.CheckNotNull("peFile");
            fixed (CustomAttributeRow * pThis = &this) {
                var pValue =
                    (byte*)pThis
                    + CodedIndex.HasCustomAttribute.IndexSize(peFile)
                    + CodedIndex.CustomAttributeConstructor.IndexSize(peFile);

                if (StreamID.Blob.IndexSize(peFile) == 2) {
                    return *(ushort*) pValue;
                }
                return *(uint*) pValue;
            }
        }
예제 #30
0
 public CustomAttributeConstructor GetConstructor(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (CustomAttributeRow * pThis = &this) {
         var pConstructor = (byte*) pThis + CodedIndex.HasCustomAttribute.IndexSize(peFile);
         uint index;
         if (CodedIndex.CustomAttributeConstructor.IndexSize(peFile) == 2) {
             index = *(ushort*) pConstructor;
         }
         else {
             index = *(uint*) pConstructor;
         }
         return new CustomAttributeConstructor(new OneBasedIndex(index));
     }
 }
예제 #31
0
 public OneBasedIndex GetParamListIndex(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (MethodDefRow * pThis = &this) {
         var pParamList =
             (byte *)pThis
             + 8
             + StreamID.Strings.IndexSize(peFile)
             + StreamID.Blob.IndexSize(peFile);
         if (MetadataTable.MethodDef.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(uint *)pParamList);
         }
         return new OneBasedIndex(*(ushort *)pParamList);
     }
 }
예제 #32
0
 public TypeOrMethodDef GetOwner(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (GenericParameterRow* pThis = &this) {
         var pOwner = (byte*) pThis + 4;
         uint index;
         if (CodedIndex.TypeOrMethodDef.IndexSize(peFile) == 2) {
             index = *(ushort*) pOwner;
         }
         else {
             index = *(uint*) pOwner;
         }
         return new TypeOrMethodDef(new OneBasedIndex(index));
     }
 }
예제 #33
0
파일: TypeDefRow.cs 프로젝트: scottwis/tiny
 public OneBasedIndex GetMethodListToken(PEFile peFile)
 {
     peFile.CheckNotNull("peFile");
     fixed (TypeDefRow* pThis = &this) {
         var pFieldList = checked(
             (byte*) pThis
             + 4
             + 2*StreamID.Strings.IndexSize(peFile)
             + CodedIndex.TypeDefOrRef.IndexSize(peFile)
         );
         if (MetadataTable.MethodDef.IndexSize(peFile) == 2) {
             return new OneBasedIndex(*(ushort*) pFieldList);
         }
         return new OneBasedIndex(*(uint*) pFieldList);
     }
 }
예제 #34
0
파일: StreamID.cs 프로젝트: dbremner/tiny
 public static uint IndexSize(this StreamID id, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetHeapIndexSize(id));
 }
예제 #35
0
 public unsafe static ZeroBasedIndex Find <T>(this MetadataTable table, T value, UnsafeSelector <T> selector, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").Find(table, value, selector));
 }
예제 #36
0
 public static uint IndexSize(this MetadataTable table, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetTableIndexSize(table));
 }
예제 #37
0
 public static int RowCount(this MetadataTable table, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetRowCount(table));
 }
예제 #38
0
 public static unsafe void *GetRow(this MetadataTable table, ZeroBasedIndex index, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetRow(index, table));
 }
예제 #39
0
 public unsafe static ZeroBasedIndex RowIndex(this MetadataTable table, void *pRow, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetRowIndex(table, pRow));
 }
예제 #40
0
 public static uint IndexSize(this CodedIndex type, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetCodedIndexSize(type));
 }
예제 #41
0
파일: StreamID.cs 프로젝트: scottwis/tiny
 public static uint IndexSize(this StreamID id, PEFile peFile)
 {
     return peFile.CheckNotNull("peFile").GetHeapIndexSize(id);
 }
예제 #42
0
 internal CustomAttribute(CustomAttributeRow *pRow, PEFile peFile)
 {
     m_pRow   = (CustomAttributeRow *)FluentAsserts.CheckNotNull((void *)pRow, "pRow");
     m_peFile = peFile.CheckNotNull("peFile");
 }