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

Contents of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 78 - (show annotations)
Tue Nov 15 08:54:44 2005 UTC (19 years, 3 months ago) by twoaday
File size: 20502 byte(s)
2005-11-14  Timo Schulz  <ts@g10code.com>
 
        * wptGPG.cpp (check_gnupg_engine): Fix version check.
        * wptMainProc.cpp (winpt_main_proc): Check keyring
        file permissions always and do not use interative output
        when the windows session ends.
        * wptProxySettingsDlg.cpp (proxy_settings_dlg_proc):
        Localize all strings.
        * wptPassphraseDlg.cpp (passwd_dlg_proc): Likewise.
        * wptGPGPrefsDlg.cpp (gpg_prefs_dlg): Likewise.
        * wptKeyEditDlgs.cpp (do_init_keylist): Skip all
        non-valid keys.
         


1 /* 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 #include "resource.h"
30 #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 #include "wptCrypto.h"
48
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 switch (msg) {
63 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 }
88
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 gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
152 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 clip_encrypt_dlg_proc, 0,
164 _("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 clip_signenc_dlg_proc, 0,
170 _("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 clip_sign_dlg_proc, 0,
176 _("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 GetDesktopWindow(), clip_edit_dlg_proc, 0,
192 _("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 clip_verify_dlg_proc, 0,
202 _("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 clip_encrypt_dlg_proc, 0,
232 _("Encryption"), IDS_WINPT_ENCRYPT );
233 break;
234
235 case ID_WINPT_SIGN:
236 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,
237 clip_sign_dlg_proc, 0,
238 _("Signing"), IDS_WINPT_SIGN );
239 break;
240
241 case ID_WINPT_SIGNENCRYPT:
242 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,
243 clip_signenc_dlg_proc, 0,
244 _("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 GetDesktopWindow(), clip_edit_dlg_proc, 0,
258 _("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 clip_verify_dlg_proc, 0,
288 _("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 }
296
297
298 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 /* 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 && msg != WM_ENDSESSION)
395 DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,
396 GetDesktopWindow (), confirm_delclipboard_dlg,
397 0);
398 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 break;
408
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
422 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 set_menu_text (popup, ID_WINPT_SIGN, _("Sign"));
439 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 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 /* 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 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 break;
462
463 case WM_LBUTTONDBLCLK:
464 gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;
465 SendMessage (hwnd, WM_COMMAND, ID_WINPT_KEY, 0);
466 break;
467 }
468 break;
469
470 case WM_HOTKEY:
471 cmd = 0;
472 switch( wparam ) {
473 case WPT_CLIP_ENCRYPT_ID:
474 SendMessage( hwnd, WM_COMMAND, ID_WINPT_ENCRYPT, 0 );
475 break;
476
477 case WPT_CLIP_DECRYPT_VERIFY_ID:
478 SendMessage( hwnd, WM_COMMAND, ID_WINPT_DECRYPT_VERIFY, 0 );
479 break;
480
481 case WPT_CLIP_SIGN_ID:
482 SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGN, 0 );
483 break;
484
485 case WPT_CLIP_SIGN_ENCRYPT_ID:
486 SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGNENCRYPT, 0 );
487 break;
488
489 case WPT_CURRWND_ENCRYPT_ID:
490 use_hotkey = 1;
491 SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_ENCRYPT, 0 );
492 break;
493
494 case WPT_CURRWND_SIGN_ID:
495 use_hotkey = 1;
496 SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGN, 0 );
497 break;
498
499 case WPT_CURRWND_SIGN_ENCRYPT_ID:
500 use_hotkey = 1;
501 SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGNENCRYPT, 0 );
502 break;
503
504 case WPT_CURRWND_DECRYPT_VERIFY_ID:
505 use_hotkey = 1;
506 SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_DECRYPT_VERIFY, 0 );
507 break;
508
509 case WPT_AGENT_FORGET_ID:
510 rc = msg_box( hwnd, _("Remove all passphrases from cache?"),
511 _("WinPT"), MB_YESNO|MB_ICONQUESTION );
512 if( rc == IDYES )
513 agent_flush_cache();
514 break;
515 }
516 break;
517
518 case WM_COMMAND:
519 if( gnupg_access_keyring( 1 ) ) {
520 if( log_box( "WinPT", MB_ERR|MB_YESNO,
521 _("Could not access public keyring, exit WinPT?") ) == IDYES )
522 SendMessage( hwnd, WM_DESTROY, 0, 0 );
523 break;
524 }
525 switch( wparam ) {
526 /** Clipboard operations **/
527 case ID_WINPT_SYMENC:
528 case ID_WINPT_ENCRYPT:
529 case ID_WINPT_SIGN:
530 case ID_WINPT_SIGNENCRYPT:
531 case ID_WINPT_DECRYPT_VERIFY:
532 err = gpg_clip_istext_avail( &has_data );
533 if( err ) {
534 msg_box( hwnd, gpgme_strerror( err ),_("Clipboard"), MB_ERR );
535 break;
536 }
537 if( !has_data ) {
538 msg_box( hwnd, winpt_strerror (WPTERR_CLIP_EMPTY),_("Clipboard"), MB_ERR );
539 break;
540 }
541 ctx.msecs = 500;
542 window_reminder( &ctx );
543 clip_gpg_dlg( hwnd, (int)wparam );
544 break;
545
546 /** Current window operations **/
547 case ID_WINPT_CURRWND_SYMENC:
548 case ID_WINPT_CURRWND_ENCRYPT:
549 case ID_WINPT_CURRWND_SIGNENCRYPT:
550 case ID_WINPT_CURRWND_DECRYPT_VERIFY:
551 case ID_WINPT_CURRWND_SIGN:
552 rc = get_window_contents( hwnd, &currwnd, &use_hotkey );
553 if( rc ) {
554 log_box( _("WinPT Error"), MB_ERR,
555 _("Make sure that the window contains text.\n"
556 "%s."),
557 winpt_strerror( WPTERR_CURR_WND ) );
558 break;
559 }
560 ctx.msecs = 500;
561 window_reminder( &ctx );
562 rc = currwnd_gpg_dlg( hwnd, (UINT)wparam, &set_wc );
563 if( !rc && set_wc )
564 set_window_contents( hwnd, &currwnd );
565 break;
566
567 /** File handling **/
568 case ID_WINPT_FILE:
569 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_FILE,
570 GetDesktopWindow(), file_manager_dlg_proc, 0,
571 _("File Manager (use drag & drop to add files)"), IDS_WINPT_FILE );
572 break;
573
574 /** Misc **/
575 case ID_WINPT_KEY:
576 param = 0;
577 if( cmd )
578 param = (LPARAM)cmd;
579 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYMISC,
580 GetDesktopWindow(), keymanager_dlg_proc, param,
581 _("Key Manager"), IDS_WINPT_KEYMISC );
582 cmd = 0;
583 break;
584
585 case ID_WINPT_CARD:
586 load_smartcard ();
587 break;
588
589 case ID_WINPT_EDIT:
590 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
591 GetDesktopWindow(), clip_edit_dlg_proc, 0,
592 _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
593 break;
594
595 case ID_WINPT_ABOUT:
596 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, GetDesktopWindow(),
597 about_winpt_dlg_proc, 0,
598 _("About WinPT"), IDS_WINPT_ABOUT );
599 break;
600
601 case ID_WINPT_PREFS:
602 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_PREFS, GetDesktopWindow(),
603 prefs_dlg_proc, 0,
604 _("WinPT Preferences"), IDS_WINPT_PREFS );
605 break;
606
607 case ID_WINPT_GPGPREFS:
608 dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, GetDesktopWindow(),
609 gpgprefs_dlg_proc, 0,
610 _("GnuPG Preferences"), IDS_WINPT_GPGPREFS);
611 break;
612
613 case ID_WINPT_CDISKNEW:
614 DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_NEW,
615 GetDesktopWindow (), cryptdisk_new_dlg_proc, 0);
616 break;
617
618 case ID_WINPT_CDISKMOUNT:
619 DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_MOUNT,
620 GetDesktopWindow (), cryptdisk_mount_dlg_proc, 0);
621 break;
622
623 case ID_WINPT_CDISKUNMOUNT:
624 DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_UMOUNT,
625 GetDesktopWindow (), cryptdisk_umount_dlg_proc, 0);
626 break;
627
628 case ID_WINPT_CDISKUMOUNTALL:
629 cryptdisk_unmount (0, 0);
630 break;
631
632 case ID_WINPT_QUIT:
633 SendMessage (hwnd, WM_DESTROY, 0, 0);
634 break;
635 }
636 break;
637 }
638
639 return DefWindowProc (hwnd, msg, wparam, lparam);
640 }

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26