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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26