views:

186

answers:

2

I've always been mystified how software vendors can ship their application or game, and then later provide a different set of executables that change the behaviors of the previous build. How is this done? Do the original application and the patch have to adhere to some kind of rule? Or does the patch crawl into the original executable and change its assembly information? Would that require knowledge of the binary file to the byte level?

A: 

I suspect that most of the time, "patches" are just some replacement files.

It is, however, possible to compare two binary files, determine their differences, and create a set of edit commands that will change one into the other. The Unix utility "diff" can do this for text files, for example.

Glomek
+1  A: 

There are two main methods I have seen. Many programs are composed of a number of smaller parts that are dynamically loaded at runtime, often these files are simply replaced with newer versions. Since updates often only affect a relatively small number of these files the patch may be a small subset of the entire application. The other method, which I've seen used with larger monolithic applications, is to actually change the executable code using a sort of "binary diff". One of the drawbacks with this approach is that it is more difficult to support upgrading to a new version from a version several revisions prior without having to perform each incremental update.

Robert Gamble