Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ttxssh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7554 by zmatsuo, Sat Apr 6 15:40:46 2019 UTC revision 7560 by zmatsuo, Mon Apr 8 17:12:02 2019 UTC
# Line 76  static char *ProtocolFamilyList[] = { "U Line 76  static char *ProtocolFamilyList[] = { "U
76  #include "buffer.h"  #include "buffer.h"
77  #include "cipher.h"  #include "cipher.h"
78  #include "key.h"  #include "key.h"
79    #include "dlglib.h"
80    
81  #include "sftp.h"  #include "sftp.h"
82    
# Line 84  static char *ProtocolFamilyList[] = { "U Line 85  static char *ProtocolFamilyList[] = { "U
85    
86  #include "libputty.h"  #include "libputty.h"
87    
88    #undef DialogBoxParam
89    #define DialogBoxParam(p1,p2,p3,p4,p5) \
90            TTDialogBoxParam(p1,p2,p3,p4,p5)
91    #undef EndDialog
92    #define EndDialog(p1,p2) \
93            TTEndDialog(p1, p2)
94    
95  #define MATCH_STR(s, o) strncmp((s), (o), NUM_ELEM(o) - 1)  #define MATCH_STR(s, o) strncmp((s), (o), NUM_ELEM(o) - 1)
96  #define MATCH_STR_I(s, o) _strnicmp((s), (o), NUM_ELEM(o) - 1)  #define MATCH_STR_I(s, o) _strnicmp((s), (o), NUM_ELEM(o) - 1)
97    
# Line 96  static HICON SecureSmallIcon = NULL; Line 104  static HICON SecureSmallIcon = NULL;
104  static HICON SecureNotifyIcon = NULL;  static HICON SecureNotifyIcon = NULL;
105  static HICON OldNotifyIcon = NULL;  static HICON OldNotifyIcon = NULL;
106    
107  static HFONT DlgHostFont;  //static HFONT DlgHostFont;
108  static HFONT DlgAboutFont;  //static HFONT DlgAboutFont;
109  static HFONT DlgAboutTextFont;  static HFONT DlgAboutTextFont;
110  static HFONT DlgSetupFont;  //static HFONT DlgSetupFont;
111  static HFONT DlgKeygenFont;  //static HFONT DlgKeygenFont;
112    
113  static TInstVar *pvar;  static TInstVar *pvar;
114    
# Line 1249  static BOOL CALLBACK TTXHostDlg(HWND dlg Line 1257  static BOOL CALLBACK TTXHostDlg(HWND dlg
1257          static char *ComPortDesc[MAXCOMPORT];          static char *ComPortDesc[MAXCOMPORT];
1258          int comports;          int comports;
1259          BOOL Ok;          BOOL Ok;
1260          LOGFONT logfont;  //      LOGFONT logfont;
1261          HFONT font;  //      HFONT font;
1262          char uimsg[MAX_UIMSG];          char uimsg[MAX_UIMSG];
1263          static HWND hwndHostname     = NULL; // HOSTNAME dropdown          static HWND hwndHostname     = NULL; // HOSTNAME dropdown
1264          static HWND hwndHostnameEdit = NULL; // Edit control on HOSTNAME dropdown          static HWND hwndHostnameEdit = NULL; // Edit control on HOSTNAME dropdown
# Line 1454  static BOOL CALLBACK TTXHostDlg(HWND dlg Line 1462  static BOOL CALLBACK TTXHostDlg(HWND dlg
1462                          SetFocus(hwnd);                          SetFocus(hwnd);
1463                  }                  }
1464    
1465    #if 0
1466                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
1467                  GetObject(font, sizeof(LOGFONT), &logfont);                  GetObject(font, sizeof(LOGFONT), &logfont);
1468                  if (UTIL_get_lang_font("DLG_SYSTEM_FONT", dlg, &logfont, &DlgHostFont, pvar)) {                  if (UTIL_get_lang_font("DLG_SYSTEM_FONT", dlg, &logfont, &DlgHostFont, pvar)) {
# Line 1481  static BOOL CALLBACK TTXHostDlg(HWND dlg Line 1490  static BOOL CALLBACK TTXHostDlg(HWND dlg
1490                  else {                  else {
1491                          DlgHostFont = NULL;                          DlgHostFont = NULL;
1492                  }                  }
1493    #endif
1494                    
1495                  // SetFocus()でフォーカスをあわせた場合、FALSEを返す必要がある。                  // SetFocus()でフォーカスをあわせた場合、FALSEを返す必要がある。
1496                  // TRUEを返すと、TABSTOP対象の一番はじめのコントロールが選ばれる。                  // TRUEを返すと、TABSTOP対象の一番はじめのコントロールが選ばれる。
1497                  // (2004.11.23 yutaka)                  // (2004.11.23 yutaka)
# Line 1559  static BOOL CALLBACK TTXHostDlg(HWND dlg Line 1569  static BOOL CALLBACK TTXHostDlg(HWND dlg
1569                          }                          }
1570                          SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);                          SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);
1571                          EndDialog(dlg, 1);                          EndDialog(dlg, 1);
1572    #if 0
1573                          if (DlgHostFont != NULL) {                          if (DlgHostFont != NULL) {
1574                                  DeleteObject(DlgHostFont);                                  DeleteObject(DlgHostFont);
1575                          }                          }
1576    #endif
1577                          return TRUE;                          return TRUE;
1578    
1579                  case IDCANCEL:                  case IDCANCEL:
1580                          SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);                          SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);
1581                          EndDialog(dlg, 0);                          EndDialog(dlg, 0);
1582    #if 0
1583                          if (DlgHostFont != NULL) {                          if (DlgHostFont != NULL) {
1584                                  DeleteObject(DlgHostFont);                                  DeleteObject(DlgHostFont);
1585                          }                          }
1586    #endif
1587                          return TRUE;                          return TRUE;
1588    
1589                  case IDC_HOSTTCPIP:                  case IDC_HOSTTCPIP:
# Line 1657  hostssh_enabled: Line 1667  hostssh_enabled:
1667          return FALSE;          return FALSE;
1668  }  }
1669    
1670    static void UTIL_SetDialogFont()
1671    {
1672            SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTSSH");
1673    }
1674    
1675  static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec)  static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec)
1676  {  {
1677            UTIL_SetDialogFont();
1678          return (BOOL) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HOSTDLG),          return (BOOL) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HOSTDLG),
1679                                       parent, TTXHostDlg, (LONG) rec);                                       parent, TTXHostDlg, (LPARAM)rec);
1680  }  }
1681    
1682  static void PASCAL TTXGetUIHooks(TTXUIHooks *hooks)  static void PASCAL TTXGetUIHooks(TTXUIHooks *hooks)
# Line 2459  static LRESULT CALLBACK AboutDlgEditWind Line 2475  static LRESULT CALLBACK AboutDlgEditWind
2475  static BOOL CALLBACK TTXAboutDlg(HWND dlg, UINT msg, WPARAM wParam,  static BOOL CALLBACK TTXAboutDlg(HWND dlg, UINT msg, WPARAM wParam,
2476                                   LPARAM lParam)                                   LPARAM lParam)
2477  {  {
2478          LOGFONT logfont;  //      LOGFONTA logfont;
2479          HFONT font;  //      HFONT font;
2480    
2481          switch (msg) {          switch (msg) {
2482          case WM_INITDIALOG:          case WM_INITDIALOG:
2483    #if 0
2484                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
2485                  GetObject(font, sizeof(LOGFONT), &logfont);                  GetObject(font, sizeof(LOGFONT), &logfont);
2486                  if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgAboutFont, pvar)) {                  if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgAboutFont, pvar)) {
# Line 2484  static BOOL CALLBACK TTXAboutDlg(HWND dl Line 2501  static BOOL CALLBACK TTXAboutDlg(HWND dl
2501                  else {                  else {
2502                          DlgAboutFont = NULL;                          DlgAboutFont = NULL;
2503                  }                  }
2504    #endif
2505    
2506                  // Edit controlは等幅フォントで表示したいので、別設定情報からフォントをセットする。                  // Edit controlは等幅フォントで表示したいので、別設定情報からフォントをセットする。
2507                  // (2014.5.5. yutaka)                  // (2014.5.5. yutaka)
2508                  if (UTIL_get_lang_font("DLG_ABOUT_FONT", dlg, &logfont, &DlgAboutTextFont, pvar)) {                  if (!UTIL_get_lang_font("DLG_ABOUT_FONT", dlg, NULL, &DlgAboutTextFont, pvar)) {
                         SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETFONT, (WPARAM)DlgAboutTextFont, MAKELPARAM(TRUE,0));  
                 } else {  
2509                          // 読み込めなかった場合は等幅フォントを指定する。                          // 読み込めなかった場合は等幅フォントを指定する。
2510                          // エディットコントロールはダイアログと同じフォントを持っており                          // エディットコントロールはダイアログと同じフォントを持っており
2511                          // 等幅フォントではないため。                          // 等幅フォントではないため。
2512                            LOGFONTA logfont = {0};
2513                          strncpy_s(logfont.lfFaceName, sizeof(logfont.lfFaceName), "Courier New", _TRUNCATE);                          strncpy_s(logfont.lfFaceName, sizeof(logfont.lfFaceName), "Courier New", _TRUNCATE);
2514                          logfont.lfCharSet = 0;                          logfont.lfCharSet = 0;
2515                          logfont.lfHeight = MulDiv(8, GetDeviceCaps(GetDC(dlg),LOGPIXELSY) * -1, 72);                          logfont.lfHeight = MulDiv(8, GetDeviceCaps(GetDC(dlg),LOGPIXELSY) * -1, 72);
2516                          logfont.lfWidth = 0;                          logfont.lfWidth = 0;
2517                          if ((DlgAboutTextFont = CreateFontIndirect(&logfont)) != NULL) {                          DlgAboutTextFont = CreateFontIndirect(&logfont);        // エラー時 NULL
2518                                  SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETFONT, (WPARAM)DlgAboutTextFont, MAKELPARAM(TRUE,0));                  }
2519                          }                  if (DlgAboutTextFont != NULL) {
2520                          else {                          SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETFONT, (WPARAM)DlgAboutTextFont, MAKELPARAM(TRUE,0));
                                 DlgAboutTextFont = NULL;  
                         }  
2521                  }                  }
2522    
2523                  // アイコンを動的にセット                  // アイコンを動的にセット
# Line 2534  static BOOL CALLBACK TTXAboutDlg(HWND dl Line 2549  static BOOL CALLBACK TTXAboutDlg(HWND dl
2549                  switch (LOWORD(wParam)) {                  switch (LOWORD(wParam)) {
2550                  case IDOK:                  case IDOK:
2551                          EndDialog(dlg, 1);                          EndDialog(dlg, 1);
2552    #if 0
2553                          if (DlgAboutFont != NULL) {                          if (DlgAboutFont != NULL) {
2554                                  DeleteObject(DlgAboutFont);                                  DeleteObject(DlgAboutFont);
2555                          }                          }
2556    #endif
2557                          if (DlgAboutTextFont != NULL) {                          if (DlgAboutTextFont != NULL) {
2558                                  DeleteObject(DlgAboutTextFont);                                  DeleteObject(DlgAboutTextFont);
2559                          }                          }
# Line 2544  static BOOL CALLBACK TTXAboutDlg(HWND dl Line 2561  static BOOL CALLBACK TTXAboutDlg(HWND dl
2561                  case IDCANCEL:                  /* there isn't a cancel button, but other Windows                  case IDCANCEL:                  /* there isn't a cancel button, but other Windows
2562                                                                     UI things can send this message */                                                                     UI things can send this message */
2563                          EndDialog(dlg, 0);                          EndDialog(dlg, 0);
2564    #if 0
2565                          if (DlgAboutFont != NULL) {                          if (DlgAboutFont != NULL) {
2566                                  DeleteObject(DlgAboutFont);                                  DeleteObject(DlgAboutFont);
2567                          }                          }
2568    #endif
2569                          if (DlgAboutTextFont != NULL) {                          if (DlgAboutTextFont != NULL) {
2570                                  DeleteObject(DlgAboutTextFont);                                  DeleteObject(DlgAboutTextFont);
2571                          }                          }
# Line 3299  static void choose_read_only_file(HWND d Line 3318  static void choose_read_only_file(HWND d
3318  static BOOL CALLBACK TTXSetupDlg(HWND dlg, UINT msg, WPARAM wParam,  static BOOL CALLBACK TTXSetupDlg(HWND dlg, UINT msg, WPARAM wParam,
3319                                   LPARAM lParam)                                   LPARAM lParam)
3320  {  {
3321          LOGFONT logfont;  //      LOGFONT logfont;
3322          HFONT font;  //      HFONT font;
3323    
3324          switch (msg) {          switch (msg) {
3325          case WM_INITDIALOG:          case WM_INITDIALOG:
3326                  SetWindowLong(dlg, DWL_USER, lParam);                  SetWindowLong(dlg, DWL_USER, lParam);
3327                  init_setup_dlg((PTInstVar) lParam, dlg);                  init_setup_dlg((PTInstVar) lParam, dlg);
3328    #if 0
3329                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
3330                  GetObject(font, sizeof(LOGFONT), &logfont);                  GetObject(font, sizeof(LOGFONT), &logfont);
3331                  if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgSetupFont, pvar)) {                  if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgSetupFont, pvar)) {
# Line 3363  static BOOL CALLBACK TTXSetupDlg(HWND dl Line 3382  static BOOL CALLBACK TTXSetupDlg(HWND dl
3382                  else {                  else {
3383                          DlgSetupFont = NULL;                          DlgSetupFont = NULL;
3384                  }                  }
3385    #endif
3386                  return TRUE;                  return TRUE;
3387          case WM_COMMAND:          case WM_COMMAND:
3388                  switch (LOWORD(wParam)) {                  switch (LOWORD(wParam)) {
3389                  case IDOK:                  case IDOK:
3390                          complete_setup_dlg((PTInstVar) GetWindowLong(dlg, DWL_USER), dlg);                          complete_setup_dlg((PTInstVar) GetWindowLong(dlg, DWL_USER), dlg);
3391                          EndDialog(dlg, 1);                          EndDialog(dlg, 1);
3392    #if 0
3393                          if (DlgSetupFont != NULL) {                          if (DlgSetupFont != NULL) {
3394                                  DeleteObject(DlgSetupFont);                                  DeleteObject(DlgSetupFont);
3395                          }                          }
3396    #endif
3397                          return TRUE;                          return TRUE;
3398                  case IDCANCEL:                  /* there isn't a cancel button, but other Windows                  case IDCANCEL:                  /* there isn't a cancel button, but other Windows
3399                                                                     UI things can send this message */                                                                     UI things can send this message */
3400                          EndDialog(dlg, 0);                          EndDialog(dlg, 0);
3401    #if 0
3402                          if (DlgSetupFont != NULL) {                          if (DlgSetupFont != NULL) {
3403                                  DeleteObject(DlgSetupFont);                                  DeleteObject(DlgSetupFont);
3404                          }                          }
3405    #endif
3406                          return TRUE;                          return TRUE;
3407                  // Cipher order                  // Cipher order
3408                  case IDC_SSHMOVECIPHERUP:                  case IDC_SSHMOVECIPHERUP:
# Line 4298  static BOOL CALLBACK TTXKeyGenerator(HWN Line 4321  static BOOL CALLBACK TTXKeyGenerator(HWN
4321          static ssh_keytype key_type;          static ssh_keytype key_type;
4322          static int saved_key_bits;          static int saved_key_bits;
4323          char uimsg[MAX_UIMSG];          char uimsg[MAX_UIMSG];
4324          LOGFONT logfont;  //      LOGFONT logfont;
4325          HFONT font;  //      HFONT font;
4326    
4327          switch (msg) {          switch (msg) {
4328          case WM_INITDIALOG:          case WM_INITDIALOG:
# Line 4340  static BOOL CALLBACK TTXKeyGenerator(HWN Line 4363  static BOOL CALLBACK TTXKeyGenerator(HWN
4363                  GetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, uimsg, sizeof(uimsg));                  GetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, uimsg, sizeof(uimsg));
4364                  UTIL_get_lang_msg("DLG_KEYGEN_BCRYPT_ROUNDS", pvar, uimsg);                  UTIL_get_lang_msg("DLG_KEYGEN_BCRYPT_ROUNDS", pvar, uimsg);
4365                  SetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, pvar->ts->UIMsg);                  SetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, pvar->ts->UIMsg);
4366    #if 0
4367                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);                  font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
4368                  GetObject(font, sizeof(LOGFONT), &logfont);                  GetObject(font, sizeof(LOGFONT), &logfont);
4369                  if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgKeygenFont, pvar)) {                  if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgKeygenFont, pvar)) {
# Line 4372  static BOOL CALLBACK TTXKeyGenerator(HWN Line 4395  static BOOL CALLBACK TTXKeyGenerator(HWN
4395                  else {                  else {
4396                          DlgHostFont = NULL;                          DlgHostFont = NULL;
4397                  }                  }
4398    #endif
4399    
4400                  init_password_control(dlg, IDC_KEY_EDIT);                  init_password_control(dlg, IDC_KEY_EDIT);
4401                  init_password_control(dlg, IDC_CONFIRM_EDIT);                  init_password_control(dlg, IDC_CONFIRM_EDIT);
# Line 4529  static BOOL CALLBACK TTXKeyGenerator(HWN Line 4553  static BOOL CALLBACK TTXKeyGenerator(HWN
4553                          // don't forget to free SSH resource!                          // don't forget to free SSH resource!
4554                          free_ssh_key();                          free_ssh_key();
4555                          EndDialog(dlg, 0); // dialog close                          EndDialog(dlg, 0); // dialog close
4556    #if 0
4557                          if (DlgKeygenFont != NULL) {                          if (DlgKeygenFont != NULL) {
4558                                  DeleteObject(DlgKeygenFont);                                  DeleteObject(DlgKeygenFont);
4559                          }                          }
4560    #endif
4561                          return TRUE;                          return TRUE;
4562    
4563                  // if radio button pressed...                  // if radio button pressed...

Legend:
Removed from v.7554  
changed lines
  Added in v.7560

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26