Skip to content

Commit

Permalink
Tweaking the Rich structure parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
erocarrera committed Mar 28, 2016
1 parent 3f06837 commit a3e5d09
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2083,9 +2083,16 @@ def parse_rich_header(self):
DANS = 0x536E6144 # 'DanS' as dword
RICH = 0x68636952 # 'Rich' as dword

rich_index = self.__data__.find(
'Rich', 0x80, self.OPTIONAL_HEADER.struct.offset)
if rich_index == -1:
return None

# Read a block of data
try:
rich_data = self.get_data(0x80, 0x80)
# The end of the structure is 8 bytes after the start of the Rich
# string.
rich_data = self.get_data(0x80, rich_index + 8)
if len(rich_data) != 0x80:
return None
data = list(struct.unpack("<32I", rich_data))
Expand Down

0 comments on commit a3e5d09

Please sign in to comment.