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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations)
Mon Oct 17 08:49:30 2005 UTC (19 years, 4 months ago) by twoaday
File size: 20204 byte(s)
More bug fixes all over the place.
See ChangeLog for details.

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26