comparison pytouhou/formats/exe.py @ 305:5492472963b0

Minor cleanup
author Thibaut Girka <thib@sitedethib.com>
date Tue, 13 Mar 2012 18:45:43 +0100
parents 92a6fd2632f1
children 2674c789e0c3
comparison
equal deleted inserted replaced
304:f3099ebf4f61 305:5492472963b0
136 @classmethod 136 @classmethod
137 def read(cls, file): 137 def read(cls, file):
138 pe_file = PEFile(file) 138 pe_file = PEFile(file)
139 data_section = [section for section in pe_file.sections 139 data_section = [section for section in pe_file.sections
140 if section.Name.startswith('.data')][0] 140 if section.Name.startswith('.data')][0]
141 text_section = [section for section in pe_file.sections
142 if section.Name.startswith('.text')][0]
143 data_va = pe_file.image_base + data_section.VirtualAddress 141 data_va = pe_file.image_base + data_section.VirtualAddress
144 data_size = data_section.SizeOfRawData 142 data_size = data_section.SizeOfRawData
145 text_va = pe_file.image_base + text_section.VirtualAddress
146 text_size = text_section.SizeOfRawData
147 143
148 possible_character_records = list(cls.find_character_defs(pe_file)) 144 possible_character_records = list(cls.find_character_defs(pe_file))
149 if not possible_character_records: 145 if not possible_character_records:
150 raise InvalidExeException 146 raise InvalidExeException
151 147