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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (hide annotations)
Mon Nov 7 12:48:34 2005 UTC (19 years, 3 months ago) by twoaday
File size: 20422 byte(s)
Patch for better encrypt-only environment.

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

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26