Skip to content

Commit

Permalink
Merge tag 'v0.76.1.13' into cnKiTTY
Browse files Browse the repository at this point in the history
  • Loading branch information
dZ8Lx9OwX authored and dZ8Lx9OwX committed Sep 18, 2023
2 parents f6e424f + 75fa2ab commit 142b608
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 96 deletions.
2 changes: 1 addition & 1 deletion 0.76_My_PuTTY/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3631,6 +3631,7 @@ static void do_osc(Terminal *term)

if (gfmt == CF_TEXT) {

n = wcsnlen((wchar_t *)pClipData, n / sizeof(wchar_t));
ClipTextSize = WideCharToMultiByte(
CP_UTF8,
0,
Expand All @@ -3643,7 +3644,6 @@ static void do_osc(Terminal *term)
) + 1;

if (ClipTextSize >= 0) {
n = wcsnlen((wchar_t *)pClipData, n / sizeof(wchar_t));
ClipText = calloc(ClipTextSize + 1, 1);
if (ClipText) {
WideCharToMultiByte(
Expand Down
1 change: 1 addition & 0 deletions 0.76b_My_PuTTY/putty.h
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,7 @@ NORETURN void cleanup_exit(int);
X(BOOL, NONE, no_focus_rep) /* totally disable mouse reporting */ \
X(INT, NONE, scrolllines) /* Options for Scroll Lines per Wheel */ \
X(BOOL, NONE, ssh_tunnel_print_in_title) /* print dynamic port number in window title */ \
X(BOOL, NONE, osc52_warn_before_cliboard_sync) /* Warn before clipboard sync */ \
/* #endif */ \
/* #ifdef MOD_PROXY */ \
X(STR, NONE, proxyselection) /* Options for proxy selection */ \
Expand Down
2 changes: 2 additions & 0 deletions 0.76b_My_PuTTY/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_b(sesskey, "NoFocusReporting", conf_get_bool(conf, CONF_no_focus_rep));
write_setting_i(sesskey, "LinesAtAScroll", conf_get_int(conf, CONF_scrolllines));
write_setting_b(sesskey, "SSHTunnelInTitle", conf_get_bool(conf, CONF_ssh_tunnel_print_in_title));
write_setting_b(sesskey, "OSC52WarnBeforeClipboardSync", conf_get_bool(conf, CONF_osc52_warn_before_cliboard_sync));
#endif
#ifdef MOD_PORTKNOCKING
write_setting_s(sesskey, "PortKnocking", conf_get_str(conf, CONF_portknockingoptions) );
Expand Down Expand Up @@ -1640,6 +1641,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppb(sesskey, "NoFocusReporting", true, conf, CONF_no_focus_rep);
gppi(sesskey, "LinesAtAScroll", -1, conf, CONF_scrolllines);
gppb(sesskey, "SSHTunnelInTitle", false, conf, CONF_ssh_tunnel_print_in_title);
gppb(sesskey, "OSC52WarnBeforeClipboardSync", false, conf, CONF_osc52_warn_before_cliboard_sync);
#endif
#ifdef MOD_PORTKNOCKING
gpps(sesskey, "PortKnocking", "", conf, CONF_portknockingoptions );
Expand Down
126 changes: 75 additions & 51 deletions 0.76b_My_PuTTY/terminal/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3637,6 +3637,7 @@ static void do_osc(Terminal *term)

if (gfmt == CF_TEXT) {

n = wcsnlen((wchar_t *)pClipData, n / sizeof(wchar_t));
ClipTextSize = WideCharToMultiByte(
CP_UTF8,
0,
Expand All @@ -3649,7 +3650,6 @@ static void do_osc(Terminal *term)
) + 1;

if (ClipTextSize >= 0) {
n = wcsnlen((wchar_t *)pClipData, n / sizeof(wchar_t));
ClipText = calloc(ClipTextSize + 1, 1);
if (ClipText) {
WideCharToMultiByte(
Expand Down Expand Up @@ -3857,66 +3857,90 @@ static void do_osc(Terminal *term)
break;
#ifdef MOD_PERSO
case 52:
{
int status = MessageBox(NULL,
"Allow OSC52 clipboard sync?", "PyTTY", MB_OKCANCEL);

if (status == IDOK) {

base64_decodestate _d_state;
base64_init_decodestate(&_d_state);
char* d_out = malloc(term->osc_strlen);
int d_count = base64_decode_block(
term->osc_string+1, term->osc_strlen-1, d_out, &_d_state);

uint32_t fmt;
char* buffer = NULL;
int BufferSize = 0;

int cnt = MultiByteToWideChar(CP_UTF8, 0, (LPCCH)d_out, d_count, NULL, 0);
if (cnt > 0) {
buffer = calloc(cnt + 1, sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, (LPCCH)d_out, d_count, (PWCHAR)buffer, cnt);
}

fmt = CF_UNICODETEXT;
BufferSize = (wcslen((PWCHAR)buffer) + 1) * sizeof(WCHAR);

HGLOBAL hData;
void *GData;

if (buffer && (hData=GlobalAlloc(GMEM_MOVEABLE,BufferSize))) {
{
char *env_check = getenv("OSC52ALLOWED");
int status = IDOK; // Default to IDOK

if( conf_get_bool(term->conf, CONF_osc52_warn_before_cliboard_sync) && (!env_check || strlen(env_check) == 0)) {
status = MessageBox(NULL,
"是否允许OSC52剪贴板同步?", "PyTTY", MB_OKCANCEL);
}

if (status == IDOK) {
base64_decodestate _d_state;
base64_init_decodestate(&_d_state);
char* d_out = malloc(term->osc_strlen);

if (!d_out) {
// Failed to allocate memory
break;
}

if ((GData=GlobalLock(hData))) {
int d_count = base64_decode_block(
term->osc_string+1, term->osc_strlen-1, d_out, &_d_state);

memcpy(GData,buffer,BufferSize);
GlobalUnlock(hData);
uint32_t fmt;
wchar_t* buffer = NULL; // Changed to wchar_t

if (OpenClipboard(NULL)) {
int cnt = MultiByteToWideChar(CP_UTF8, 0, (LPCCH)d_out, d_count, NULL, 0);
if (cnt > 0) {
buffer = calloc(cnt + 1, sizeof(wchar_t));

if (!buffer) {
// Failed to allocate memory
free(d_out);
break;
}

MultiByteToWideChar(CP_UTF8, 0, (LPCCH)d_out, d_count, buffer, cnt);
}

EmptyClipboard();
fmt = CF_UNICODETEXT;

if (!SetClipboardData(fmt, (HANDLE)hData)) {
GlobalFree(hData);
}
if (buffer) {
int BufferSize = (wcslen(buffer) + 1) * sizeof(wchar_t);

CloseClipboard();
HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, BufferSize);

if (!hData) {
// Failed to allocate global memory
free(buffer);
free(d_out);
break;
}

} else {
GlobalFree(hData);
}
void *GData = GlobalLock(hData);

if (!GData) {
// Failed to lock global memory
GlobalFree(hData);
free(buffer);
free(d_out);
break;
}

} else {
GlobalFree(hData);
}
}
memcpy(GData, buffer, BufferSize);
GlobalUnlock(hData);

if (OpenClipboard(NULL)) {
EmptyClipboard();

if (!SetClipboardData(fmt, (HANDLE)hData)) {
GlobalFree(hData);
}

CloseClipboard();
} else {
GlobalFree(hData);
}
}

free(buffer);
free(d_out);
}
free(buffer);
free(d_out);
}

break;
}
break;
}
#endif
case 4:
if (term->ldisc && !strcmp(term->osc_string, "?")) {
Expand Down
2 changes: 1 addition & 1 deletion 0.76b_My_PuTTY/version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define RELEASE 0.76
#define TEXTVER "Release 0.76"
#define SSHVER "-Release-0.76"
#define BINARY_VERSION 0,76,1,12
#define BINARY_VERSION 0,76,1,13
#define SOURCE_COMMIT "unavailable"
4 changes: 4 additions & 0 deletions 0.76b_My_PuTTY/windows/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
HELPCTX(no_help),
conf_checkbox_handler,
I(CONF_ctrl_tab_switch));
ctrl_checkbox(s, "在OSC52剪贴板同步之前发出警告", NO_SHORTCUT,
HELPCTX(no_help),
conf_checkbox_handler, I(CONF_osc52_warn_before_cliboard_sync));

}
#endif
ctrl_checkbox(s, "Alt-Enter 开启全屏", 'f',
Expand Down
4 changes: 2 additions & 2 deletions 0.76b_My_PuTTY/windows/dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
sprintf( buffer, "KiTTY - %s", BuildVersionTime ) ;
SetDlgItemText(hwnd,IDA_VERSION,buffer);

str = dupprintf("关于%s_v0.76.1.12.1 - 这是一个KiTTY中文版本!", appname);
str = dupprintf("关于%s_v0.76.1.13.1 - 这是一个KiTTY中文版本!", appname);
SetWindowText(hwnd, str);
sfree(str);

Expand Down Expand Up @@ -681,7 +681,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg,
int h ;
GetWindowRect(hwnd, &rcClient) ;

int NormalSize = 536 ;
int NormalSize = 555 ;

if( GetConfigBoxWindowHeight() > 0 ) { h = GetConfigBoxWindowHeight() ; }
else if( GetConfigBoxHeight() >= 100 ) { h = GetConfigBoxHeight() ; }
Expand Down
70 changes: 35 additions & 35 deletions 0.76b_My_PuTTY/windows/pageant.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#ifdef MOD_INTEGRATED_AGENT
#define APPNAME_AGENT "cnKageant"
#define APPDESC_AGENT "cnKiTTY SSH��֤����"
#define APPDESC_AGENT "cnKiTTY SSH认证代理"
#else
#define APPNAME "cnKageant"
#define APPDESC "cnKiTTY SSH��֤����"
#define APPDESC "cnKiTTY SSH认证代理"
#endif

#include "help.rc2"
Expand All @@ -27,84 +27,84 @@ IDI_TRAYICON ICON "pageants.ico"
IDD_LOAD_PASSPHRASE DIALOG DISCARDABLE 0, 0, 140, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
#ifdef MOD_PERSO
CAPTION "cnKageant���ؼ�����Կ"
CAPTION "cnKageant加载加密密钥"
#else
CAPTION "Pageant���ؼ�����Կ"
CAPTION "Pageant加载加密密钥"
#endif
FONT 9, "����"
FONT 9, "宋体"
BEGIN
CTEXT "���������Լ�����Կ", IDC_PASSPHRASE_STATIC1, 10, 6, 120, 8
CTEXT "输入密码以加载密钥", IDC_PASSPHRASE_STATIC1, 10, 6, 120, 8
CTEXT "", IDC_PASSPHRASE_FINGERPRINT, 10, 16, 120, 8
EDITTEXT IDC_PASSPHRASE_EDITBOX, 10, 26, 120, 12,
ES_PASSWORD | ES_AUTOHSCROLL
DEFPUSHBUTTON "ȷ��(&K)", IDOK, 20, 42, 40, 14
PUSHBUTTON "ȡ��(&C)", IDCANCEL, 80, 42, 40, 14
DEFPUSHBUTTON "确定(&K)", IDOK, 20, 42, 40, 14
PUSHBUTTON "取消(&C)", IDCANCEL, 80, 42, 40, 14
END

IDD_ONDEMAND_PASSPHRASE DIALOG DISCARDABLE 0, 0, 250, 78
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "cnKageant���ܴ洢����Կ"
FONT 9, "����"
CAPTION "cnKageant解密存储的密钥"
FONT 9, "宋体"
BEGIN
CTEXT "cnKageant�Ŀͻ�����Ҫʹ�����¼�����Կ:",
CTEXT "cnKageant的客户端想要使用以下加密密钥:",
IDC_PASSPHRASE_STATIC1, 10, 6, 230, 8
CTEXT "", IDC_PASSPHRASE_FINGERPRINT, 10, 16, 230, 8
CTEXT "�������������������ѡ��ȷ������������",
CTEXT "如果您打算这样做,请选择确定来正常加载",
IDC_PASSPHRASE_STATIC2, 10, 26, 230, 8
CTEXT "Ȼ������������������Կ��",
CTEXT "然后输入密码来解密密钥。",
IDC_PASSPHRASE_STATIC3, 10, 34, 230, 8
EDITTEXT IDC_PASSPHRASE_EDITBOX, 10, 44, 230, 12,
ES_PASSWORD | ES_AUTOHSCROLL
DEFPUSHBUTTON "ȷ��(&K)", IDOK, 45, 60, 40, 14
PUSHBUTTON "ȡ��(&C)", IDCANCEL, 105, 60, 40, 14
PUSHBUTTON "����(&H)", IDHELP, 165, 60, 50, 14
DEFPUSHBUTTON "确定(&K)", IDOK, 45, 60, 40, 14
PUSHBUTTON "取消(&C)", IDCANCEL, 105, 60, 40, 14
PUSHBUTTON "帮助(&H)", IDHELP, 165, 60, 50, 14
END

IDD_KEYLIST DIALOG DISCARDABLE 0, 0, 450, 236
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
#ifdef MOD_PERSO
CAPTION "cnKageant��Կ�б�"
CAPTION "cnKageant密钥列表"
#else
CAPTION "Pageant��Կ�б�"
CAPTION "Pageant密钥列表"
#endif
FONT 9, "����"
FONT 9, "宋体"
BEGIN
LISTBOX 100, 10, 10, 420, 155,
LBS_EXTENDEDSEL | LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "������Կ(&A)", IDC_KEYLIST_ADDKEY, 10, 187, 60, 14
PUSHBUTTON "���Ӽ�����Կ(&E)", IDC_KEYLIST_ADDKEY_ENC, 75, 187, 80, 14
PUSHBUTTON "���¼���(&N)", IDC_KEYLIST_REENCRYPT, 315, 187, 60, 14
PUSHBUTTON "ɾ����Կ(&R)", IDC_KEYLIST_REMOVE, 380, 187, 60, 14
PUSHBUTTON "����(&H)", IDC_KEYLIST_HELP, 10, 212, 50, 14
DEFPUSHBUTTON "ȡ��(&C", IDOK, 390, 212, 50, 14
LTEXT "ָ������(&F):", IDC_KEYLIST_FPTYPE_STATIC, 10, 172, 60, 8
PUSHBUTTON "添加密钥(&A)", IDC_KEYLIST_ADDKEY, 10, 187, 60, 14
PUSHBUTTON "添加加密密钥(&E)", IDC_KEYLIST_ADDKEY_ENC, 75, 187, 80, 14
PUSHBUTTON "重新加密(&N)", IDC_KEYLIST_REENCRYPT, 315, 187, 60, 14
PUSHBUTTON "删除密钥(&R)", IDC_KEYLIST_REMOVE, 380, 187, 60, 14
PUSHBUTTON "帮助(&H)", IDC_KEYLIST_HELP, 10, 212, 50, 14
DEFPUSHBUTTON "取消(&C", IDOK, 390, 212, 50, 14
LTEXT "指纹类型(&F):", IDC_KEYLIST_FPTYPE_STATIC, 10, 172, 60, 8
COMBOBOX IDC_KEYLIST_FPTYPE, 70, 170, 60, 12, CBS_DROPDOWNLIST
END

/* Accelerators used: cl */
IDD_ABOUT DIALOG DISCARDABLE 140, 40, 270, 136
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
#ifdef MOD_PERSO
CAPTION "����cnKageant"
CAPTION "关于cnKageant"
#else
CAPTION "����Pageant"
CAPTION "关于Pageant"
#endif
FONT 9, "����"
FONT 9, "宋体"
BEGIN
DEFPUSHBUTTON "�ر�(&C)", IDOK, 216, 118, 48, 14
PUSHBUTTON "�鿴����֤(&L)", IDC_ABOUT_LICENCE, 6, 118, 70, 14
PUSHBUTTON "�������(&W)", IDC_ABOUT_WEBSITE, 140, 118, 70, 14
DEFPUSHBUTTON "关闭(&C)", IDOK, 216, 118, 48, 14
PUSHBUTTON "查看许可证(&L)", IDC_ABOUT_LICENCE, 6, 118, 70, 14
PUSHBUTTON "浏览官网(&W)", IDC_ABOUT_WEBSITE, 140, 118, 70, 14
EDITTEXT IDC_ABOUT_TEXTBOX, 10, 6, 250, 110,
ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
END

/* No accelerators used */
IDD_LICENCE DIALOG DISCARDABLE 50, 50, 326, 239
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "cnKiTTY����֤"
FONT 9, "����"
CAPTION "cnKiTTY许可证"
FONT 9, "宋体"
BEGIN
DEFPUSHBUTTON "ȷ��", IDOK, 148, 219, 44, 14
DEFPUSHBUTTON "确定", IDOK, 148, 219, 44, 14

EDITTEXT IDC_LICENCE_TEXTBOX, 10, 10, 306, 200,
ES_READONLY | ES_MULTILINE | ES_LEFT, WS_EX_STATICEDGE
Expand Down
6 changes: 3 additions & 3 deletions 0.76b_My_PuTTY/windows/version.rc2
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ BEGIN
* in the file properties in Explorer.) */
BLOCK "StringFileInfo"
BEGIN
/* "lang-charset" LLLLCCCC = (CN ���ģ��л����񹲺͹�) */
/* "lang-charset" LLLLCCCC = (CN 中文,中华人民共和国) */
BLOCK "080404B0"
BEGIN
#ifdef MOD_PERSO
VALUE "CompanyName", "9bis.com" /* required :/ */
VALUE "ProductName", "cnKiTTY_v0.76.1.12.1"
VALUE "ProductName", "cnKiTTY_v0.76.1.13.1"
VALUE "FileDescription", APPDESC
VALUE "InternalName", APPNAME
VALUE "OriginalFilename", "KiTTY"
Expand All @@ -67,7 +67,7 @@ BEGIN
#else
VALUE "ProductVersion", TEXTVER
#endif
VALUE "LegalCopyright", "��Ȩ����(C)" SHORT_COPYRIGHT_DETAILS "."
VALUE "LegalCopyright", "版权所有(C)" SHORT_COPYRIGHT_DETAILS "."
#if (!defined SNAPSHOT) && (!defined RELEASE) && (!defined PRERELEASE)
/* Only if VS_FF_PRIVATEBUILD. */
VALUE "PrivateBuild", TEXTVER /* NBI */
Expand Down
2 changes: 1 addition & 1 deletion 0.76b_My_PuTTY/windows/version_minor.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
13
2 changes: 1 addition & 1 deletion LICENCE.PuTTY.TXT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PuTTY is copyright 1997-2022 Simon Tatham.
PuTTY is copyright 1997-2023 Simon Tatham.

Portions copyright Robert de Bath, Joris van Rantwijk, Delian
Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
Expand Down
Loading

0 comments on commit 142b608

Please sign in to comment.