Freigeben über


Developer Story Windows Installer

Developing with the Microsoft Windows Installer

Introduction

The Windows Vista® enhancements in Microsoft® Windows® Installer version 4.0 build on the robust and familiar interfaces known to developers.

Compatibility with Windows Installer version 3.0 is maintained. Therefore developers who want to make use of Windows Vista features need to be familiar with the technologies in current and earlier versions.

The primary resource for this information is the Windows Installer section of the Windows Software Development Kit (SDK), which provides:

  • Information about installations and the installer service

  • Complete descriptions of the API and the elements of the installer database

  • Supplemental information of interest to developers who want to make or maintain an installation or to use a table editor

For additional topics organized by professional role and common task scenarios, see the "Role-based Guide to Windows Installer Documentation" section of the Windows SDK. The Windows Installer Team Blog (https://blogs.msdn.com/windows\_installer\_team/) is a useful resource for information, especially the "Tao of the Windows Installer" series of articles.

Integration with Windows Vista Security

Windows Installer version 4.0 fully integrates with the Windows® User Account Control (UAC) and Windows Resource Protection (WRP) technologies. The main scenarios where Windows Installer interacts with User Account Control involve elevating user rights for the installation process to administrator level (regardless of the user rights level of the current user). This operation is known as elevated installation.

  • Group policy is used within organizations to configure and control the installation of managed applications (managed is used here in a different context than managed .NET Framework 3.0 applications). Installations and patches for such applications are automatically elevated. The MsiIsProductElevated function can be used to determine if the current installation is for a managed application.

  • When used in an unmanaged environment, UAC prompts the user for consent to run the installation. If accepted, the Windows Installer automatically calls the Windows Application Information Service (AIS) to request elevated user rights.

  • User Account Control (UAC) patching enables the authors of Windows Installer installations to identify digitally-signed patches that can be applied later by non-administrator users. (UAC Patching was called Least-Privileged User Account Patching in Microsoft Windows XP.) Elevated patching can be controlled by the AllowLockdownPatch machine policy.

These UAC integration measures are backward-compatible with previous versions of Windows, where they are ignored. For more general information, see "Using Windows Installer with UAC" in the Windows SDK. Additional policies that affect installation are documented in the "System Policy" section of the Windows SDK.

Mandatory Integrity Control (MIC) and WRP security mechanism are uniformly applied to all processes, including Windows Installer installations. This ensures that the installation is not influenced by processes with lesser user rights, and that corrupted Windows components will not be installed. The Windows Installer will silently skip the installation of any file or modification of any registry key that is protected by WRP.

Integration with the Restart Manager

Considerable improvements have been made in the Windows Installer to reduce the need for system restarts during installs, uninstalls, maintenance tasks, and patching of applications. One important change is that the default behavior of the Windows Installer is to shut down applications over system reboot whenever possible (although this can be overridden by the MSIRESTARTMANAGERCONTROL property or the DisableAutomaticApplicationShutdown system policy). The new RmShutdownAndRestart event notifies the Windows Installer to use the Restart Manager to shutdown all applications that have files in use and to restart them at the completion of the installation.

Developers can use the following steps to further integrate the capabilities of an installation package using the Restart Manager:

  • Add the MsiRMFilesInUse dialog box to packages to enable a user running at Full UI user interface level to automatically close and restart applications. This dialog replaces the FilesInUse dialog, and should also be displayed by custom user-interface handlers enabled through the MsiSetExternalUI and MsiSetExternalUIRecord functions whenever an INSTALLLOGMODE_RMFILESINUSE message is received.

  • Use the RegisterApplicationRestart function so that applications can register to be restarted automatically after installation is complete. Applications should save their state after receiving a shutdown message.

  • Have custom actions that are modifying the system's state call the RmJoinSession and RmEndSession functions of the Restart Manager API to add files to the list of resources to be freed by Restart Manager.

  • Base installation conditions in the LaunchCondition table on the new MsiSystemRebootPending property to prevent the installation of the package when a system restart is pending.

For more information, see "Using Windows Installer with Restart Manager" in the Windows SDK.

Application Reliability and Manageability Features

Logging and management integration have been improved in Windows Installer 4.0.

Logging Changes

Logging can now be controlled on an individual package level through the use of the MsiLogging property in the package's property table. If this optional property is present, the installer generates a log file using the default naming scheme MSI*.LOG. The full path for this log file can be accessed through the MsiLogFileLocation property. The default logging mode of a package can be modified through database transforms but not by patch packages (.msp files).

The following order of precedence determines whether the installer performs logging:

  1. The MsiEnableLog function or the EnableLog method of the Installer object.

  2. The command-line /L option.

  3. The MsiLogging property in the package's property table.

  4. The Logging machine policy.

Note

The exception to this order is that the DisableLoggingFromPackage policy can be used to disable all installation logging.

Multilingual User Interface Support

Windows Installer 4.0 contains support for applications that use Multilingual User Interface (MUI) resources in their single worldwide installation package. Support for this technology is provided by new entries in the shortcut table of the installation package.

The following lists these entries and their descriptions.

Property

Description

DisplayResourceDLL

A string that contains the full path to the language neutral file that contains the MUI manifest

DisplayResourceId

The integer display name index for the shortcut

DescriptionResourceDLL

A string that contains the full path to the language neutral file that contains the MUI manifest

DescriptionResourceId

The integer description name index for the shortcut

For more information about MUI, see "Multilingual User Interface" in the Windows SDK.

Windows Management Instrumentation Enhancements

The Microsoft Windows Installer provider supplies applications enabled with Windows Management Instrumentation (WMI) these capabilities:

  • Access to information collected from Windows Installer–compliant applications.

  • Access to the functionality of the Windows Installer platform.

This functionality is exposed as a set of WMI interfaces and classes.

To describe the capabilities of Windows Installer, the following properties have been added to the WIN32_Product WMI class:

Property

Description

AssignmentType

The value that specifies whether the software is installed per-user (0) or per-machine for all users (1)

HelpLink

The Internet address for technical support

HelpTelephone

The telephone number for user assistance

InstallSource

The root directory that contains the source cabinet file or the source file tree of the installation package

Language

The primary language being installed by the product

LocalPackage

The path to the local cached copy of the install package

PackageCode

GUID identifier of the installation package

PackageName

Name of the original installation package

ProductID

The product identifier for the product

RegOwner

The individual user registered to use the application

RegCompany

The company registered to use the application

Transforms

A list of the language transforms that the installer applies when installing the package

URLInfoAbout

The URL that links to the publisher's or application's home page

URLUpdateInfo

The URL used to update information on the application

WordCount

A bit field that contains summary information about the type of source file image (for more information, see "Word Count Summary Property" in the Windows SDK)

For more information, see "Windows Installer Provider" in the Windows SDK.

See Also

Concepts

Installation and Update Management