@@ -2300,6 +2300,13 @@ def extract(self, file_path, file_header, dest_dir, dest_dir_0):
2300
2300
if ret :
2301
2301
return ret
2302
2302
2303
+ # Cover Inno Setup installers.
2304
+ if file_header [48 :52 ] == b'Inno' :
2305
+ # Determine if this executable can be extracted with innoextract.
2306
+ ret = self ._extract_inno (file_path , file_header , dest_dir )
2307
+ if ret :
2308
+ return ret
2309
+
2303
2310
# Read up to 16 MB as a safety net.
2304
2311
file_header += util .read_complement (file_path , file_header )
2305
2312
@@ -2455,6 +2462,32 @@ def _extract_flashtool(self, file_path, file_header, dest_dir, match):
2455
2462
# Return destination directory path.
2456
2463
return dest_dir
2457
2464
2465
+ def _extract_inno (self , file_path , file_header , dest_dir ):
2466
+ # Create destination directory and stop if it couldn't be created.
2467
+ if not util .try_makedirs (dest_dir ):
2468
+ return True
2469
+
2470
+ # Run innoextract command.
2471
+ try :
2472
+ subprocess .run (['innoextract' , '-e' , os .path .abspath (file_path )], stdout = self ._devnull , stderr = subprocess .STDOUT , cwd = dest_dir )
2473
+ except :
2474
+ pass
2475
+
2476
+ # Assume failure if nothing was extracted.
2477
+ files_extracted = os .listdir (dest_dir )
2478
+ if len (files_extracted ) < 1 :
2479
+ self .debug_print ('Extraction produced no files:' , file_path )
2480
+ return False
2481
+
2482
+ # Remove file.
2483
+ try :
2484
+ os .remove (file_path )
2485
+ except :
2486
+ pass
2487
+
2488
+ # Return destination directory path.
2489
+ return dest_dir
2490
+
2458
2491
2459
2492
class TarExtractor (ArchiveExtractor ):
2460
2493
"""Extract tar archives."""
0 commit comments