node/lib/metasm/metasm/exe_format/coff_decode.rb
def decode(coff)
			super(coff)

			if coff.sect_at_rva(@libname_p)
				@libname = coff.decode_strz
			end

			if coff.sect_at_rva(@func_p)
				@exports = []
				addrs = []
				@num_exports.times { addrs << coff.decode_word }
				@num_exports.times { |i|
					e = Export.new
					e.ordinal = i + @ordinal_base
					addr = addrs[i]
					if addr >= coff.directory['export_table'][0] and addr < coff.directory['export_table'][0] + coff.directory['export_table'][1] and coff.sect_at_rva(addr)
						name = coff.decode_strz
						e.forwarder_lib, name = name.split('.', 2)
						if name[0] == ?#
							e.forwarder_ordinal = name[1..-1].to_i
						else
							e.forwarder_name = name
						end
					else
						e.target = e.target_rva = addr
					end
					@exports << e
				}
			end
			if coff.sect_at_rva(@names_p)
				namep = []
				num_names.times { namep << coff.decode_word }
			end
			if coff.sect_at_rva(@ord_p)
				ords = []
				num_names.times { ords << coff.decode_half }
			end
			if namep and ords
				namep.zip(ords).each { |np, oi|
					@exports[oi].name_p = np
					if coff.sect_at_rva(np)
						@exports[oi].name = coff.decode_strz
					end
				}
			end
		end
# decodes a COFF export table from coff.cursection
decodes a COFF export table from coff.cursection
decodes a COFF export table from coff . cursection
def decode(coff)
			super(coff)
			if coff.sect_at_rva(@libname_p)
				@libname = coff.decode_strz
			end
			if coff.sect_at_rva(@func_p)
				@exports = []
				addrs = []
				@num_exports.times { addrs << coff.decode_word }
				@num_exports.times { |i|
					e = Export.new
					e.ordinal = i + @ordinal_base
					addr = addrs[i]
					if addr >= coff.directory['export_table'][0] and addr < coff.directory['export_table'][0] + coff.directory['export_table'][1] and coff.sect_at_rva(addr)
						name = coff.decode_strz
						e.forwarder_lib, name = name.split('.', 2)
						if name[0] == ?#
							e.forwarder_ordinal = name[1..-1].to_i
						else
							e.forwarder_name = name
						end
					else
						e.target = e.target_rva = addr
					end
					@exports << e
				}
			end
			if coff.sect_at_rva(@names_p)
				namep = []
				num_names.times { namep << coff.decode_word }
			end
			if coff.sect_at_rva(@ord_p)
				ords = []
				num_names.times { ords << coff.decode_half }
			end
			if namep and ords
				namep.zip(ords).each { |np, oi|
					@exports[oi].name_p = np
					if coff.sect_at_rva(np)
						@exports[oi].name = coff.decode_strz
					end
				}
			end
		end
def decode ( coff ) super ( coff ) if coff . sect_at_rva ( @libname_p ) @libname = coff . decode_strz end if coff . sect_at_rva ( @func_p ) @exports = [ ] addrs = [ ] @num_exports . times { addrs << coff . decode_word } @num_exports . times { | i | e = Export . new e . ordinal = i + @ordinal_base addr = addrs [ i ] if addr >= coff . directory [ 'export_table' ] [ 0 ] and addr < coff . directory [ 'export_table' ] [ 0 ] + coff . directory [ 'export_table' ] [ 1 ] and coff . sect_at_rva ( addr ) name = coff . decode_strz e . forwarder_lib , name = name . split ( '.' , 2 ) if name [ 0 ] == ?# e . forwarder_ordinal = name [ 1 .. - 1 ] . to_i else e . forwarder_name = name end else e . target = e . target_rva = addr end @exports << e } end if coff . sect_at_rva ( @names_p ) namep = [ ] num_names . times { namep << coff . decode_word } end if coff . sect_at_rva ( @ord_p ) ords = [ ] num_names . times { ords << coff . decode_half } end if namep and ords namep . zip ( ords ) . each { | np , oi | @exports [ oi ] . name_p = np if coff . sect_at_rva ( np ) @exports [ oi ] . name = coff . decode_strz end } end end
decodes a COFF export table from coff.cursection
decodes a COFF export table from coff . cursection
coff