Windows: assorted fixes to make it compile under Visual Studio 2013