Revision: 9485 https://osdn.net/projects/ttssh2/scm/svn/commits/9485 Author: zmatsuo Date: 2021-10-23 01:09:19 +0900 (Sat, 23 Oct 2021) Log Message: ----------- GetHostName dialog構造体のホスト名メンバをUnicode化 - TGetHNRec.HostName (tttypes.h) - char * から wchar_t * に変更 Modified Paths: -------------- trunk/TTXSamples/TTXttyrec/TTXttyplay.c trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/vtwin.cpp trunk/teraterm/ttpdlg/ttdlg.c trunk/ttssh2/ttxssh/ttxssh.c -------------- next part -------------- Modified: trunk/TTXSamples/TTXttyrec/TTXttyplay.c =================================================================== --- trunk/TTXSamples/TTXttyrec/TTXttyplay.c 2021-10-22 16:09:09 UTC (rev 9484) +++ trunk/TTXSamples/TTXttyrec/TTXttyplay.c 2021-10-22 16:09:19 UTC (rev 9485) @@ -475,7 +475,7 @@ static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec GetHNRec) { GetHNRec->PortType = IdTCPIP; - _snprintf_s(GetHNRec->HostName, MAXPATHLEN, _TRUNCATE, "/R=\"%s\" /TP", pvar->openfn); + _snwprintf_s(GetHNRec->HostName, MAXPATHLEN, _TRUNCATE, L"/R=\"%hs\" /TP", pvar->openfn); return (TRUE); } Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2021-10-22 16:09:09 UTC (rev 9484) +++ trunk/teraterm/common/tttypes.h 2021-10-22 16:09:19 UTC (rev 9485) @@ -793,7 +793,7 @@ PCHAR SetupFN; // setup file name const wchar_t *SetupFNW; WORD PortType; // TCPIP/Serial - PCHAR HostName; // host name + wchar_t *HostName; // host name WORD Telnet; // non-zero: enable telnet WORD TelPort; // default TCP port# for telnet WORD TCPPort; // TCP port # Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2021-10-22 16:09:09 UTC (rev 9484) +++ trunk/teraterm/teraterm/vtwin.cpp 2021-10-22 16:09:19 UTC (rev 9485) @@ -3469,13 +3469,13 @@ void CVTWindow::OnFileNewConnection() { -// char Command[MAXPATHLEN], Command2[MAXPATHLEN]; - char Command[MAXPATHLEN + HostNameMaxLength], Command2[MAXPATHLEN + HostNameMaxLength]; // yutaka - TGetHNRec GetHNRec; /* record for dialog box */ - if (Connecting) return; + if (! LoadTTDLG()) { + return; + } - HelpId = HlpFileNewConnection; + wchar_t hostname[HostNameMaxLength]; + TGetHNRec GetHNRec; /* record for dialog box */ GetHNRec.SetupFN = ts.SetupFName; GetHNRec.SetupFNW = ts.SetupFNameW; GetHNRec.PortType = ts.PortType; @@ -3485,25 +3485,30 @@ GetHNRec.ProtocolFamily = ts.ProtocolFamily; GetHNRec.ComPort = ts.ComPort; GetHNRec.MaxComPort = ts.MaxComPort; + GetHNRec.HostName = hostname; - strncpy_s(Command, sizeof(Command),"ttermpro ", _TRUNCATE); - GetHNRec.HostName = &Command[9]; + HelpId = HlpFileNewConnection; + SetDialogFont(ts.DialogFontName, ts.DialogFontPoint, ts.DialogFontCharSet, + ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT"); + BOOL r = (*GetHostName)(HVTWin,&GetHNRec); - if (! LoadTTDLG()) { - return; - } + if (r) { + char Command[MAXPATHLEN + HostNameMaxLength]; + char Command2[MAXPATHLEN + HostNameMaxLength]; - SetDialogFont(ts.DialogFontName, ts.DialogFontPoint, ts.DialogFontCharSet, - ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT"); - if ((*GetHostName)(HVTWin,&GetHNRec)) { + strncpy_s(Command, _countof(Command), "ttermpro ", _TRUNCATE); + char *hostnameA = ToCharW(hostname); + strncat_s(Command, _countof(Command), hostnameA, _TRUNCATE); + free(hostnameA); + if ((GetHNRec.PortType==IdTCPIP) && LoadTTSET()) { if (ts.HistoryList) { - wchar_t *HostNameW = ToWcharA(GetHNRec.HostName); - (*AddHostToList)(ts.SetupFNameW, HostNameW); - free(HostNameW); + (*AddHostToList)(ts.SetupFNameW, hostname); } if (ts.JumpList) { - add_session_to_jumplist(GetHNRec.HostName, GetHNRec.SetupFN); + char *HostNameA = ToCharW(hostname); + add_session_to_jumplist(HostNameA, GetHNRec.SetupFN); + free(HostNameA); } FreeTTSET(); } Modified: trunk/teraterm/ttpdlg/ttdlg.c =================================================================== --- trunk/teraterm/ttpdlg/ttdlg.c 2021-10-22 16:09:09 UTC (rev 9484) +++ trunk/teraterm/ttpdlg/ttdlg.c 2021-10-22 16:09:19 UTC (rev 9485) @@ -1960,7 +1960,7 @@ char afstr[BUFSIZ]; GetRB(Dialog,&GetHNRec->PortType,IDC_HOSTTCPIP,IDC_HOSTSERIAL); if ( GetHNRec->PortType==IdTCPIP ) { - GetDlgItemText(Dialog, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength); + GetDlgItemTextW(Dialog, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength); } else { GetHNRec->HostName[0] = 0; Modified: trunk/ttssh2/ttxssh/ttxssh.c =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.c 2021-10-22 16:09:09 UTC (rev 9484) +++ trunk/ttssh2/ttxssh/ttxssh.c 2021-10-22 16:09:19 UTC (rev 9485) @@ -1207,8 +1207,7 @@ i == 0 ? AF_UNSPEC : i == 1 ? AF_INET6 : AF_INET; GetHNRec->PortType = IdTCPIP; - GetDlgItemText(dlg, IDC_HOSTNAME, GetHNRec->HostName, - HostNameMaxLength); + GetDlgItemTextW(dlg, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength); pvar->hostdlg_activated = TRUE; pvar->hostdlg_Enabled = FALSE; if (IsDlgButtonChecked(dlg, IDC_HOSTTELNET)) {