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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26