It determines: - whether the program has a console - whether that console has a window - whether that window is on the current window station It's motivated by the IntelliJ clipboard/winpty bug.