Enhanced Service Configuration for Windows Installer 5.0


Windows Installer 5.0 provides enhanced native support for setup authors to configure services which are a part of an application install MSI. The new MsiServiceCofig and MsiServiceConfigFailureActions tables will provide options to Configure a service with enhanced options. Windows Vista brought in some significant changes to the services model to improve performance, reliability, security, management, and administration of services.

  • Delayed Auto-Start – These services starts shortly after the system has started to improve the system startup performance.
  • Failure Detection and Recovery – Automatic Service restart by the service control manager (SCM) on failure.
  • Preshutdown Notifications- This provides services with a lengthy shutdown procedure more time to shut down gracefully.
  • Restricted Network Access
  • Running with Least Privilege – Services can run under any account that contains the required privileges (LocalService, NetworkService, LocalSystem, a domain account, or a local account).
  • Service Isolation – Isolate objects, such as files or registry keys for its exclusive use by securing them with an access control entry.
  • Service State Change Notifications
  • Session 0 Isolation- Session 0 is reserved exclusively for services and other applications not associated with an interactive user session. Session 0 does not support processes that interact with the user. This change means that a service cannot post or send a message to an application and an application cannot send or post a message to a service. In addition, services cannot display a user interface item such as a dialog box directly.For Reading more on Session 0 Isolation – Click here.

Implementation:

The services in the MSI packages are handled using ServiceControl and ServiceInstall tables. The ServiceInstall table is used to install a service to the machine, ServiceControl table is used to start, stop or delete a service from your machine during an installation or un-installation. Going forward in Windows 7 (Windows Installer 5.0), we will have new MsiServiceCofig / MsiServiceConfigFailureActions tables which configure a service with enhanced service configuration options.

MsiServiceConfig table provides options for configuring a service that is being installed or one that already exists on the machine by specifying the type of configuration as well as the parameters needed for that configuration.

MsiServiceConfigFailureActions table is used to document failure actions that need to be invoked in the event of a service failure. This change takes effect the next time the system is started. Both these tables will be processed during the MsiConfigureServices action.

The MsiConfigureServices standard action should be scheduled in the following order:

  1. StopServices – From ServiceControl table
  2. DeleteServices – From ServiceControl table
  3. InstallServices – From ServiceInstall table
  4. MsiConfigureServices – From MsiServiceConfig and MsiServiceConfigFailureActions tables
  5. StartServices – From ServiceControl table

Note: the standard action MsiConfigureServices is introduced only in Windows 7 and will not be re-distributable for Vista/Xp.

References:
Windows Installer Team Blog
Service Model Enhancements in Windows Vista