小软件如何修补大软件?

时间:2023-01-13 00:01:54

One thing I've always wondered about is how software patches work. A lot of software seems to just release new versions on their binaries that need to be installed over older versions, but some software (operating systems like Windows in particular) seem to be able to release very small patches that correct bugs or add functionality to existing software.

我一直想知道的一件事是软件补丁是如何工作的。许多软件似乎只是在他们的二进制文件上发布需要安装在旧版本上的新版本,但是某些软件(特别是像Windows这样的操作系统)似乎能够发布非常小的补丁来纠正错误或为现有功能添加功能软件。

Most of the time the patches I see can't possibly replace entire applications, or even small files that are used within applications. To me it seems like the actual binary is being modified.

大多数情况下,我看到的补丁不可能取代整个应用程序,甚至不能替换应用程序中使用的小文件。对我来说,似乎正在修改实际的二进制文件。

How are these kinds of patches actually implemented? Could anyone point me to any resources that explain how this works, or is it just as simple as replacing small components such as linked libraries in an application?

这些补丁实际上是如何实现的?任何人都可以向我指出解释其工作原理的任何资源,或者它是否像在应用程序中替换诸如链接库之类的小组件一样简单?

I'll probably never need to do a deployment in this manner, but I am curious to find out how it works. If I'm correct in my understanding that patches can really modify only portions of binary files, is this possible to do in .NET? If it is I'd like to learn it since that's the framework I'm most familiar with and I'd like to understand how it works.

我可能永远不需要以这种方式进行部署,但我很想知道它是如何工作的。如果我理解补丁可以真正修改二进制文件的部分是正确的,那么在.NET中可以做到这一点吗?如果它是我想学习它,因为这是我最熟悉的框架,我想了解它是如何工作的。

2 个解决方案

#1


14  

This is usually implemented using binary diff algorithms -- diff the most recently released version against the new code. If the user's running the most recent version, you only need to apply the diff. Works particularly well against software, because compiled code is usually pretty similar between versions. Of course, if the user's not running the most recent version you'll have to download the whole thing anyway.

这通常使用二进制diff算法实现 - 将最近发布的版本与新代码区分开来。如果用户运行的是最新版本,则只需应用diff。特别适用于软件,因为编译代码在版本之间通常非常相似。当然,如果用户没有运行最新版本,则无论如何都必须下载整个版本。


There are a couple implementations of generic binary diff algorithms: bsdiff and xdelta are good open-source implementations. I can't find any implementations for .NET, but since the algorithms in question are pretty platform-agnostic it shouldn't be too difficult to port them if you feel like a project.

通用二进制diff算法有两种实现方式:bsdiff和xdelta是很好的开源实现。我找不到.NET的任何实现,但由于所讨论的算法与平台无关,因此如果你觉得它是一个项目,那么移植它们应该不会太困难。

#2


2  

If you are talking about patching windows applications then what you want to look at are .MSP files. These are similar to an .MSI but just patch and application.

如果您正在讨论修补Windows应用程序,那么您要查看的是.MSP文件。这些类似于.MSI,但只是补丁和应用程序。

Take a look at Patching and Upgrading in the MSDN documents.

请查看MSDN文档中的修补和升级。

What an .MSP files does is load updated files to an application install. This typically is updated dll's and resource files, but could include any file.

.MSP文件的作用是将更新的文件加载到应用程序安装。这通常是更新的dll和资源文件,但可以包含任何文件。

In addition to patching the installed application, the repair files located in C:\WINDOWS\Installer are updated as well. Then if the user selects "Repair" from Add / Remove programs the updated patch files are used as well.

除了修补已安装的应用程序之外,还会更新位于C:\ WINDOWS \ Installer中的修复文件。然后,如果用户从“添加/删除程序”中选择“修复”,则也会使用更新的修补程序文件。

I'm thinking that the binary diff method discussed by John Millikin must be used in other operating systems. Although you could make it work in windows it would be somewhat alien.

我认为John Millikin讨论的二进制diff方法必须在其他操作系统中使用。虽然你可以让它在windows中工作,但它会有些陌生。

#1


14  

This is usually implemented using binary diff algorithms -- diff the most recently released version against the new code. If the user's running the most recent version, you only need to apply the diff. Works particularly well against software, because compiled code is usually pretty similar between versions. Of course, if the user's not running the most recent version you'll have to download the whole thing anyway.

这通常使用二进制diff算法实现 - 将最近发布的版本与新代码区分开来。如果用户运行的是最新版本,则只需应用diff。特别适用于软件,因为编译代码在版本之间通常非常相似。当然,如果用户没有运行最新版本,则无论如何都必须下载整个版本。


There are a couple implementations of generic binary diff algorithms: bsdiff and xdelta are good open-source implementations. I can't find any implementations for .NET, but since the algorithms in question are pretty platform-agnostic it shouldn't be too difficult to port them if you feel like a project.

通用二进制diff算法有两种实现方式:bsdiff和xdelta是很好的开源实现。我找不到.NET的任何实现,但由于所讨论的算法与平台无关,因此如果你觉得它是一个项目,那么移植它们应该不会太困难。

#2


2  

If you are talking about patching windows applications then what you want to look at are .MSP files. These are similar to an .MSI but just patch and application.

如果您正在讨论修补Windows应用程序,那么您要查看的是.MSP文件。这些类似于.MSI,但只是补丁和应用程序。

Take a look at Patching and Upgrading in the MSDN documents.

请查看MSDN文档中的修补和升级。

What an .MSP files does is load updated files to an application install. This typically is updated dll's and resource files, but could include any file.

.MSP文件的作用是将更新的文件加载到应用程序安装。这通常是更新的dll和资源文件,但可以包含任何文件。

In addition to patching the installed application, the repair files located in C:\WINDOWS\Installer are updated as well. Then if the user selects "Repair" from Add / Remove programs the updated patch files are used as well.

除了修补已安装的应用程序之外,还会更新位于C:\ WINDOWS \ Installer中的修复文件。然后,如果用户从“添加/删除程序”中选择“修复”,则也会使用更新的修补程序文件。

I'm thinking that the binary diff method discussed by John Millikin must be used in other operating systems. Although you could make it work in windows it would be somewhat alien.

我认为John Millikin讨论的二进制diff方法必须在其他操作系统中使用。虽然你可以让它在windows中工作,但它会有些陌生。