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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (hide annotations)
Fri Sep 30 10:10:16 2005 UTC (19 years, 5 months ago) by twoaday
File size: 20154 byte(s)
Almost finished phase 1 of the WinPT GPGME port.
Still need more cleanup, comments and tests.


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26