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

 
目录
相关文章
|
BI C语言 索引
Python科学计算库Numpy数值运算基础详解(超详细 附源码)
Python科学计算库Numpy数值运算基础详解(超详细 附源码)
812 0
|
7月前
|
弹性计算 网络安全 异构计算
使用阿里云GPU服务器部署Qwen3-235B-A22B推理模型,基于ecs.ebmgn8v实例规格
本文介绍如何使用阿里云GPU服务器(ecs.ebmgn8v实例,8卡96GB显存)部署Qwen3-235B-A22B大模型,涵盖创建VPC、安全组、GPU实例、环境配置、模型下载、部署及推理测试全流程,费用约290元/小时。
|
2月前
|
人工智能 安全 算法
大模型应用:AI 智能体核心引擎:RAG检索增强生成原理与医疗场景深度落地.126
本文详解RAG(检索增强生成)在医疗智能体中的落地实践:针对大模型知识过时、幻觉、专业性不足三大痛点,基于Qwen本地大模型、MiniLM嵌入、FAISS向量库与LangChain框架,实现全流程可追溯、全本地化、无幻觉的精准问答。含环境配置、适配器封装、知识库构建及调试分析。
443 7
|
人工智能 数据可视化 数据挖掘
团队日报不用愁!自动化生成工具亲测:任务进度实时同步
本文深入分析了传统手动日报在数据孤岛、格式混乱和时效性差三大痛点,并探讨了自动化日报带来的效率提升、决策优化等四大核心价值。通过对板栗看板、SmartBrief、n8n 等六款主流工具的功能、适用场景及实战效果进行测评,为企业提供科学的选型建议与实施路径。
团队日报不用愁!自动化生成工具亲测:任务进度实时同步
|
6月前
|
域名解析 缓存 网络协议
Linux dnsmasq完全教程
dnsmasq是轻量级DNS+DHCP一体化工具,专为小型局域网设计。它能实现DNS缓存加速、内网域名解析(如用“server.local”代替IP)、自动分配IP地址,配置简单、资源占用低,树莓派或老旧服务器也能流畅运行,是家庭、工作室网络管理的“全能小管家”。
|
Shell 网络安全 开发工具
项目快速导入git
本文介绍了如何在本地初始化 Git 仓库并将代码提交到远程仓库(如 GitHub 或 Gitee)的基本流程。内容包括安装 Git、创建仓库、添加文件、提交更改以及推送代码到远程仓库的详细步骤,适合初学者快速掌握 Git 的基本使用方法。
2846 1
|
弹性计算 网络协议 安全
【转】如何配置服务器的端口映射?
本文详解端口映射原理及配置方法,涵盖家庭、企业与云环境,包含静态、动态与双向映射类型,并提供常见问题解决方案。
2569 6
|
监控 算法 自动驾驶
基于YOLOv8的7种交通场景识别项目【完整源码数据集+PyQt5界面+完整训练流程+开箱即用】
本项目基于YOLOv8算法,打造了一个支持7类交通场景识别的智能系统,包括机动车、非机动车、行人及各类信号灯状态。采用PyQt5开发图形界面,提供单图、批量图片、视频文件和摄像头实时流等多种输入方式,并支持检测结果保存与模型自定义训练。项目包含完整源码、数据集及预训练权重,开箱即用,适合智能驾驶、城市监控等领域。通过简洁友好的UI,用户无需代码基础即可体验高性能目标检测功能,同时支持二次开发与工程部署。
|
安全 Linux 数据处理
Linux命令strip详解
`strip`命令在Linux中用于移除可执行文件和库的符号表及调试信息,减小文件大小,提升运行效率。它的工作原理是删除文件中包含的函数名、变量名等信息。主要参数包括`-s`(移除所有符号)、`-g`(仅移除调试信息)等。在应用时要注意文件备份,因为该操作不可逆。最佳实践是在发布版本中使用,并结合构建流程自动化。
|
传感器 搜索推荐 算法
淘宝iOS拍立淘微距能力探索与实现
画面模糊问题的源头也是来自用户的微距体验不佳,我们对问题深入分析,适当拆解。通过 Apple Development Doc 的查阅及实践,一步步抽丝剥茧,最终完美解决用户的体验痛点,也为我们自身沉淀了展示微距的能力。
1529 1

热门文章

最新文章