Pages

Showing posts with label application packaging interview questions. Show all posts
Showing posts with label application packaging interview questions. Show all posts

Sunday, 5 August 2012

INSTALLDIR vs. TARGETDIR


INSTALLDIR represents the main product installation directory 


TARGETDIR represents the installation directory for an administrative Windows Installer–based installation (when the user runs MsiExec.exe with
the /a command-line switch).

Saturday, 4 August 2012

Windows File Versioning Rules


Suppose your installation source contains a file named newstuff.dll, and the
Installer finds a copy of newstuff.dll already on the user’s hard drive. How
would you decide whether to overwrite the existing copy on the hard drive with a new copy from the source media? Your first idea might be to compare file dates; you would then overwrite if the copy in the source media was newer. A more sophisticated version of this technique is to look at the internal file version information, and overwrite if the copy in the source media has a higher version.


The Windows Installer uses an even more complex algorithm when deciding
whether to keep an existing file or install a new copy. It takes into account not just the file dates and the version, but the languages involved as well. Here’s the set of rules the Windows Installer follows:

Highest version wins: All other things being equal, the file with the highest
version number wins, whether that’s the file on the hard drive or the file in the
source media.


Any version is higher than no version at all: If the copy in the source media
contains version information, and the copy on the hard drive has no version
information, Windows Installer chooses the one with the version information.


Favor the new language: All other things being equal, if the file being
installed is localized for a different language than the file on the computer, Windows Installer uses the copy with the language that matches the product being installed.


Meet the product’s needs for multiple languages: If both copies support
multiple languages, Windows Installer ignores the common languages and uses the copy that supports the most languages out of the set of languages that the product uses.


Keep the maximum number of languages: If the copies differ in the number
of languages they support and both support all the languages that the product
needs, Windows Installer keeps the copy that supports the most languages.


Treat non-versioned files as user data: If there is no version information for
either copy, Windows Installer compares the file creation date and the last modification date for the file on the computer. If the modification date is later than the creation date, Windows Installer assumes this file has been customized by the user and does not overwrite it. Otherwise, it installs a new copy.


Companion files go along with the versioned file: It’s possible to mark a
file within the Installer database that does not include version information as a companion file to a file that does include version information. In this case, the companion file is installed if the other file is installed. There is one exception to this rule, though. If the companion file is not present on the target machine, it’s installed even if the versioned file is not installed.


It’s a good thing that these rules match the way most developers would like
installations to behave because there’s no way for you to change them. Of course, you can pervert their intention if you feel you must. One way to guarantee that a file from the source media is installed is to set its version string in the File table to 65535.65535.65535.65535, which is the maximum version number that the Windows Installer accommodates. Beware, though: if you do this, you’ll never be able to use the Windows Installer to replace that copy of the file with a new version.


Friday, 3 August 2012

MSI Just-in-time (JIT) installation


Just-in-time (JIT) installation—A package need not be fully installed right away. If a feature or component of the package is needed later, it can be grabbed from the source and loaded JIT—all while the application is already started.

MSI Custom Action Type Flags


Value added to Type
Effect
0
Synchronous execution. Fails if exit code is not
zero., Always executed. Immediate
execution.
+64
Synchronous execution. Exit code is ignored
+128
Asynchronous execution. Fails if exit code is not
zero.
+192
Asynchronous execution. Exit code is ignored
+256
Execute once. If the action is in both the UI and
Execute sequence tables, it is executed only in
the UI sequence table if the user interface is
used, and it is executed only in the Execute
sequence table if the user interface is not used.
+512
Execute once per process. If the action is in both
the UI and Execute sequence tables, and both
tables are read by the same process, it is
executed only in the UI sequence table if the user
interface is used, and only in the Execute
sequence table if the user interface is not used
+768
Execute only on client after UI sequence. This
custom action is in the Execute sequence table,
but it should not be run if the user interface is
suppressed.
+1024
Deferred execution custom action
+1280
Rollback custom action
+1536
Commit custom action
+3072
Deferred custom action run in the system
process.


MSI Custom Action Types


This table also shows how you should interpret the Source and Target columns for each type of custom action


Type
Description
Source
Target
1
.dll stored in a binary
Stream
Key to a row in the
Binary table
Name of the .dll
entry point.
2
.exe stored in a binary
Stream
Key to a row in the
Binary table
Command-line string
used to launch the
.exe.
5
JScript in a binary
Stream
Key to a row in the
Binary table
Name of the JScript
function to call.
6
VBScript in a binary
Stream
Key to a row in the
Binary table
Name of the VBScript
function to call
7
Installation of a
package nested inside
of the first package
Name of the substorage
containing
database of nested
application.
Properties settings
string.
17
.dll installed as part
of a product
Key to a row in the File
Table
Name of the .dll
entry point.
18
.exe installed as part
of a product
Key to a row in the File
Table
Command-line string
used to launch the
.exe.
19
Displays a specified
error message and
returns failure,
terminating the
installation
Blank
Formatted text string.
The literal message or
an index into the Error
table.
21
JScript file installed as
part of a product
Key to a row in the File
Table
Name of the JScript
function to call.
22
VBScript file installed
as part of a product
Key to a row in the File
Table
Name of the VBScript
function to call.
23
Installation of a
package that resides in
the first application’s
source tree
Path of nested
package specified
relative to the root of
the source location
Properties settings
String
34
EXE in a known
Directory
Key to a row in the
Directory table
Name of the
executable file and any
options. Use quotes to
surround long file
names.
35
Directory set via
formatted text
Key to the Directory
Table
Formatted text string
that will be set as the
directory path when
this action is executed.
37
JScript text         
Null
A string of JScript code
to execute.
38
VBScript text
Null
A string of VBScript
code to execute.
39
Installation of an
application that is
advertised or already
installed
Product Code for the
application to install
Properties settings
String
50
.exe named by a
Property
Property name or key
to a row in the Property
table
Command-line string
used to launch the
.exe.
51
Property set via
formatted text
Property name or key
to the Property table
Formatted text string
that will be stored in
the property when this
action is executed.
53
JScript text stored in a
Property
Property name or key
to a row in the Property
table
Name of the JScript
function to call.
54
VBScript text stored in
a property
Property name or key
to a row in the Property
table
Name of the VBScript
function to call.


MSI Private Properties

Following are the list of Private Properties


Property
Description
AdminProperties
A semicolon-delimited list of properties that should be “filled in” when an administrative install is performed. When the user later installs from the
Share point, this list is used instead of the values originally in the Installer database.
AdminToolsFolder
Full path to the directory that stores a user’s administrative tools (for example, Microsoft Management Console files).
AdminUser
Set to True if the user has administrative privileges. Always set to True if running on Windows 95 or Windows 98.
Alpha
Set to the processor level if the Installer is running on an Alpha computer.
AppDataFolder
Full path to the directory that stores the user’s application data.
BorderSide
Width of a Windowsdialog box borders in pixels.
BorderTop
Height of a Windows dialog box borders in pixels.
CaptionHeight
Height of a Windows caption in pixels
ColorBits
Color depth for the current video settings
CommonFilesFolder
Full path to the directory that stores the user’s common files.
CommonAppDataFolder
Full path to the directory that stores the user’s application data.
ComputerName
Name of the computer where the installation is running. Set by the Installer by calling the GetComputerName API.
CostingComplete
This property is set to zero by the CostFinalize action. The Installer sets it to 1 when costing is completed.
Date
Current date as a text string.
DefaultUIFont
The name of the TextStyle to use by default on controls. You should set this in the Property table.
DesktopFolder
Full path to the current user’s desktop.
DiskPrompt
String that the Installer uses to prompt for a new source disk.
EnableUserControl
Setting this to 1 has the effect of making all public properties unrestricted.
FavoritesFolder
Full path to the Favorites folder of the current user.
FontsFolder
Full path to the system font’s folder.
Installed
Set to 1 if the product has already been installed for the current user, or on a per-machine basis. Useful to detect when you’re in maintenance mode instead of installing for the first time.
Intel
Set to the processor level (4 for 486, 5 for Pentium, etc.) if the installation is running on an
Intel-based computer.
IsAdminPackage
Set to 1 if the current installation is being run from a package created by an administrative installation.
LeftUnit
Set to 1 to display units to the left of numbers in such things as free space displays.
LocalAppDataFolder
Full path to the application data folder for nonroaming applications.
LogonUser
Name of the current user, set by a call to the
GetUserName API.
NetHoodFolder
Full path to the Network Neighborhood folder. Although this property has been dropped from the most recent SDK documentation, it still works.
Manufacturer
Manufacturer of the product. You must set this property’s value in the Property table.
MyPicturesFolder
Full path to the user’s My Pictures folder.
OLEAdvtSupport
Set to True if the current system supports installon- demand and advertisement.
OutOfDiskSpace
Set to True if any disk in the system doesn’t have enough free disk space for the installation to complete.
OutOfNoRbDiskSpace
Set to true if any disk in the system doesn’t have enough free disk space for the installation to complete even if rollback is disabled.
PersonalFolder
Full path to the current user’s Personal folder.
PhysicalMemory
Megabytes of actual RAM installed in the current computer.
PIDTemplate
String used as a template for the PIDKEY property.
Preselected
Set to 1 when the selection dialog has already been processed.
PrintHoodFolder
Full path to the user’s Printer Neighborhood folder. Although this property has been dropped from the most recent SDK documentation, it still works.
PrimaryVolumePath
Path portion of the PRIMARYFOLDER property
PrimaryVolumeSpaceAvailable
Number of bytes available on the primary volume, in units of 512 bytes.
PrimaryVolumeSpaceRequired
Number of bytes required by all selected features on the primary volume, in units of 512 bytes.
PrimaryVolumeSpaceRemaining
Number of bytes remaining after installation on the primary volume, in units of 512 bytes.
Privileged
Set to 1 when the installation is running with administrative privileges.
ProductCode
GUID that identifies this product. You must set a value for this property in the Property table.
ProductID
Set to the product ID by the ValidateProductID action.
ProductLanguage
Language ID to use for internal Installer strings displayed to the user.
ProductName
Name of the product being installed. You must set a value for this property in the Property table.
ProductState
Will return –1 if the product is neither advertised nor installed, 1 if the product is advertised but not installed, 2 if the product is installed but for a different user, or 5 if the product is already installed for the current user.
ProductVersion
Product version represented as a string in the format 00.00.0000. You must set a value for this property in the Property table.
ProgramFilesFolder
Full path to the user’s Program Files folder.
ProgramMenuFolder
Full path to the user’s Program folder in the Start menu.
RecentFolder
Full path to the current user’s Recent folder. Although this property has been dropped from the most recent SDK documentation, it still works.
RemoteAdminTS
Set to 1 when the system is configured for remote administration via Windows Terminal Services.
ReplacedInUseFiles
Set to 1 if the Installer replaces a file that’s in use (thus requiring a reboot to finish the installation).
RestrictedUserControl
Set to 1 if the user can’t change the value of restricted public properties.
RollbackDisabled
Set to 1 whenever rollback has been disabled by any means.
ScreenX
Width of the screen (in pixels).
ScreenY
Height of the screen (in pixels).
SecureCustomProperties
Semicolon-delimited list of public properties that should be treated as restricted public properties.
SendToFolder
Full path of the Send To folder for the current user.
ServicePackLevel
Major revision number of the most recent service
pack applied to the operating system
ServicePackLevelMinor
Minor revision number of the most recent service pack applied to the operating system.
SharedWindows
Set to 1 when the system is operating in shared
Windows mode.
ShellAdvtSupport
Set to 1 if the operating system supports advertising.
SourceDir
The root directory of the current installation package.
StartMenuFolder
Full path to the current user’s Start Menu folder
StartupFolder
Full path to the current user’s Startup folder.
System16Folder
Full path to the Windows System folder.
SystemFolder
Full path to the Windows System32 folder.
SystemLanguageID
Default language for the system. The Installer sets this by calling the GetSystemDefaultLangID API.
TempFolder
Full path to the user’s Temp folder
TemplateFolder
Full path to the user’s Templates folder
TerminalServer
Set to 1 when the Installer is running on Windows
Terminal Server.
Time
Current time in the format HH:MM:SS. 
TTCSupport
Set to 1 if the system supports .ttc (TrueType
Font Collection) files.
UILevel
2 for none, 3 for basic, 4 for reduced, or 5 for the full user interface.
UpdateStarted
Set to 1 when changes have been made to the user’s system.
UpgradeCode
A GUID representing allowable upgrades.
UserLanguageID
The default language ID for the current user. The
Installer sets this by calling the GetUserDefaultLangID API.
Version9X
If running on Windows 95 or 98, this is set to 100 times the major version of Windows plus the minor version of Windows.
VersionDatabase
Numeric version of the Installer database for the package being installed.
VersionNT
If running on Windows NT or Windows 2000, this is set to 100 times the major version of Windows plus the minor version of Windows.
VirtualMemory
Size of the current page file in megabytes.
WindowsBuild
Build number of the operating system. 
WindowsFolder
Full path to the Windows folder.
WindowsVolume
Root of the drive containing the Windows folder.