Home

To solve compatibility issues, Microsoft would quietly patch other people's code

How to get that all-important piece of software working on Windows has vexed Microsoft since the beginning of the operating system. Compatibility was king.

Things were simpler in the days of Windows 3.1. It was up to the user to tell the system which application was which in the event they shared a filename. Veteran Microsoft engineer Raymond Chen gave the example of C:\MAIL\MAIL.EXE. Perhaps it was Microsoft Mail? Or maybe it was cc:Mail for MS-DOS?

The APPS.INF told Windows what to do with the application, but it was up to the user to differentiate apps that shared the same filename. Simpler times indeed.

Windows 95, however, dialed things up quite a bit with its application compatibility database. The behavior of the operating system could be altered based on compatibility flags, and Microsoft went so far as to automatically patch programs where a simple operating system tweak wouldn't address a deep-seated problem.

Patching someone else's code is inherently risky. Chen said: "Out of safety, the Windows 95 team got written permission from the vendor whenever they needed to patch a program."

"The consultation included detailed information on what the problem was and how it was going to be patched. In exchange, the team requested information from the vendor on what versions of their product are affected (and if they could send those versions for analysis), as well as a promise to fix the problem in their next version, because the next version won't have the benefit of the patch."

But how to spot an application for which a patch is available? Rather than rely on the user to tell the operating system what a given file was, Windows 95 used detection strings stored in the Registry. When a 16-bit module was loaded, targeting a version of Windows earlier than 4.0, the kernel tried every detection string to see if one was triggered.

The strings weren't straightforward checksums. Instead, the string was decoded into bytes, with the first being the match algorithm, which dictated what came next. "In practice, you tend to see a lot of file size matches," said Chen.

"Conversely, you are unlikely to see many file contents matches because those incur additional I/O and are therefore more expensive."

Chen noted that while there was eventually a tool to build the detection strings, earlier incarnations had to be written by hand.

"If a match is found," explained Chen, "the subkeys indicate the segments to patch, and the values of those subkeys are binary data providing the patch to apply."

"The names of the values are not significant, but traditionally 'Add' patches are named Add and 'Change' patches are named Change. If there is more than one Add or Replace patch, tradition dictates that they are given numeric suffixes to distinguish them."

Microsoft's focus on backward compatibility is often cited as a major factor in its success at the end of the 20th century and the beginning of the 21st.

An interesting thought experiment is what engineers from the Windows 95 era would make of the hundreds of millions of devices that were suddenly made obsolete with the end of Windows 10 support. ®

Source: The register

Previous

Next