Fix windows build and clean up use of <windows.h>