Login to participate
Endpoint Management & Virtualization ArticlesRSS

WinSxS Assemblies: Basics and Directions

R-Vijay's picture

Some years back, Microsoft recommend installing DLLs to c:\windows\system32 if you wanted to share them with other applications. This lead to "DLL Hell" since one applications installer would install one version of a DLL and another installer would install another version overwriting the existing DLL.

If the new version of the DLL wasn't compatible the older application would suddenly break and stop working. With SxS technology, applications can install DLLs to version specific directories tell Windows what version of the DLL should be used when they load a DLL by that name.

Windows OSes which have SxS will look for an application's manifest information to determine which version to load from SxS. A manifest is a fairly simple XML description of all the SxS DLLs that might be loaded by the application and which version to use. The manifest can either be embedded in the application EXE/DLL file as a resource or stored separately on the filesystem as a .manifest file. In the second case, the manifest file for app.exe would be called app.exe.manifest.

How WinSxS Assemblies Work???

The manifest resolution algorithm is fairly complex, but it can include among other things searching based on the user's locale (i.e. Look for French/German version first). As well, to eliminate security disasters like what happened with gdiplus.dll, SxS DLLs have a "force upgrade" mechanism implemented as separate security policy files (also XML files).

This mechanism allows Microsoft to override version number request by applications in the case where some gaping security hole is discovered in a shared library that effects thousands of applications. For example, an application manifest may say "I want version 1.0.0.0 of xyz.dll", but Microsoft can push a policy file update that says "redirect all request of version 1.0.0.0 to 1.0.0.5".

A win32 assembly is an unmanaged assembly (native code). An assembly that is installed to the GAC is actually a managed assembly or otherwise known as a .NET assembly. While the concept of the assembly unit is the same, there are quite a few differences between the two. Typically .NET assemblies are contained within a single module that includes an embedded manifest. For Win32 assemblies, the manifest and catalog file are separate from the binary itself.

We can review the assembly structure by taking a look at the following folders on a Windows Vista machine:

.NET assemblies
%windir%\assembly

Win32 assemblies
%windir%\winsxs

Directions

If we need to install Win32 side by side assemblies globally, we should use the MsiAssembly and MsiAssemblyName tables to do so. The InstallExecuteSequence table should also include the MsiPublishAssemblies and MsiUnpublishAssemblies standard actions.

There is more information on these tables in MSDN and the sample sequence.msi package provided with the Windows Installer SDK (of the Windows SDK) provides a recommended sequence number for those standard actions. A good starting point on MSDN is http://msdn2.microsoft.com/en-us/library/aa367757.....

References

Thinstall site, MSDN blogs and few peer reviews.

Louist's picture

Source acknowledged

http://www.thinstall.com/assets/docs/Application%2...
and
https://thinstall.com/help/index.php?side_by_side(sxs).htm

R-Vijay's picture

MSI Assembly Table - Significance in Vista

Well, Notified Louist.
This will be very useful for people who wanna look more at Thinstall solutions.

However, the extract from this pdf (which you pointed) is just a reference to get the overview of WinSxS. You can very well get this in MSDN blog or in any discussion forum as well. This article doesn't convey any of the Thinstall solutions as such. My article gives you more inwards towards the packaging perspective and addres the significance of MSI Assembly table.

One point which we need to take care while dealing with WInSxS assemblies is that, the policy files needs to be taken more care while assigning that to the component.

Many a times, the entry of policy files is not done, as this involves using a security algorthm as well.

When we set the attribute to 1 in the MSIAssembly table, the installer engine gets notfied that these assmblies needs to be installed in WinSxS folder.

As all understand, Vista doesn't have any folder like dllcache to store the Protected files. All the protected files are stored in WInSxS. Hence, there involves a best practice to add WinSxS assemblies, which can't be added by any other practice.

Cheers'
Vijay

Microsoft MVP [Setup-Deploy]
Weblog: www.msigeek.com