Esempio n. 1
0
 internal unsafe string GetName(PEBuffer buff, int resourceStartFileOffset)
 {
     if (IsStringName)
     {
         int   nameLen = *((ushort *)buff.Fetch(NameOffset + resourceStartFileOffset, 2));
         char *namePtr = (char *)buff.Fetch(NameOffset + resourceStartFileOffset + 2, nameLen);
         return(new string(namePtr));
     }
     else
     {
         return(Id.ToString());
     }
 }
Esempio 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);
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
 internal unsafe string GetName(PEBuffer buff, int resourceStartFileOffset)
 {
     if (IsStringName)
     {
         int nameLen = *((ushort*)buff.Fetch(NameOffset + resourceStartFileOffset, 2));
         char* namePtr = (char*)buff.Fetch(NameOffset + resourceStartFileOffset + 2, nameLen);
         return new string(namePtr);
     }
     else
         return Id.ToString();
 }
Esempio n. 5
0
 public byte* FetchData(int offsetInResourceData, int size, PEBuffer buff)
 {
     return buff.Fetch(m_dataFileOffset + offsetInResourceData, size);
 }
Esempio n. 6
0
 internal byte* FetchRVA(int rva, int size, PEBuffer buffer)
 {
     return buffer.Fetch(Header.RvaToFileOffset(rva), size);
 }
Esempio n. 7
0
 public byte *FetchData(int offsetInResourceData, int size, PEBuffer buff)
 {
     return(buff.Fetch(m_dataFileOffset + offsetInResourceData, size));
 }
Esempio n. 8
0
 internal byte *FetchRVA(int rva, int size, PEBuffer buffer)
 {
     return(buffer.Fetch(Header.RvaToFileOffset(rva), size));
 }