Catch and ignore CTRL_LOGOFF_EVENT when run as a windows service
Revert "Catch and ignore CTRL_LOGOFF_EVENT when run as a windows service"

This reverts commit a7ddf81b37b578b1448f83b0efb4f7116de0c3fb.
Put console event handle in reachable code
Fix import issues
Merge pull request #5664 from olliewalsh/fix_issue_5637

Potential fix for issue #5637