MinGW patches against windows branch

Here are a few MinGW/windows related patches. Please merge if you think they are appropriate.