Skip to content

PuTTY hang when config dialog is closed by rapid enter key #1

Description

@ranvis

PuTTY shows configuration dialog box on launch for making a connection.
If you use the enter key there to open the terminal, the application hangs, if the key is released instantly after you press it.

Some may have difficulty reproducing this, for it requires a rapid action on fast computers, I have written a macro script that automates this, which is appended at the bottom.

The problem may be "hidden" if you add EndDialog(hwnd, 0); to the end of SaneEndDialog() function in windows/windlg.c, although it must be illegal to call EndDialog() in this case.

Automation script: (requires AutoHotkey https://www.autohotkey.com/)

#NoEnv

Run,putty.exe,,UseErrorLevel,pid ; launch putty of the current directory or in PATH
if (!pid) {
  MsgBox,putty.exe was not found
  ExitApp
}
WinActivate,ahk_pid %pid% ; expect config window is up
WinWaitActive,ahk_pid %pid%,,3
if (ErrorLevel) {
  MsgBox,PuTTY config window was not found
  ExitApp
}
ControlGet,portHwnd,Hwnd,,Edit2,A ; port
classBase := !ErrorLevel ? "Edit" : "xEdit" ; PuTTYjp detection
ControlSetText,%classBase%1,127.0.0.1,A ; whatever host
ControlSetText,%classBase%2,12345,A ; port
SendInput,{Enter} ; press Enter as fast as possible

Sleep,3000
MsgBox,Now PuTTY should not be responding. Press OK to close it.
Process,Close,%pid%
ExitApp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions