[Ttssh2-commit] [8606] 伏せ字がおかしくならないよう修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2020年 3月 18日 (水) 00:37:56 JST


Revision: 8606
          https://osdn.net/projects/ttssh2/scm/svn/commits/8606
Author:   zmatsuo
Date:     2020-03-18 00:37:56 +0900 (Wed, 18 Mar 2020)
Log Message:
-----------
伏せ字がおかしくならないよう修正

- Unicodeが使える環境で ANSI API を使用しているとき
  - debug時のみか?
  - ANSI Window のときは '*' 固定とした
- 伏せ字を ANSI API で取得するとUnicode(U+25cf) が返ってくる
  - SendMessageA(EM_GETPASSWORDCHAR)
- この伏せ字を ANSI API で設定すると文字化け('%' (0x25))する
  - SendMessageA(EM_SETPASSWORDCHAR)

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/auth.c

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2020-03-17 15:37:47 UTC (rev 8605)
+++ trunk/ttssh2/ttxssh/auth.c	2020-03-17 15:37:56 UTC (rev 8606)
@@ -1113,7 +1113,14 @@
 					if (ShowPassPhrase) {
 						_SendMessageW(hWnd, EM_SETPASSWORDCHAR, 0, 0);
 					} else {
-						_SendMessageW(hWnd, EM_SETPASSWORDCHAR, (WPARAM)password_char, 0);
+						if (IsWindowUnicode(hWnd)) {
+							_SendMessageW(hWnd, EM_SETPASSWORDCHAR, (WPARAM)password_char, 0);
+						}
+						else {
+							// EM_GETPASSWORDCHAR \x82\xC5 Unicode \x83L\x83\x83\x83\x89\x83N\x83^\x82\xAA\x8E擾\x82ł\xAB\x82Ă\xE0
+							// IsWindowUnicode(hWnd) == FALSE \x82̂Ƃ\xAB Unicode \x82͐ݒ\xE8\x82ł\xAB\x82Ȃ\xA2
+							SendMessageA(hWnd, EM_SETPASSWORDCHAR, (WPARAM)'*', 0);
+						}
 					}
 					SendDlgItemMessage(dlg, IDC_SSHPASSWORD, EM_SETSEL, 0, -1);
 					SendMessage(dlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(dlg, IDC_SSHPASSWORD), TRUE);


Ttssh2-commit メーリングリストの案内
Back to archive index