Wednesday, November 23, 2011

Basics of Application Repackaging

What is Windows Installer technology ?

Windows Installer is a built-in Operating System service that manages the installed state of an application on windows operating system. The installed state includes installation, repair, uninstallation and upgrades of application.

The widows installer service is the part of the windows XP professional, windows vista,windows 7 ,windows 2000 professional and windows is available for windows 95,windows 98 and windows NT 4.0 systems

Versions of windows installer
  • Version 1.1 Windows ME
  • Version 1.2 Windows 2000
  • Version 2.0 Windows XP and Server 2003
  • version 3.0 Windows XP SP2
  • Version 3.1 Windows XP SP3,Windows Server 2003 SP1, SP2,Windows XP Professional x64 Edition RTM, SP2
  • Version 4.0 Windows Vista RTM, SP1,Windows Server 2008 RTM
  • Version 4.5 Windows Vista SP2,Windows Server 2008 SP2
  • version 5.0 Windows 7 RTM ,Windows Server 2008 R2 RTM
Before Windows Installer technology:
  • No standard rules for application installation.Each application has its unique rules.
  • Improper management of shared resources giving raise to problem of DLL hell.No method of maintaing reference count which breaks application across the system.
  • Application May break the system integrity while installing and uninstalling including breaking other applications and in worse case breaking the target Operating system.
  • No conflict management.
  • High maintenance costs.
What is the need of Windows Installer:
  • There are no standard rules for legacy application installation, uninstalling and upgrading, each application has its own unique rules. Hence to provide a standard format windows installer came into exsistence.
  • For proper management of shared components.
  • To maintain system stability this may get break during installation, un-installation and upgrading of application.
  • To reduce high maintenance cost by saved time and effort through automated installs.
Overview of Windows Installer :
The Windows Installer technology is made up of three elements that work together:
1.Windows Installer client: Its any application that calls Windows Installer to perform a task.
2. Windows Installer service: It uses information in a Windows Installer package file to manage all phases of installing a program-- install, change, upgrade and remove.
3. Windows Installer package (Msi File): It contains a database that stores all the instructions for the Windows Installer service and data required to manage the state of a program, such as adding, changing, or removing it from a system.
For Example a simple windows installer MSI can have the following structure.The MSI contains the installation and uninstallation logic, information about the application files and shortcuts actions,configuration settings as per the target system.The files can be in the external format which is uncompressed and may be in compressed format as per requirement.

Benefits of Windows Installer technology:
  • Provides a standard Package format for distribution through the organization or a company.
  • Self heal of corrupted or deleted files i.e Critical files.
  • Advertising.
  • Install on Demand.
  • Unattended installation.
  • Rollback.
  • Elevated Privileges.
Application Packaging Process:
Following Process describes the flow in which the source Application form start to end is subjected till the User Acceptance Stage:

  • Review the packaging requirements (Inward Sanity Check: Client Requirement Review).
  • Analyze the vendor package (Application Analysis with Tech Review).
  • Repackage the application (Package Development: Setup capture).
  • Customize the package (Scripting).
  • Test the package (Peer Testing & UAT).
  • Release the package to end users (Deployment).
Installtion Database
Installation Database is divided into two types of tables:
  • Information about software application to be installed.
  • Information about actual execution of the package.
1.       The installation database is a set of relational tables that are linked together through the data in various primary and foreign keys.
2.       MSI Database Tables are divided into different types of groups which maintain data related to the application:

  • Core Tables Group(Feature,condition,Feature Component,Directory etc.)
  • File Tables Group(File,RemoveFile,IniFile,Icon,Media table etc.)
  • Registry  Tables Group(Registry,AppID,ProgID,TypeLib,MIME,Class etc.)
  • Locator Tables Group(Appsearch,Reglocator,Drlocator,Complocator etc.)
  • Program Information Tables Group(Property,Binary,Error,Shortcut table etc.)
  • System Tables Group(_Table, _Validation, _Columns tables etc.)
  • Installation Procedure Tables Group(RemoveFile,RemoveRegistry,CreateFolder,Custom Action table etc.)
Types of Files in Application Repackaging


Contains of a windows installer application or product i.e MSI
Windows Installer categorizes the elements of an application or product into three containers:
components, features, and products:
  1. A Windows Installer component is a collection of files, registry keys, and other resources that are installed or uninstalled together on the client computer.In layman terms a component is like a container which contains the required resources for the application.
  2. Windows Installer features are groupings of components. Features are the granular or the basic installation units of an application that a user can choose to install, and typically they represent the functional elements of the application, such as the spelling checker in Microsoft Word.
  3. A Windows Installer product can represent a single application such as Microsoft Project or a suite of applications such as Microsoft Office. 
Mechanism of an MSI(flow during installation)

  1. when ever a MSI is double clicked or installed via cmd line, a background process msiexec.exe is executing in multiple mode(refer to multiple msiexec.exe process in my blog).
  2. This first phase is a acquisition phase or a information gathering phase where information related to files,registries,appsearch,feature selection etc is gathered and a script is generated which is passed to the next phase know as execution phase.
  3. In execution phase, the script previously generated is used here and passed to process running with elevated privileges and the script is executed.for complete details refer to custom actions post in my blog.
  4. rollback phase comesinto play if the installation is unsuccessful, the installer restores the original state of the computer.
what is a transform(MST) and its types?

A transform is a windows installer file with the extension (.MST). It should be used along with a MSI to customize or change the installation package without modifying the MSI. The installer can only apply transforms during an installation.

Types of transform are embedded,secured and unsecured transforms.

  • Embedded transforms

  1. Embedded transforms are stored inside the .msi file of the package. This guarantees to users that the transform is always available when the installation package is available.
  2. To add an embedded transform to the transforms list, add a colon (:) prefix to the file name. Because the installer can always obtain the transform from storage in the .msi file, embedded transforms are not cached on the user's computer.
  3. Eg TRANSFORMS= :t1.mst;t2.mst;:t3.mst
  •  Secured transforms
  1. Secured transforms are sometimes necessary for security reasons. Secured transforms are stored locally on the user's computer in a location where, on a secure file system, the user does not have write access. Such transforms are cached in this location during the installation or advertisement of the package. Only administrators and local system have write access to this location. A non-admin user would not be able to modify the transform file.To Specify a secure transform use the TRANSFORMSSECURE property, or pass the @ or | symbol in the transform list.

  • UnSecured Transform
  1. Transforms that have not been secured as described in Secured Transforms are unsecured transforms by default.To apply an unsecured transform when installing a package, pass the transform file names in the TRANSFORMS property or command line string. Do not begin the string with the @ or | characters or set the TransformsSecure policy or the TRANSFORMSSECURE property. Note that you cannot combine unsecured transforms and secured transforms in the same transforms list.


No comments: