Ejemplo n.º 1
0
        public PEFile(string filePath)
        {
            m_stream = File.OpenRead(filePath);
            m_headerBuff = new PEBuffer(m_stream);

            Header = new PEHeader(m_headerBuff.Fetch(0, 512));
            // We did not read in the complete header, Try again using the right sized buffer.  
            if (Header.Size > m_headerBuff.Length)
                Header = new PEHeader(m_headerBuff.Fetch(0, Header.Size));

            if (Header.Size > m_headerBuff.Length)
                throw new InvalidOperationException("Bad PE Header in " + filePath);
        }
Ejemplo n.º 2
0
        public PEFile(string filePath)
        {
            m_stream     = File.OpenRead(filePath);
            m_headerBuff = new PEBuffer(m_stream);

            Header = new PEHeader(m_headerBuff.Fetch(0, 512));
            // We did not read in the complete header, Try again using the right sized buffer.
            if (Header.Size > m_headerBuff.Length)
            {
                Header = new PEHeader(m_headerBuff.Fetch(0, Header.Size));
            }

            if (Header.Size > m_headerBuff.Length)
            {
                throw new InvalidOperationException("Bad PE Header in " + filePath);
            }
        }