Factor out Windows-specific code