lib/pedump/loader/section.rb in pedump-0.4.16 vs lib/pedump/loader/section.rb in pedump-0.5.0

- old
+ new

@@ -11,14 +11,16 @@ end @data = EMPTY_DATA.dup @deferred_load_io = args[:deferred_load_io] @deferred_load_pos = args[:deferred_load_pos] || (@hdr && @hdr.PointerToRawData) @deferred_load_size = args[:deferred_load_size] || (@hdr && @hdr.SizeOfRawData) + @image_base = args[:image_base] || 0 end def name; @hdr.Name; end - def va ; @hdr.VirtualAddress; end + def va ; @hdr.VirtualAddress + @image_base; end + def rva ; @hdr.VirtualAddress; end def vsize; @hdr.VirtualSize; end def flags; @hdr.Characteristics; end def flags= f; @hdr.Characteristics= f; end def data @@ -40,12 +42,16 @@ def range va...(va+vsize) end def inspect - "#<Section name=%-10s va=%8x vsize=%8x rawsize=%8s>" % [ - name.inspect, va, vsize, + r = "#<Section" + r << (" name=%-10s" % name.inspect) if name + r << " va=%8x vsize=%8x rawsize=%8s" % [ + va, vsize, @data.size > 0 ? @data.size.to_s(16) : (@deferred_load_io ? "<defer>" : 0) ] + r << (" dlpos=%8x" % @deferred_load_pos) if @deferred_load_pos + r << ">" end end end