bool LoadSegment(NeSegment seg, LoadedImage loadedImage, ImageMap imageMap) { Array.Copy( RawImage, (uint)seg.DataOffset << this.cbFileAlignmentShift, loadedImage.Bytes, seg.LinearAddress - (int)loadedImage.BaseAddress.ToLinear(), seg.DataLength); var x = seg.Address.ToLinear(); AccessMode access = (seg.Flags & 1) != 0 ? AccessMode.ReadWrite : AccessMode.ReadExecute; imageMap.AddSegment( seg.Address, seg.Address.Selector.Value.ToString("X4"), access, seg.DataLength); var rdr = new LeImageReader( RawImage, seg.DataLength + ((uint)seg.DataOffset << this.cbFileAlignmentShift)); int count = rdr.ReadLeInt16(); return(ApplyRelocations(rdr, count, seg)); }
private bool LoadSegment(NeSegment neSeg, ByteMemoryArea mem) { Array.Copy( RawImage, (uint)neSeg.DataOffset << this.cbFileAlignmentShift, mem.Bytes, neSeg.LinearAddress - (int)mem.BaseAddress.ToLinear(), neSeg.DataLength); AccessMode access = (neSeg.Flags & 1) != 0 ? AccessMode.ReadWrite : AccessMode.ReadExecute; var seg = this.segmentMap.AddSegment( mem, neSeg.Address.Selector.Value.ToString("X4"), access); var stg = new TemporaryStorage( string.Format("seg{0:X4}", seg.Address.Selector.Value), 0, PrimitiveType.SegmentSelector); seg.Identifier = new Identifier(seg.Name, stg.DataType, stg); if ((neSeg.Flags & NE_STFLAGS_RELOCATIONS) == 0) { return(true); } var rdr = new LeImageReader( RawImage, neSeg.DataLength + ((uint)neSeg.DataOffset << this.cbFileAlignmentShift)); int count = rdr.ReadLeInt16(); return(ApplyRelocations(rdr, count, neSeg)); }
bool LoadSegment(NeSegment seg, MemoryArea mem, SegmentMap imageMap) { Array.Copy( RawImage, (uint)seg.DataOffset << this.cbFileAlignmentShift, mem.Bytes, seg.LinearAddress - (int)mem.BaseAddress.ToLinear(), seg.DataLength); var x = seg.Address.ToLinear(); AccessMode access = (seg.Flags & 1) != 0 ? AccessMode.ReadWrite : AccessMode.ReadExecute; this.segmentMap.AddSegment( mem, seg.Address.Selector.Value.ToString("X4"), access); if ((seg.Flags & NE_STFLAGS_RELOCATIONS) == 0) { return(true); } var rdr = new LeImageReader( RawImage, seg.DataLength + ((uint)seg.DataOffset << this.cbFileAlignmentShift)); int count = rdr.ReadLeInt16(); return(ApplyRelocations(rdr, count, seg)); }
public string ReadResourceUtf16leString(uint rva) { var rdr = new LeImageReader(imgLoaded, rva); var len = rdr.ReadLeInt16(); var abStr = rdr.ReadBytes(len * 2); return(Encoding.Unicode.GetString(abStr)); }
public Dictionary<int, string> LoadEntryNames(uint offset, Dictionary<int, string> dict) { var rdr = new LeImageReader(RawImage, offset); for (;;) { var cChar = rdr.ReadByte(); if (cChar == 0) break; var abName = rdr.ReadBytes(cChar); var name = Encoding.ASCII.GetString(abName); int ordinal = rdr.ReadLeInt16(); dict[ordinal] = name; } return dict; }
public bool ReadDirectorySector(LeImageReader rdr, List <ArchiveDirectoryEntry> entries) { byte nextDirTrack = 0; byte nextDirSector = 0; for (int i = 0; i < 8; ++i) { if (i == 0) { nextDirTrack = rdr.ReadByte(); nextDirSector = rdr.ReadByte(); } else { rdr.Seek(2); } var fileType = (FileType)rdr.ReadByte(); var fileTrack = rdr.ReadByte(); var fileSector = rdr.ReadByte(); var sName = Encoding.ASCII.GetString(rdr.ReadBytes(16)) .TrimEnd((char)0xA0); var relTrack = rdr.ReadByte(); var relSector = rdr.ReadByte(); var rel = rdr.ReadByte(); rdr.Seek(6); var sectorSize = rdr.ReadLeInt16(); if ((fileType & FileType.FileTypeMask) != FileType.DEL) { entries.Add(new D64FileEntry( sName, RawImage, SectorOffset(fileTrack, fileSector), fileType)); } } if (nextDirTrack != 0) { rdr.Offset = (uint)SectorOffset(nextDirTrack, nextDirSector); return(true); } else { return(false); } }
public Dictionary <int, string> LoadEntryNames() { var rdr = new LeImageReader(RawImage, this.lfaNew + this.offResidentNameTable); var dict = new Dictionary <int, string>(); for (;;) { var cChar = rdr.ReadByte(); if (cChar == 0) { break; } var abName = rdr.ReadBytes(cChar); var name = Encoding.ASCII.GetString(abName); int ordinal = rdr.ReadLeInt16(); dict[ordinal] = name; } return(dict); }