Easy MSI - A basic guide to Windows Installer

Click here to edit subtitle

Chapter 2 - Basics (Download Solution)


Exercise 2.1: Authoring the SIS


In this exercise you will author the Summary Information Stream of your just created blastermaster.msi package.


Open your blastermaster.msi package with InstEd. Click on Tables > Summary Info and modify the Summary Information Stream with the values as shown in table below.

SUMMARY PROPERTY
 Value
Title
Installation Database
 Author
Easy MSI Book Company
 Subject
Blaster Master
 Comments
This installer database contains the logic and data required to install Blaster Master
 Keywords
Installer, Blaster Master
 Platform
Intel
 Languages
1033
 Package Code
{E3A8910A-DA82-420E-936A-6F8E42C3A28F} (Click button to generate new GUID)
 Schema
400
 Security
read-only recommended
 Image Type
External Tree. Long file names
Requires elevated privileges? (Checkbox)
 Yes (Tick checkbox)
 Code Page
 1252

Exercise 2.2: Adding Features and Components


In this exercise you will use InstEd to add new features and components to your blastermaster.msi package.


First you need to author the Feature table and add the three new features "Blaster Master", "User Manual", and "Blaster Master Service" as described by the tables below:

Column
 VALUE
Feature
 Feature_BlasterMaster
 Feature_Parent
 <null>
 Title
 Blaster Master
 Description
 Core binaries to run the game.
 Display
 2
 Level
 1
 Directory_
 <null>
 Attributes
 0x0000
COLUMN
 VALUE
Feature
Feature_UserManual
Feature_Parent
  <null>
Title
 User Manual
Description
 The User Manuals as PDF.
Display
 1
Level
 1
Directory_
 <null>
Attributes
0x0000
COLUMN
 VALUE
Feature
 Feature_BlasterMasterService
Feature_Parent
 <null>
Title
 Blaster Master Service
Description
 Blaster Master Service logging to the Event Log.
Display
1
Level
 1
Directory_
 <null>
Attributes
 0x0000

Next add the two records for the subfeatures (english and german user manals) to the Feature table:

COLUMN
 VALUE
Feature
 Feature_UserManual_English
 Feature_Parent
 Feature_UserManual
 Title
  English
 Description
 The English User Manual.
 Display
  2
 Level
  1
 Directory_
  <null>
 Attributes
 0x0000
COLUMN
 VALUE
 Feature
 Feature_UserManual_German
 Feature_Parent
 Feature_UserManual
 Title
  German
 Description
 The German User Manual.
 Display
 2
 Level
 1
 Directory_
  <null>
 Attributes
 0x0000

Next add the record for the "Product Name Registry Key" to the Component table:

COLUMN
 VALUE
Component
 Comp_Reg_ProdName
ComponentId
 <new GUID>
Directory_
 TARGETDIR
Attributes
 0x0004
Condition
 <null>
KeyPath
  <null>

Finally link the component to its feature by adding the following record to the FeatureComponents table:

COLUMN
 VALUE
Feature_
 Feature_BlasterMaster
 Component_
 Comp_Reg_ProdName

Exercise 2.3: Properties


In this exercise you will a the required properties to your blastermaster.msi package.


Add the following new records to the Property table:

PROPERTY
 VALUE
ProductCode
 <new GUID>
ProductVersion
 1.0.0
ProductName
 Blaster Master
Manufacturer
 Easy MSI Book Company
UpgradeCode
 <new GUID>

Then add the following new record to the Directory table:

COLUMN
 VALUE
 Directory
 TARGETDIR
 Directory_Parent
 <null>
 DefaultDir
 SourceDir

Exercise 2.4: Installing to the Registry and AppSearch


In this exercise you will install keys to the Registry and using AppSearch for finding files, directories, components, .ini file entries, and registry values.

As a first start use AppSearch to find out if the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727 registry key exists.
Therefore add the following new record to the AppSearch table:
COLUMN
 VALUE
Property
 DOTNET_REGKEY
Signature_
 RegLocator_DOTNET_REGKEY

Next add the following new record to the RegLocator table:

COLUMN
 VALUE
Signature_
 RegLocator_DOTNET_REGKEY
 Root
 0x002 (HKLM)
 Key
 SOFTWARE\Microsoft\.NETFramework\v2.0.50727
 Name
 <null>
 Type
 0x002 (registry value)

Now author the LaunchCondition table for making the presence of the .NET registry key a launch prerequiste for the package:

Column
 VALUE
Condition
 NOT DOTNET_REGKEY
 Description
 This package requires .NET Framework 2.0 to run.

In a next step we use AppSearch in order to find the path to notepad.exe.

Therefore first add the following new record to the AppSearch table:

COLUMN
 VALUE
Property
 NOTEPAD_PATH
Signature_
 Signature_NOTEPAD_PATH

Then add the following record to the Signature table:

COLUMN
 VALUE
Signature_
 Signature_NOTEPAD_PATH
 FileName
 notepad.exe
 MinVersion
 <null>
 MaxVersion
 <null>
 MinSize
 <null>
 MaxSize
 <null>
 MinDate
 <null>
 MaxDate
 <null>
 Languages
 <null>

Then add the following record to the DrLocator table:

COLUMN
 VALUE
Signature_
 Signature_NOTEPAD_PATH
 Parent
 <null>
 Path
 [SystemFolder]
 Depth
 0

Now we use AppSearch for a component search in order to retrieve the path of InstEd.exe.

Therefore first add the following new record to the AppSearch table:

COLUMN
 VALUE
Property
 INSTED_PATH
Signature_
 CompLocator_INSTED_PATH

Next add the following new record to the CompLocator table:

Column
 VALUE
Signature_
 CompLocator_INSTED_PATH
 ComponentId
 {578FE71F-EDB7-4A0A-A9A4-4D9877E1385D}
 Type
 1

Now we are writing the Product Name into the resistry. For that purpose add the following new record to the Registry table:

Column
 VALUE
 Registry
 Reg_ProductName
 Root
 0x002 (HKLM)
 Key
 SOFTWARE\[Manufacturer]\[ProductName]
 Name
 ProductName
 Value
 [ProductName]
 Component_
 Comp_Reg_ProdName

Now you need to create the component for writing the AppSearch results into the registry.

Therefore add the following new record to the Component table:

COLumn
 VALUE
Component
 Comp_Reg_AppSearchKeys
 ComponentId
 <New GUID>
 Directory_
 TARGETDIR
 Attributes
 0x0004
 Condition
 <null>
 KeyPath
 <null>

Then add the just created component to the "Blaster Master" feature by authoring the FeatureComponents table:

Column
 VALUE
Feature_
 Feature_BlasterMaster
 Component_
 Comp_Reg_AppSearchKeys

Finally import the file export.reg as described in the book.

Once this is done fix the imported entries in the Registry table as follows:

Registry
 Root
 Key
 Name
 VALUE
 COMPONENT
Reg_AppSearchKeys_reg00000
  2
SOFTWARE\[Manufacturer]\[ProductName]
 DOTNET_REGKEY
 [DOTNET_REGKEY]
Comp_Reg_AppSearchKeys
Reg_AppSearchKeys_reg00001
  2
SOFTWARE\[Manufacturer]\[ProductName]
NOTEPAD_PATH
[NOTEPAD_PATH]
Comp_Reg_AppSearchKeys
Reg_AppSearchKeys_reg00002
  2
SOFTWARE\[Manufacturer]\[ProductName] 
INSTED_PATH
[INSTED_PATH]
Comp_Reg_AppSearchKeys