RvaToFileOffset() public method

Transforms a relative virtual address to a physical file offset.
public RvaToFileOffset ( uint rva ) : uint
rva uint The relative virtual address to convert.
return uint
Esempio n. 1
0
        /// <summary>
        /// Creates an instance of an offset by specifying a virtual address that is relative to a section.
        /// </summary>
        /// <param name="rva">The relative virtual address.</param>
        /// <param name="assembly">The assembly containing the offset.</param>
        /// <returns></returns>
        public static Offset FromRva(uint rva, Win32Assembly assembly)
        {
            if (rva == 0)
            {
                return(new Offset(0, 0, 0));
            }
            if (assembly == null)
            {
                return(new Offset(0, rva, 0));
            }
            OffsetConverter offsetconverter = CreateConverter(assembly, rva, 2);

            return(new Offset(offsetconverter.RvaToFileOffset(rva), rva, offsetconverter.RvaToVa(rva)));
        }
Esempio n. 2
0
 /// <summary>
 /// Creates an instance of an offset by specifying a virtual address that is relative to a section.
 /// </summary>
 /// <param name="rva">The relative virtual address.</param>
 /// <param name="assembly">The assembly containing the offset.</param>
 /// <returns></returns>
 public static Offset FromRva(uint rva, Win32Assembly assembly)
 {
     if (rva == 0)
         return new Offset(0, 0, 0, ASM.OperandType.Normal);
     OffsetConverter offsetconverter = new OffsetConverter(Section.GetSectionByRva(assembly, rva));
     return new Offset(offsetconverter.RvaToFileOffset(rva), rva, offsetconverter.RvaToVa(rva), ASM.OperandType.Normal);
 }