| 57 |
#include "unicode.h" |
#include "unicode.h" |
| 58 |
#include "ttdde.h" |
#include "ttdde.h" |
| 59 |
#include "checkeol.h" |
#include "checkeol.h" |
| 60 |
|
#include "asprintf.h" |
| 61 |
|
|
| 62 |
#include "vtterm.h" |
#include "vtterm.h" |
| 63 |
|
|
| 5072 |
static void XsProcClipboard(PCHAR buff) |
static void XsProcClipboard(PCHAR buff) |
| 5073 |
{ |
{ |
| 5074 |
int len, blen; |
int len, blen; |
| 5075 |
char *p, *cbbuff, hdr[20], notify_buff[256], notify_title[MAX_UIMSG]; |
char *p, *cbbuff, hdr[20]; |
| 5076 |
|
wchar_t *notify_buff, *notify_title; |
| 5077 |
HGLOBAL cbmem; |
HGLOBAL cbmem; |
| 5078 |
int wide_len; |
int wide_len; |
| 5079 |
HGLOBAL wide_cbmem; |
HGLOBAL wide_cbmem; |
| 5088 |
if (*p == '?' && *(p+1) == 0) { // Read access |
if (*p == '?' && *(p+1) == 0) { // Read access |
| 5089 |
if (ts.CtrlFlag & CSF_CBREAD) { |
if (ts.CtrlFlag & CSF_CBREAD) { |
| 5090 |
if (ts.NotifyClipboardAccess) { |
if (ts.NotifyClipboardAccess) { |
| 5091 |
get_lang_msg("MSG_CBACCESS_TITLE", notify_title, sizeof(notify_title), |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_TITLE", |
| 5092 |
"Clipboard Access", ts.UILanguageFile); |
L"Clipboard Access", ts.UILanguageFileW, ¬ify_title); |
| 5093 |
get_lang_msg("MSG_CBACCESS_READ", notify_buff, sizeof(notify_buff), |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_READ", |
| 5094 |
"Remote host reads clipboard contents.", ts.UILanguageFile); |
L"Remote host reads clipboard contents.", ts.UILanguageFileW, ¬ify_buff); |
| 5095 |
NotifyInfoMessage(&cv, notify_buff, notify_title); |
NotifyInfoMessageW(&cv, notify_buff, notify_title); |
| 5096 |
|
free(notify_title); |
| 5097 |
|
free(notify_buff); |
| 5098 |
} |
} |
| 5099 |
strncpy_s(hdr, sizeof(hdr), "\033]52;", _TRUNCATE); |
strncpy_s(hdr, sizeof(hdr), "\033]52;", _TRUNCATE); |
| 5100 |
if (strncat_s(hdr, sizeof(hdr), buff, p - buff) == 0) { |
if (strncat_s(hdr, sizeof(hdr), buff, p - buff) == 0) { |
| 5102 |
} |
} |
| 5103 |
} |
} |
| 5104 |
else if (ts.NotifyClipboardAccess) { |
else if (ts.NotifyClipboardAccess) { |
| 5105 |
get_lang_msg("MSG_CBACCESS_REJECT_TITLE", notify_title, sizeof(notify_title), |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_REJECT_TITLE", |
| 5106 |
"Rejected Clipboard Access", ts.UILanguageFile); |
L"Rejected Clipboard Access", ts.UILanguageFileW, ¬ify_title); |
| 5107 |
get_lang_msg("MSG_CBACCESS_READ_REJECT", notify_buff, sizeof(notify_buff), |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_READ_REJECT", |
| 5108 |
"Reject clipboard read access from remote.", ts.UILanguageFile); |
L"Reject clipboard read access from remote.", ts.UILanguageFileW, ¬ify_buff); |
| 5109 |
NotifyWarnMessage(&cv, notify_buff, notify_title); |
NotifyWarnMessageW(&cv, notify_buff, notify_title); |
| 5110 |
|
free(notify_title); |
| 5111 |
|
free(notify_buff); |
| 5112 |
} |
} |
| 5113 |
} |
} |
| 5114 |
else if (ts.CtrlFlag & CSF_CBWRITE) { // Write access |
else if (ts.CtrlFlag & CSF_CBWRITE) { // Write access |
| 5135 |
GlobalUnlock(cbmem); |
GlobalUnlock(cbmem); |
| 5136 |
|
|
| 5137 |
if (ts.NotifyClipboardAccess) { |
if (ts.NotifyClipboardAccess) { |
| 5138 |
get_lang_msg("MSG_CBACCESS_TITLE", notify_title, sizeof(notify_title), |
wchar_t *buf; |
| 5139 |
"Clipboard Access", ts.UILanguageFile); |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_TITLE", |
| 5140 |
get_lang_msg("MSG_CBACCESS_WRITE", ts.UIMsg, sizeof(ts.UIMsg), |
L"Clipboard Access", ts.UILanguageFileW, ¬ify_title); |
| 5141 |
"Remote host wirtes clipboard.", ts.UILanguageFile); |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_WRITE", |
| 5142 |
_snprintf_s(notify_buff, sizeof(notify_buff), _TRUNCATE, "%s\n--\n%s", ts.UIMsg, cbbuff); |
L"Remote host wirtes clipboard.", ts.UILanguageFileW, &buf); |
| 5143 |
NotifyInfoMessage(&cv, notify_buff, notify_title); |
aswprintf(¬ify_buff, L"%s\n--\n%hs", buf, cbbuff); |
| 5144 |
|
NotifyInfoMessageW(&cv, notify_buff, notify_title); |
| 5145 |
|
free(buf); |
| 5146 |
|
free(notify_title); |
| 5147 |
|
free(notify_buff); |
| 5148 |
} |
} |
| 5149 |
|
|
| 5150 |
wide_len = MultiByteToWideChar(CP_ACP, 0, cbbuff, -1, NULL, 0); |
wide_len = MultiByteToWideChar(CP_ACP, 0, cbbuff, -1, NULL, 0); |
| 5165 |
} |
} |
| 5166 |
} |
} |
| 5167 |
else if (ts.NotifyClipboardAccess) { |
else if (ts.NotifyClipboardAccess) { |
| 5168 |
get_lang_msg("MSG_CBACCESS_REJECT_TITLE", notify_title, sizeof(notify_title), |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_REJECT_TITLE", |
| 5169 |
"Rejected Clipboard Access", ts.UILanguageFile); |
L"Rejected Clipboard Access", ts.UILanguageFileW, ¬ify_title); |
| 5170 |
get_lang_msg("MSG_CBACCESS_WRITE_REJECT", notify_buff, sizeof(notify_buff), |
GetI18nStrWW("Tera Term", "MSG_CBACCESS_WRITE_REJECT", |
| 5171 |
"Reject clipboard write access from remote.", ts.UILanguageFile); |
L"Reject clipboard write access from remote.", ts.UILanguageFileW, ¬ify_buff); |
| 5172 |
NotifyWarnMessage(&cv, notify_buff, notify_title); |
NotifyWarnMessageW(&cv, notify_buff, notify_title); |
| 5173 |
|
free(notify_title); |
| 5174 |
|
free(notify_buff); |
| 5175 |
} |
} |
| 5176 |
} |
} |
| 5177 |
} |
} |