about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-05-02 15:07:50 +0200
committerGitHub <noreply@github.com>2020-05-02 15:07:50 +0200
commitc118fcb212e89348cacfe5e74ff971dece769ce8 (patch)
treed60c6f4a42440fc2c8f8036153a641e9ba185388
parentcf41ca9d2c883a2f1d871415fae1b7ea81135acd (diff)
parent4731d59661a02337834fdb4eca7ebecc49f3a55b (diff)
downloadmiasm-c118fcb212e89348cacfe5e74ff971dece769ce8.tar.gz
miasm-c118fcb212e89348cacfe5e74ff971dece769ce8.zip
Merge pull request #1215 from serpilliere/fix_import_rebuild
Loader: fix import rebuild
Diffstat (limited to '')
-rw-r--r--miasm/loader/pe.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/miasm/loader/pe.py b/miasm/loader/pe.py
index 90d8b12a..c402715a 100644
--- a/miasm/loader/pe.py
+++ b/miasm/loader/pe.py
@@ -434,7 +434,7 @@ class DirImport(CStruct):
             #    entry.firstthunk = rva
             # rva+=(len(entry.firstthunks)+1)*self.parent_head._wsize//8 # Rva size
             if entry.originalfirstthunk and entry.firstthunk:
-                if isinstance(entry.originalfirstthunk, struct_array):
+                if isinstance(entry.originalfirstthunks, struct_array):
                     tmp_thunk = entry.originalfirstthunks
                 elif isinstance(entry.firstthunks, struct_array):
                     tmp_thunk = entry.firstthunks
@@ -457,6 +457,11 @@ class DirImport(CStruct):
                     rva += len(imp)
 
     def build_content(self, raw):
+        if self.parent_head._wsize == 32:
+            mask_ptr = 0x80000000
+        elif self.parent_head._wsize == 64:
+            mask_ptr = 0x8000000000000000
+
         dirimp = self.parent_head.NThdr.optentries[DIRECTORY_ENTRY_IMPORT]
         of1 = dirimp.rva
         if not of1:  # No Import