Class: COFF::SCOFF_SectionHeader

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/rmasm/bincoff.rb

Instance Method Summary collapse

Instance Method Details

#FlagsToStr(flags) ⇒ Object



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/rmasm/bincoff.rb', line 297

def FlagsToStr(flags)
  str = ""
  n = 0
  flags_no_aligned = flags & (~PE_SCN_ALIGN_MASK)
  i = 1
  32.times do
    if (i & flags_no_aligned) != 0
      value = MAP_PE_SCN_TO_STRING[ i & flags_no_aligned ]
      str += " | " if n > 0
      str += "#{value}"
      n += 1
    end
    i = i << 1
  end

  if (flags & PE_SCN_ALIGN_MASK)
    a = 1 << (((flags & PE_SCN_ALIGN_MASK) / PE_SCN_ALIGN_1) - 1);
    str += " Align by 0x%4X" % a
    n += 1
  end

  if n == 0
    str = "None"
  end
  str
end

#to_sObject



324
325
326
327
328
# File 'lib/rmasm/bincoff.rb', line 324

def to_s()
  str = inspect
  str += " Flags: " + FlagsToStr(self.Flags)
  str
end