User:OO628/sandbox

Component Based Servicing - built into Windows Vista and later

History
Before Windows Vista was released, the installation of optional components, Windows Updates, and drivers were quite easy to complete. In the release of Vista, Component Based Servicing was introduced and it altered the way components got were installed. This new method is more secure that the previous versions of Windows. Now users can take advantage of a more controlled process during installation, which allows updates to be added at the same time as avoiding issues with instability from corrupt installations.

"In a simplest sense, a component is a small grouping of files based on a feature area, functionality, and reusability. A manifest defines how the files are grouped in a component and largely, this is something that each product group at Microsoft has defined for their own product.  when it comes to servicing, a component is the smallest unit of measure and this creates an interesting patching behavior.   So, even if a fix for a particular bug is localized to one file, if the file belongs to a component that consists of other files, the patch will contain all files in the component.  All files, regardless of whether they are changed or not, are built, their version numbers incremented, and packaged in the hotfix.  When the hotfix is applied, the component in the component store is updated, and all files included in the component are updated on the file system.  In a KB article that accompanies the hotfix for Vista and Windows Server 2008, you will notice that there is a section to document the list of included files in the hotfix and another section to document which file is actually changed." (Yoo 2008)

The Core componentization services

 * 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

Three Levels of Servicing Stack

 * 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.

Setup Infrastructure
Optional Component Setup: "Optional Component Setup (OCSetup.exe) is a command-line tool that installs and uninstalls Windows optional components. This tool replaces Sysocmgr.exe. You can use OCSetup.exe to install, update, and remove Windows Installer (MSI) components and Component-Based Servicing (CBS) components. “Further information is found here: http://go.microsoft.com/fwlink/?LinkId=91915

Package Manager: "The Package Manager is a tool that installs or removes packages or Windows components. It is called by Windows Setup during normal installation, including unattended installation, and runs transparently while updating or installing Windows. Further information can be found here: http://technet.microsoft.com/en-us/library/cc753368.aspx

Language Pack Installation: Language Packs help with the display of dialog boxes, wizards, menus and help documentation in different languages.

Component Based Servicing: This is a critical component to installing, updating and removing applications on the Vista and Windows Server 2008 Platforms. The Microsoft Component-Based Servicing (CBS) is part of the servicing stack which is defined by Microsoft as "a set of files and resources that are required to service a Windows image or operating system"

“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:” (Hameed 2008)

Installation package phases

 * 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

Uninstallation package phases

 * 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.” (Hameed 2008).