Пример #1
0
        public void ImageResourceDataEntryConstructorWorks_Test()
        {
            var resourceDataEntry = new ImageResourceDataEntry(new BufferFile(RawStructures.RawResourceDataEntry), 2);

            Assert.Equal((uint)0x33221100, resourceDataEntry.OffsetToData);
            Assert.Equal((uint)0x77665544, resourceDataEntry.Size1);
            Assert.Equal(0xbbaa9988, resourceDataEntry.CodePage);
            Assert.Equal(0xffeeddcc, resourceDataEntry.Reserved);
        }
Пример #2
0
            public DataSegment GetDataSegment(ImageResourceDataEntry dataDirectory)
            {
                DataSegment segment;

                if (!_dataMapping.TryGetValue(dataDirectory, out segment))
                {
                    _dataMapping.Add(dataDirectory, segment = new DataSegment(dataDirectory.Data));
                    Segments.Add(segment);
                }
                return(segment);
            }
Пример #3
0
        internal static ImageResourceDataEntry FromReadingContext(ReadingContext context)
        {
            var reader = context.Reader;
            var entry  = new ImageResourceDataEntry
            {
                StartOffset  = reader.Position,
                OffsetToData = reader.ReadUInt32(),
                _size        = reader.ReadUInt32(),
                CodePage     = reader.ReadUInt32(),
                Reserved     = reader.ReadUInt32(),
            };

            entry._dataReaderContext = context.CreateSubContext(context.Assembly.RvaToFileOffset(entry.OffsetToData));

            return(entry);
        }
 public DataSegment GetDataSegment(ImageResourceDataEntry dataDirectory)
 {
     DataSegment segment;
     if (!_dataMapping.TryGetValue(dataDirectory, out segment))
     {
         _dataMapping.Add(dataDirectory, segment = new DataSegment(dataDirectory.Data));
         Segments.Add(segment);
     }
     return segment;
 }
 public void AddDataEntry(ImageResourceDataEntry entry)
 {
     _dataEntries.Add(entry);
     Segments.Add(entry);
 }
Пример #6
0
 public void AddDataEntry(ImageResourceDataEntry entry)
 {
     _dataEntries.Add(entry);
     Segments.Add(entry);
 }
Пример #7
0
        internal static ImageResourceDataEntry FromReadingContext(ReadingContext context)
        {
            var reader = context.Reader;
            var entry = new ImageResourceDataEntry
            {
                StartOffset = reader.Position,
                OffsetToData = reader.ReadUInt32(),
                Size = reader.ReadUInt32(),
                CodePage = reader.ReadUInt32(),
                Reserved = reader.ReadUInt32(),

            };

            entry._dataReaderContext = context.CreateSubContext(context.Assembly.RvaToFileOffset(entry.OffsetToData));

            return entry;
        }