There is a free library called Nini that I use to read and write ini files (and other configuration formats also):
http://nini.sourceforge.net/

It's great. It provides a unified interface to all configuration formats (ini, xml, command line arguments and registry). No need to use those ugly API commands.