Use probably-horrendously slow metaprogramming to make things work on Windwos with minimal code duplication.