a whole bunch of windows-related fixups. compiles with osgeo4w64 on msvc2013