зеркало из https://github.com/github/putty.git
Enable copying the Event Log
[originally from svn r619]
This commit is contained in:
Родитель
ddbc120725
Коммит
cbdd9b3ac5
6
plink.c
6
plink.c
|
@ -33,6 +33,12 @@ void connection_fatal (char *p, ...) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stubs for linking with other modules.
|
||||
*/
|
||||
void write_clip (void *data, int len) { }
|
||||
void term_deselect(void) { }
|
||||
|
||||
HANDLE outhandle;
|
||||
DWORD orig_console_mode;
|
||||
|
||||
|
|
13
scp.c
13
scp.c
|
@ -74,14 +74,13 @@ static void send_str_msg(unsigned int msg_id, char *str);
|
|||
static void gui_update_stats(char *name, unsigned long size, int percentage, time_t elapsed);
|
||||
|
||||
/*
|
||||
* These functions are needed to link with ssh.c, but never get called.
|
||||
* These functions are needed to link with other modules, but
|
||||
* (should) never get called.
|
||||
*/
|
||||
void term_out(void)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
void begin_session(void) {
|
||||
}
|
||||
void term_out(void) { abort(); }
|
||||
void begin_session(void) { }
|
||||
void write_clip (void *data, int len) { }
|
||||
void term_deselect(void) { }
|
||||
|
||||
/* GUI Adaptation - Sept 2000 */
|
||||
void send_msg(HWND h, UINT message, WPARAM wParam)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define IDD_LICENCEBOX 113
|
||||
|
||||
#define IDN_LIST 1001
|
||||
#define IDN_COPY 1002
|
||||
|
||||
#define IDA_ICON 1001
|
||||
#define IDA_TEXT1 1002
|
||||
|
|
|
@ -340,14 +340,15 @@ BEGIN
|
|||
|
||||
END
|
||||
|
||||
/* Accelerators used: c */
|
||||
/* Accelerators used: co */
|
||||
IDD_LOGBOX DIALOG DISCARDABLE 100, 20, 160, 119
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "PuTTY Event Log"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "&Close", IDOK, 58, 102, 44, 14
|
||||
LISTBOX IDN_LIST, 3, 3, 154, 95, LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL
|
||||
DEFPUSHBUTTON "&Close", IDOK, 85, 102, 44, 14
|
||||
PUSHBUTTON "C&opy", IDN_COPY, 31, 102, 44, 14
|
||||
LISTBOX IDN_LIST, 3, 3, 154, 95, LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL | LBS_EXTENDEDSEL
|
||||
END
|
||||
|
||||
/* No accelerators used */
|
||||
|
|
42
windlg.c
42
windlg.c
|
@ -431,6 +431,46 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
|
|||
logbox = NULL;
|
||||
DestroyWindow (hwnd);
|
||||
return 0;
|
||||
case IDN_COPY:
|
||||
if (HIWORD(wParam) == BN_CLICKED ||
|
||||
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
||||
int selcount;
|
||||
int *selitems;
|
||||
selcount = SendDlgItemMessage(hwnd, IDN_LIST,
|
||||
LB_GETSELCOUNT, 0, 0);
|
||||
selitems = malloc(selcount * sizeof(int));
|
||||
if (selitems) {
|
||||
int count = SendDlgItemMessage(hwnd, IDN_LIST,
|
||||
LB_GETSELITEMS,
|
||||
selcount, (LPARAM)selitems);
|
||||
int i;
|
||||
int size;
|
||||
char *clipdata;
|
||||
static unsigned char sel_nl[] = SEL_NL;
|
||||
|
||||
size = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
size += strlen(events[selitems[i]]) + sizeof(sel_nl);
|
||||
|
||||
clipdata = malloc(size);
|
||||
if (clipdata) {
|
||||
char *p = clipdata;
|
||||
for (i = 0; i < count; i++) {
|
||||
char *q = events[selitems[i]];
|
||||
int qlen = strlen(q);
|
||||
memcpy(p, q, qlen);
|
||||
p += qlen;
|
||||
memcpy(p, sel_nl, sizeof(sel_nl));
|
||||
p += sizeof(sel_nl);
|
||||
}
|
||||
write_clip(clipdata, size);
|
||||
term_deselect();
|
||||
free(clipdata);
|
||||
}
|
||||
free(selitems);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
case WM_CLOSE:
|
||||
|
@ -1584,7 +1624,7 @@ void logevent (char *string) {
|
|||
SendDlgItemMessage (logbox, IDN_LIST, LB_ADDSTRING,
|
||||
0, (LPARAM)string);
|
||||
count = SendDlgItemMessage (logbox, IDN_LIST, LB_GETCOUNT, 0, 0);
|
||||
SendDlgItemMessage (logbox, IDN_LIST, LB_SETCURSEL, count-1, 0);
|
||||
SendDlgItemMessage (logbox, IDN_LIST, LB_SETTOPINDEX, count-1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче