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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 95 - (hide annotations)
Thu Nov 24 12:09:28 2005 UTC (19 years, 3 months ago) by twoaday
File size: 20681 byte(s)
See ChangeLog.


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

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26