J. P. Gilliver (John) said:
It is ... wait for it ... the registry.
Yet another case where - IMO - the registry is inappropriate.[/QUOTE]
INI files are slow. File I/O to read an INI file is much slower than
getting settings from memory. Who knows how many times an app might
need to access its settings. File I/O of an INI file is sequential;
that is, you have to start from the beginning and read the whole thing
to find just one setting. The registry gets loaded into memory so each
key and data values under it are randomly accessible. You can access a
registry key and its data values directly, not by having to sequentially
read through a file.
Even if the INI file were loaded into memory, those bytes would occupy
more space than a binary database of all INI files.
There is also almost no access control outside of file permissions on
INI files versus permissions on not just the parent key but the same or
different permissions possible on the child keys. The registry can be
made secure. An INI file never is.
A program may actually want to store or modify "internal-use only"
settings that the users cannot get at. They're all exposed in the
registry. regedit.exe and reg.exe only expose part of the registry so
it's possible to store values that users cannot get at (or malware)
because they're only accessible via the registry API. Registry editors
don't show you everything in the registry. Also, the registry is
binary. Registry editors interpret it so you see the alphanum bytes you
know how to read. There is no parsing (or much less) required to
specify a registry key along with a data item and its value. The
structure of the registry provides much if not all of the parsing so
retrieving settings is very fast (besides the registry being read from
memory instead of from a file).
Just because it may not be easy for you or to your liking doesn't mean
it is harder for program to access the registry. Using the registry is
faster and easier for program and that's what it was designed to work
with, not for users putzing around inside there. That limited access is
granted using regedit.exe doesn't really mean most users should be in
There are 2 real hives: HKLM and HKU. The others are pseudo-hives
comprised of values take from HKLM and HKU. This allows complete
separation of per-user and global settings that is not possible in an
INI file. All settings, per-user and global, are exposed in an INI
file. This also permits coordination with user profiles as separate
keys under HKU instead of relying on file permissions of INI files under
different %userprofile% paths.
The registry is managed by the kernel. If an application crashes before
you can exit, registry changes are still committed.
Access to the registry is thread and multiple instance safe. Multiple
threads and multiple process can SIMULTANEOUSLY acess the same registry
keys and their data items and values without lockout. While you may not
employ multiple concurrent user logins (i.e., multi-user logins),
Windows is still capable of that using either FUS (fast user switching)
or terminal services. Also, this lets multiple components even within
the same application to access the same common settings across all those
components. For example, a suite of components (e.g., MS Office) can
have settings that are common across all components and all of them can
concurrently access the same settings. Changes to the data values is
atomic and immediately affected to the other components. No lockouts.
You can also exchange the same settings between multiple instances of
the same process without conflict. With INI files, one may have to wait
until the other unlocked the INI file (released its handle).
The registry wasn't designed for the convenience of users. It was
designed for better config management by *applications*. The only
reason we users end up delving into the registry is that quite often the
program developers do not expose all the settings in a configuration UI
that is callable from within the program. We have to keep accessing
settings the developers omitted or deliberately chose not to expose. So
if there are settings that you need to get at and seem like they should
be accessible to common or everday users then send feedback to the
program author to enhance the config UI. Yep, lots of Windows settings
are that way, too; however, Microsoft doesn't design registry work for
everyday users and intends experts and admins with education and
experience and eptitude to be delving into the registry.
The registry is daunting for humans, not for programs. There is one
scenario where INI files have an advantage over the registry: portable
operation. So whether or not an application was intended to be portable
is up to the program's author. Ask THEM to provide a settings export
function to save an INI file so their app is portable.