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

Legend:
Removed from v.20  
changed lines
  Added in v.200

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26