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

Diff of /trunk/Src/wptCardManager.cpp

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

revision 25 by twoaday, Fri Sep 30 10:10:16 2005 UTC revision 26 by twoaday, Mon Oct 17 08:49:30 2005 UTC
# Line 1  Line 1 
1  /* wptCardManager.cpp  /* wptCardManager.cpp
2   *      Copyright (C) 2003 Timo Schulz   *      Copyright (C) 2003, 2005 Timo Schulz
3     *      Copyright (C) 2005 g10 Code GmbH
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
6   *   *
# Line 30  Line 31 
31  #include "../resource.h"  #include "../resource.h"
32    
33    
34    /* Dialog box procedure for the card callback. */
35  static BOOL CALLBACK  static BOOL CALLBACK
36  card_cb_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )  card_cb_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
37  {  {
38      static card_cb_s * ctx;      static card_cb_s * ctx;
39    
# Line 40  card_cb_dlg_proc( HWND dlg, UINT msg, WP Line 42  card_cb_dlg_proc( HWND dlg, UINT msg, WP
42          ctx = (struct card_cb_s *)lparam;          ctx = (struct card_cb_s *)lparam;
43          if( !ctx )          if( !ctx )
44              BUG( NULL );              BUG( NULL );
45          switch( ctx->code ) {          switch (ctx->code) {
46          case 1:          case CARD_CB_INS_CARD:
47              ShowWindow( GetDlgItem( dlg, IDC_CCTRL_VAL ), FALSE );              ShowWindow (GetDlgItem (dlg, IDC_CCTRL_VAL), FALSE);
48              SetDlgItemText( dlg, IDC_CCTRL_MSG,              SetDlgItemText (dlg, IDC_CCTRL_MSG,
49                  _("Please insert the OpenPGP smart card\n"                              _("Please insert the OpenPGP smart card\n"
50                    "Press OK to continue or Cancel") );                                "Press OK to continue or Cancel"));
51              break;              break;
52          }          }
53          center_window( dlg, NULL );          center_window (dlg, NULL);
54          SetForegroundWindow( dlg );          SetForegroundWindow (dlg);
55          break;          break;
56    
57      case WM_COMMAND:      case WM_COMMAND:
58          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
59          case IDOK:          case IDOK:
60              strcpy( ctx->val, "\r\n" );              strcpy (ctx->val, "\r\n");
61              EndDialog( dlg, TRUE );              EndDialog( dlg, TRUE );
62              break;              break;
63    
64          case IDCANCEL:          case IDCANCEL:
65              strcpy( ctx->val, "c" );              strcpy (ctx->val, "c");
66              ctx->cancel = 1;              ctx->cancel = 1;
67              EndDialog( dlg, FALSE );              EndDialog (dlg, FALSE);
68              break;              break;
69          }          }
70          break;          break;
71      }      }
72    
73      return FALSE;      return FALSE;
74  } /* card_cb_dlg_proc */  }
75    
76    
77  const char*  const char*
78  card_callback (int code, void * opaque)  card_callback (int code, void *opaque)
79  {  {
80      struct card_cb_s *ctx = (struct card_cb_s *)opaque;      struct card_cb_s *ctx = (struct card_cb_s *)opaque;
81    
# Line 81  card_callback (int code, void * opaque) Line 83  card_callback (int code, void * opaque)
83          return NULL;          return NULL;
84    
85      if (!ctx->init) {      if (!ctx->init) {
86          memset( ctx->val, 0, sizeof ctx->val );          memset (ctx->val, 0, sizeof (ctx->val));
87          ctx->code = code;          ctx->code = code;
88          DialogBoxParam( glob_hinst, (LPCTSTR)IDD_WINPT_CARD_CTRL, glob_hwnd,          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CARD_CTRL, glob_hwnd,
89                          card_cb_dlg_proc, (LPARAM)ctx );                          card_cb_dlg_proc, (LPARAM)ctx);
90          ctx->init = 0;          ctx->init = 0;
91      }      }
92    
93      return ctx->val;      return ctx->val;
 } /* card_callback */  
94    }

Legend:
Removed from v.25  
changed lines
  Added in v.26

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26