Sha256: 4171fe0577fc76f28f6cde5be84224ae6e4e26a7f2e9b2eb48ebbcde1f782199

Contents?: true

Size: 876 Bytes

Versions: 6

Compression:

Stored size: 876 Bytes

Contents

#    This file is part of Metasm, the Ruby assembly manipulation suite
#    Copyright (C) 2006-2009 Yoann GUILLOT
#
#    Licence is LGPL, see LICENCE in the top-level directory

#
# this script takes a list of dll filenames as arguments, and outputs each lib export
# libname, followed by the list of the exported symbol names, in a format usable
# by the PE class autoimport functionnality (see metasm/os/windows.rb)
#

require 'metasm'

ARGV.each { |f|
	pe = Metasm::PE.decode_file_header(f) rescue next
	pe.decode_exports
	next if not pe.export or not pe.export.libname
	puts pe.export.libname.sub(/\.dll$/i, '')
	line = ''
	pe.export.exports.each { |e|
		next if not e.name
		# next if not e.target	# allow forwarders ? (may change name)
		e = ' ' << e.name
		if line.length + e.length >= 160
			puts line
			line = ''
		end
		line << e
	}
	puts line if not line.empty?
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metasm-1.0.5 samples/pe_listexports.rb
metasm-1.0.4 samples/pe_listexports.rb
metasm-1.0.3 samples/pe_listexports.rb
metasm-1.0.2 samples/pe_listexports.rb
metasm-1.0.1 samples/pe_listexports.rb
metasm-1.0.0 samples/pe_listexports.rb