Another shocking discovery. WritePrivateProfileString hangs because AntiVirus is accessing the ini file.
I really don't know what to do now.