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()); } }
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); }
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); } }
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(); }
public byte* FetchData(int offsetInResourceData, int size, PEBuffer buff) { return buff.Fetch(m_dataFileOffset + offsetInResourceData, size); }
internal byte* FetchRVA(int rva, int size, PEBuffer buffer) { return buffer.Fetch(Header.RvaToFileOffset(rva), size); }
public byte *FetchData(int offsetInResourceData, int size, PEBuffer buff) { return(buff.Fetch(m_dataFileOffset + offsetInResourceData, size)); }
internal byte *FetchRVA(int rva, int size, PEBuffer buffer) { return(buffer.Fetch(Header.RvaToFileOffset(rva), size)); }