mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
a55aac71e4
This fulfills our long-standing Mayhem-difficulty wishlist item 'win-command-prompt': this is a Windows pterm in the sense that when you run it you get a local cmd.exe running inside a PuTTY-style window. Advantages of this: you get the same free choice of fonts as PuTTY has (no restriction to a strange subset of the system's available fonts); you get the same copy-paste gestures as PuTTY (no mental gear-shifting when you have command prompts and SSH sessions open on the same desktop); you get scrollback with the PuTTY semantics (scrolling to the bottom gets you to where the action is, as opposed to the way you could accidentally find yourself 500 lines past the end of the action in a real console). 'win-command-prompt' was at Mayhem difficulty ('Probably impossible') basically on the grounds that with Windows's old APIs for accessing the contents of consoles, there was no way I could find to get this to work sensibly. What was needed to make it feasible was a major piece of re-engineering work inside Windows itself. But, of course, that's exactly what happened! In 2019, the new ConPTY API arrived, which lets you create an object that behaves like a Windows console at one end, and round the back, emits a stream of VT-style escape sequences as the screen contents evolve, and accepts a VT-style input stream in return which it will parse function and arrow keys out of in the usual way. So now it's actually _easy_ to get this to basically work. The new backend, in conpty.c, has to do a handful of magic Windows API calls to set up the pseudo-console and its feeder pipes and start a subprocess running in it, a further magic call every time the PuTTY window is resized, and detect the end of the session by watching for the subprocess terminating. But apart from that, all it has to do is pass data back and forth unmodified between those pipes and the backend's associated Seat! That said, this is new and experimental, and there will undoubtedly be issues. One that I already know about is that you can't copy and paste a word that has wrapped between lines without getting an annoying newline in the middle of it. As far as I can see this is a fundamental limitation: the ConPTY system sends the _same_ escape sequence stream for a line that wrapped as it would send for a line that had a logical \n at what would have been the wrap point. Probably the best we can do to mitigate this is to adopt a different heuristic for newline elision that's right more often than it's wrong. For the moment, that experimental-ness is indicated by the fact that Buildscr will build, sign and deliver a copy of pterm.exe for each flavour of Windows, but won't include it in the .zip file or in the installer. (In fact, that puts it in exactly the same ad-hoc category as PuTTYtel, although for completely different reasons.)
163 lines
4.4 KiB
CMake
163 lines
4.4 KiB
CMake
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
add_sources_from_current_dir(utils
|
|
utils/arm_arch_queries.c
|
|
utils/cryptoapi.c
|
|
utils/defaults.c
|
|
utils/dll_hijacking_protection.c
|
|
utils/dputs.c
|
|
utils/escape_registry_key.c
|
|
utils/filename.c
|
|
utils/fontspec.c
|
|
utils/getdlgitemtext_alloc.c
|
|
utils/get_system_dir.c
|
|
utils/get_username.c
|
|
utils/is_console_handle.c
|
|
utils/load_system32_dll.c
|
|
utils/ltime.c
|
|
utils/makedlgitemborderless.c
|
|
utils/message_box.c
|
|
utils/minefield.c
|
|
utils/open_for_write_would_lose_data.c
|
|
utils/pgp_fingerprints_msgbox.c
|
|
utils/platform_get_x_display.c
|
|
utils/registry_get_string.c
|
|
utils/request_file.c
|
|
utils/security.c
|
|
utils/split_into_argv.c
|
|
utils/version.c
|
|
utils/win_strerror.c
|
|
unicode.c)
|
|
if(NOT HAVE_STRTOUMAX)
|
|
add_sources_from_current_dir(utils utils/strtoumax.c)
|
|
endif()
|
|
add_sources_from_current_dir(eventloop
|
|
cliloop.c handle-io.c)
|
|
add_sources_from_current_dir(console
|
|
select-cli.c nohelp.c console.c)
|
|
add_sources_from_current_dir(settings
|
|
storage.c)
|
|
add_sources_from_current_dir(network
|
|
network.c handle-socket.c named-pipe-client.c named-pipe-server.c local-proxy.c x11.c)
|
|
add_sources_from_current_dir(sshcommon
|
|
noise.c)
|
|
add_sources_from_current_dir(sshclient
|
|
agent-client.c gss.c sharing.c)
|
|
add_sources_from_current_dir(sftpclient
|
|
sftp.c)
|
|
add_sources_from_current_dir(otherbackends
|
|
serial.c)
|
|
add_sources_from_current_dir(agent
|
|
agent-client.c)
|
|
add_sources_from_current_dir(guiterminal
|
|
dialog.c controls.c config.c printing.c jump-list.c sizetip.c)
|
|
add_dependencies(guiterminal generated_licence_h) # dialog.c uses licence.h
|
|
|
|
add_library(guimisc STATIC
|
|
select-gui.c)
|
|
|
|
add_executable(pageant
|
|
pageant.c
|
|
help.c
|
|
pageant.rc)
|
|
add_dependencies(pageant generated_licence_h)
|
|
target_link_libraries(pageant
|
|
guimisc eventloop agent network crypto utils
|
|
${platform_libraries})
|
|
set_target_properties(pageant PROPERTIES
|
|
WIN32_EXECUTABLE ON
|
|
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
|
|
installed_program(pageant)
|
|
|
|
add_sources_from_current_dir(plink no-jump-list.c nohelp.c plink.rc)
|
|
add_dependencies(plink generated_licence_h)
|
|
|
|
add_sources_from_current_dir(pscp no-jump-list.c nohelp.c pscp.rc)
|
|
add_dependencies(pscp generated_licence_h)
|
|
|
|
add_sources_from_current_dir(psftp no-jump-list.c nohelp.c psftp.rc)
|
|
add_dependencies(psftp generated_licence_h)
|
|
|
|
add_sources_from_current_dir(psocks nohelp.c)
|
|
|
|
add_executable(putty
|
|
window.c
|
|
putty.c
|
|
help.c
|
|
${CMAKE_SOURCE_DIR}/be_all_s.c
|
|
putty.rc)
|
|
add_dependencies(putty generated_licence_h)
|
|
target_link_libraries(putty
|
|
guiterminal guimisc eventloop sshclient otherbackends settings network crypto
|
|
utils
|
|
${platform_libraries})
|
|
set_target_properties(putty PROPERTIES
|
|
WIN32_EXECUTABLE ON
|
|
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
|
|
installed_program(putty)
|
|
|
|
add_executable(puttytel
|
|
window.c
|
|
putty.c
|
|
help.c
|
|
${CMAKE_SOURCE_DIR}/be_nos_s.c
|
|
${CMAKE_SOURCE_DIR}/nogss.c
|
|
${CMAKE_SOURCE_DIR}/norand.c
|
|
${CMAKE_SOURCE_DIR}/nocproxy.c
|
|
puttytel.rc)
|
|
add_dependencies(puttytel generated_licence_h)
|
|
target_link_libraries(puttytel
|
|
guiterminal guimisc eventloop otherbackends settings network utils
|
|
${platform_libraries})
|
|
set_target_properties(puttytel PROPERTIES
|
|
WIN32_EXECUTABLE ON
|
|
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
|
|
installed_program(puttytel)
|
|
|
|
add_executable(puttygen
|
|
puttygen.c
|
|
${CMAKE_SOURCE_DIR}/notiming.c
|
|
noise.c
|
|
no-jump-list.c
|
|
storage.c
|
|
help.c
|
|
${CMAKE_SOURCE_DIR}/sshpubk.c
|
|
${CMAKE_SOURCE_DIR}/sshrand.c
|
|
controls.c
|
|
puttygen.rc)
|
|
add_dependencies(puttygen generated_licence_h)
|
|
target_link_libraries(puttygen
|
|
keygen guimisc crypto utils
|
|
${platform_libraries})
|
|
set_target_properties(puttygen PROPERTIES
|
|
WIN32_EXECUTABLE ON
|
|
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
|
|
installed_program(puttygen)
|
|
|
|
if(HAVE_CONPTY)
|
|
add_executable(pterm
|
|
window.c
|
|
pterm.c
|
|
help.c
|
|
conpty.c
|
|
be_conpty.c
|
|
${CMAKE_SOURCE_DIR}/nogss.c
|
|
${CMAKE_SOURCE_DIR}/norand.c
|
|
pterm.rc)
|
|
add_dependencies(pterm generated_licence_h)
|
|
target_link_libraries(pterm
|
|
guiterminal guimisc eventloop settings network utils
|
|
${platform_libraries})
|
|
set_target_properties(pterm PROPERTIES
|
|
WIN32_EXECUTABLE ON
|
|
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
|
|
installed_program(pterm)
|
|
else()
|
|
message("ConPTY not available; cannot build Windows pterm")
|
|
endif()
|
|
|
|
add_executable(test_split_into_argv
|
|
utils/split_into_argv.c)
|
|
target_compile_definitions(test_split_into_argv PRIVATE TEST)
|
|
target_link_libraries(test_split_into_argv utils ${platform_libraries})
|