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

Legend:
Removed from v.32  
changed lines
  Added in v.200

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26