Windows Server Summit 2024
Mar 26 2024 08:00 AM - Mar 28 2024 04:30 PM (PDT)
Microsoft Tech Community
LIVE
Understanding Component-Based Servicing
Published Mar 15 2019 06:50 PM 40K Views
Microsoft
First published on TECHNET on Apr 23, 2008


Prior to Windows Vista, if you wanted to install optional components, Windows Updates or driver files on your system, the process was fairly simple.  In Windows Vista, the new componentization architecture, known as Component-Based Servicing (CBS) changes the way that these components are installed.  The CBS architecture is far more robust and secure than the installers in previous operating systems.  Users benefit from a more complete and controlled installation process that allows updates, drivers and optional components to be added while simultaneously mitigating against instability issues caused by improper or partial installation.  CBS allows components and features from IIS to Windows Media Player to be packaged as small modules that encompass the full functionality of the component.  In other words, each module contains all of the files, registry settings, and methods required for a full installation or removal of the component it contains.  The Core componentization services include the following:

  • CBS (Component Based Servicing) - Also known as the trusted installer (TRUSTEDINSTALLER.EXE), which works at the package / update level
  • CSI (Component Servicing Infrastructure) - Works at the deployment/component level
  • DMI (Driver Management and Install) – Advanced driver installation processes
  • CMI (Component Management Infrastructure) - Handles the advanced installers
  • SMI (Systems Management Infrastructure) – Used to manage registry settings
  • Kernel Transaction Manager (KTM) – Enables clients to use the transactional registry and file system

The Servicing Stack in Windows Vista consists of three levels:

  • At the top of the stack are the top level clients, such as Windows Update, Programs and Features, and MSI, which deliver packages to a system.  The top-level clients are also responsible for control of user input and collection of user preferences during the servicing process.
  • In the middle of the servicing stack is the Trusted Installer, CBS.  The top-level clients pass downloaded packages to CBS, which evaluates each individually to determine if they are applicable to the system.  For applicable updates, CBS provides the components to CSI, generates appropriate installation events, and registers packages with Programs and Features if needed.  Finally, CBS exposes the interfaces to enumerate and inventory the updates.
  • At the bottom of the servicing stack is CSI, which uses the Kernel Transaction Manager (KTM) to do its work.

CSI is responsible for the actual installation of components.  To install components, CSI utilizes the Component Store (the %windir%\WinSXS folder) which is a collection of all components, manifests (%windir%\WinSXS\Manifests) and files on the system.  As new components are added, CSI moves them into the Component Store, and determines what state the component should enter.  Staging determines the current state of the package on the file system.  There are different staging activities that occur during the installation of a package:

  • Identify any files that are missing from the package.  For a file to be installed, it must first be staged.  Some may already present in the system store, others may need to be transferred from installation media or downloaded from network locations
  • Determine which files are required to install a package and identify files in other packages that may also be required
  • Resolve dependencies and ensure that all required files are present before installation begins
  • Complete installation

When a package is uninstalled, the process is reversed:

  • The installer creates a list of any files in use, and other actions that require system reboot
  • Remove the files or dependencies – files may either be removed from the system completely or may remain in the system store for future use.
  • Files not in use may be removed from the system, and the system is rebooted to release and remove any files that were in use

When a newer version of a component is installed on the system, CSI queries the Component Store to determine what components are being updated.  When installing a component, CSI sets up a Primitive Operations Queue (POQ) which contains all files and registry keys that will be installed.  Advanced installers or generic commands are then executed to complete installation.  Advanced installers run in-process using CMI.

If there is a failure during installation of a component, CSI rolls back the entire installation.  If a file or process is in use during a component installation and cannot be replaced, generic commands and advanced installer actions are written to %windir%\WinSXS\Pending.xml, and then written to disk on the following reboot.  If several packages are installed at the same time, each additional package appends to Pending.xml.  Additional logging during this phase occurs in %windir%\Logs\CBS\CBS.log.

And that brings us to the end of our post on Component-Based Servicing.  Until next time ...

- CC Hameed

Share this post :

EDIT

  • 4/23: Several Updates and Changes made to the article.  Article republished to ensure that RSS feeds have the updated version.
4 Comments
Version history
Last update:
‎Mar 15 2019 06:50 PM
Updated by: