# Windows – the servicing stack and how does it work

package-managementwindowswindows updatewindows-installerwinsxs

In Windows, there's something called the servicing stack which seems to fulfill the role of a package manager. I don't understand it very well, only that it seems that Component-Based Servicing (CBS), Windows Installer, Windows Update, and WinSxS are part of the servicing stack or are otherwise involved in servicing.

I've done lots of research and have not been able to find an easy-to-understand overview on servicing in Windows. Hence, I'm asking the following:

• What is servicing and what does the servicing stack do?
• How does the servicing stack work? What roles do CBS, Windows Installer, WinSxS, and Windows Update play?

1. What is servicing and what does the servicing stack do?

Servicing is the name of configuring Windows updates or Windows features (installing, removing updates/features). This can be done when Windows is running (Online) or against a not running Windows partition/or mounted WIM (offline):

What is servicing? Servicing is the act of installing a role, feature, service pack or windows update against a Windows OS. Most of the time servicing is done in an online state. In this case, online means that the operating system is up and running when a change is made. Online servicing is what most people do and is usually done via Windows Update or double clicking a downloaded update. There is also an offline state. Offline, of course, means that the installation is happening against a non-running version of Windows. This is what a lot of larger corporations and OEMs do with their image files, they mount them with IMAGEX or DISM and then install hotfixes or other updates against those images to reduce their patch time when the image is rolled into production.

2. What is CBS

CBS stands for component based servicing and was added in Windows Vista. In older Windows versions, the Setup was based on .inf files to install features/Updates.

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.

3. What roles do WinSxS play

This folder was added in Windows XP, to have the ability to have 2 different DLL version instaleld side by side (sxs) on a system. Microsoft used this to allow the new Theming support in WinXp, but still keep the old system dlls to not break old Win95 applications. It was also used to fixed the DLL hell. In Win95 you have the issue that a tool requires a special Windows DLL in version 4 and the next tool in version 4.10. If you installed the newer tool it may broke the old program, if you installed the older after the newer tool, the older worked but the newer tool crashes because the DLL doesn't support all required features.

Since Vista, the WinSxS folder was contains all files used by Windows and when you activate a feature, the files are not copied to the destination in C:\Program Files, they are linked via a hardlink:

One of the largest changes between previous versions of Windows and Windows Vista was a move from an INF described OS to componentization. A component in Windows is one or more binaries, a catalog file, and an XML file that describes everything about how the files should be installed. From associated registry keys and services to what kind security permissions the files should have. Components are grouped into logical units, and these units are used to build the different Windows editions.

All of the components in the operating system are found in the WinSxS folder – in fact we call this location the component store. Each component has a unique name that includes the version, language, and processor architecture that it was built for. The WinSxS folder is the only location that the component is found on the system, all other instances of the files that you see on the system are “projected” by hard linking from the component store. Let me repeat that last point – there is only one instance (or full data copy) of each version of each file in the OS, and that instance is located in the WinSxS folder. So looked at from that perspective, the WinSxS folder is really the entirety of the whole OS, referred to as a “flat” in down-level operating systems. This also accounts for why you will no longer be prompted for media when running operations such as System File Checker (SFC), or when installing additional features and roles.

4. What roles do Windows Installer play?

this is unrelated to WinSxS, the folder C:Windows\Installer is the folder where the Windows Installer service copies is data to be able to modify or remove installed programs.

5. What roles do Windows Update play?

Windows update downloads the files to C:\Windows\SoftwareDistribution\Download and servicing stack copies the data to WinSxS and tries to create the hardlinks, if this fails (when the files are still used), the operation is pending and the update gets installed at next boot (the configure Windows updates screen at shutdown and boot).