예제 #1
0
            public FieldMarshalEntry(PEFile module, byte *ptr, int metadataOffset, int row)
            {
                this.module   = module;
                this.metadata = module.Metadata;
                this.RID      = row;
                var rowOffset = metadata.GetTableMetadataOffset(TableIndex.FieldMarshal)
                                + metadata.GetTableRowSize(TableIndex.FieldMarshal) * (row - 1);

                this.Offset = metadataOffset + rowOffset;
                int hasFieldMarshalRefSize = metadata.ComputeCodedTokenSize(32768, TableMask.Field | TableMask.Param);
                int blobHeapSize           = metadata.GetHeapSize(HeapIndex.Blob) < ushort.MaxValue ? 2 : 4;

                this.fieldMarshal = new FieldMarshal(ptr + rowOffset, blobHeapSize, hasFieldMarshalRefSize);
            }
예제 #2
0
            public unsafe ImplMapEntry(PEFile module, byte *ptr, int metadataOffset, int row)
            {
                this.module   = module;
                this.metadata = module.Metadata;
                this.RID      = row;
                var rowOffset = metadata.GetTableMetadataOffset(TableIndex.ImplMap)
                                + metadata.GetTableRowSize(TableIndex.ImplMap) * (row - 1);

                this.Offset = metadataOffset + rowOffset;
                int moduleRefSize             = metadata.GetTableRowCount(TableIndex.ModuleRef) < ushort.MaxValue ? 2 : 4;
                int memberForwardedTagRefSize = metadata.ComputeCodedTokenSize(32768, TableMask.MethodDef | TableMask.Field);
                int stringHandleSize          = metadata.GetHeapSize(HeapIndex.String) < ushort.MaxValue ? 2 : 4;

                this.implMap = new ImplMap(ptr + rowOffset, moduleRefSize, memberForwardedTagRefSize, stringHandleSize);
            }
예제 #3
0
            public InterfaceImplEntry(PEFile module, byte *ptr, int metadataOffset, int row)
            {
                this.module   = module;
                this.metadata = module.Metadata;
                this.RID      = row;
                var rowOffset = metadata.GetTableMetadataOffset(TableIndex.InterfaceImpl)
                                + metadata.GetTableRowSize(TableIndex.InterfaceImpl) * (row - 1);

                this.Offset        = metadataOffset + rowOffset;
                this.interfaceImpl = new InterfaceImpl(ptr + rowOffset, metadata.GetTableRowCount(TableIndex.TypeDef) < ushort.MaxValue ? 2 : 4, metadata.ComputeCodedTokenSize(16384, TableMask.TypeDef | TableMask.TypeRef | TableMask.TypeSpec));
            }