dscharrer / innoextract

A tool to unpack installers created by Inno Setup
https://constexpr.org/innoextract/
Other
1.01k stars 125 forks source link

Innoextract doesn't extract multiple install files #37

Closed ghost closed 9 years ago

ghost commented 10 years ago

I tried to extract the GOG Installer for Divinity: Original Sin but innoextract just extracts the.exe file (I think), not the 3 .bin files that are part of the install. The files on GOG are: setup_divinity_original_sin_2.5.0.11.exe setup_divinity_original_sin_2.5.0.11-1.bin setup_divinity_original_sin_2.5.0.11-2.bin setup_divinity_original_sin_2.5.0.11-3.bin

It extracts a /tmp (files for the install shield) and /app (contains GameuxInstallHelper.dll Support.ico ) folder, but not all the game files.

dscharrer commented 10 years ago

In these multi-file setups the .exe typically doesn't store any files but only the headers that describe where and how the files are stored - so some of the .bin files must be read.

/tmp (files for the install shield)

Install shield files for what? If they are for the game and not some extra utility (like Foxit Reader / DirectX / MSVC runtime / .NET runtime / ...) then I haven't seen that layout from GOG before. What size do these files have (ie: are they large enough to contain the game files)?

I don't have access to a version 2.5.0 installer - besides The Witcher 2 (which seems to use a different versioning scheme), the newest GOG installer I have is versioned 2.1.0.6 - maybe they did change something.

Can you please post the complete console output of:

innoextract -v

and

innoextract -l setup_divinity_original_sin_2.5.0.11.exe

and

innoextract -t setup_divinity_original_sin_2.5.0.11.exe
ghost commented 10 years ago

Install shield files for the game installer itself. Eula, various .pngs that are shown in the background of gog installs.

innoextract -v
innoextract 1.4
Extracts installers created by Inno Setup 1.2.10 to 5.5.3

and

innoextract -l setup_divinity_original_sin_2.5.0.11.exe 
Listing "Divinity - Original Sin" - setup data version 5.5.0 (unicode)
 - "tmp/MSVC2008EULA.txt" (5.08 KiB)
 - "tmp/dotnet35EULA.txt" (12.3 KiB)
 - "tmp/DirectXEULA.txt" (9.92 KiB)
 - "tmp/botva2.dll" (35 KiB)
 - "tmp/crcdll.dll" (69.5 KiB)
 - "tmp/get_hw_caps.dll" (76.7 KiB)
 - "app/GameuxInstallHelper.dll" (94 KiB)
 - "tmp/InnoCallback.dll" (63.5 KiB)
 - "tmp/md5log.ini" (7 B)
 - "tmp/unrar.dll" (232 KiB)
 - "tmp/background.png" (4.84 KiB)
 - "tmp/bg-bot@2x.jpg" (1.22 KiB)
 - "tmp/BigFail.png" (1.63 KiB)
 - "tmp/BigFail200.png" (3.41 KiB)
 - "tmp/BigOK.png" (3.33 KiB)
 - "tmp/BigOK200.png" (12.8 KiB)
 - "tmp/BigWarn.png" (1.58 KiB)
 - "tmp/BigWarn200.png" (3.27 KiB)
 - "tmp/bottombar.png" (340 B)
 - "tmp/bottombar200.png" (938 B)
 - "tmp/btn_browse.png" (4.82 KiB)
 - "tmp/btn_browse200.png" (11.5 KiB)
 - "tmp/btn_close.png" (3.36 KiB)
 - "tmp/btn_close200.png" (9.33 KiB)
 - "tmp/btn_continue.png" (4.18 KiB)
 - "tmp/btn_continue200.png" (11.2 KiB)
 - "tmp/btn_exit.png" (3.76 KiB)
 - "tmp/btn_exit200.png" (8.37 KiB)
 - "tmp/btn_launch.png" (9.96 KiB)
 - "tmp/btn_launch200.png" (21.5 KiB)
 - "tmp/btn_md5.png" (8.73 KiB)
 - "tmp/btn_md5200.png" (12.5 KiB)
 - "tmp/btn_options.png" (5.01 KiB)
 - "tmp/btn_options200.png" (12.5 KiB)
 - "tmp/btn_save_as.png" (5.64 KiB)
 - "tmp/btn_save_as200.png" (15.6 KiB)
 - "tmp/btn_skip.png" (3.23 KiB)
 - "tmp/btn_skip200.png" (8.52 KiB)
 - "tmp/btn_start.png" (4.21 KiB)
 - "tmp/btn_start200.png" (9.59 KiB)
 - "tmp/btn_tryagain.png" (10.5 KiB)
 - "tmp/btn_tryagain200.png" (24.2 KiB)
 - "tmp/error.png" (726 B)
 - "tmp/error200.png" (1.78 KiB)
 - "tmp/error_icon.png" (1.44 KiB)
 - "tmp/error_icon200.png" (2.14 KiB)
 - "tmp/EULA.png" (2.32 KiB)
 - "tmp/EULA200.png" (10.5 KiB)
 - "tmp/EULAAccepted.png" (2.63 KiB)
 - "tmp/EULAAccepted200.png" (11.4 KiB)
 - "tmp/EULAShow.png" (1.47 KiB)
 - "tmp/EULAShow200.png" (2.15 KiB)
 - "tmp/EULA_bkg.png" (3.52 KiB)
 - "tmp/gog.ico" (67.6 KiB)
 - "tmp/GOG.png" (3.45 KiB)
 - "tmp/GOG200.png" (5.29 KiB)
 - "tmp/ok.png" (1.18 KiB)
 - "tmp/ok200.png" (2.18 KiB)
 - "tmp/OpenSans-Regular.ttf" (212 KiB)
 - "tmp/OpenSans-Semibold.ttf" (216 KiB)
 - "tmp/progress_center.png" (1.12 KiB)
 - "tmp/progress_center200.png" (1.26 KiB)
 - "tmp/progress_left.png" (1.15 KiB)
 - "tmp/progress_left200.png" (792 B)
 - "tmp/progress_right.png" (1.15 KiB)
 - "tmp/progress_right200.png" (828 B)
 - "tmp/scroll-handle-bot.png" (1 KiB)
 - "tmp/scroll-handle-top.png" (1.01 KiB)
 - "tmp/trackbar_back.png" (1.7 KiB)
 - "tmp/trackbar_back200.png" (4.4 KiB)
 - "tmp/trackbar_btn.png" (2 KiB)
 - "tmp/trackbar_btn200.png" (5.65 KiB)
 - "tmp/track_center.png" (1.09 KiB)
 - "tmp/track_center200.png" (1.21 KiB)
 - "tmp/track_left.png" (1.11 KiB)
 - "tmp/track_left200.png" (558 B)
 - "tmp/track_right.png" (1.12 KiB)
 - "tmp/track_right200.png" (557 B)
 - "app/Support.ico" (61.4 KiB)
 - "tmp/05.Might-and-Magic-6-Pack-Limited-Edition.png" (1.34 MiB)
 - "tmp/09.Arcanum_-Of-Steamworks-and-Magick-Obscura.png" (1.38 MiB)
 - "tmp/14.Geneforge-1-5.png" (1.22 MiB)
 - "tmp/01.Baldur's-Gate-2-Complete.png" (1.46 MiB)
 - "tmp/02.Planescape-Torment.png" (1.05 MiB)
 - "tmp/01.System-Shock-2.png" (1.05 MiB)
 - "tmp/04.Witcher-2-Assassins-of-Kings.png" (1.31 MiB)
 - "tmp/06.Legend-of-Grimrock.png" (1.03 MiB)
 - "tmp/07.Ultima-7-The-Complete-Edition.png" (1.07 MiB)
 - "tmp/08.Neverwinter-Nights-Diamond-Edition.png" (1.17 MiB)
 - "tmp/10.Divine-Divinity.png" (877 KiB)
 - "tmp/11.Icewind-Dale-Complete.png" (1.29 MiB)
 - "tmp/13.The-Inquisitor.png" (1.19 MiB)
 - "tmp/15.Nox.png" (952 KiB)
 - "tmp/16.Darklands.png" (1.09 MiB)
 - "tmp/03.Comanche-vs.-Hokum.png" (1.08 MiB)
 - "tmp/04.Beyond-Good-&-Evil.png" (1.06 MiB)
 - "tmp/05.Another-World-15th-Anniversary-Edition.png" (1.15 MiB)
 - "tmp/06.Driver-Parallel-Lines.png" (1.16 MiB)
 - "tmp/07.ArmA-II.png" (1.25 MiB)
 - "tmp/08.Alone-in-The-Dark-1+2+3.png" (1.42 MiB)
 - "tmp/09.Alan-Wake.png" (1.02 MiB)
 - "tmp/10.Bloodrayne.png" (1.07 MiB)
 - "tmp/11.Age-of-Wonders.png" (1.01 MiB)
 - "tmp/02.Far-Cry.png" (1.56 MiB)
 - "tmp/12.Oddworld-Abe's-Exoddus.png" (1.29 MiB)
 - "tmp/13.Cannon-Fodder.png" (1.06 MiB)
 - "tmp/14.Fahrenheit-(Indigo-Prophecy).png" (1.19 MiB)
 - "tmp/15.Crusader-No-Regret.png" (1.2 MiB)
 - "tmp/1207664923.ini" (3.85 KiB)
 - "tmp/gog_installer_background.jpg" (79.3 KiB)
 - "tmp/EULA.txt" (0 B)
 - "tmp/GOG_EULA.txt" (7.33 KiB)
 - "tmp/changelog.ini" (6.75 KiB)
 - "tmp/QTEULA.txt" (27.7 KiB)
Done.

and:

innoextract -t setup_divinity_original_sin_2.5.0.11.exe 
Testing "Divinity - Original Sin" - setup data version 5.5.0 (unicode)
 - "tmp/MSVC2008EULA.txt" (5.08 KiB)
 - "tmp/dotnet35EULA.txt" (12.3 KiB)                                                 
 - "tmp/DirectXEULA.txt" (9.92 KiB)                                                  
 - "tmp/botva2.dll" (35 KiB)                                                         
 - "tmp/crcdll.dll" (69.5 KiB)                                                       
 - "tmp/get_hw_caps.dll" (76.7 KiB)                                                  
 - "app/GameuxInstallHelper.dll" (94 KiB)                                            
 - "tmp/InnoCallback.dll" (63.5 KiB)                                                 
 - "tmp/md5log.ini" (7 B)                                                            
 - "tmp/unrar.dll" (232 KiB)                                                         
 - "tmp/background.png" (4.84 KiB)                                                   
 - "tmp/bg-bot@2x.jpg" (1.22 KiB)                                                    
 - "tmp/BigFail.png" (1.63 KiB)                                                      
 - "tmp/BigFail200.png" (3.41 KiB)                                                   
 - "tmp/BigOK.png" (3.33 KiB)                                                        
 - "tmp/BigOK200.png" (12.8 KiB)                                                     
 - "tmp/BigWarn.png" (1.58 KiB)                                                      
 - "tmp/BigWarn200.png" (3.27 KiB)                                                   
 - "tmp/bottombar.png" (340 B)                                                       
 - "tmp/bottombar200.png" (938 B)                                                    
 - "tmp/btn_browse.png" (4.82 KiB)                                                   
 - "tmp/btn_browse200.png" (11.5 KiB)                                                
 - "tmp/btn_close.png" (3.36 KiB)                                                    
 - "tmp/btn_close200.png" (9.33 KiB)                                                 
 - "tmp/btn_continue.png" (4.18 KiB)                                                 
 - "tmp/btn_continue200.png" (11.2 KiB)                                              
 - "tmp/btn_exit.png" (3.76 KiB)                                                     
 - "tmp/btn_exit200.png" (8.37 KiB)                                                  
 - "tmp/btn_launch.png" (9.96 KiB)                                                   
 - "tmp/btn_launch200.png" (21.5 KiB)                                                
 - "tmp/btn_md5.png" (8.73 KiB)                                                      
 - "tmp/btn_md5200.png" (12.5 KiB)                                                   
 - "tmp/btn_options.png" (5.01 KiB)                                                  
 - "tmp/btn_options200.png" (12.5 KiB)                                               
 - "tmp/btn_save_as.png" (5.64 KiB)                                                  
 - "tmp/btn_save_as200.png" (15.6 KiB)                                               
 - "tmp/btn_skip.png" (3.23 KiB)                                                     
 - "tmp/btn_skip200.png" (8.52 KiB)                                                  
 - "tmp/btn_start.png" (4.21 KiB)                                                    
 - "tmp/btn_start200.png" (9.59 KiB)                                                 
 - "tmp/btn_tryagain.png" (10.5 KiB)                                                 
 - "tmp/btn_tryagain200.png" (24.2 KiB)                                              
 - "tmp/error.png" (726 B)                                                           
 - "tmp/error200.png" (1.78 KiB)                                                     
 - "tmp/error_icon.png" (1.44 KiB)                                                   
 - "tmp/error_icon200.png" (2.14 KiB)                                                
 - "tmp/EULA.png" (2.32 KiB)                                                         
 - "tmp/EULA200.png" (10.5 KiB)                                                      
 - "tmp/EULAAccepted.png" (2.63 KiB)                                                 
 - "tmp/EULAAccepted200.png" (11.4 KiB)                                              
 - "tmp/EULAShow.png" (1.47 KiB)                                                     
 - "tmp/EULAShow200.png" (2.15 KiB)                                                  
 - "tmp/EULA_bkg.png" (3.52 KiB)                                                     
 - "tmp/gog.ico" (67.6 KiB)                                                          
 - "tmp/GOG.png" (3.45 KiB)                                                          
 - "tmp/GOG200.png" (5.29 KiB)                                                       
 - "tmp/ok.png" (1.18 KiB)                                                           
 - "tmp/ok200.png" (2.18 KiB)                                                        
 - "tmp/OpenSans-Regular.ttf" (212 KiB)                                              
 - "tmp/OpenSans-Semibold.ttf" (216 KiB)                                             
 - "tmp/progress_center.png" (1.12 KiB)                                              
 - "tmp/progress_center200.png" (1.26 KiB)                                           
 - "tmp/progress_left.png" (1.15 KiB)                                                
 - "tmp/progress_left200.png" (792 B)                                                
 - "tmp/progress_right.png" (1.15 KiB)                                               
 - "tmp/progress_right200.png" (828 B)                                               
 - "tmp/scroll-handle-bot.png" (1 KiB)                                               
 - "tmp/scroll-handle-top.png" (1.01 KiB)                                            
 - "tmp/trackbar_back.png" (1.7 KiB)                                                 
 - "tmp/trackbar_back200.png" (4.4 KiB)                                              
 - "tmp/trackbar_btn.png" (2 KiB)                                                    
 - "tmp/trackbar_btn200.png" (5.65 KiB)                                              
 - "tmp/track_center.png" (1.09 KiB)                                                 
 - "tmp/track_center200.png" (1.21 KiB)                                              
 - "tmp/track_left.png" (1.11 KiB)                                                   
 - "tmp/track_left200.png" (558 B)                                                   
 - "tmp/track_right.png" (1.12 KiB)                                                  
 - "tmp/track_right200.png" (557 B)                                                  
 - "app/Support.ico" (61.4 KiB)                                                      
 - "tmp/05.Might-and-Magic-6-Pack-Limited-Edition.png" (1.34 MiB)                    
 - "tmp/09.Arcanum_-Of-Steamworks-and-Magick-Obscura.png" (1.38 MiB)                 
 - "tmp/14.Geneforge-1-5.png" (1.22 MiB)                                             
 - "tmp/01.Baldur's-Gate-2-Complete.png" (1.46 MiB)                                  
 - "tmp/02.Planescape-Torment.png" (1.05 MiB)                                        
 - "tmp/01.System-Shock-2.png" (1.05 MiB)                                            
 - "tmp/04.Witcher-2-Assassins-of-Kings.png" (1.31 MiB)                              
 - "tmp/06.Legend-of-Grimrock.png" (1.03 MiB)                                        
 - "tmp/07.Ultima-7-The-Complete-Edition.png" (1.07 MiB)                             
 - "tmp/08.Neverwinter-Nights-Diamond-Edition.png" (1.17 MiB)                        
 - "tmp/10.Divine-Divinity.png" (877 KiB)                                            
 - "tmp/11.Icewind-Dale-Complete.png" (1.29 MiB)                                     
 - "tmp/13.The-Inquisitor.png" (1.19 MiB)                                            
 - "tmp/15.Nox.png" (952 KiB)                                                        
 - "tmp/16.Darklands.png" (1.09 MiB)                                                 
 - "tmp/03.Comanche-vs.-Hokum.png" (1.08 MiB)                                        
 - "tmp/04.Beyond-Good-&-Evil.png" (1.06 MiB)                                        
 - "tmp/05.Another-World-15th-Anniversary-Edition.png" (1.15 MiB)                    
 - "tmp/06.Driver-Parallel-Lines.png" (1.16 MiB)                                     
 - "tmp/07.ArmA-II.png" (1.25 MiB)                                                   
 - "tmp/08.Alone-in-The-Dark-1+2+3.png" (1.42 MiB)                                   
 - "tmp/09.Alan-Wake.png" (1.02 MiB)                                                 
 - "tmp/10.Bloodrayne.png" (1.07 MiB)                                                
 - "tmp/11.Age-of-Wonders.png" (1.01 MiB)                                            
 - "tmp/02.Far-Cry.png" (1.56 MiB)                                                   
 - "tmp/12.Oddworld-Abe's-Exoddus.png" (1.29 MiB)                                    
 - "tmp/13.Cannon-Fodder.png" (1.06 MiB)                                             
 - "tmp/14.Fahrenheit-(Indigo-Prophecy).png" (1.19 MiB)                              
 - "tmp/15.Crusader-No-Regret.png" (1.2 MiB)                                         
 - "tmp/1207664923.ini" (3.85 KiB)                                                   
 - "tmp/gog_installer_background.jpg" (79.3 KiB)                                     
 - "tmp/EULA.txt" (0 B)                                                              
 - "tmp/GOG_EULA.txt" (7.33 KiB)                                                     
 - "tmp/changelog.ini" (6.75 KiB)                                                    
 - "tmp/QTEULA.txt" (27.7 KiB)                                                       
Done.
dscharrer commented 10 years ago

Hm, that is odd…

Normally the output for multi-part installers would start with something like:

$ innoextract -t setup_nwn2_complete_2.1.0.6.exe 
Testing "Neverwinter Nights 2 Complete" - setup data version 5.5.0 (unicode)
opening "setup_nwn2_complete_2.1.0.6-1.bin"
 - "app/binkw32.dll" (339 KiB)

You can see that the first .bin file is opened before any files are extracted because the .exe contains only headers. Having both embedded and external data slices is not supported by Inno Setup so I suspect those .bin files are something else.

The tmp/unrar.dll file is also suspicious - have you tried running the unrar and file utilities on the .bin files?

ghost commented 10 years ago

Unrar demands a password for the bin files, which I have no idea where I can find that. File tells me this:

setup_divinity_original_sin_2.5.0.11-1.bin: RAR archive data, v2a,
dscharrer commented 10 years ago

I don't think there's much I can do here then - extracting RAR files is certainly out of the scope of the project.

Unrar demands a password for the bin files, which I have no idea where I can find that.

It is probably embedded in th compiled Inno Setup script code, possibly obfuscated - I have seen something similar with other installers that used Inno Setup's encryption feature, but have no idea why GOG would do that.

Getting to that password could be very hard - doing it reliably would mean implementing Inno Setup scripting and the WinAPI calls it supports, including loading and running external helper DLLs. At that point you might as well run the installer directly (there should be a non-interactive mode as well), either on Windows or under Wine.

shmerl commented 9 years ago

How can it use RAR? Innosetup is an open source tool, and there is no open RAR compressor. I think it's some confusion. This requires some further investigation.

dscharrer commented 9 years ago

I don't think Inno Setup is directly using rar here. The innoextract -l output posted shows that there is a unrar.dll, which most likely gets called by GOG's setup scripts. This isn't anything vanilla Inno Setup will do so GOG (or Larian?) must have added on their own. I have no idea why - maybe rar provided a better compression ratio or extract speed than lzma2 in this case.

Have you seen any other GOG installers like this? I'm only aware of Divinity: Original Sin so far.

shmerl commented 9 years ago

@dscharrer : You are right. I just checked it for Deponia (the first game, 2.2.0.8). Other games that were reported to be affected by this:

Heroes of Might and Magic 5, French version 2.1.0.22 Heroes of Might and Magic 5: Tribes of the East, French version 2.1.0.24 Overlord: Rising Hell, French version 2.1.0.13 The Bard’s Tale, version 2.1.0.9 Deponia, version 2.2.0.8 Chaos on Deponia, version 2.2.0.6 Goodbye Deponia, version 2.1.0.10

For first Deponia, the first file setup_deponia_2.2.0.8.exe is an innosetup archive, and the second file (setup_deponia_2.2.0.8.bin) is an encrypted RAR archive.

Is there any way to extract the scripts from the package made by innosetup which are executed by the installer? May be then it will be possible to figure out how that password is generated.

dscharrer commented 9 years ago

It appears this is more common after all :( A few that I have:

File Format Password
setup_assassins_creed_2.1.0.23-1.bin RAR
setup_baldurs_gate2_french_2.1.0.17.bin RAR
setup_nwn_diamond_french_2.1.0.19.bin RAR
setup_the_bards_tale_2.1.0.9.bin RAR
setup_the_witcher_2_ee_3.0.1.17.bin FreeArc
setup_the_witcher2_ee_3.4.0.25.bin Inno Setup (patch)
setup_wasteland2_2.4.0.13-1.bin RAR

However not all installers with version 2.1+ and multiple files are affected. At least this one is fine:

Smaller installers with only the .exe file are also still standard Inno Setup installers.

Is there any way to extract the scripts from the package made by innosetup which are executed by the installer?

Not currently, but that is easy to add - it's part of the headers that innoextract already needs to decompress and parse.

I'll look more into this, thanks for the update.

WTF is GOG encrypting installers for DRM-free games anyway?

shmerl commented 9 years ago

WTF is GOG encrypting installers for DRM-free games anyway?

No idea and it's indeed rather weird for GOG to do such a thing. I'm still waiting for any concrete answer from them. See related discussions here:

shmerl commented 9 years ago

Thanks to great help from immi101 from the GOG forums. He figured out that password is generated as md5sum of the game ID. Id can be extracted from the installations script (install_script.iss)

For Neverwinter Nights for example:

Root: HKLM; Subkey: "SOFTWARE\GOG.com\Games\1207658890"; ValueName: "gameID"; ValueType: String; ValueData: "1207658890"; Components: Component0; MinVersion: 0.0,5.0; Flags: uninsdeletekey 

You need 1207658890. To get the password make md5sum using that as a string. For example to test it with unrar

printf 1207658890 | md5sum | cut -d ' ' -f 1

You'll get 7387bbd6cc05b8c37e1c21b3061f241c

That's the password for unrar. You can also fetch the game ID from the GOG site page for that game as follows:

curl -s -o- http://www.gog.com/game/neverwinter_nights_diamond_edition | pcregrep --buffer-size 1M -o1 "addToCart\('/cart/add/(\d+)'\)"
vv221 commented 9 years ago

While unrar is non-free software, RAR 3.0 archives can be extracted with unar, which is free software (LGPL 2.1+): http://unarchiver.c3.cx/commandline

shmerl commented 9 years ago

Yes, unrar isn't an issue to use.

dscharrer commented 9 years ago

Turns out setup_the_witcher2_ee_3.4.0.25.bin is just an Inno Setup installer for the v.9000 patch - no idea why I didn't check for that.

dscharrer commented 9 years ago

Here's a modified innoextract build: http://constexpr.org/innoextract/files/snapshots/innoextract-1.5-rc1/

Additions:

Any thoughts?

The --gog option is not in master yet, only in the gog branch.

shmerl commented 9 years ago

Sounds good. May be it would be good to add an option for extracting all .iss data as well?

vv221 commented 9 years ago

Some news on the topic: GOG.com decided to drop the password encryption on their installers. https://www.gog.com/forum/general/on_gnulinux_has_anyone_be_able_to_extract_the_rar_innosetup_installers/post470/?staff=yes

I didn’t check if it’s done yet.

ssokolow commented 9 years ago

As far as I can tell, it's not done yet. There's been no indication that new installers have been released so far, either via the flagging system or via manual announcement in the "What did just update?" thread.

dscharrer commented 9 years ago

1.5 is out with the --gog option

parasiteoflife commented 10 months ago

Sorry to reopen this but I want to list the contents of an old installer and I'm being asked for unrar or unar, I already have unrar on my PATH but innoextract keeps asking for it, I'm using Windows 10, I also tried copying the unrar.exe file to the program directory to no avail.