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

Diff of /trunk/Src/wptMainProc.cpp

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

revision 25 by twoaday, Wed Oct 12 10:04:26 2005 UTC revision 68 by twoaday, Sat Nov 5 12:00:55 2005 UTC
# Line 1  Line 1 
1  /* wptMainProc.cpp - Main window procedure  /* wptMainProc.cpp - Main window procedure
2   *      Copyright (C) 2000-2005 Timo Schulz   *      Copyright (C) 2000-2005 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
6   * WinPT is free software; you can redistribute it and/or modify   * WinPT is free software; you can redistribute it and/or modify
7   * it under the terms of the GNU General Public License as published by   * it under the terms of the GNU General Public License as published by
8   * the Free Software Foundation; either version 2 of the License, or   * the Free Software Foundation; either version 2 of the License, or
9   * (at your option) any later version.   * (at your option) any later version.
10   *   *
11   * WinPT is distributed in the hope that it will be useful,   * WinPT is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.   * GNU General Public License for more details.
15   *   *
16   * You should have received a copy of the GNU General Public License   * You should have received a copy of the GNU General Public License
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
20    
21  #include <windows.h>  #ifdef HAVE_CONFIG_H
22  #include <commctrl.h>  #include <config.h>
23  #include <io.h>  #endif
24    
25  #include "../resource.h"  #include <windows.h>
26  #include "wptTypes.h"  #include <commctrl.h>
27  #include "wptGPG.h"  #include <io.h>
28  #include "wptW32API.h"  
29  #include "wptVersion.h"  #include "resource.h"
30  #include "wptCommonCtl.h"  #include "wptTypes.h"
31  #include "wptContext.h" /* for passphrase_s */  #include "wptGPG.h"
32  #include "wptDlgs.h"  #include "wptW32API.h"
33  #include "wptErrors.h"  #include "wptVersion.h"
34  #include "wptNLS.h"  #include "wptCommonCtl.h"
35  #include "wptHotkey.h"  #include "wptContext.h" /* for passphrase_s */
36  #include "wptRegistry.h"  #include "wptDlgs.h"
37  #include "wptKeyserver.h"  #include "wptErrors.h"
38  #include "wptAgent.h"  #include "wptNLS.h"
39  #include "wptKeyManager.h"  #include "wptHotkey.h"
40  #include "wptCard.h"  #include "wptRegistry.h"
41  #include "wptCryptdisk.h"  #include "wptKeyserver.h"
42  #include "wptCardEdit.h"  #include "wptAgent.h"
43    #include "wptKeyManager.h"
44  extern HWND activ_hwnd;  #include "wptCard.h"
45  static int cmd = 0;  #include "wptCryptdisk.h"
46  static int wipe_contents = 0;  #include "wptCardEdit.h"
47    #include "wptCrypto.h"
48    
49  /* Dialog box procedure to display all insecure all ElGamal keys. */  extern HWND activ_hwnd;
50  BOOL CALLBACK  static int cmd = 0;
51  elgamal_warn_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )  static int wipe_contents = 0;
52  {  
53      gpg_keycache_t pc;  
54      gpgme_key_t key;  /* Dialog box procedure to display all insecure all ElGamal keys. */
55      char tmp[128+64+1];  BOOL CALLBACK
56    elgamal_warn_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
57      switch( msg ) {  {
58      case WM_INITDIALOG:      gpg_keycache_t pc;
59          pc = keycache_get_ctx (1);      gpgme_key_t key;
60          while (!gpg_keycache_next_key (pc, 0, &key)) {      char tmp[128+64+1];
61              if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {  
62                  _snprintf (tmp, sizeof (tmp)-1, "(0x%s) %s",      switch( msg ) {
63                              key->subkeys->keyid+8, key->uids->uid);      case WM_INITDIALOG:
64                  SendDlgItemMessage( dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,          pc = keycache_get_ctx (1);
65                                      0, (LPARAM)(const char *) tmp );          while (!gpg_keycache_next_key (pc, 0, &key)) {
66              }              if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {
67          }                  _snprintf (tmp, sizeof (tmp)-1, "(0x%s) %s",
68          gpg_keycache_rewind (pc);                             key->subkeys->keyid+8, key->uids->uid);
69          center_window (dlg, NULL);                  SendDlgItemMessage (dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,
70          SetForegroundWindow (dlg);                                      0, (LPARAM)(const char *) tmp);
71          break;              }
72            }
73      case WM_COMMAND:          gpg_keycache_rewind (pc);
74          switch (LOWORD (wparam)) {          center_window (dlg, NULL);
75          case IDOK:          SetForegroundWindow (dlg);
76              EndDialog (dlg, TRUE);          break;
77              break;  
78          }      case WM_COMMAND:
79          break;          switch (LOWORD (wparam)) {
80      }          case IDOK:
81      return FALSE;              EndDialog (dlg, TRUE);
82  }              break;
83            }
84            break;
85        }
86  static int      return FALSE;
87  cleanup_tmp_files (void)  }
88  {  
89      struct _finddata_t dat;  
90      char tmp[384];  /* @unused
91      long hd;  static int
92    cleanup_tmp_files (void)
93      if (GetTempPath (sizeof (tmp)-1, tmp) == FALSE ||  {
94          SetCurrentDirectory (tmp) == FALSE) {      struct _finddata_t dat;
95          winpt_errmsg ("GetTempPath", 0);      char tmp[384];
96          return WPTERR_GENERAL;      long hd;
97      }  
98      hd = _findfirst ("gpgmeOUT*", &dat);      if (GetTempPath (sizeof (tmp)-1, tmp) == FALSE ||
99      if (hd == -1)          SetCurrentDirectory (tmp) == FALSE) {
100          return 0;          winpt_errmsg ("GetTempPath", 0);
101      do {          return WPTERR_GENERAL;
102          secure_unlink (dat.name, WIPE_MODE_SIMPLE);      }
103      } while (_findnext (hd, &dat) == 0);      hd = _findfirst ("gpgmeOUT*", &dat);
104      _findclose (hd);      if (hd == -1)
105      return 0;          return 0;
106  }      do {
107            secure_unlink (dat.name, WIPE_MODE_SIMPLE);
108        } while (_findnext (hd, &dat) == 0);
109  /* Dialog box procedure to confirm to delete the clipboard contents. */      _findclose (hd);
110  static BOOL CALLBACK      return 0;
111  confirm_delclipboard_dlg (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  }
112  {  */
113      switch (msg) {  
114      case WM_INITDIALOG:  
115          center_window (dlg, NULL);  /* Dialog box procedure to confirm to delete the clipboard contents. */
116          SetForegroundWindow (dlg);  static BOOL CALLBACK
117          break;  confirm_delclipboard_dlg (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
118    {
119      case WM_COMMAND:      switch (msg) {
120          switch (LOWORD (wparam)) {      case WM_INITDIALOG:
121          case IDYES:          SetWindowText (dlg, _("Delete Clipboard Contents"));
122              wipe_contents = 1;          center_window (dlg, NULL);
123              if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))          SetForegroundWindow (dlg);
124                  set_reg_winpt_flag ("WipeClipboard", 1);          break;
125              EndDialog (dlg, TRUE);  
126              break;      case WM_COMMAND:
127            switch (LOWORD (wparam)) {
128          case IDNO:          case IDYES:
129              wipe_contents = 0;              wipe_contents = 1;
130              if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))              if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))
131                  set_reg_winpt_flag ("WipeClipboard", 0);                  set_reg_winpt_flag ("WipeClipboard", 1);
132              EndDialog (dlg, FALSE);              EndDialog (dlg, TRUE);
133              break;              break;
134          }  
135          break;          case IDNO:
136      }              wipe_contents = 0;
137      return FALSE;              if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))
138  }                  set_reg_winpt_flag ("WipeClipboard", 0);
139                EndDialog (dlg, FALSE);
140                break;
141  static gpgme_error_t          }
142  currwnd_gpg_dlg (HWND hwnd, UINT id, int *ret_set)          break;
143  {      }
144      gpgme_error_t err;      return FALSE;
145      gpg_pgptype_t type;  }
146        
147      if (ret_set)  
148          *ret_set = 1;  static gpgme_error_t
149      switch (id) {  currwnd_gpg_dlg (HWND hwnd, UINT id, int *ret_set)
150      case ID_WINPT_CURRWND_SYMENC:  {
151          gpg_encrypt_symmetric ();      gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
152          break;      int type;
153        
154      case ID_WINPT_CURRWND_ENCRYPT:      if (ret_set)
155          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,          *ret_set = 1;
156                            clip_encrypt_dlg_proc, NULL,      switch (id) {
157                            _("Encryption"), IDS_WINPT_ENCRYPT );      case ID_WINPT_CURRWND_SYMENC:
158          break;          gpg_encrypt_symmetric ();
159                    break;
160      case ID_WINPT_CURRWND_SIGNENCRYPT:  
161          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,      case ID_WINPT_CURRWND_ENCRYPT:
162                            clip_signenc_dlg_proc, NULL,          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,
163                            _("Sign & Encrypt"), IDS_WINPT_SIGNENC );                            clip_encrypt_dlg_proc, 0,
164          break;                            _("Encryption"), IDS_WINPT_ENCRYPT );
165                    break;
166      case ID_WINPT_CURRWND_SIGN:          
167          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,      case ID_WINPT_CURRWND_SIGNENCRYPT:
168                            clip_sign_dlg_proc, NULL,          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,
169                            _("Signing"), IDS_WINPT_SIGN );                            clip_signenc_dlg_proc, 0,
170          break;                            _("Sign & Encrypt"), IDS_WINPT_SIGNENC );
171                    break;
172      case ID_WINPT_CURRWND_DECRYPT_VERIFY:          
173          err = gpg_clip_get_pgptype (&type);      case ID_WINPT_CURRWND_SIGN:
174          if (err) {          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,
175              msg_box (hwnd, gpgme_strerror (err), _("Clipboard"), MB_ERR);                            clip_sign_dlg_proc, 0,
176              break;                            _("Signing"), IDS_WINPT_SIGN );
177          }          break;
178          if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {          
179              /* It makes only sense to insert the data in the window if it's      case ID_WINPT_CURRWND_DECRYPT_VERIFY:
180                 really a ciphertext. Verfied data doesn't need this. */          err = gpg_clip_get_pgptype (&type);
181              err = clip_decrypt_dlg (hwnd);          if (err) {
182              if (!err && reg_prefs.use_viewer) {              msg_box (hwnd, gpgme_strerror (err), _("Clipboard"), MB_ERR);
183                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,              break;
184                                    GetDesktopWindow(), clip_edit_dlg_proc, NULL,          }
185                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT);          if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {
186                  if (ret_set)              /* It makes only sense to insert the data in the window if it's
187                      *ret_set = 0;                 really a ciphertext. Verfied data doesn't need this. */
188              }              err = clip_decrypt_dlg (hwnd);
189          }              if (!err && reg_prefs.use_viewer) {
190          else if ((type & PGP_PUBKEY) && !(type & PGP_CLEARSIG))                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
191              km_clip_import (GetDesktopWindow ());                                    GetDesktopWindow(), clip_edit_dlg_proc, 0,
192          else {                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT);
193              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,                  if (ret_set)
194                                clip_verify_dlg_proc, NULL,                      *ret_set = 0;
195                                _("Verify"), IDS_WINPT_VERIFY );              }
196              err  = gpg_error (GPG_ERR_EOF); /* make sure window is ot updated. */          }
197          }          else if ((type & PGP_PUBKEY) && !(type & PGP_CLEARSIG))
198          break;              km_clip_import (GetDesktopWindow ());
199      }          else {
200                    dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
201      return err;                                clip_verify_dlg_proc, 0,
202  }                                _("Verify"), IDS_WINPT_VERIFY );
203                err  = gpg_error (GPG_ERR_EOF); /* make sure window is ot updated. */
204            }
205  static void          break;
206  clip_gpg_dlg (HWND hwnd, UINT id)      }
207  {      
208      gpgme_error_t err;      return err;
209      gpg_pgptype_t type;  }
210      size_t size = 0;      
211        
212      if( (id == ID_WINPT_SIGN || id == ID_WINPT_SIGNENCRYPT)  static void
213          && gnupg_access_keyring (0) ) {  clip_gpg_dlg (HWND hwnd, UINT id)
214          msg_box( hwnd, _("Could not access secret keyring."), _("Sign"), MB_ERR );  {
215          return;      gpgme_error_t err;
216      }      int type;
217            
218      switch( id ) {      if( (id == ID_WINPT_SIGN || id == ID_WINPT_SIGNENCRYPT)
219      case ID_WINPT_SYMENC:          && gnupg_access_keyring (0) ) {
220          gpg_encrypt_symmetric();          msg_box( hwnd, _("Could not access secret keyring."), _("Sign"), MB_ERR );
221          break;          return;
222                }
223      case ID_WINPT_ENCRYPT:      
224          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,      switch( id ) {
225                            clip_encrypt_dlg_proc, NULL,      case ID_WINPT_SYMENC:
226                            _("Encryption"), IDS_WINPT_ENCRYPT );          gpg_encrypt_symmetric();
227          break;          break;
228                    
229      case ID_WINPT_SIGN:      case ID_WINPT_ENCRYPT:
230          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,
231                            clip_sign_dlg_proc, NULL,                            clip_encrypt_dlg_proc, 0,
232                            _("Signing"), IDS_WINPT_SIGN );                            _("Encryption"), IDS_WINPT_ENCRYPT );
233          break;          break;
234                    
235      case ID_WINPT_SIGNENCRYPT:      case ID_WINPT_SIGN:
236          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,
237                            clip_signenc_dlg_proc, NULL,                            clip_sign_dlg_proc, 0,
238                            _("Sign & Encrypt"), IDS_WINPT_SIGNENC );                            _("Signing"), IDS_WINPT_SIGN );
239          break;          break;
240                    
241      case ID_WINPT_DECRYPT_VERIFY:      case ID_WINPT_SIGNENCRYPT:
242          err = gpg_clip_get_pgptype (&type);          dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,
243          if (err) {                            clip_signenc_dlg_proc, 0,
244              msg_box( hwnd, gpgme_strerror( err ), _("Clipboard"), MB_ERR );                            _("Sign & Encrypt"), IDS_WINPT_SIGNENC );
245              break;          break;
246          }          
247          if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {      case ID_WINPT_DECRYPT_VERIFY:
248              err = clip_decrypt_dlg (hwnd);          err = gpg_clip_get_pgptype (&type);
249              if (!err && reg_prefs.use_viewer) {          if (err) {
250                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,              msg_box( hwnd, gpgme_strerror( err ), _("Clipboard"), MB_ERR );
251                                    GetDesktopWindow(), clip_edit_dlg_proc, NULL,              break;
252                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );          }
253              }          if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {
254          }              err = clip_decrypt_dlg (hwnd);
255          else if( (type & PGP_SIG) && !(type & PGP_CLEARSIG) ) {              if (!err && reg_prefs.use_viewer) {
256              text_input_s input;                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
257              gpgme_data_t sig;                                    GetDesktopWindow(), clip_edit_dlg_proc, 0,
258                                                 _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
259              memset( &input, 0, sizeof (input) );              }
260              err = gpg_data_new_from_clipboard (&sig, 0);          }
261              if( err ) {          else if( (type & PGP_SIG) && !(type & PGP_CLEARSIG) ) {
262                  msg_box( hwnd, gpgme_strerror( err ),_("Verify"), MB_ERR );              text_input_s input;
263                  return;              gpgme_data_t sig;
264              }              
265              input.type = 0;              memset( &input, 0, sizeof (input) );
266              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_TEXT, hwnd,              err = gpg_data_new_from_clipboard (&sig, 0);
267                               text_input_dlg_proc, (LPARAM)&input,              if( err ) {
268                               _("Text Input"), IDS_WINPT_TEXT );                  msg_box( hwnd, gpgme_strerror( err ),_("Verify"), MB_ERR );
269                                return;
270              gpg_data_release_and_set_clipboard( sig, 0 );              }
271              if( input.length ) {              input.type = 0;
272                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_TEXT, hwnd,
273                                   clip_verify_dlg_proc, (LPARAM)&input,                               text_input_dlg_proc, (LPARAM)&input,
274                                   _("Verify"), IDS_WINPT_VERIFY );                               _("Text Input"), IDS_WINPT_TEXT );
275                  input.length = 0;              
276                  free_if_alloc( input.data );              gpg_data_release_and_set_clipboard( sig, 0 );
277              }              if( input.length ) {
278          }                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
279          else if (type & PGP_CLEARSIG) {                                   clip_verify_dlg_proc, (LPARAM)&input,
280              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,                                   _("Verify"), IDS_WINPT_VERIFY );
281                                clip_verify_dlg_proc, NULL,                  input.length = 0;
282                                _("Verify"), IDS_WINPT_VERIFY );                  free_if_alloc( input.data );
283          }              }
284          else if ((type & PGP_PUBKEY) || (type & PGP_SECKEY))          }
285              km_clip_import (GetDesktopWindow ());          else if (type & PGP_CLEARSIG) {
286          else              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
287              msg_box (hwnd, _("Unknown OpenPGP type."), _("Clipboard"), MB_ERR);                                clip_verify_dlg_proc, 0,
288      }                                _("Verify"), IDS_WINPT_VERIFY );
289  } /* clip_gpg_dlg */          }
290            else if ((type & PGP_PUBKEY) || (type & PGP_SECKEY))
291                km_clip_import (GetDesktopWindow ());
292  gpg_card_t          else
293  smartcard_init (void)              msg_box (hwnd, _("Unknown OpenPGP type."), _("Clipboard"), MB_ERR);
294  {      }
295      /*  } /* clip_gpg_dlg */
296      pcsc_loadlib (scard_support);  
297      rc = show_card_status ();  
298      if( rc )      /* Load the Card Manager with the current card. */
299          break;  static void
300      */  load_smartcard (void)
301      return gpg_load_scard ();  {
302  }      gpg_card_t card;
303    
304        card = gpg_card_load ();
305  /* Add the winpt symbol to the task bar. */      if (card) {
306  static void          dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_CARD_EDIT,
307  add_taskbar_icon (HWND hwnd, NOTIFYICONDATA *nid)                            GetDesktopWindow (), card_edit_dlg_proc,
308  {                            (LPARAM)card,
309      nid->cbSize = sizeof (NOTIFYICONDATA);                            _("Card Edit"), IDS_WINPT_CARD_EDIT);
310      nid->uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;          gpg_card_release (card);
311      nid->uCallbackMessage = WM_USER;          card = NULL;    
312      nid->hWnd = hwnd;      }
313      nid->hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));  }
314      strcpy (nid->szTip, "Windows Privacy Tray v"PGM_VERSION);  
315      Shell_NotifyIcon (NIM_ADD, nid);  
316      DestroyIcon (nid->hIcon);  /* Add the winpt symbol to the task bar. */
317  }  static void
318    add_taskbar_icon (HWND hwnd, NOTIFYICONDATA *nid)
319    {
320  /* Main message loop for the tray window. */      nid->cbSize = sizeof (NOTIFYICONDATA);
321  LRESULT CALLBACK      nid->uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
322  winpt_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)      nid->uCallbackMessage = WM_USER;
323  {                    nid->hWnd = hwnd;
324      static NOTIFYICONDATA NID;      nid->hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));
325      static int use_hotkey = 0;          strcpy (nid->szTip, "Windows Privacy Tray v"PGM_VERSION);
326      reminder_ctx_s ctx;      Shell_NotifyIcon (NIM_ADD, nid);
327      LPARAM param;      DestroyIcon (nid->hIcon);
328      curr_wnd_ctx currwnd = {0};  }
329      size_t size = 0;  
330      int rc, set_wc = 0, has_data = 0;  
331      INITCOMMONCONTROLSEX cce;  /* Main message loop for the tray window. */
332      gpgme_error_t err;  LRESULT CALLBACK
333      gpg_card_t card;  winpt_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
334    {              
335      switch (msg) {      static NOTIFYICONDATA NID;
336      case WM_CREATE:      static int use_hotkey = 0;    
337          add_taskbar_icon (hwnd, &NID);      reminder_ctx_s ctx;
338          rc = wsock_init ();      LPARAM param;
339          if (rc)      curr_wnd_ctx currwnd = {0};
340              msg_box (NULL, winpt_strerror (rc), "Winsock2 DLL", MB_ERR);      int rc, set_wc = 0, has_data = 0;
341          if (!reg_prefs.no_hotkeys) {      INITCOMMONCONTROLSEX cce;
342              rc = hotkeys_register (hwnd);      gpgme_error_t err;
343              if (rc)  
344                  msg_box (hwnd, hotkeys_strerror (), winpt_strerror (rc), MB_ERR);      switch (msg) {
345          }      case WM_CREATE:
346          rc = PTD_initialize ();          add_taskbar_icon (hwnd, &NID);
347          if (!rc)          rc = wsock_init ();
348              msg_box (hwnd, _("Could not set current window mode hooks."),          if (rc)
349                       _("WinPT Error"), MB_OK);              msg_box (NULL, winpt_strerror (rc), "Winsock2 DLL", MB_ERR);
350          mapi_init ();          if (!reg_prefs.no_hotkeys) {
351          /* init common controls: date control. */              rc = hotkeys_register (hwnd);
352          cce.dwSize = sizeof (INITCOMMONCONTROLSEX);              if (rc)
353          cce.dwICC = ICC_DATE_CLASSES;                  msg_box (hwnd, hotkeys_strerror (), winpt_strerror (rc), MB_ERR);
354          InitCommonControlsEx (&cce);          }
355          LoadLibrary ("RichEd32.Dll");          rc = PTD_initialize ();
356          break;          if (!rc)
357                        msg_box (hwnd, _("Could not set current window mode hooks."),
358      case WM_ENDSESSION:                       _("WinPT Error"), MB_OK);
359      case WM_DESTROY:          mapi_init ();
360      case WM_CLOSE:          /* init common controls: date control. */
361      case WM_QUIT:          cce.dwSize = sizeof (INITCOMMONCONTROLSEX);
362          cryptdisk_cleanup ();          cce.dwICC = ICC_DATE_CLASSES;
363          mapi_deinit ();          InitCommonControlsEx (&cce);
364          wsock_end ();                  LoadLibrary ("RichEd32.Dll");
365          keycache_release (1);          break;
366          gnupg_backup_keyrings ();          
367          free_reg_prefs ();      case WM_ENDSESSION:
368          free_gnupg_table ();      case WM_DESTROY:
369          hotkeys_unregister (hwnd);      case WM_CLOSE:
370          release_file_lock (&mo_file);      case WM_QUIT:
371          PTD_delete ();          cryptdisk_cleanup ();
372          agent_flush_cache ();          mapi_deinit ();
373          if (!gpg_clip_istext_avail (&has_data) && has_data) {          wsock_end ();        
374              int chk = get_reg_winpt_flag ("WipeClipboard");          keycache_release (1);
375              if (chk == -1)          gnupg_backup_keyrings ();
376                  DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,          free_reg_prefs ();
377                                  GetDesktopWindow (), confirm_delclipboard_dlg,          free_gnupg_table ();
378                                  NULL);          hotkeys_unregister (hwnd);
379              if (wipe_contents || chk)          release_file_lock (&mo_file);
380                  set_clip_text (NULL, " ", 1);          PTD_delete ();
381              wipe_contents = 0;          agent_flush_cache ();
382          }          if (!gpg_clip_istext_avail (&has_data) && has_data) {
383          cleanup_tmp_files ();              int chk = get_reg_winpt_flag ("WipeClipboard");
384          Shell_NotifyIcon (NIM_DELETE, &NID);              if (chk == -1)
385          PostQuitMessage (0);                  DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,
386          ExitProcess (0);                                  GetDesktopWindow (), confirm_delclipboard_dlg,
387          return 0;                                  0);
388                        if (wipe_contents || chk)
389      case WM_USER:                  set_clip_text (NULL, " ", 1);
390          switch (lparam) {              wipe_contents = 0;
391          case WM_RBUTTONUP:          }
392              HMENU hm, popup;          debug_end ();
393              POINT p;          /*cleanup_tmp_files ();*/
394            Shell_NotifyIcon (NIM_DELETE, &NID);
395              gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;          PostQuitMessage (0);
396            ExitProcess (0);
397              SetForegroundWindow (hwnd);          return 0;
398              GetCursorPos (&p);          
399              hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT));      case WM_USER:
400              popup = GetSubMenu (hm, 0);          switch (lparam) {
401  #ifndef LANG_DE          case WM_RBUTTONUP:
402              set_menu_text( popup, ID_WINPT_FILE, _("File Manager") );              HMENU hm, popup;
403              set_menu_text( popup, ID_WINPT_KEY, _("Key Manager") );              POINT p;
404              set_menu_text( popup, ID_WINPT_CARD, _("Card Manager") );  
405              if (!scard_support)              gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;
406                  set_menu_state (popup, ID_WINPT_CARD, MF_DISABLED|MF_GRAYED);  
407              if (!cryptdisk_available ()) {              SetForegroundWindow (hwnd);
408                  set_menu_state (popup, ID_WINPT_CDISKNEW, MF_DISABLED|MF_GRAYED);              GetCursorPos (&p);
409                  set_menu_state (popup, ID_WINPT_CDISKMOUNT, MF_DISABLED|MF_GRAYED);              hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT));
410                  set_menu_state (popup, ID_WINPT_CDISKUNMOUNT, MF_DISABLED|MF_GRAYED);              popup = GetSubMenu (hm, 0);
411              }  #ifndef LANG_DE
412                set_menu_text( popup, ID_WINPT_FILE, _("File Manager") );
413              set_menu_text( popup, ID_WINPT_EDIT, _("Edit Clipboard") );              set_menu_text( popup, ID_WINPT_KEY, _("Key Manager") );
414              set_menu_text( popup, ID_WINPT_ABOUT, _("About...") );              set_menu_text( popup, ID_WINPT_CARD, _("Card Manager") );
415              set_menu_text( popup, ID_WINPT_QUIT, _("Exit") );              if (!scard_support)
416              set_menu_text( popup, ID_WINPT_SYMENC, _("Symmetric") );                  set_menu_state (popup, ID_WINPT_CARD, MF_DISABLED|MF_GRAYED);
417  #if 0              if (!cryptdisk_available ()) {
418              set_menu_text( popup, ID_WINPT_ENCRYPT, _("Encrypt") );                  set_menu_state (popup, ID_WINPT_CDISKNEW, MF_DISABLED|MF_GRAYED);
419              set_menu_text( popup, ID_WINPT_SIGNENCRYPT, _("Sign && Encrypt") );                  set_menu_state (popup, ID_WINPT_CDISKMOUNT, MF_DISABLED|MF_GRAYED);
420              set_menu_text( popup, ID_WINPT_DECRYPT, _("Decrypt/Verify") );                  set_menu_state (popup, ID_WINPT_CDISKUNMOUNT, MF_DISABLED|MF_GRAYED);
421              set_menu_text( popup, ID_WINPT_VERIFY, _("Verify") );              }
422              set_menu_text( popup, ID_WINPT_CURRWND_ENCRYPT, _("Encrypt") );  
423              set_menu_text( popup, ID_WINPT_CURRWND_SIGNENCRYPT, _("Sign && Encrypt") );              set_menu_text (popup, ID_WINPT_EDIT, _("Edit Clipboard"));
424              set_menu_text( popup, ID_WINPT_CURRWND_DECRYPT_VERIFY, _("Decrypt/Verify") );              set_menu_text (popup, ID_WINPT_ABOUT, _("About..."));
425              set_menu_text( popup, ID_WINPT_CURRWND_SIGN, _("Sign") );              set_menu_text (popup, ID_WINPT_QUIT, _("Exit"));
426  #endif              set_menu_text (popup, ID_WINPT_SYMENC, _("Symmetric"));
427  #endif              set_menu_text (popup, ID_WINPT_ENCRYPT, _("Encrypt"));
428              TrackPopupMenu( popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL );              set_menu_text (popup, ID_WINPT_SIGNENCRYPT, _("Sign && Encrypt"));
429              PostMessage( hwnd, WM_USER, 0, 0 );              set_menu_text (popup, ID_WINPT_DECRYPT, _("Decrypt/Verify"));
430              DestroyMenu( popup );              set_menu_text (popup, ID_WINPT_VERIFY, _("Verify"));
431              DestroyMenu( hm );              set_menu_text (popup, ID_WINPT_CURRWND_ENCRYPT, _("Encrypt"));
432              break;              set_menu_text (popup, ID_WINPT_CURRWND_SIGNENCRYPT, _("Sign && Encrypt"));
433                            set_menu_text (popup, ID_WINPT_CURRWND_DECRYPT_VERIFY, _("Decrypt/Verify"));
434          case WM_LBUTTONDBLCLK:              set_menu_text (popup, ID_WINPT_CURRWND_SIGN, _("Sign"));
435              SendMessage( hwnd, WM_COMMAND, ID_WINPT_KEY, 0 );              /* change popup texts */
436              break;              set_menu_text_bypos (popup, 6, _("Clipboard"));
437          }              set_menu_text_bypos (popup, 7, _("Current Window"));
438          break;              set_menu_text_bypos (popup, 9, _("Preferences"));
439            
440      case WM_HOTKEY:  #endif
441          cmd = 0;              TrackPopupMenu( popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL );
442          switch( wparam ) {              PostMessage( hwnd, WM_USER, 0, 0 );
443          case WPT_CLIP_ENCRYPT_ID:                                    DestroyMenu( popup );
444              SendMessage( hwnd, WM_COMMAND, ID_WINPT_ENCRYPT, 0 );              DestroyMenu( hm );
445              break;              break;
446                            
447          case WPT_CLIP_DECRYPT_VERIFY_ID:          case WM_LBUTTONDBLCLK:
448              SendMessage( hwnd, WM_COMMAND, ID_WINPT_DECRYPT_VERIFY, 0 );              SendMessage( hwnd, WM_COMMAND, ID_WINPT_KEY, 0 );
449              break;              break;
450                        }
451          case WPT_CLIP_SIGN_ID:          break;
452              SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGN, 0 );          
453              break;      case WM_HOTKEY:
454                        cmd = 0;
455          case WPT_CLIP_SIGN_ENCRYPT_ID:          switch( wparam ) {
456              SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGNENCRYPT, 0 );          case WPT_CLIP_ENCRYPT_ID:                      
457              break;              SendMessage( hwnd, WM_COMMAND, ID_WINPT_ENCRYPT, 0 );
458                            break;
459          case WPT_CURRWND_ENCRYPT_ID:              
460              use_hotkey = 1;          case WPT_CLIP_DECRYPT_VERIFY_ID:
461              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_ENCRYPT, 0 );              SendMessage( hwnd, WM_COMMAND, ID_WINPT_DECRYPT_VERIFY, 0 );
462              break;                                            break;
463                            
464          case WPT_CURRWND_SIGN_ID:          case WPT_CLIP_SIGN_ID:
465              use_hotkey = 1;              SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGN, 0 );
466              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGN, 0 );              break;
467              break;              
468                        case WPT_CLIP_SIGN_ENCRYPT_ID:
469          case WPT_CURRWND_SIGN_ENCRYPT_ID:              SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGNENCRYPT, 0 );
470              use_hotkey = 1;              break;
471              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGNENCRYPT, 0 );              
472              break;          case WPT_CURRWND_ENCRYPT_ID:
473                            use_hotkey = 1;
474          case WPT_CURRWND_DECRYPT_VERIFY_ID:              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_ENCRYPT, 0 );
475              use_hotkey = 1;              break;                              
476              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_DECRYPT_VERIFY, 0 );              
477              break;          case WPT_CURRWND_SIGN_ID:
478                            use_hotkey = 1;
479          case WPT_AGENT_FORGET_ID:              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGN, 0 );
480              rc = msg_box( hwnd, _("Remove all passphrases from cache?"),              break;
481                            _("WinPT"), MB_YESNO|MB_ICONQUESTION );              
482              if( rc == IDYES )          case WPT_CURRWND_SIGN_ENCRYPT_ID:
483                  agent_flush_cache();              use_hotkey = 1;
484              break;              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGNENCRYPT, 0 );
485          }                            break;
486          break;              
487                    case WPT_CURRWND_DECRYPT_VERIFY_ID:
488      case WM_COMMAND:              use_hotkey = 1;
489          if( gnupg_access_keyring( 1 ) ) {              SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_DECRYPT_VERIFY, 0 );
490              if( log_box( "WinPT", MB_ERR|MB_YESNO,              break;
491                  _("Could not access public keyring, exit WinPT?") ) == IDYES )              
492                  SendMessage( hwnd, WM_DESTROY, 0, 0 );          case WPT_AGENT_FORGET_ID:
493              break;              rc = msg_box( hwnd, _("Remove all passphrases from cache?"),
494          }                            _("WinPT"), MB_YESNO|MB_ICONQUESTION );
495          switch( wparam ) {              if( rc == IDYES )
496              /** Clipboard operations **/                  agent_flush_cache();
497          case ID_WINPT_SYMENC:              break;
498          case ID_WINPT_ENCRYPT:          }              
499          case ID_WINPT_SIGN:          break;
500          case ID_WINPT_SIGNENCRYPT:          
501          case ID_WINPT_DECRYPT_VERIFY:      case WM_COMMAND:
502              err = gpg_clip_istext_avail( &has_data );          if( gnupg_access_keyring( 1 ) ) {
503              if( err ) {              if( log_box( "WinPT", MB_ERR|MB_YESNO,
504                  msg_box( hwnd, gpgme_strerror( err ),_("Clipboard"), MB_ERR );                  _("Could not access public keyring, exit WinPT?") ) == IDYES )
505                  break;                  SendMessage( hwnd, WM_DESTROY, 0, 0 );
506              }              break;
507              if( !has_data ) {          }
508                  msg_box( hwnd, winpt_strerror (WPTERR_CLIP_EMPTY),_("Clipboard"), MB_ERR );          switch( wparam ) {
509                  break;              /** Clipboard operations **/
510              }          case ID_WINPT_SYMENC:
511              ctx.msecs = 500;          case ID_WINPT_ENCRYPT:
512              window_reminder( &ctx );                              case ID_WINPT_SIGN:
513              clip_gpg_dlg( hwnd, (int)wparam );          case ID_WINPT_SIGNENCRYPT:
514              break;          case ID_WINPT_DECRYPT_VERIFY:
515                            err = gpg_clip_istext_avail( &has_data );
516              /** Current window operations **/              if( err ) {
517          case ID_WINPT_CURRWND_SYMENC:                  msg_box( hwnd, gpgme_strerror( err ),_("Clipboard"), MB_ERR );
518          case ID_WINPT_CURRWND_ENCRYPT:                  break;
519          case ID_WINPT_CURRWND_SIGNENCRYPT:              }
520          case ID_WINPT_CURRWND_DECRYPT_VERIFY:              if( !has_data ) {
521          case ID_WINPT_CURRWND_SIGN:                  msg_box( hwnd, winpt_strerror (WPTERR_CLIP_EMPTY),_("Clipboard"), MB_ERR );
522              rc = get_window_contents( hwnd, &currwnd, &use_hotkey );                  break;
523              if( rc ) {              }
524                  log_box( _("WinPT Error"), MB_ERR,              ctx.msecs = 500;
525                           _("Make sure that the window contains text.\n"              window_reminder( &ctx );                    
526                             "%s."),              clip_gpg_dlg( hwnd, (int)wparam );
527                          winpt_strerror( WPTERR_CURR_WND ) );              break;
528                  break;              
529              }              /** Current window operations **/
530              ctx.msecs = 500;          case ID_WINPT_CURRWND_SYMENC:
531              window_reminder( &ctx );          case ID_WINPT_CURRWND_ENCRYPT:
532              rc = currwnd_gpg_dlg( hwnd, (UINT)wparam, &set_wc );          case ID_WINPT_CURRWND_SIGNENCRYPT:
533              if( !rc && set_wc )          case ID_WINPT_CURRWND_DECRYPT_VERIFY:
534                  set_window_contents( hwnd, &currwnd );          case ID_WINPT_CURRWND_SIGN:
535              break;              rc = get_window_contents( hwnd, &currwnd, &use_hotkey );
536                            if( rc ) {
537              /** File handling **/                  log_box( _("WinPT Error"), MB_ERR,
538          case ID_WINPT_FILE:                           _("Make sure that the window contains text.\n"
539              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_FILE,                             "%s."),
540                                GetDesktopWindow(), file_manager_dlg_proc, NULL,                          winpt_strerror( WPTERR_CURR_WND ) );
541                                _("File Manager (use drag & drop to add files)"), IDS_WINPT_FILE );                  break;
542              break;              }
543                            ctx.msecs = 500;
544              /** Misc **/              window_reminder( &ctx );
545          case ID_WINPT_KEY:              rc = currwnd_gpg_dlg( hwnd, (UINT)wparam, &set_wc );
546              param = NULL;              if( !rc && set_wc )
547              if( cmd )                  set_window_contents( hwnd, &currwnd );
548                  param = (LPARAM)cmd;              break;
549              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYMISC,              
550                                GetDesktopWindow(), keymanager_dlg_proc, param,              /** File handling **/
551                                _("Key Manager"), IDS_WINPT_KEYMISC );          case ID_WINPT_FILE:
552              cmd = 0;              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_FILE,
553              break;                                GetDesktopWindow(), file_manager_dlg_proc, 0,
554                                  _("File Manager (use drag & drop to add files)"), IDS_WINPT_FILE );
555          case ID_WINPT_CARD:              break;
556              card = smartcard_init ();              
557              if( card ) {              /** Misc **/
558                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CARD_EDIT,          case ID_WINPT_KEY:
559                                    GetDesktopWindow(), card_edit_dlg_proc,              param = NULL;
560                                    (LPARAM)card,              if( cmd )
561                                    _("Card Edit"), IDS_WINPT_CARD_EDIT );                  param = (LPARAM)cmd;
562                  gpg_card_release( card ); card = NULL;              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYMISC,
563              }                                GetDesktopWindow(), keymanager_dlg_proc, param,
564              break;                                _("Key Manager"), IDS_WINPT_KEYMISC );
565                            cmd = 0;
566          case ID_WINPT_EDIT:              break;
567              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,  
568                                GetDesktopWindow(), clip_edit_dlg_proc, NULL,          case ID_WINPT_CARD:
569                               _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );              load_smartcard ();
570              break;              break;
571                            
572          case ID_WINPT_ABOUT:          case ID_WINPT_EDIT:
573              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, GetDesktopWindow(),              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
574                                about_winpt_dlg_proc, NULL,                                GetDesktopWindow(), clip_edit_dlg_proc, 0,
575                               _("About WinPT"), IDS_WINPT_ABOUT );                               _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
576              break;              break;
577                            
578          case ID_WINPT_PREFS:          case ID_WINPT_ABOUT:
579              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_PREFS, GetDesktopWindow(),              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, GetDesktopWindow(),
580                                prefs_dlg_proc, NULL,                                about_winpt_dlg_proc, 0,
581                               _("WinPT Preferences"), IDS_WINPT_PREFS );                               _("About WinPT"), IDS_WINPT_ABOUT );
582              break;              break;
583                            
584          case ID_WINPT_GPGPREFS:          case ID_WINPT_PREFS:
585              dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, GetDesktopWindow(),              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_PREFS, GetDesktopWindow(),
586                                gpgprefs_dlg_proc, NULL,                                prefs_dlg_proc, 0,
587                                _("GnuPG Preferences"), IDS_WINPT_GPGPREFS);                               _("WinPT Preferences"), IDS_WINPT_PREFS );
588              break;              break;
589                
590          case ID_WINPT_CDISKNEW:          case ID_WINPT_GPGPREFS:
591              DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_NEW,              dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, GetDesktopWindow(),
592                          GetDesktopWindow (), cryptdisk_new_dlg_proc, NULL);                                gpgprefs_dlg_proc, 0,
593              break;                                _("GnuPG Preferences"), IDS_WINPT_GPGPREFS);
594                break;
595          case ID_WINPT_CDISKMOUNT:  
596              DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_MOUNT,          case ID_WINPT_CDISKNEW:
597                          GetDesktopWindow (), cryptdisk_mount_dlg_proc, NULL);              DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_NEW,
598              break;                          GetDesktopWindow (), cryptdisk_new_dlg_proc, 0);
599                break;
600          case ID_WINPT_CDISKUNMOUNT:  
601              DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_UMOUNT,          case ID_WINPT_CDISKMOUNT:
602                          GetDesktopWindow (), cryptdisk_umount_dlg_proc, NULL);              DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_MOUNT,
603              break;                          GetDesktopWindow (), cryptdisk_mount_dlg_proc, 0);
604                break;
605          case ID_WINPT_CDISKUMOUNTALL:  
606              cryptdisk_unmount (0, 0);          case ID_WINPT_CDISKUNMOUNT:
607              break;              DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_UMOUNT,
608                                        GetDesktopWindow (), cryptdisk_umount_dlg_proc, 0);
609          case ID_WINPT_QUIT:              break;
610              SendMessage (hwnd, WM_DESTROY, 0, 0);  
611              break;          case ID_WINPT_CDISKUMOUNTALL:
612          }              cryptdisk_unmount (0, 0);
613          break;              break;
614      }              
615                case ID_WINPT_QUIT:
616      return DefWindowProc (hwnd, msg, wparam, lparam);              SendMessage (hwnd, WM_DESTROY, 0, 0);
617  } /* winpt_main_proc */              break;
618            }
619            break;
620        }
621        
622        return DefWindowProc (hwnd, msg, wparam, lparam);
623    }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26