node/lib/metasm/metasm/exe_format/coff_decode.rb
def decode(coff)
			return set_default_values(coff) if coff.header.size_opthdr == 0 and not coff.header.characteristics.include?('EXECUTABLE_IMAGE')
			off = coff.curencoded.ptr
			super(coff)
			nrva = (coff.header.size_opthdr - (coff.curencoded.ptr - off)) / 8
			nrva = @numrva if nrva < 0

			if nrva > DIRECTORIES.length or nrva != @numrva
				puts "W: COFF: Weird directories count #{@numrva}" if $VERBOSE
				nrva = DIRECTORIES.length if nrva > DIRECTORIES.length
			end

			coff.directory = {}
			DIRECTORIES[0, nrva].each { |dir|
				rva = coff.decode_word
				sz  = coff.decode_word
				if rva != 0 or sz != 0
					coff.directory[dir] = [rva, sz]
				end
			}
		end
# decodes a COFF optional header from coff.cursection
# also decodes directories in coff.directory
decodes a COFF optional header from coff.cursection
also decodes directories in coff.directory
decodes a COFF optional header from coff . cursection also decodes directories in coff . directory
def decode(coff)
			return set_default_values(coff) if coff.header.size_opthdr == 0 and not coff.header.characteristics.include?('EXECUTABLE_IMAGE')
			off = coff.curencoded.ptr
			super(coff)
			nrva = (coff.header.size_opthdr - (coff.curencoded.ptr - off)) / 8
			nrva = @numrva if nrva < 0
			if nrva > DIRECTORIES.length or nrva != @numrva
				puts "W: COFF: Weird directories count #{@numrva}" if $VERBOSE
				nrva = DIRECTORIES.length if nrva > DIRECTORIES.length
			end
			coff.directory = {}
			DIRECTORIES[0, nrva].each { |dir|
				rva = coff.decode_word
				sz  = coff.decode_word
				if rva != 0 or sz != 0
					coff.directory[dir] = [rva, sz]
				end
			}
		end
def decode ( coff ) return set_default_values ( coff ) if coff . header . size_opthdr == 0 and not coff . header . characteristics . include? ( 'EXECUTABLE_IMAGE' ) off = coff . curencoded . ptr super ( coff ) nrva = ( coff . header . size_opthdr - ( coff . curencoded . ptr - off ) ) / 8 nrva = @numrva if nrva < 0 if nrva > DIRECTORIES . length or nrva != @numrva puts "W: COFF: Weird directories count #{@numrva}" if $VERBOSE nrva = DIRECTORIES . length if nrva > DIRECTORIES . length end coff . directory = { } DIRECTORIES [ 0 , nrva ] . each { | dir | rva = coff . decode_word sz = coff . decode_word if rva != 0 or sz != 0 coff . directory [ dir ] = [ rva , sz ] end } end
decodes a COFF optional header from coff.cursection
also decodes directories in coff.directory
decodes a COFF optional header from coff . cursection also decodes directories in coff . directory
coff