Initialization file functions

OllyDbg keeps its global settings in the initialization file. They include options, file history, layout and placement of windows, fonts and colour schemes. In my personal opinion, initialization file has many advantages over the registry. First of all, it's portable. You can easily backup it. You can copy ollydbg.ini to the flash drive and use your favourite options everywhere. It's compact, human-readable and easily editable. And, you can delete it anytime and be sure that there are no dead keys remaining in the registry.

Initialization file is located in the same directory as OllyDbg executable and is named xxxxx.ini, where xxxxx is the current name of the OllyDbg. Thus, if you rename d:\ollydbg\ollydbg.exe into quark.exe and start it, it will create its own initialization file, d:\ollydbg\quark.ini. This is the easiest way to switch between the different configurations.

Initialization functions take care of the UNICODE characters and quoted file names.

Note that child debugger (copy of the OllyDbg thar was automatically started when debugged process started child process) is not allowed to save any data to the initialization file. This behaviour is by design to prevent interference with the main instance.

API functions:

int Stringfromini(wchar_t *section,wchar_t *key,wchar_t *s,int length);
int Filefromini(wchar_t *key,wchar_t *name,wchar_t *defname);
int Getfromini(wchar_t *file,wchar_t *section,wchar_t *key,wchar_t *format,...);
int Writetoini(wchar_t *file,wchar_t *section,wchar_t *key,wchar_t *format,...);
int Filetoini(wchar_t *key,wchar_t *name);
void Deleteinisection(wchar_t *file,wchar_t *section);
int Getfromsettings(wchar_t *key,int defvalue);
void Addtosettings(wchar_t *key,int value);