More Windows patches

Some more changes on the way to a minimal Windows build.