Пример #1
0
        public ushort ReadLeUInt16()
        {
            ushort u = LoadedImage.ReadLeUInt16(bytes, off);

            off += 2;
            return(u);
        }
Пример #2
0
 public short PeekLeInt16(uint offset)
 {
     return((short)LoadedImage.ReadLeUInt16(bytes, offset + (uint)off));
 }
Пример #3
0
        // Unpacks the relocation entries in a LzExe 0.91 binary
        private ImageMap Relocate91(byte [] abUncompressed, ushort segReloc, LoadedImage pgmImgNew, RelocationDictionary relocations)
        {
            const int CompressedRelocationTableAddress = 0x0158;
            int ifile = lzHdrOffset + CompressedRelocationTableAddress;

            int rel_off=0;
            for (;;)
            {
                ushort span = abUncompressed[ifile++];
                if (span == 0)
                {
                    span = abUncompressed[ifile++];
                    span |= (ushort) (abUncompressed[ifile++] << 8);
                    if (span == 0)
                    {
                        rel_off += 0x0FFF0;
                        continue;
                    }
                    else if (span == 1)
                    {
                        break;
                    }
                }

                rel_off += span;
                ushort seg = (ushort) (pgmImgNew.ReadLeUInt16((uint)rel_off) + segReloc);
                pgmImgNew.WriteLeUInt16((uint)rel_off, seg);
                relocations.AddSegmentReference((uint)rel_off, seg);
                imageMap.AddSegment(Address.SegPtr(seg, 0), seg.ToString("X4"), AccessMode.ReadWriteExecute, 0);
            }
            return imageMap;
        }