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

Diff of /trunk/Src/WinPT.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16 by twoaday, Mon May 9 08:54:21 2005 UTC revision 23 by twoaday, Fri Sep 30 10:10:16 2005 UTC
# Line 33  Line 33 
33  #include "wptCard.h"  #include "wptCard.h"
34  #include "wptFileManager.h"  #include "wptFileManager.h"
35  #include "wptContext.h"  #include "wptContext.h"
36    #include "wptCardEdit.h"
37    
38  HINSTANCE glob_hinst; /* global instance for the dialogs */  HINSTANCE glob_hinst; /* global instance for the dialogs */
39  HWND glob_hwnd; /* global window handle for the dialogs */  HWND glob_hwnd; /* global window handle for the dialogs */
# Line 97  static int Line 98  static int
98  check_default_key (gpgme_keycache_t kc)  check_default_key (gpgme_keycache_t kc)
99  {  {
100      gpgme_key_t key;      gpgme_key_t key;
101      gpgme_error_t err = GPGME_No_Error;      gpgme_error_t err = GPG_ERR_NO_ERROR;
102      char * defkey;      char * defkey;
103    
104      defkey = get_gnupg_default_key ();      defkey = get_gnupg_default_key ();
# Line 143  get_prog_part (const char * fname, int u Line 144  get_prog_part (const char * fname, int u
144  static int  static int
145  check_crypto_engine (void)  check_crypto_engine (void)
146  {  {
147      int ma=1, mi=2, pa=4; /* GPG 1.2.4 */      int ma=1, mi=4, pa=0; /* GPG 1.4.0 */
148      int rc;      int rc;
149    
150      rc = check_gnupg_engine (&ma, &mi, &pa);      rc = check_gnupg_engine (&ma, &mi, &pa);
# Line 154  check_crypto_engine (void) Line 155  check_crypto_engine (void)
155      else if (rc) {      else if (rc) {
156          log_box (_("WinPT Error"), MB_ERR,          log_box (_("WinPT Error"), MB_ERR,
157                   _("Sorry, you need a newer GPG version.\n"                   _("Sorry, you need a newer GPG version.\n"
158                     "GPG version %d.%d.%d requred GPG version 1.2.4"),                     "GPG version %d.%d.%d required GPG version 1.4.0"),
159                     ma, mi, pa);                     ma, mi, pa);
160          return rc;          return rc;
161      }      }
# Line 219  win_main (HINSTANCE hinst, HINSTANCE hpr Line 220  win_main (HINSTANCE hinst, HINSTANCE hpr
220      int first_start = 0, start_gpgprefs = 0;      int first_start = 0, start_gpgprefs = 0;
221      const char * s;      const char * s;
222      MSG msg;      MSG msg;
223      HWND hwnd;      HWND hwnd = NULL;
224    
225      glob_hinst = hinst;      glob_hinst = hinst;
226            
     gpgme_lib_init ();  
227      #ifdef _DEBUG      #ifdef _DEBUG
228      gpgme_set_debug_mode (1);      gpgme_set_debug_mode (1);
229      #endif      #endif
     gpgme_set_pgm_string ("WinPT "PGM_VERSION);  
230    
231      s = PTD_get_version ();      s = PTD_get_version ();
232      if (strcmp (s, "0.8.0")) {      if (strcmp (s, "0.8.0")) {
# Line 244  win_main (HINSTANCE hinst, HINSTANCE hpr Line 243  win_main (HINSTANCE hinst, HINSTANCE hpr
243      }      }
244    
245      if (cmdline && stristr (cmdline, "--mobile")) {      if (cmdline && stristr (cmdline, "--mobile")) {
246          msg_box (NULL, "WARNING: mobile modus is not fully implemented yet!", "WinPT", MB_INFO);          msg_box (NULL, "WARNING: mobile modus is not fully implemented yet!",
247                     "WinPT", MB_INFO);
248          mobile = 1;          mobile = 1;
249      }      }
250    
# Line 279  win_main (HINSTANCE hinst, HINSTANCE hpr Line 279  win_main (HINSTANCE hinst, HINSTANCE hpr
279                                             _("Select GPG Public Keyring"),                                             _("Select GPG Public Keyring"),
280                                             _("GPG Keyrings (*.gpg)\0*.gpg\0\0"),                                             _("GPG Keyrings (*.gpg)\0*.gpg\0\0"),
281                                             NULL);                                             NULL);
282          if (s && !file_exist_check (s))          if (s != NULL) {
         {  
283              size_t n;              size_t n;
284              char * p = strrchr (s, '\\');              char * p = strrchr (s, '\\');
285              if (!p)              if (!p)
# Line 382  win_main (HINSTANCE hinst, HINSTANCE hpr Line 381  win_main (HINSTANCE hinst, HINSTANCE hpr
381                              GetDesktopWindow(), keymanager_dlg_proc, NULL,                              GetDesktopWindow(), keymanager_dlg_proc, NULL,
382                              _("Key Manager"), IDS_WINPT_KEYMISC);                                _("Key Manager"), IDS_WINPT_KEYMISC);  
383          else {          else {
384              gpgme_card_t crd = smartcard_init ();              gpg_card_t crd = smartcard_init ();
385              if (crd)              if (crd)
386                  dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_CARD_EDIT,                  dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_CARD_EDIT,
387                                    GetDesktopWindow(), card_edit_dlg_proc,                                    GetDesktopWindow(), card_edit_dlg_proc,
388                                    (LPARAM)crd, _("Card Manager"),                                    (LPARAM)crd, _("Card Manager"),
389                                    IDS_WINPT_CARD_EDIT);                                    IDS_WINPT_CARD_EDIT);
390              gpgme_card_release (crd);              gpg_card_release (crd);
391          }          }
392          keycache_release ();          keycache_release ();
393          free_gnupg_table ();          free_gnupg_table ();
# Line 403  win_main (HINSTANCE hinst, HINSTANCE hpr Line 402  win_main (HINSTANCE hinst, HINSTANCE hpr
402    
403      if (cmdline) {      if (cmdline) {
404          if (stristr (cmdline, "--enable-debug") || stristr (cmdline, "--debug")) {          if (stristr (cmdline, "--enable-debug") || stristr (cmdline, "--debug")) {
405              gpgme_set_debug_mode (1);              gpg_set_debug_mode (1);
406              winpt_debug_msg ();              winpt_debug_msg ();
407              debug = 1;              debug = 1;
408          }          }
# Line 433  win_main (HINSTANCE hinst, HINSTANCE hpr Line 432  win_main (HINSTANCE hinst, HINSTANCE hpr
432      UpdateWindow (hwnd);      UpdateWindow (hwnd);
433    
434      if (!first_start && !start_gpgprefs) {      if (!first_start && !start_gpgprefs) {
435          gnupg_backup_options (1);          gnupg_backup_options ();        
         gnupg_backup_options (0);  
           
436          rc = check_crypto_engine ();          rc = check_crypto_engine ();
437          if (rc) {          if (rc) {
438              DestroyWindow (hwnd);              DestroyWindow (hwnd);
# Line 443  win_main (HINSTANCE hinst, HINSTANCE hpr Line 440  win_main (HINSTANCE hinst, HINSTANCE hpr
440              return 0;              return 0;
441          }          }
442      }      }
443        
444      if (start_gpgprefs)      if (start_gpgprefs) {
     {  
445          char *ring;          char *ring;
446          size_t size = 0;          size_t size = 0;
447          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_GPGPREFS, hwnd,          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_GPGPREFS, hwnd,
# Line 457  win_main (HINSTANCE hinst, HINSTANCE hpr Line 453  win_main (HINSTANCE hinst, HINSTANCE hpr
453      }      }
454    
455      if (first_start) {      if (first_start) {
456          struct key_wizard_s c, dummy;          struct first_start_s fs;
457            struct genkey_s c;
458            HWND h;
459  start:  start:
460          DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_FIRST, hwnd,          h = GetDesktopWindow ();
461                          first_run_dlg_proc, (LPARAM)&dummy);          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_GPGPREFS, h,
462          switch (dummy.interactive)                              gpgprefs_dlg_proc, NULL);
463          {          DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_FIRST, h,
464                            first_run_dlg_proc, (LPARAM)&fs);
465            switch (fs.choice) {
466          case SETUP_KEYGEN:          case SETUP_KEYGEN:
467              c.interactive = 1;              c.interactive = 1;
468                c.first_start = 1;
469              rc = DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYWIZARD,              rc = DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYWIZARD,
470                                   hwnd, keygen_wizard_dlg_proc, (LPARAM)&c);                                   h, keygen_wizard_dlg_proc, (LPARAM)&c);
471              if (!rc)              if (!rc)
472                  goto start;                  goto start;
473              break;              break;
# Line 479  start: Line 480  start:
480              }              }
481              break;              break;
482    
         case SETUP_EXISTING:  
             DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_GPGPREFS, hwnd,  
                             gpgprefs_dlg_proc, NULL);  
             break;  
   
483          case -1:          case -1:
484              DestroyWindow (hwnd);              DestroyWindow (hwnd);
485              free_gnupg_table ();              free_gnupg_table ();

Legend:
Removed from v.16  
changed lines
  Added in v.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26