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

Contents of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (show annotations)
Wed Jul 27 11:17:22 2005 UTC (19 years, 7 months ago) by twoaday
File size: 20275 byte(s)
2005-07-22  Timo Schulz  <twoaday@freakmail.de>
 
        * wptMainProc.cpp (winpt_main_proc): Take care for shutdown
        messages and make sure WinPT make a keyring backup in this case.
        * wptGPGME.cpp (keycache_reload): Do not rebuild the signature
        cache each time. Just do it on startup.
        * wptKeyManager.cpp (km_key_is_v3): Use new ATTR_VERSION.
        * wptKeyEditDlgs.cpp (keyedit_main_dlg_proc): Assume the v3 flag
        was set by the calling function.
        * wptKeyGenDlg.cpp (keygen_wizard_dlg_proc): Ask for backups.
        (keygen_dlg_proc): Only add the generated key to the keycache
        and do not reload the entire cache.
        * wptKeyManager.cpp (km_delete_keys): Store the number of keys
        because in each loop iteration it will be new calculated.
        * wptListView.cpp (listview_del_items): Likewise.
        * wptKeyManagerDlg.cpp (keymanager_dlg_proc): Directly add the
        generated key to the list instead of reloading the entire cache.
        * wptKeyEditDlgs.cpp (parse_preflist): Support fpr SHAnnn.


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26