mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-18 03:28:07 -05:00
Jacob's patch to make passphrase boxes work more sanely
[originally from svn r1084]
This commit is contained in:
parent
1c998f6482
commit
713679a0fa
@ -170,7 +170,7 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg,
|
|||||||
*/
|
*/
|
||||||
static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
||||||
WPARAM wParam, LPARAM lParam) {
|
WPARAM wParam, LPARAM lParam) {
|
||||||
static char *passphrase;
|
static char *passphrase = NULL;
|
||||||
struct PassphraseProcStruct *p;
|
struct PassphraseProcStruct *p;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
@ -197,6 +197,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||||||
if (p->comment)
|
if (p->comment)
|
||||||
SetDlgItemText(hwnd, 101, p->comment);
|
SetDlgItemText(hwnd, 101, p->comment);
|
||||||
*passphrase = 0;
|
*passphrase = 0;
|
||||||
|
SetDlgItemText (hwnd, 102, passphrase);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
@ -210,7 +211,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||||||
EndDialog (hwnd, 0);
|
EndDialog (hwnd, 0);
|
||||||
return 0;
|
return 0;
|
||||||
case 102: /* edit box */
|
case 102: /* edit box */
|
||||||
if (HIWORD(wParam) == EN_CHANGE) {
|
if ((HIWORD(wParam) == EN_CHANGE) && passphrase) {
|
||||||
GetDlgItemText (hwnd, 102, passphrase, PASSPHRASE_MAXLEN-1);
|
GetDlgItemText (hwnd, 102, passphrase, PASSPHRASE_MAXLEN-1);
|
||||||
passphrase[PASSPHRASE_MAXLEN-1] = '\0';
|
passphrase[PASSPHRASE_MAXLEN-1] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ FONT 8, "MS Sans Serif"
|
|||||||
BEGIN
|
BEGIN
|
||||||
CTEXT "Enter passphrase for key", 100, 10, 6, 120, 8
|
CTEXT "Enter passphrase for key", 100, 10, 6, 120, 8
|
||||||
CTEXT "", 101, 10, 16, 120, 8
|
CTEXT "", 101, 10, 16, 120, 8
|
||||||
EDITTEXT 102, 10, 26, 120, 12, ES_PASSWORD
|
EDITTEXT 102, 10, 26, 120, 12, ES_PASSWORD | ES_AUTOHSCROLL
|
||||||
DEFPUSHBUTTON "O&K", IDOK, 20, 42, 40, 14
|
DEFPUSHBUTTON "O&K", IDOK, 20, 42, 40, 14
|
||||||
PUSHBUTTON "&Cancel", IDCANCEL, 80, 42, 40, 14
|
PUSHBUTTON "&Cancel", IDCANCEL, 80, 42, 40, 14
|
||||||
END
|
END
|
||||||
|
@ -93,7 +93,7 @@ struct PassphraseProcStruct {
|
|||||||
*/
|
*/
|
||||||
static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
||||||
WPARAM wParam, LPARAM lParam) {
|
WPARAM wParam, LPARAM lParam) {
|
||||||
static char *passphrase;
|
static char *passphrase = NULL;
|
||||||
struct PassphraseProcStruct *p;
|
struct PassphraseProcStruct *p;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
@ -121,6 +121,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||||||
if (p->comment)
|
if (p->comment)
|
||||||
SetDlgItemText(hwnd, 101, p->comment);
|
SetDlgItemText(hwnd, 101, p->comment);
|
||||||
*passphrase = 0;
|
*passphrase = 0;
|
||||||
|
SetDlgItemText(hwnd, 102, passphrase);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
@ -134,7 +135,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||||||
EndDialog (hwnd, 0);
|
EndDialog (hwnd, 0);
|
||||||
return 0;
|
return 0;
|
||||||
case 102: /* edit box */
|
case 102: /* edit box */
|
||||||
if (HIWORD(wParam) == EN_CHANGE) {
|
if ((HIWORD(wParam) == EN_CHANGE) && passphrase) {
|
||||||
GetDlgItemText (hwnd, 102, passphrase, PASSPHRASE_MAXLEN-1);
|
GetDlgItemText (hwnd, 102, passphrase, PASSPHRASE_MAXLEN-1);
|
||||||
passphrase[PASSPHRASE_MAXLEN-1] = '\0';
|
passphrase[PASSPHRASE_MAXLEN-1] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ FONT 8, "MS Sans Serif"
|
|||||||
BEGIN
|
BEGIN
|
||||||
CTEXT "Enter passphrase for key", 100, 10, 6, 120, 8
|
CTEXT "Enter passphrase for key", 100, 10, 6, 120, 8
|
||||||
CTEXT "", 101, 10, 16, 120, 8
|
CTEXT "", 101, 10, 16, 120, 8
|
||||||
EDITTEXT 102, 10, 26, 120, 12, ES_PASSWORD
|
EDITTEXT 102, 10, 26, 120, 12, ES_PASSWORD | ES_AUTOHSCROLL
|
||||||
DEFPUSHBUTTON "O&K", IDOK, 20, 42, 40, 14
|
DEFPUSHBUTTON "O&K", IDOK, 20, 42, 40, 14
|
||||||
PUSHBUTTON "&Cancel", IDCANCEL, 80, 42, 40, 14
|
PUSHBUTTON "&Cancel", IDCANCEL, 80, 42, 40, 14
|
||||||
END
|
END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user