Mingw32 compatibility fixes

Various fixes for problems I ran into with the Ming32 build.
Also added a compile-time flag to disable WSAPoll, which seems broken.