Solved! It turns out that when calling GetCommConfig the third parameter has to be set to the size in bytes of the buffer pointed by the second parameter, which is typical for a number of win32 API functions:
HANDLE hPort; COMMCONFIG cfg; DWORD n; ... n = sizeof(COMMCONFIG); // <- I had missed this one fSuccess = GetCommConfig (hPort, &cfg, &n);
This is true despite the fact one has to pass the address of a COMMCONFIG variable as second parameter.
I seem to remember that the reason is that the size can vary in different version of Windows, so this approach is agnostic of the particular version used to compile and/or run the application.
Phew. I shall publish updated binaries at some point next week.