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

Diff of /trunk/Src/wptMainProc.cpp

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

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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26