mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Handle WM_NETEVENT in Windows Pageant.
Apparently when I made Windows Pageant use the winselgui system, I added the call that gets WSAAsyncSelect response messages sent to Pageant's window, but I didn't add the switch case in the window procedure that actually handles those responses. I suppose I didn't notice at the time because no actual functionality used it - Pageant has never yet dealt with any real (i.e. Winsock) sockets, only with HANDLE-based named pipes, which are called 'sockets' in PuTTY's abstraction, but not by Windows.
This commit is contained in:
parent
018236da29
commit
82971a3ebb
@ -1270,6 +1270,9 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_NETEVENT:
|
||||
winselgui_response(wParam, lParam);
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
quit_help(hwnd);
|
||||
PostQuitMessage(0);
|
||||
|
@ -333,6 +333,7 @@ const char *do_select(SOCKET skt, bool enable);
|
||||
*/
|
||||
void winselgui_set_hwnd(HWND hwnd);
|
||||
void winselgui_clear_hwnd(void);
|
||||
void winselgui_response(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void winselcli_setup(void);
|
||||
SOCKET winselcli_unique_socket(void);
|
||||
|
@ -36,3 +36,30 @@ const char *do_select(SOCKET skt, bool enable)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wm_netevent_params {
|
||||
/* Used to pass data to wm_netevent_callback */
|
||||
WPARAM wParam;
|
||||
LPARAM lParam;
|
||||
};
|
||||
|
||||
static void wm_netevent_callback(void *vctx)
|
||||
{
|
||||
struct wm_netevent_params *params = (struct wm_netevent_params *)vctx;
|
||||
select_result(params->wParam, params->lParam);
|
||||
sfree(params);
|
||||
}
|
||||
|
||||
void winselgui_response(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
/*
|
||||
* To protect against re-entrancy when Windows's recv()
|
||||
* immediately triggers a new WSAAsyncSelect window message, we
|
||||
* don't call select_result directly from this handler but instead
|
||||
* wait until we're back out at the top level of the message loop.
|
||||
*/
|
||||
struct wm_netevent_params *params = snew(struct wm_netevent_params);
|
||||
params->wParam = wParam;
|
||||
params->lParam = lParam;
|
||||
queue_toplevel_callback(wm_netevent_callback, params);
|
||||
}
|
||||
|
@ -151,12 +151,6 @@ static Conf *conf;
|
||||
static LogContext *logctx;
|
||||
static Terminal *term;
|
||||
|
||||
struct wm_netevent_params {
|
||||
/* Used to pass data to wm_netevent_callback */
|
||||
WPARAM wParam;
|
||||
LPARAM lParam;
|
||||
};
|
||||
|
||||
static void conf_cache_data(void);
|
||||
static int cursor_type;
|
||||
static int vtmode;
|
||||
@ -1117,16 +1111,6 @@ void cmdline_error(const char *fmt, ...)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Actually do the job requested by a WM_NETEVENT
|
||||
*/
|
||||
static void wm_netevent_callback(void *vctx)
|
||||
{
|
||||
struct wm_netevent_params *params = (struct wm_netevent_params *)vctx;
|
||||
select_result(params->wParam, params->lParam);
|
||||
sfree(vctx);
|
||||
}
|
||||
|
||||
static inline rgb rgb_from_colorref(COLORREF cr)
|
||||
{
|
||||
rgb toret;
|
||||
@ -2812,21 +2796,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
ShowCaret(hwnd);
|
||||
return 0;
|
||||
}
|
||||
case WM_NETEVENT: {
|
||||
/*
|
||||
* To protect against re-entrancy when Windows's recv()
|
||||
* immediately triggers a new WSAAsyncSelect window
|
||||
* message, we don't call select_result directly from this
|
||||
* handler but instead wait until we're back out at the
|
||||
* top level of the message loop.
|
||||
*/
|
||||
struct wm_netevent_params *params =
|
||||
snew(struct wm_netevent_params);
|
||||
params->wParam = wParam;
|
||||
params->lParam = lParam;
|
||||
queue_toplevel_callback(wm_netevent_callback, params);
|
||||
case WM_NETEVENT:
|
||||
winselgui_response(wParam, lParam);
|
||||
return 0;
|
||||
}
|
||||
case WM_SETFOCUS:
|
||||
term_set_focus(term, true);
|
||||
CreateCaret(hwnd, caretbm, font_width, font_height);
|
||||
|
Loading…
Reference in New Issue
Block a user