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

Diff of /trunk/Src/wptMainProc.cpp

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

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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26