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

Contents of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations)
Mon Oct 24 08:03:48 2005 UTC (19 years, 4 months ago) by twoaday
File size: 20541 byte(s)
2005-10-23  Timo Schulz  <twoaday@g10code.com>
 
        * wptFileManager.cpp (fm_get_file_type): Detect detached sigs.
        * wptKeyList.cpp (keylist_cmp_cb): Take care of expired/revoked keys.
        (get_ext_validity): New.
        * wptFileVerifyDlg.cpp (file_verify_dlg_proc): Several cleanups.
        * wptClipEditDlg.cpp (load_clipboard): Factored out some code into
        this function.
        (load_clipboard_from_file): Likewise.
        (save_clipboard_to_file): New.
        * wptKeyManagerDlg.cpp (keyprops_dlg_proc): Fix stack overflow.

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26