Class: Resedit::Multiexe
Constant Summary
collapse
- KNOWN_TYPES =
{'MZ' => MZ, 'BW' => BW, 'LE' => LE, 'LX' => LE, 'LC'=>LE}
Constants inherited
from ExeFile
ExeFile::BODYCLASS, ExeFile::CFGEXT, ExeFile::HDRCLASS, ExeFile::MODE
Instance Attribute Summary collapse
Attributes inherited from ExeFile
#fname, #name, #path
Instance Method Summary
collapse
-
#append(value, type = nil, where = nil) ⇒ Object
-
#body ⇒ Object
-
#change(ofs, value, disp = nil, type = nil) ⇒ Object
-
#close ⇒ Object
-
#dasm(ofs, size = nil, how = nil) ⇒ Object
-
#dump(out, parts, how = nil) ⇒ Object
-
#env ⇒ Object
-
#getValue(value, type) ⇒ Object
-
#header ⇒ Object
-
#hex(ofs, size = nil, how = nil, disp = nil) ⇒ Object
-
#hexify(str) ⇒ Object
-
#initialize(path, quiet = false) ⇒ Multiexe
constructor
A new instance of Multiexe.
-
#load(f, fsize) ⇒ Object
-
#loadConfig(cfg) ⇒ Object
-
#print(what, how = nil) ⇒ Object
-
#readRelocated(ofs, size) ⇒ Object
-
#reloc(ofs, target = nil) ⇒ Object
-
#relocfind(value, type = nil) ⇒ Object
-
#replace(value, type = nil, where = nil) ⇒ Object
-
#revert(what) ⇒ Object
-
#saveConfig ⇒ Object
-
#saveFile(f) ⇒ Object
-
#setPart(id) ⇒ Object
-
#stringfind(size = nil) ⇒ Object
-
#valueof(str, type) ⇒ Object
Methods inherited from ExeFile
#is?, #log, #s2i, #save, #wsize
Constructor Details
#initialize(path, quiet = false) ⇒ Multiexe
Returns a new instance of Multiexe.
14
15
16
17
18
|
# File 'lib/resedit/mz/multiexe.rb', line 14
def initialize(path, quiet = false)
@cur = nil
@parts = []
super(path, quiet)
end
|
Instance Attribute Details
#cur ⇒ Object
Returns the value of attribute cur.
12
13
14
|
# File 'lib/resedit/mz/multiexe.rb', line 12
def cur
@cur
end
|
Instance Method Details
#append(value, type = nil, where = nil) ⇒ Object
74
|
# File 'lib/resedit/mz/multiexe.rb', line 74
def append(value, type=nil, where=nil); @cur.append(value, type, where) end
|
#body ⇒ Object
55
|
# File 'lib/resedit/mz/multiexe.rb', line 55
def body; @cur.body end
|
#change(ofs, value, disp = nil, type = nil) ⇒ Object
76
|
# File 'lib/resedit/mz/multiexe.rb', line 76
def change(ofs, value, disp=nil, type=nil); @cur.change(ofs, value, disp, type) end
|
#close ⇒ Object
59
|
# File 'lib/resedit/mz/multiexe.rb', line 59
def close(); @parts.each{|pr| pr.close()} end
|
#dasm(ofs, size = nil, how = nil) ⇒ Object
80
|
# File 'lib/resedit/mz/multiexe.rb', line 80
def dasm(ofs, size=nil, how=nil) @cur.dasm(ofs, size, how) end
|
#dump(out, parts, how = nil) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/resedit/mz/multiexe.rb', line 42
def dump(out, parts, how=nil)
prts = eval(parts)
open(out,"wb"){|f|
prts.each{|i|
pr = @parts[i]
pr..mode(pr..parseHow(how))
pr.body.mode(pr..parseHow(how))
pr.saveFile(f)
}
}
end
|
#env ⇒ Object
56
|
# File 'lib/resedit/mz/multiexe.rb', line 56
def env; @cur.env end
|
#getValue(value, type) ⇒ Object
73
|
# File 'lib/resedit/mz/multiexe.rb', line 73
def getValue(value, type); @cur.getValue(value, type) end
|
54
|
# File 'lib/resedit/mz/multiexe.rb', line 54
def ; @cur. end
|
#hex(ofs, size = nil, how = nil, disp = nil) ⇒ Object
71
|
# File 'lib/resedit/mz/multiexe.rb', line 71
def hex(ofs, size=nil, how=nil, disp=nil); @cur.hex(ofs, size, how, disp) end
|
#hexify(str) ⇒ Object
72
|
# File 'lib/resedit/mz/multiexe.rb', line 72
def hexify(str); @cur.hexify(str) end
|
#load(f, fsize) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/resedit/mz/multiexe.rb', line 20
def load(f, fsize)
cid = 0
while !f.eof?
s = f.read(2).unpack('A2')[0]
f.seek(-2, IO::SEEK_CUR)
raise "Unknown format #{s}" if !KNOWN_TYPES[s]
obj = KNOWN_TYPES[s].new(nil, @quiet)
sz = fsize - f.tell()
obj.load(f, sz, @parts.length>0 ? @parts[-1] : 0 )
cid = @parts.length() if obj.is_a?(LE)
@parts += [obj]
end
setPart(cid)
end
|
#loadConfig(cfg) ⇒ Object
36
37
38
39
40
|
# File 'lib/resedit/mz/multiexe.rb', line 36
def loadConfig(cfg)
@parts.each.with_index{|pr, i|
pr.loadConfig(cfg[i.to_s])
}
end
|
#print(what, how = nil) ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/resedit/mz/multiexe.rb', line 61
def print(what, how=nil)
if what=="parts"
puts "#{@parts.length} parts:"
@parts.each.with_index{|pr, i|
puts "#{i}: #{pr.class} #{pr}"
}
return true
end
@cur.print(what, how)
end
|
#readRelocated(ofs, size) ⇒ Object
83
|
# File 'lib/resedit/mz/multiexe.rb', line 83
def readRelocated(ofs, size); @cur.readRelocated(ofs, size) end
|
#reloc(ofs, target = nil) ⇒ Object
77
|
# File 'lib/resedit/mz/multiexe.rb', line 77
def reloc(ofs, target=nil); @cur.reloc(ofs, target) end
|
#relocfind(value, type = nil) ⇒ Object
78
|
# File 'lib/resedit/mz/multiexe.rb', line 78
def relocfind(value, type=nil); @cur.relocfind(value, type) end
|
#replace(value, type = nil, where = nil) ⇒ Object
75
|
# File 'lib/resedit/mz/multiexe.rb', line 75
def replace(value, type=nil, where=nil); @cur.replace(value, type, where) end
|
#revert(what) ⇒ Object
82
|
# File 'lib/resedit/mz/multiexe.rb', line 82
def revert(what); @cur.revert(what) end
|
#saveConfig ⇒ Object
85
86
87
88
89
90
91
|
# File 'lib/resedit/mz/multiexe.rb', line 85
def saveConfig()
cfg = {}
@parts.each.with_index{|pr, i|
cfg[i] = pr.saveConfig()
}
return cfg
end
|
#saveFile(f) ⇒ Object
93
94
95
|
# File 'lib/resedit/mz/multiexe.rb', line 93
def saveFile(f)
@parts.each{|pr| pr.saveFile(f)}
end
|
#setPart(id) ⇒ Object
58
|
# File 'lib/resedit/mz/multiexe.rb', line 58
def setPart(id); @cur = @parts[id] end
|
#stringfind(size = nil) ⇒ Object
79
|
# File 'lib/resedit/mz/multiexe.rb', line 79
def stringfind(size=nil); @cur.stringfind(size) end
|
#valueof(str, type) ⇒ Object
81
|
# File 'lib/resedit/mz/multiexe.rb', line 81
def valueof(str, type); @cur.valueof(str, type) end
|