Generic INI save and restore

From OS2World.Com Wiki
Jump to: navigation, search
Generic INI save and restore
Version 1.8 (Oct 2019)
Author Peter Moylan
License GNU GPL V3 / Open Source

A pair of utilities that convert INI files to and from human-readable form.

Many programs need a way to save their configuration data. (Window positions, program options, etc.) OS/2 uses INI files for this purposes. The INI file format is a binary file format that is efficient in terms of rapid access, but it is not human-readable. The present package provides a way of saving INI data in human-readable form. The DumpINI program converts a binary INI file into a corresponding plain-text form. The LoadINI program performs the reverse conversion: it translates human-readable data into the binary INI form.

The original OS/2 design probably envisaged that there would be just two INI files: OS2SYS.INI for the system data, and OS2.INI for the application data. Experience has shown us, however, that it is not a good idea to keep all application data in a central registry. We have evolved towards a more robust design, where each application saves its own configuration data. Some application programmers have chosen to use application-specific configuration files, but many still use INI files for that purpose.

There are two good reasons why you would want to use LoadINI and DumpINI:

  • As a matter of principle, you should keep backups of your INI data. Of course there are existing simple solutions (a periodic "copy app.ini app.ini.bak"), but having a human-readable backup might be more robust.
  • There is a design bug in OS/2 that causes INI data to be lost under certain "out of memory" conditions. This motivates us to move towards a system that does not depend on the native INI support.