Registry Blues

Mastery of the registry is one of the skills necessary to join the elite group of Hardcore COM programmers. Technically, the registry isn’t directly related to COM, and it can be used in many contexts unrelated to COM. But the reverse isn’t true. You won’t get far understanding COM without being able to at least examine, and often modify, registry entries.

The registry has been around for quite a while, but usually you could ignore it under 16-bit Windows. The fatal flaw of the 16-bit registry was its 64-KB capacity. Certain programs filled up a good chunk of that all by themselves, leaving you with little idea of how much registry space was left or what would happen if it overflowed. For all practical purposes, the 16-bit registry was left for OLE applications, which used it transparently.

It’s a different story in Win32. You now have all the space you need. Microsoft strongly recommends that you stop using INI files and similar techniques and instead make the registry your one-stop data storage mechanism. This is more easily said than done. There are two problems. First, the registry functions are among the most quirky and difficult to use in the Windows API. Second, even if you figure out how to use them, you still have to figure out what’s where in the registry.