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

Contents of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 121 - (show annotations)
Mon Dec 12 11:19:56 2005 UTC (19 years, 2 months ago) by twoaday
File size: 20253 byte(s)
2005-12-11  Timo Schulz  <ts@g10code.com>
 
        * wptW32API.cpp (get_file_version): New.
        * wptGPGUtil.cpp (create_process): Always hide window.
        * wptClipEditDlg.cpp (clipedit_dlg_proc): Use 'Close'
        instead of 'Exit'.
        * wptKeyManager.cpp (km_http_import): New filename
        generation code.
        (km_send_to_mail_recipient): Cleanups.
        * wptKeyEditDlg.cpp (showpref_dlg_proc): Localize dialog.
        * wptKeyManagerDlg.cpp (update_ui_items): Handle the case
        when multiple keys are selected.
        (popup_multiple): New.
        * WinPT.cpp (WinMain): Check that the PTD.dll and WinPT.exe
        file versions are equal. Rewrote --keymanager code.
         
Removed temporary w32gpgme dirctory, all code is now in Src.
Changed configure files.


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

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26