/[winpt]/trunk/Src/wptPassphraseDlg.cpp
ViewVC logotype

Diff of /trunk/Src/wptPassphraseDlg.cpp

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

revision 22 by twoaday, Wed Aug 10 11:33:35 2005 UTC revision 23 by twoaday, Fri Sep 30 10:10:16 2005 UTC
# Line 32  Line 32 
32    
33    
34  struct passphrase_s {  struct passphrase_s {
35      char * title;      char *title;    /* title of the dialog. */
36      char pwd[256];      char pwd[256];  /* the actual passphrase. */
37      int strict;      int strict;     /* do a simple check how good the passphrase is. */
38      int repeat;      int repeat;     /* Indicate last try was wrong. */  
39      int cancel;      int cancel;     /* 1 if user cancelled operation. */
40  };  };
41    
42    
43    /* Dialog procedure to request a passphrase from the user. */
44  static BOOL CALLBACK  static BOOL CALLBACK
45  passwd_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  passwd_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
46  {  {
# Line 51  passwd_dlg_proc (HWND dlg, UINT msg, WPA Line 52  passwd_dlg_proc (HWND dlg, UINT msg, WPA
52          pwd = (passphrase_s *)lparam;          pwd = (passphrase_s *)lparam;
53          if (pwd == NULL)          if (pwd == NULL)
54              dlg_fatal_error (dlg, "Could not get dialog param!");              dlg_fatal_error (dlg, "Could not get dialog param!");
55  #ifndef LANG_DE      #ifndef LANG_DE
56          SetWindowText (dlg, _("Passphrase Dialog"));          SetWindowText (dlg, _("Passphrase Dialog"));
57  #endif      #endif
58          CheckDlgButton (dlg, IDC_PASSWD_HIDE, BST_CHECKED);          CheckDlgButton (dlg, IDC_PASSWD_HIDE, BST_CHECKED);
59          if (pwd->title)          if (pwd->title)
60              SetWindowText (dlg, pwd->title);              SetWindowText (dlg, pwd->title);
# Line 62  passwd_dlg_proc (HWND dlg, UINT msg, WPA Line 63  passwd_dlg_proc (HWND dlg, UINT msg, WPA
63          else          else
64              SetDlgItemText (dlg, IDC_PASSWD_INFO, _("Enter Passphrase"));              SetDlgItemText (dlg, IDC_PASSWD_INFO, _("Enter Passphrase"));
65          SetFocus (GetDlgItem (dlg, IDC_PASSWD_PWD ));          SetFocus (GetDlgItem (dlg, IDC_PASSWD_PWD ));
66          center_window2 (dlg, HWND_TOPMOST);          center_window2 (dlg, NULL, HWND_TOPMOST);
67          center_window (dlg);          center_window (dlg, NULL);
68          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
69          return FALSE;          return FALSE;
70                    
# Line 88  passwd_dlg_proc (HWND dlg, UINT msg, WPA Line 89  passwd_dlg_proc (HWND dlg, UINT msg, WPA
89                                           "\n\nStill proceed?"),                                           "\n\nStill proceed?"),
90                                    _("Key Generation"), MB_ICONWARNING|MB_YESNO);                                    _("Key Generation"), MB_ICONWARNING|MB_YESNO);
91                  if (id == IDNO)                  if (id == IDNO)
92                      return FALSE;                      return TRUE;
93              }              }
94              SetDlgItemText (dlg, IDC_PASSWD_PWD, "");              SetDlgItemText (dlg, IDC_PASSWD_PWD, "");
95              EndDialog (dlg, TRUE);              EndDialog (dlg, TRUE);
# Line 96  passwd_dlg_proc (HWND dlg, UINT msg, WPA Line 97  passwd_dlg_proc (HWND dlg, UINT msg, WPA
97                            
98          case IDCANCEL:          case IDCANCEL:
99              pwd->cancel = 1;              pwd->cancel = 1;
100              EndDialog( dlg, FALSE );              EndDialog (dlg, FALSE);
101              return FALSE;              return TRUE;
102          }          }
103          break;          break;
104      }      }
105            
106      return FALSE;      return FALSE;
107  } /* passwd_dlg_proc */  }
108    
109    
110    /* Request a passphrase from the user. @title is the title of the
111       dialog and @ret_cancel is true if user cancelled the operation.
112       Return value: the passphrase or NUL for an error. */
113  char*  char*
114  request_passphrase (const char *title, int flags, int *ret_cancel)  request_passphrase (const char *title, int flags, int *ret_cancel)
115  {  {
# Line 132  request_passphrase (const char *title, i Line 136  request_passphrase (const char *title, i
136      free_if_alloc (pass.title);      free_if_alloc (pass.title);
137      memset (&pass, 0, sizeof (pass));      memset (&pass, 0, sizeof (pass));
138      return p;      return p;
139  } /* request_passphrase */  }
140    
141    
142  char *  /* Request a passphrase from the user but also confirm the passphrase
143       to make sure there is no typo. Arguments same as in the normal version
144       of the function. */
145    char*
146  request_passphrase2 (const char *title, int flags, int *ret_cancel)  request_passphrase2 (const char *title, int flags, int *ret_cancel)
147  {  {
148      char *pass1, *pass2;      char *pass1, *pass2;

Legend:
Removed from v.22  
changed lines
  Added in v.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26