Develop and Download Open Source Software

Browse Subversion Repository

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

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

revision 7729 by zmatsuo, Wed Jun 5 14:15:34 2019 UTC revision 7730 by zmatsuo, Wed Jun 5 14:15:47 2019 UTC
# Line 827  static BOOL CALLBACK auth_dlg_proc(HWND Line 827  static BOOL CALLBACK auth_dlg_proc(HWND
827          static BOOL UseControlChar;          static BOOL UseControlChar;
828          static BOOL ShowPassPhrase;          static BOOL ShowPassPhrase;
829          static HICON hIconDropdown;          static HICON hIconDropdown;
830            TCHAR uimsg[MAX_UIMSG];
831    
832          switch (msg) {          switch (msg) {
833          case WM_INITDIALOG:          case WM_INITDIALOG:
# Line 1047  canceled: Line 1048  canceled:
1048                          return TRUE;                          return TRUE;
1049    
1050                  case IDC_SSHPASSWORD_OPTION: {                  case IDC_SSHPASSWORD_OPTION: {
                         TCHAR uimsg[MAX_UIMSG];  
1051                          RECT rect;                          RECT rect;
1052                          HWND hWndButton;                          HWND hWndButton;
1053                          int result;                          int result;
# Line 1136  canceled: Line 1136  canceled:
1136                  }                  }
1137    
1138                  case IDC_USERNAME_OPTION: {                  case IDC_USERNAME_OPTION: {
                         TCHAR uimsg[MAX_UIMSG];  
1139                          RECT rect;                          RECT rect;
1140                          HWND hWndButton;                          HWND hWndButton;
1141                          HMENU hMenu= CreatePopupMenu();                          HMENU hMenu= CreatePopupMenu();
1142                          int result;                          int result;
1143                            const BOOL DisableDefaultUserName = pvar->session_settings.DefaultUserName[0] == 0;
1144                            GetI18nStrT("TTSSH", "DLG_AUTH_PASTE_DEFAULT_USERNAME",
1145                                                    uimsg, _countof(uimsg),
1146                                                    "use &default username",
1147                                                    pvar->ts->UILanguageFile);
1148                            AppendMenu(hMenu, MF_ENABLED | MF_STRING | (DisableDefaultUserName ? MFS_DISABLED : 0), 1,
1149                                               uimsg);
1150                          GetI18nStrT("TTSSH", "DLG_AUTH_PASTE_WINDOWS_USERNAME",                          GetI18nStrT("TTSSH", "DLG_AUTH_PASTE_WINDOWS_USERNAME",
1151                                                  uimsg, _countof(uimsg),                                                  uimsg, _countof(uimsg),
1152                                                  "Paste &Windows username",                                                  "use &Windows username",
1153                                                  pvar->ts->UILanguageFile);                                                  pvar->ts->UILanguageFile);
1154                          AppendMenu(hMenu, MF_ENABLED | MF_STRING, 1, uimsg);                          AppendMenu(hMenu, MF_ENABLED | MF_STRING, 2, uimsg);
1155                          hWndButton = GetDlgItem(dlg, IDC_USERNAME_OPTION);                          hWndButton = GetDlgItem(dlg, IDC_USERNAME_OPTION);
1156                          GetWindowRect(hWndButton, &rect);                          GetWindowRect(hWndButton, &rect);
1157                          result = TrackPopupMenu(hMenu, TPM_RETURNCMD, rect.left, rect.bottom, 0 , hWndButton, NULL);                          result = TrackPopupMenu(hMenu, TPM_RETURNCMD, rect.left, rect.bottom, 0 , hWndButton, NULL);
1158                          DestroyMenu(hMenu);                          DestroyMenu(hMenu);
1159                          switch (result) {                          switch (result) {
1160                          case 1: {                          case 1:
1161                                    SetDlgItemText(dlg, IDC_SSHUSERNAME, pvar->session_settings.DefaultUserName);
1162                                    goto after_user_name_set;
1163                            case 2: {
1164                                  TCHAR user_name[UNLEN+1];                                  TCHAR user_name[UNLEN+1];
1165                                  DWORD len = _countof(user_name);                                  DWORD len = _countof(user_name);
1166                                  BOOL r = GetUserName(user_name, &len);                                  BOOL r = GetUserName(user_name, &len);
1167                                  if (r != 0) {                                  if (r == 0) {
1168                                          SetDlgItemText(dlg, IDC_SSHUSERNAME, user_name);                                          break;
                                         SendDlgItemMessage(dlg, IDC_SSHUSERNAME, EM_SETSEL, 0, -1);  
                                         SendMessage(dlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(dlg, IDC_SSHUSERNAME), TRUE);  
1169                                  }                                  }
1170                                    SetDlgItemText(dlg, IDC_SSHUSERNAME, user_name);
1171                            after_user_name_set:
1172                                    SendDlgItemMessage(dlg, IDC_SSHUSERNAME, EM_SETSEL, 0, -1);
1173                                    SendMessage(dlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(dlg, IDC_SSHUSERNAME), TRUE);
1174                                  break;                                  break;
1175                          }                          }
1176                          }                          }

Legend:
Removed from v.7729  
changed lines
  Added in v.7730

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