示例#1
0
        private void AssertEqual(float fExpected, string bytes)
        {
            var mem     = BytePattern.FromHexBytes(bytes).ToArray();
            var uFloat  = MemoryArea.ReadLeUInt32(mem, 0);
            var mbf     = new MBFFloat32(uFloat);
            var fActual = mbf.ToSingle(null);

            Assert.AreEqual(fExpected, fActual, 1e-30);
        }
示例#2
0
        /// <summary>
        /// Attempt to load the linear file address of the new header.
        /// </summary>
        /// <remarks>
        /// Windows will happily load PE executables even if e_lfaRelocations is
        /// 0. So we fall back to first making sure we can read the lfanew field, and then
        /// make sure it doesn't point outside the image.
        /// </remarks>
        public uint?LoadLfaToNewHeader()
        {
            if (RawImage.Length < e_lfanewOffset + 4)
            {
                return(null);
            }

            uint e_lfanew = MemoryArea.ReadLeUInt32(base.RawImage, e_lfanewOffset);

            if (e_lfanew == 0 || e_lfanew + 4 >= RawImage.Length)
            {
                return(null);
            }
            return(e_lfanew);
        }
示例#3
0
        protected override Address GetMainFunctionAddress(IProcessorArchitecture arch, MemoryArea mem, int offset, StartPattern sPattern)
        {
            var uAddr = mem.ReadLeUInt32((uint)(offset + sPattern.MainAddressOffset));

            return(Address.Ptr64(uAddr));
        }