Monday 10 October 2011

What is the Registry?

The Registry has been made out to be a phenomenal mystery probably due to the CLSID keys alone and as such has inspired a number of books, faqs websites etc. It is very unfortunate that Microsoft has chosen to deal with the Registry and Registry editing as a "black art," leaving many people in the dark as to the real uses of all the settings in the systems. Microsoft's refusal to adequately, and publicly, supply information about the correct settings is extremely frustrating and added further mystery to registry. Certainly, more damage has and will be done because of lack of knowledge than because of too much information.

The Windows Registry is a set of data files used to help Windows control hardware, software, the user's environment, and the "look and feel" of the Windows interface. The Registry is contained in two files in the Windows directory (in NT they are called "hives"): system.dat and user.dat, with backup copies
system.da0 and user.da0. The Registry database is accessed with regedit.exe which is in the Windows directory. Formerly, in older version of windows (before windows 95) these functions were performed by WIN.INI, SYSTEM.INI, and other .INI files that are associated with applications.

The evolution of application and operating system control has three distinct levels:

  • In Legacy Windows systems, SYSTEM.INI and WIN.INI held all the control functions for the operating systems and applications. Essentially, SYSTEM.INI controlled the hardware while WIN.INI controlled the desktop and applications. All changes to drivers, fonts, settings, and preferences would be stored in the .INI files. Any new application that was installed added pointers to the .INI files. Those pointers would then be referenced in the application's code.



  • Additional .INI files that controlled the applications were added by programmers who needed more control than was available because of the limited size of the WIN.INI and SYSTEM.INI files. For example, Microsoft included with Excel a file called EXCEL.INI, which held the options, settings, defaults, and other information critical to making Excel work correctly. The only pointer that was then required in WIN.INI was to the EXCEL.INI path and filename.



  •  The Registry was initially developed as a reference file for data-file associations to applications. It was expanded to include all functions for 32-bit operating systems and applications.


Originally, SYSTEM.INI and WIN.INI controlled all Windows and application features and access. It worked
well when average users used only a few applications. As the number and complexity of applications grew, so did the number of entries to the .INI files. The downside of this approach, in a growingenvironment, is that everyone would make changes to the .INI files when applications were added to the system. However, no one ever removed references from their .INI files when they removed applications, so SYSTEM.INI and WIN.INI continued to get larger and larger. Each incremental size increase meant slower performance. Even upgrading applications presented its challenges. The upgrade would add entries but never take the old ones away, presumably to ensure compatibility if another program was to access the settings.

Because the maximum size of an .INI file is 64KB, an obvious problem arose. To counter the problem, vendors started supplying .INI files of their own, with just pointers to the specific .INI files in WIN.INI and SYSTEM.INI. The downside of this approach was the proliferation of .INI files throughout the system and the hierarchical nature of access. If WIN.INI made a particular setting, and an application's .INI file overrode that setting, who was responsible and where should--or could--a system-wide setting that had priority be made?

The Registry is a set of files that control all aspects of the operating system and how it works with outside events. Those "events" range from accessing a hardware device directly to how the interface will react to a specific user to how an application will be run and much more. It was designed to work exclusively with 32-bit applications, and file size is limited to a about 40MB.

The Registry is complex by its very nature, and on purpose.

1 comment: