I tried to work on the patch again, but it does not apply anymore. I am slowly going through what happened in profile.c, to find out which changes should be kept, and which go in a wrong direction.
I stumbled already @the first entry:
commit 9a10234ef2b5212ba44b82a797c478f190b4dad1 Author: Paul Vriens Paul.Vriens.Wine@gmail.com Date: Thu Apr 2 12:16:11 2009 +0200
The change is good and bad at the same time, in that the change depends on the windows version AFAIR. This change takes the []\r\n away for empty sections, but some windows versions do put those characters there.
See http://bugs2.winehq.org/attachment.cgi?id=6182 for a file generated under Windows XP, showing the []\r\n at the beginning for the empty string section.
There seems to be a situation where this gets changed back and forth depending on who is committing the change (and thus probably depending on which windows version is tested).
If someone is interested in fixing this confusion and has access to different windows versions, the whole history of
git log -p dlls/kernel32/profile.c
would be a good starting point, together with the experimental results of XP and 98 which respectively do and do not put the '[]\r\n' there.