[Ttssh2-commit] [7605] ttssh の passphrase edit control の tooltip を i18n化

scmno****@osdn***** scmno****@osdn*****
2019年 4月 23日 (火) 01:18:08 JST


Revision: 7605
          https://osdn.net/projects/ttssh2/scm/svn/commits/7605
Author:   zmatsuo
Date:     2019-04-23 01:18:08 +0900 (Tue, 23 Apr 2019)
Log Message:
-----------
ttssh の passphrase edit control の tooltip を i18n化
auth dialog,Key generator dialogで使用

Modified Paths:
--------------
    trunk/installer/release/lang/French.lng
    trunk/installer/release/lang/German.lng
    trunk/installer/release/lang/Japanese.lng
    trunk/installer/release/lang/Korean.lng
    trunk/installer/release/lang/Russian.lng
    trunk/installer/release/lang/Simplified Chinese.lng
    trunk/installer/release/lang/Traditional Chinese.lng
    trunk/ttssh2/ttxssh/auth.c
    trunk/ttssh2/ttxssh/auth.h
    trunk/ttssh2/ttxssh/ttxssh.c

-------------- next part --------------
Modified: trunk/installer/release/lang/French.lng
===================================================================
--- trunk/installer/release/lang/French.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/French.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 ; Last translated (French language) by Francois MOCQ (2010-07-21)
 
 [Tera Term]
@@ -596,6 +596,8 @@
 DLG_AUTH_PRIVATEKEY=Fichier cl\xE9 priv\xE9e
 DLG_AUTH_LOCALUSER=Nom d'utilisateur local:
 DLG_AUTH_HOST_PRIVATEKEY=Fichier cl\xE9 priv\xE9e h\xF4te
+DLG_AUTH_TIP_CONTROL_CODE=control character is entered
+DLG_AUTH_TIP_PASTE_KEY=Use Shift + Insert to paste from clipboard
 MSG_PAGEANT_NOTFOUND=Impossible de trouver Pageant.
 MSG_PAGEANT_NOKEY=Pageant n'a pas de cl\xE9 valide.
 

Modified: trunk/installer/release/lang/German.lng
===================================================================
--- trunk/installer/release/lang/German.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/German.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 ; Last translated (German language) by Frederik Schwarzer (2010-05-17)
 
 [Tera Term]
@@ -596,6 +596,8 @@
 DLG_AUTH_PRIVATEKEY=Schl\xFCssel:
 DLG_AUTH_LOCALUSER=Lokaler Benutzername:
 DLG_AUTH_HOST_PRIVATEKEY=rhosts-Schl\xFCssel:
+DLG_AUTH_TIP_CONTROL_CODE=control character is entered
+DLG_AUTH_TIP_PASTE_KEY=Use Shift + Insert to paste from clipboard
 MSG_PAGEANT_NOTFOUND=Can't find Pageant.
 MSG_PAGEANT_NOKEY=Pageant has no valid key.
 

Modified: trunk/installer/release/lang/Japanese.lng
===================================================================
--- trunk/installer/release/lang/Japanese.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/Japanese.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 
 [Tera Term]
 DLG_SYSTEM_FONT=\x82l\x82r \x82o\x83S\x83V\x83b\x83N,12,128
@@ -593,6 +593,8 @@
 DLG_AUTH_PRIVATEKEY=\x94閧\x8C\xAE(&K):
 DLG_AUTH_LOCALUSER=\x83\x8D\x81[\x83J\x83\x8B\x82̃\x86\x81[\x83U\x96\xBC(&U):
 DLG_AUTH_HOST_PRIVATEKEY=\x83z\x83X\x83g\x8C\xAE(&F):
+DLG_AUTH_TIP_CONTROL_CODE=\x90\xA7\x8C䕶\x8E\x9A\x82\xAA\x93\xFC\x97͂\xB3\x82\xEA\x82܂\xB5\x82\xBD
+DLG_AUTH_TIP_PASTE_KEY=Shift+Insert\x82ŃN\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82\xA9\x82\xE7\x83y\x81[\x83X\x83g\x82ł\xAB\x82܂\xB7
 MSG_PAGEANT_NOTFOUND=Pageant \x82\xAA\x8C\xA9\x82‚\xA9\x82\xE8\x82܂\xB9\x82\xF1.
 MSG_PAGEANT_NOKEY=Pageant \x82ɗL\x8C\xF8\x82Ȍ\xAE\x82\xAA\x93o\x98^\x82\xB3\x82\xEA\x82Ă\xA2\x82܂\xB9\x82\xF1.
 

Modified: trunk/installer/release/lang/Korean.lng
===================================================================
--- trunk/installer/release/lang/Korean.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/Korean.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 ; Last translated (Korean language) by Daehong Kim (2013-07-25)
 
 [Tera Term]
@@ -596,6 +596,8 @@
 DLG_AUTH_PRIVATEKEY=\xB0\xB3\xC0\xCEŰ(&K):
 DLG_AUTH_LOCALUSER=\xC1\xF6\xBF\xAA \xBB\xE7\xBF\xEB\xC0\xDA\xC0̸\xA7(&U):
 DLG_AUTH_HOST_PRIVATEKEY=ȣ\xBD\xBAƮ \xB0\xB3\xC0\xCEŰ(&F):
+DLG_AUTH_TIP_CONTROL_CODE=control character is entered
+DLG_AUTH_TIP_PASTE_KEY=Use Shift + Insert to paste from clipboard
 MSG_PAGEANT_NOTFOUND=Pageant\xB8\xA6 ã\xC0\xBB \xBC\xF6 \xBE\xF8\xBD\xC0\xB4ϴ\xD9.
 MSG_PAGEANT_NOKEY=Pageant\xB0\xA1 \xC0\xAFȿ\xC7\xD1 Ű\xB8\xA6 \xB0\xA1\xC1\xF6\xB0\xED \xC0\xD6\xC1\xF6 \xBEʽ\xC0\xB4ϴ\xD9.
 

Modified: trunk/installer/release/lang/Russian.lng
===================================================================
--- trunk/installer/release/lang/Russian.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/Russian.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 ; Last translated (Russian language) by Ryumik Sergey (2017-07-19)
 
 [Tera Term]
@@ -596,6 +596,8 @@
 DLG_AUTH_PRIVATEKEY=&\xC7\xE0\xEA\xF0\xFB\xF2\xFB\xE9 \xEA\xEB\xFE\xF7
 DLG_AUTH_LOCALUSER=&\xD1\xEA\xF0\xFB\xF2\xEE\xE5 \xE8\xEC\xFF:
 DLG_AUTH_HOST_PRIVATEKEY=&\xC7\xE0\xEA\xF0\xFB\xF2\xFB\xE9 \xEA\xEB\xFE\xF7
+DLG_AUTH_TIP_CONTROL_CODE=control character is entered
+DLG_AUTH_TIP_PASTE_KEY=Use Shift + Insert to paste from clipboard
 MSG_PAGEANT_NOTFOUND=\xCD\xE5 \xF3\xE4\xE0\xE5\xF2\xF1\xFF \xED\xE0\xE9\xF2\xE8 Pageant.
 MSG_PAGEANT_NOKEY=\xCD\xE5\xF2 \xE4\xE5\xE9\xF1\xF2\xE2\xF3\xFE\xF9\xE5\xE3\xEE \xEA\xEB\xFE\xF7\xE0 \xEA Pageant.
 

Modified: trunk/installer/release/lang/Simplified Chinese.lng
===================================================================
--- trunk/installer/release/lang/Simplified Chinese.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/Simplified Chinese.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 ; Last translated (Simplified Chinese language) by LiShaohui (2017-04-11)
 
 [Tera Term]
@@ -596,6 +596,8 @@
 DLG_AUTH_PRIVATEKEY=\xC3\xDCԿ\xCEļ\xFE(&K)\xA3\xBA
 DLG_AUTH_LOCALUSER=\xB1\xBE\xB5\xD8\xD3û\xA7\xC3\xFB(&U)\xA3\xBA
 DLG_AUTH_HOST_PRIVATEKEY=\xD6\xF7\xBB\xFA\xC3\xDCԿ\xCEļ\xFE(&F)\xA3\xBA
+DLG_AUTH_TIP_CONTROL_CODE=control character is entered
+DLG_AUTH_TIP_PASTE_KEY=Use Shift + Insert to paste from clipboard
 MSG_PAGEANT_NOTFOUND=δ\xD5ҵ\xBD Pageant
 MSG_PAGEANT_NOKEY=Pageant \xB2\xBB\xB0\xFC\xBA\xAC\xD3\xD0Ч\xB5\xC4\xC3\xDCԿ
 

Modified: trunk/installer/release/lang/Traditional Chinese.lng
===================================================================
--- trunk/installer/release/lang/Traditional Chinese.lng	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/installer/release/lang/Traditional Chinese.lng	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,4 +1,4 @@
-; Updated by TeraTerm Project (2019-04-17)
+; Updated by TeraTerm Project (2019-04-22)
 ; Last translated (Traditional Chinese language) by kikiqqp (2014-09-20)
 
 [Tera Term]
@@ -596,6 +596,8 @@
 DLG_AUTH_PRIVATEKEY=\xB1K\xC6_\xA4\xE5\xA5\xF3(&K)\xA1G
 DLG_AUTH_LOCALUSER=\xA5\xBB\xA6a\xA5Τ\xE1\xA6W(&U)\xA1G
 DLG_AUTH_HOST_PRIVATEKEY=\xA5D\xBE\xF7\xB1K\xC6_\xA4\xE5\xA5\xF3(&F)\xA1G
+DLG_AUTH_TIP_CONTROL_CODE=control character is entered
+DLG_AUTH_TIP_PASTE_KEY=Use Shift + Insert to paste from clipboard
 MSG_PAGEANT_NOTFOUND=\xA5\xBC\xA7\xE4\xA8\xEC Pageant
 MSG_PAGEANT_NOKEY=Pageant \xA4\xA3\xA5]\xA7t\xA6\xB3\xAEĪ\xBA\xB1K\xC6_
 

Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/ttssh2/ttxssh/auth.c	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1998-2001, Robert O'Callahan
- * (C) 2004-2017 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,12 +38,19 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <crtdbg.h>
 
 #include "resource.h"
 #include "keyfiles.h"
 #include "libputty.h"
 #include "tipwin.h"
+#include "auth.h"
 
+#if defined(_DEBUG)
+#define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
+#define free(p)   _free_dbg((p), _NORMAL_BLOCK)
+#endif
+
 #define AUTH_START_USER_AUTH_ON_ERROR_END 1
 
 #define MAX_AUTH_CONTROL IDC_SSHUSEPAGEANT
@@ -73,11 +80,18 @@
 	IDC_SSHUSERHOSTS, IDC_SSHUSETIS, -1,
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, IDC_SSHUSEPAGEANT, -1
 };
-static TipWin *tipwin;
 
-LRESULT CALLBACK password_wnd_proc(HWND control, UINT msg,
-                                   WPARAM wParam, LPARAM lParam)
+typedef struct {
+	WNDPROC ProcOrg;
+	PTInstVar pvar;
+	TipWin *tipwin;
+} TPasswordControlData;
+
+static LRESULT CALLBACK password_wnd_proc(HWND control, UINT msg,
+										  WPARAM wParam, LPARAM lParam)
 {
+	LRESULT result;
+	TPasswordControlData *data = (TPasswordControlData *)GetWindowLongPtr(control, GWLP_USERDATA);
 	switch (msg) {
 	case WM_CHAR:
 		if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) {
@@ -86,48 +100,56 @@
 			SendMessage(control, EM_REPLACESEL, (WPARAM) TRUE,
 			            (LPARAM) (TCHAR *) chars);
 
-			if (tipwin == NULL) {
-				TCHAR *s;
+			if (data->tipwin == NULL) {
+				TCHAR uimsg[MAX_UIMSG];
 				RECT rect;
+				PTInstVar pvar = data->pvar;
+				UTIL_get_lang_msg("DLG_AUTH_TIP_CONTROL_CODE", pvar, "control character is entered");
+				_tcscpy_s(uimsg, _countof(uimsg), pvar->ts->UIMsg);
 				if (wParam == 'V' - 'A' + 1) {
-					s = _T("\x90\xA7\x8C䕶\x8E\x9A\x82\xF0\x93\xFC\x97͂\xB5\x82Ă\xA2\x82܂\xB7")
-						_T("\n")
-						_T("\x83N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82\xA9\x82\xE7\x82̓\\x82\xE8\x95t\x82\xAF\x82̃V\x83\x87\x81[\x83g\x83J\x83b\x83g\x82\xCDCTRL+Insert\x82ł\xB7");
-				} else {
-					s = _T("\x90\xA7\x8C䕶\x8E\x9A\x82\xF0\x93\xFC\x97͂\xB5\x82Ă\xA2\x82܂\xB7");
+					// CTRL + V
+					_tcscat_s(uimsg, _countof(uimsg), _T("\n"));
+					UTIL_get_lang_msg("DLG_AUTH_TIP_PASTE_KEY", pvar, "Use Shift + Insert to paste from clipboard");
+					_tcscat_s(uimsg, _countof(uimsg), pvar->ts->UIMsg);
 				}
 				GetWindowRect(control, &rect);
-				tipwin = TipWinCreate(control, rect.left, rect.bottom, s);
+				data->tipwin = TipWinCreate(control, rect.left, rect.bottom, uimsg);
 			}
 
 			return 0;
 		} else {
-			if (tipwin != NULL) {
-				TipWinDestroy(tipwin);
-				tipwin = NULL;
+			if (data->tipwin != NULL) {
+				TipWinDestroy(data->tipwin);
+				data->tipwin = NULL;
 			}
 		}
 		break;
-	case WM_NCDESTROY:
-		if (tipwin != NULL) {
-			TipWinDestroy(tipwin);
-			tipwin = NULL;
+	}
+
+	result = CallWindowProc((WNDPROC)data->ProcOrg,
+							control, msg, wParam, lParam);
+
+	if (msg == WM_NCDESTROY) {
+		SetWindowLongPtr(control, GWLP_WNDPROC, (LONG_PTR)data->ProcOrg);
+		if (data->tipwin != NULL) {
+			TipWinDestroy(data->tipwin);
+			data->tipwin = NULL;
 		}
-		break;
+		free(data);
 	}
 
-	return CallWindowProc((WNDPROC) GetWindowLong(control, GWL_USERDATA),
-	                      control, msg, wParam, lParam);
+	return result;
 }
 
-static void init_password_control(HWND dlg)
+void init_password_control(PTInstVar pvar, HWND dlg, int item)
 {
-	HWND passwordControl = GetDlgItem(dlg, IDC_SSHPASSWORD);
-
-	SetWindowLong(passwordControl, GWL_USERDATA,
-	              SetWindowLong(passwordControl, GWL_WNDPROC,
-	                            (LONG) password_wnd_proc));
-
+	HWND passwordControl = GetDlgItem(dlg, item);
+	TPasswordControlData *data = (TPasswordControlData *)malloc(sizeof(TPasswordControlData));
+	data->ProcOrg = (WNDPROC)GetWindowLongPtr(passwordControl, GWLP_WNDPROC);
+	data->pvar = pvar;
+	data->tipwin = NULL;
+	SetWindowLongPtr(passwordControl, GWLP_WNDPROC, (LONG_PTR)password_wnd_proc);
+	SetWindowLongPtr(passwordControl, GWLP_USERDATA, (LONG_PTR)data);
 	SetFocus(passwordControl);
 }
 
@@ -269,7 +291,7 @@
 	SetDlgItemText(dlg, IDCANCEL, pvar->ts->UIMsg);
 
 	init_auth_machine_banner(pvar, dlg);
-	init_password_control(dlg);
+	init_password_control(pvar, dlg, IDC_SSHPASSWORD);
 
 	// \x94F\x8F؎\xB8\x94s\x8C\xE3\x82̓\x89\x83x\x83\x8B\x82\xF0\x8F\x91\x82\xAB\x8A\xB7\x82\xA6
 	if (pvar->auth_state.failed_method != SSH_AUTH_NONE) {
@@ -1197,7 +1219,7 @@
 	SetDlgItemText(dlg, IDCANCEL, pvar->ts->UIMsg);
 
 	init_auth_machine_banner(pvar, dlg);
-	init_password_control(dlg);
+	init_password_control(pvar, dlg, IDC_SSHPASSWORD);
 
 	if (pvar->auth_state.TIS_prompt != NULL) {
 		if (strlen(pvar->auth_state.TIS_prompt) > 10000) {

Modified: trunk/ttssh2/ttxssh/auth.h
===================================================================
--- trunk/ttssh2/ttxssh/auth.h	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/ttssh2/ttxssh/auth.h	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1998-2001, Robert O'Callahan
- * (C) 2004-2017 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -73,8 +73,7 @@
 void AUTH_notify_end_error(PTInstVar pvar);
 void AUTH_end(PTInstVar pvar);
 void destroy_malloced_string(char **str);
-LRESULT CALLBACK password_wnd_proc(HWND control, UINT msg,
-                                   WPARAM wParam, LPARAM lParam);
+void init_password_control(PTInstVar pvar, HWND dlg, int item);
 
 #define AUTH_get_cur_cred(pvar) (&(pvar)->auth_state.cur_cred)
 

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2019-04-22 15:22:46 UTC (rev 7604)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2019-04-22 16:18:08 UTC (rev 7605)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1998-2001, Robert O'Callahan
- * (C) 2004-2017 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,7 @@
 #include "ttlib.h"
 #include "keyfiles.h"
 #include "arc4random.h"
+#include "auth.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -4163,15 +4164,6 @@
 	return;
 }
 
-static void init_password_control(HWND dlg, int item)
-{
-	HWND passwordControl = GetDlgItem(dlg, item);
-
-	SetWindowLong(passwordControl, GWL_USERDATA,
-	              SetWindowLong(passwordControl, GWL_WNDPROC,
-	                            (LONG) password_wnd_proc));
-}
-
 // bcrypt KDF\x8C`\x8E\xAE\x82Ŕ閧\x8C\xAE\x82\xF0\x95ۑ\xB6\x82\xB7\x82\xE9
 // based on OpenSSH 6.5:key_save_private(), key_private_to_blob2()
 static void save_bcrypt_private_key(char *passphrase, char *filename, char *comment, HWND dlg, PTInstVar pvar, int rounds)
@@ -4406,8 +4398,8 @@
 		}
 #endif
 
-		init_password_control(dlg, IDC_KEY_EDIT);
-		init_password_control(dlg, IDC_CONFIRM_EDIT);
+		init_password_control(pvar, dlg, IDC_KEY_EDIT);
+		init_password_control(pvar, dlg, IDC_CONFIRM_EDIT);
 
 		// default key type
 		SendMessage(GetDlgItem(dlg, IDC_RSA_TYPE), BM_SETCHECK, BST_CHECKED, 0);


Ttssh2-commit メーリングリストの案内