Refactored Win32 support to be DRY'er