Side-by-side assembly

简介: Side-by-side technology is a standard for executable files in Windows 98 Second Edition, Windows 2000, and later versions of Windows that attemp...

Side-by-side technology is a standard for executable files in Windows 98 Second Edition, Windows 2000, and later versions of Windows that attempts to alleviate problems that arise from the use of dynamic-link libraries in Microsoft Windows. Such problems include version conflicts, missing DLLs, duplicate DLLs, and incorrect or missing registration. In side-by-side, Windows stores multiple versions of a DLL in the WinSXS subdirectory of the Windows directory, and loads them on demand. This reduces dependency problems for applications that include a side-by-side manifest.

Side-by-side technology is also known as WinSxS or SxS, although technically WinSxS refers only to the global side-by-side store (officially called the "Windows component store"), which is conceptually the native equivalent of the .NET Global Assembly Cache. Executables that include an SxS manifest are designated SxS assemblies.

Microsoft Visual C++ 2005 and 2008 employ SxS with all C runtime libraries. However, runtime libraries in Visual C++ 2010 no longer use this technology; instead, they include the version number of a DLL in its file name, which means that different versions of one DLL will technically be completely different DLLs now.[1][2]

SxS is also the technological basis for registration-free COM activation. Only in-process COM servers may be activated this way.

 

 

Operation[edit]

An application that employs SxS must have a manifest. Manifests are typically a section embedded in the application's executable file but may also be an external file. When the operating system loads the application and detects the presence of a manifest, the operating system DLL loader is directed to the version of the DLL corresponding to that listed in the manifest. If there is no manifest, the DLL loader loads a default version of all DLL dependencies. If the DLL is a COM server, it must have a manifest of its own for registration-free activation to succeed.

On Windows Vista and later, application start failures due to SxS misconfiguration can be diagnosed using sxstrace.exe.

Because it is sometimes desirable to override manifest-specified assemblies anyway, for example in the case of security patches applied to a library, a publisher configuration file can globally redirect assemblies. Digital signatures may be used to ensure that this redirection is legitimate.[3]

Manifest format[edit]

The manifest is internally represented as XML. The URN associated with SxS manifests is "urn:schemas-microsoft-com:asm.v1".

Several other recent Microsoft technologies such as ClickOnce employ the same manifest format.

Example manifest[edit]

The following is an example of a manifest for an application that depends on a C runtime DLL.

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

Activation contexts[edit]

A manifest like the one above is parsed into an activation context by the SxS loader. There is a stack of activation contexts for each thread or fiber. An API allows programmatic manipulation of these contexts. It may be necessary for a library (DLL) to change its activation context, for example if it requires a specific version of another library for its own consumption instead of using the activation context of its caller. This type of issue is sometimes called (activation context) pollution.[4] To prevent polluting its activation context, a DLL can have a manifest embedded as a resource, which is parsed when the DLL is loaded. This manifest must be at resource id 2 in the image file for the loader to find it.[5]

WinSxS[edit]

From Vista onward the operating system also uses WinSxS for its core components. Operating system files in the WinSxS directory are hard linked to their usual locations in the Windows directory structure. The same file may be linked from a directory in WinSxS and from, say, the System32 directory. Windows Explorer double counts the disk space occupied by these files.[6] This can be demonstrated using the fsutil command-line program.[7] (Some third-party Explorer extensions to show the link count also exist.) However not all files from WinSxS are projected this way to "live" operating system files. For example, after installing some Windows updates, old file versions replaced by the updates are still kept in WinSxS although they are no longer linked in the "live" Windows directories. This allows updates to be uninstalled safely.[8]

Because of its elevated importance, from Vista onward the WinSxS directory is owned by the Trusted Installer service SID. By default not even administrators can modify its contents (without taking ownership first). Uninstalling applications does not immediately free space in the WinSxS directory; space for unused assemblies is garbage-collected over time by the Installer service.[9]

Although not officially documented, the algorithm for generating the directory names residing inside the WinSxS directory has been made public on an MSDN Microsoft employee's blog. The algorithm was changed in the transition from XP to Vista.[10]

Advantages[edit]

  • For applications that have been built with SxS, multiple applications may coexist that depend on different versions of the same DLL. This is in contrast to non-SxS DLL environments where an original DLL in a shared system folder may be overwritten by the subsequent installation of another program that depends on a different version of the same DLL.
  • The XML formatting of the manifest is human-legible and thus makes it easier for developers to determine the dependencies of an application and their versions.

Disadvantages[edit]

  • In Windows XP, a bug in sxs.dll causes heap corruption, leading to application crashes. This issue is not fixed by any XP service packs. Users must manually install a QFE (Quick Fix Engineering).[11]
  • Considerably higher disk space consumption. The winsxs directory typically starts at several gigabytes in size and continues to grow as applications are installed. Further, there is currently no supported way to significantly reduce the size of the winsxs directory.[8]

Misconceptions[edit]

The winsxs directory is thought to be much larger than it actually is. The directory contains mostly "hard links" to files that exist elsewhere. DIR and Explorer are not aware of the difference between an actual file and a hard link to a file, and so may count the same file several times, adding incorrectly to the perceived disk usage. The disk usage reported by these two programs is as if each hard link *is* an actual file.[12][13]

See also[edit]

Notes[edit]

  1. Jump up^ Section "Visual C++ Libraries" in Breaking Changes in Visual C++. Retrieved on 2010-09-10.
  2. Jump up^ See section "Differences between Visual C++ 2008 and Visual C++ 2010" in "Deployment in Visual C++ 2010". Retrieved on 2010-09-10.
  3. Jump up^ http://msdn.microsoft.com/en-us/library/Aa375680
  4. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2006/01/07/510375.aspx
  5. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2006/01/17/514192.aspx
  6. Jump up^ http://support.microsoft.com/kb/2592038
  7. Jump up^ http://blogs.technet.com/b/joscon/archive/2010/08/06/should-you-delete-files-in-the-winsxs-directory-and-what-s-the-deal-with-vss.aspx
  8. ^ Jump up to:a b Huges, Jeff. "What is the WINSXS directory in Windows 2008 and Windows Vista and why is it so large?". Microsoft Corporation. Retrieved 15 March 2011.
  9. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2007/01/02/deleting-from-the-winsxs-directory.aspx
  10. Jump up^ http://blogs.msdn.com/b/jonwis/archive/2005/12/28/507863.aspx
  11. Jump up^ http://support.microsoft.com/kb/943232
  12. Jump up^ http://blogs.msdn.com/b/e7/archive/2008/11/19/disk-space.aspx
  13. Jump up^ http://www.davidlenihan.com/2008/11/winsxs_disk_space_usage_its_no.html

External links[edit]

 

from:http://en.wikipedia.org/wiki/Side-by-side_assembly

 
目录
相关文章
|
存储 数据安全/隐私保护
忘记被浏览器记住的密码如何找回,如何查看浏览器保存的密码?
现在很多网站都需要注册账号和密码,由于数量众多,每个网站的账号不通用,所有我们经常会用浏览器记录密码功能记住密码,但时间一长就会忘记密码,想换个浏览器登陆或其他原因无法直接查看到密码,下面有2种查看密码的方法仅供参考。
忘记被浏览器记住的密码如何找回,如何查看浏览器保存的密码?
|
Linux Go Windows
NATS服务器部署及测试
版权声明:本文为博主chszs的原创文章,未经博主允许不得转载。 https://blog.csdn.net/chszs/article/details/51002444 NATS服务器部署及测试 作者:chszs,未经博主允许不得转载。
3000 0
|
SQL NoSQL Java
SQL查询引擎原理浅析
# SQL的诞生 SQL英文全称是Structured Query Language,中文名即结构化查询语言,是一门专门用来查询数据的声明式编程语言。 我先解释一下声明式语言的概念,编程语言有两个分类: * 命令式:手把手教机器做事情 * 声明式:告诉机器任务,让它自己想办法解决 举个例子,假设你家里有机器人,你想让它帮忙拿一个在客厅桌子上的白色杯子给你。 如果用命令式编程的方
769 0
SQL查询引擎原理浅析
|
分布式计算 Oracle 关系型数据库
实时计算 Flink版产品使用问题之获取Oracle的数据时无法获取clob类型的数据,该怎么办
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStream API、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
|
数据可视化 Ubuntu 机器人
ROS学习-tf介绍
ROS学习-tf介绍
426 0
ROS学习-tf介绍
|
存储 缓存 安全
【VulnHub靶场】——HARRYPOTTER第三部: FAWKES
今天的博客内容是HARRYPOTTER: FAWKES教程(困难难度)
492 0
【VulnHub靶场】——HARRYPOTTER第三部: FAWKES
|
Web App开发 安全 Java
【面试-八股文】万字app测试 面试题,助你吊打面试官系列
最近温大大的读者们问我有没有app相关的面试题, 作为「平易近人」的大大怎么能忍心说没有呢, 这不继续爆肝 输出app测试工程师专项面试题, 本篇从:app测试基础、app 测试场景(覆盖7大场景 + 100 多个测试点,直接可以拿来用)、app工具 Appium/ Fiddler/ Monkey 介绍、app 常见问答定位、app 环境安装 这些个纬度大家全面解析app面试题。
【面试-八股文】万字app测试 面试题,助你吊打面试官系列
|
存储 运维 监控
SLS新版告警入门-监控OSS访问日志
在业务中经常会有波峰波谷的现象,使用同一个监控阈值往往不能满足告警需求;基于SLS,可以使用日环比方式,配置SLS新版告警,来监控PV日环比是否有陡增或陡降,比如陡增10%或者陡降10%,会发出告警;本文以此为背景,来讲解如何配置告警并发出通知。
1312 0
|
机器学习/深度学习 Kubernetes 并行计算
如何通过ACK 纳管Nvidia A100 GPU实例,实现资源池化
### 介绍 在GTC 2020(5月14日)大会上英伟达新一代架构“Ampere”(安培)正式亮相。继数据中心Volta GPU推出三年后终于亮剑。Ampere以数据中心GPU A100的形式首次亮相,专为科学计算,云图形和数据分析而构建。 ![image.png](https://ata2-img.oss-cn-zhangjiakou.aliyuncs.com/614630bc
1927 0
如何通过ACK 纳管Nvidia A100 GPU实例,实现资源池化