/// <summary> /// Creates an instance of an offset by specifying a virtual address. /// </summary> /// <param name="va">The virtual address.</param> /// <param name="assembly">The assembly containing the offset.</param> /// <returns></returns> public static Offset FromVa(ulong va, Win32Assembly assembly) { if (va == 0) { return(new Offset(0, 0, 0)); } if (assembly == null) { return(new Offset(0, 0, va)); } OffsetConverter offsetconverter = CreateConverter(assembly, va, 3); return(new Offset(offsetconverter.VaToFileOffset(va), offsetconverter.VaToRva(va), va)); }
/// <summary> /// Creates an instance of an offset by specifying a virtual address. /// </summary> /// <param name="va">The virtual address.</param> /// <param name="assembly">The assembly containing the offset.</param> /// <returns></returns> public static Offset FromVa(ulong va, Win32Assembly assembly) { if (va == 0) return new Offset(0, 0, 0, ASM.OperandType.Normal); OffsetConverter offsetconverter = new OffsetConverter(Section.GetSectionByRva(assembly, (uint)(va - assembly.NTHeader.OptionalHeader.ImageBase))); return new Offset(offsetconverter.VaToFileOffset(va), offsetconverter.VaToRva(va), va, ASM.OperandType.Normal); }