Thursday, December 31, 2015

Extracting without installing: Inno installer
Inno Setup is a free software that's also very popular in installer packaging. It comes with the install_script.iss file that's so useful for any portable application developer.
   You can learn what libraries or services used by the application and most importanty—how to run it, complete with all required arguments/parameters.

How to Identify an Inno Setup Installer

We will use 7-Zip and its "Open archive" feature. There are 3 types of Inno installer:
  1. one that is password protected (encrypted),
  2. one that "can't be opened" by 7-Zip, and
  3. one that can.
The Third Type: 7-Zip-friendly Ones
We'll begin with the most common, the third type, an example is Free Download Manager/FDM installer. Let's open it,Open archive
   This is what an Inno Setup installer typically looks like, Inside Inno
   Let's go inside the .rsrc folder → 1033 (English) folder → and then double click to view the version.txt file. From that file we learn that it is an Inno Setup file, Inside .rsrc
Open text file
The Second Type: Advanced 7-Zip Open Archive
The second type of Inno setup file "can't be opened" with usual Open archive, Usual Open archive
and we'll get an error message like this one:
 Can not open file 'C:\0TEST\a_sharper_scaling_1_2_setup.exe' as archive
Can't open file
   That error message along with installer icon that looks like this one: Inno standard icon
usually means that it is most likely an Inno setup file.
   When these two conditions are met then you can try it out with Inno unpacker utility—to see if it's extractable. We'll show that you later.

   But if we want to make sure if it is an Inno Setup file, we can use the other Open archive > (with more options)—in this case we'll use the #:e option, Open archive >
We'll see something like this: an 1.exe and 2 files, 1 and 2 file
For comparison, other Inno installer Aegisub—this time with Open archive > # option will look like this: now we have 2 pair of "1-2 files" and "3-4 files", Aegisub with #
Similar 1-2 files
But if we open it with #:e option, it will look a lot "better", Aegisub with #:e
We said "better" (in quotes) because even then, we can't really extract the contents properly with 7-Zip. But at least, we can be sure that it is an Inno Setup file.
The First Type: The Troublesome Ones
The rarest Inno setup file is the first type. We might be able to open it with 7-Zip but we can't extract its content with Inno Setup unpacker—without knowing the password.
   One example is VSDC Free Video Editor installer. We have to log its installation in VM/virtual machine and then following the before/after snapshots log to collect all the files manually... :(
   It can be troublesome when the installer not just extracting its content in one place, which is usually %PROGRAMFILES% or %PROGRAMFILES(X86)% folder.
   In case of VSDC installer, it also extracts to %COMMONPROGRAMFILES% or %COMMONPROGRAMFILES(x86)% and scatters quite a lot to %WINDIR%\SYSTEM32. This will mean a lot of work for each upgrade!
   We're lucky that this kind of installers are rare. We only ever encountered one: VSDC Free Video Editor. We do hope they will change their policy :)

How to Extract Inno Setup File

Download the command line utility from Inno Setup Unpacker website. The help file is included in the package, but we'll use this ready to use command line template:
 innounp -x -m -a -d"__" "__.exe"
   We'll use "A Sharper Scaling/ASS" installer as example.
  1. Let's put ASS installer and innounp.exe in the same folder.
  2. Copy the command line template above to a text file → replace the "__" in the command line template with ASS installer name a_sharper_scaling_1_2_setup so it becomes:
      innounp -x -m -a -d"a_sharper_scaling_1_2_setup" "a_sharper_scaling_1_2_setup.exe"
    → copy that command line to clipboard (Ctrl+C).
  3. Bring up a command window by pressing the Shift key → right-click on any empty space on the folder → click "Open command window here" → paste the command line we just copied and press Enter. Don't close the windows, wait until the extraction finished, usually it ends with install_script.iss file, Open command window
    Paste the command
    Extraction completed
  4. Done! Here are the files, Extracted folder
    app folder

One more thing, you can open more than one window command to extract several Inno Setup files in parallel.