Example #1
0
        public void VisitDataRef(DataRef field)
        {
            SeekToOffset(field.Offset);
            StructureValueCollection values = StructureReader.ReadStructure(_reader, _dataRefLayout);

            var  length  = (int)values.GetInteger("size");
            uint pointer = values.GetInteger("pointer");

            if (length > 0 && _cache.MetaArea.ContainsBlockPointer(pointer, length))
            {
                field.DataAddress = pointer;
                field.Length      = length;

                // Go to position
                if (_type == LoadType.Memory)
                {
                    _reader.SeekTo(pointer);
                }
                else
                {
                    _reader.SeekTo(_cache.MetaArea.PointerToOffset(pointer));
                }

                switch (field.Format)
                {
                default:
                    byte[] data = _reader.ReadBlock(field.Length);
                    field.Value = FunctionHelpers.BytesToHexLines(data, 27);
                    break;

                case "unicode":
                    field.Value = _reader.ReadUTF16(field.Length);
                    break;

                case "asciiz":
                    field.Value = _reader.ReadAscii(field.Length);
                    break;
                }
            }
            else
            {
                field.DataAddress = 0;
                field.Length      = 0;
                field.Value       = "";
            }
        }
Example #2
0
 public void VisitRawData(RawData field)
 {
     SeekToOffset(field.Offset);
     field.DataAddress = field.FieldAddress;
     field.Value       = FunctionHelpers.BytesToHexLines(_reader.ReadBlock(field.Length), 27);
 }