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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26