gpgme_key_ref (dec->signer);
decrypt_key_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam){    static struct decrypt_key_s * dec;    static int hide_state = 1;    size_t n;    switch (msg) {    case WM_INITDIALOG:	dec = (struct decrypt_key_s *)lparam;	if (dec && dec->use_as_cb) {	    dec->opts = 0;	    dec->pass = NULL;	    set_key_hint (dec, dlg, IDC_DEC_KEYLIST);	    EnableWindow (GetDlgItem (dlg, IDC_DEC_KEYLIST), FALSE);	}	if (dec && dec->last_was_bad)	    SetDlgItemText (dlg, IDC_DEC_HINT, "Invalid passphrase; please try again...");	else	    SetDlgItemText (dlg, IDC_DEC_HINT, "");	if (dec && !dec->use_as_cb)	    load_secbox (dlg, IDC_DEC_KEYLIST);	CheckDlgButton (dlg, IDC_DEC_HIDE, BST_CHECKED);	center_window (dlg, NULL);	if (dec->hide_pwd) {	    ShowWindow (GetDlgItem (dlg, IDC_DEC_HIDE), SW_HIDE);	    ShowWindow (GetDlgItem (dlg, IDC_DEC_PASS), SW_HIDE);	    ShowWindow (GetDlgItem (dlg, IDC_DEC_PASSINF), SW_HIDE);	    /* XXX: make the dialog window smaller */	}	else	    SetFocus (GetDlgItem (dlg, IDC_DEC_PASS));	SetForegroundWindow (dlg);	return FALSE;    case WM_DESTROY:	hide_state = 1;	break;    case WM_SYSCOMMAND:	if (wparam == SC_CLOSE)	    EndDialog (dlg, TRUE);	break;    case WM_COMMAND:	switch (HIWORD (wparam)) {	case BN_CLICKED:	    if ((int)LOWORD (wparam) == IDC_DEC_HIDE) {		HWND hwnd;		hide_state ^= 1;		hwnd = GetDlgItem (dlg, IDC_DEC_PASS);		SendMessage (hwnd, EM_SETPASSWORDCHAR, hide_state? '*' : 0, 0);		SetFocus (hwnd);	    }	    break;	}	switch (LOWORD (wparam)) {	case IDOK:	    n = SendDlgItemMessage (dlg, IDC_DEC_PASS, WM_GETTEXTLENGTH, 0, 0);	    if (n) {		dec->pass = (char *)xcalloc( 1, n+2 );		GetDlgItemText( dlg, IDC_DEC_PASS, dec->pass, n+1 );	    }	    if (!dec->use_as_cb) {		int idx = SendDlgItemMessage (dlg, IDC_DEC_KEYLIST, CB_GETCURSEL, 0, 0);		dec->signer = (gpgme_key_t)SendDlgItemMessage (dlg, IDC_DEC_KEYLIST, 							       CB_GETITEMDATA, idx, 0);	    }	    EndDialog (dlg, TRUE);	    break;	case IDCANCEL:	    if (dec && dec->use_as_cb && (dec->flags & 0x01)) {		const char *warn = "If you cancel this dialog, the message will be sent without signing.\n"				   "Do you really want to cancel?";		n = MessageBox (dlg, warn, "Secret Key Dialog", MB_ICONWARNING|MB_YESNO);		if (n == IDNO)		    return FALSE;	    }	    dec->opts = OPT_FLAG_CANCEL;	    dec->pass = NULL;	    EndDialog (dlg, FALSE);	    break;	}	break;    }    return FALSE;}