Method: Rex::PeParsey::PeBase#file_offset_to_rva

Defined in:
lib/rex/peparsey/pebase.rb

#file_offset_to_rva(foffset) ⇒ Object

Raises:



1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
# File 'lib/rex/peparsey/pebase.rb', line 1206

def file_offset_to_rva(foffset)
  if foffset < 0
    raise PeParseyError, "Offset should not be less than 0. The value is: #{foffset}", caller
  end

  all_sections.each do |section|
    if section.contains_file_offset?(foffset)
      return section.file_offset_to_rva(foffset)
    end
  end

  raise PeParseyError, "No section contains file offset #{foffset}", caller
end