MinGW fixes.

Another assorted batch of MinGW fixes.

Test suite green is becoming dangerously close: https://gist.github.com/klickverbot/4999401.