/// <summary> /// Constructor /// </summary> /// <param name="imageStreamCreator">The PE stream creator</param> /// <param name="imageLayout">Image layout</param> /// <param name="verify">Verify PE file data</param> public PEImage(IImageStreamCreator imageStreamCreator, ImageLayout imageLayout, bool verify) { try { this.imageStreamCreator = imageStreamCreator; this.peType = ConvertImageLayout(imageLayout); ResetReader(); this.peInfo = new PEInfo(imageStream, verify); Initialize(); } catch { Dispose(); throw; } }
/// <inheritdoc/> public FileOffset ToFileOffset(PEInfo peInfo, RVA rva) { return (FileOffset)rva; }
/// <inheritdoc/> public RVA ToRVA(PEInfo peInfo, FileOffset offset) { return (RVA)offset; }
/// <inheritdoc/> public FileOffset ToFileOffset(PEInfo peInfo, RVA rva) { return peInfo.ToFileOffset(rva); }
/// <inheritdoc/> public RVA ToRVA(PEInfo peInfo, FileOffset offset) { return peInfo.ToRVA(offset); }
/// <inheritdoc/> public void Dispose() { IDisposable id; if (win32Resources.IsValueInitialized && (id = win32Resources.Value) != null) id.Dispose(); if ((id = imageStream) != null) id.Dispose(); if ((id = imageStreamCreator) != null) id.Dispose(); win32Resources.Value = null; imageStream = null; imageStreamCreator = null; peType = null; peInfo = null; }
/// <inheritdoc/> public void Dispose() { if (win32Resources.IsValueInitialized && win32Resources.Value != null) win32Resources.Value.Dispose(); if (imageStream != null) imageStream.Dispose(); if (imageStreamCreator != null) imageStreamCreator.Dispose(); win32Resources.Value = null; imageStream = null; imageStreamCreator = null; peType = null; peInfo = null; }
/// <inheritdoc/> public FileOffset ToFileOffset(PEInfo peInfo, RVA rva) { return((FileOffset)rva); }
/// <inheritdoc/> public FileOffset ToFileOffset(PEInfo peInfo, RVA rva) { return(peInfo.ToFileOffset(rva)); }
/// <inheritdoc/> public RVA ToRVA(PEInfo peInfo, FileOffset offset) { return((RVA)offset); }
/// <inheritdoc/> public RVA ToRVA(PEInfo peInfo, FileOffset offset) { return(peInfo.ToRVA(offset)); }
public FileOffset?ToFileOffset(PEInfo peInfo, RVA rva) => (FileOffset)rva;
public RVA?ToRVA(PEInfo peInfo, FileOffset offset) => (RVA)offset;
public FileOffset?ToFileOffset(PEInfo peInfo, RVA rva) => peInfo.ToFileOffset(rva);
public RVA?ToRVA(PEInfo peInfo, FileOffset offset) => peInfo.ToRVA(offset);