13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/pedump/version_info.rb', line 13
def self.read f, size = SIZE
super.tap do |vi|
vi.szKey.force_encoding('UTF-16LE').encode!('UTF-8').sub!(/\u0000$/,'') rescue nil
vi.Padding1 = f.tell%4 > 0 ? f.read(4 - f.tell%4) : nil
vi.Value = VS_FIXEDFILEINFO.read(f,vi.wValueLength)
vi.Padding2 = f.tell%4 > 0 ? f.read(4 - f.tell%4) : nil
vi.Children = []
2.times do
pos = f.tell
f.seek(pos+6)
t = f.read(6)
f.seek(pos)
case t
when "V\x00a\x00r\x00"
vi.Children << VarFileInfo.read(f)
when "S\x00t\x00r\x00"
vi.Children << StringFileInfo.read(f)
else
PEdump.logger.warn "[?] invalid VS_VERSIONINFO child type #{t.inspect}"
break
end
end
end
end
|