lib/pedump/loader.rb
# find all occurences of string
# returns array of VAs or empty array
find all occurences of string
returns array of VAs or empty array
find all occurences of string returns array of VAs or empty array
def find_all needle, options = {}
    options[:align] ||= 1
    options[:limit] ||= @find_limit
    if needle.is_a?(Fixnum)
      needle = [needle].pack('L')
    end
    r = []
    if options[:align] == 1
      processed_bytes = 0
      sections.each do |section|
        next unless section.data 
        section.data.scan(needle) do
          r << $~.begin(0) + section.va
        end
        processed_bytes += section.vsize
        return r if processed_bytes >= options[:limit]
      end
    end
    r
  end
def find_all needle , options = { } options [ :align ] ||= 1 options [ :limit ] ||= @find_limit if needle . is_a? ( Fixnum ) needle = [ needle ] . pack ( 'L' ) end r = [ ] if options [ :align ] == 1 processed_bytes = 0 sections . each do | section | next unless section . data section . data . scan ( needle ) do r << $~ . begin ( 0 ) + section . va end processed_bytes += section . vsize return r if processed_bytes >= options [ :limit ] end end r end
find all occurences of string
returns array of VAs or empty array
find all occurences of string returns array of VAs or empty array
# silently convert to DWORD # fastest find? # skip empty sections
needle
options