/[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 4 by twoaday, Sun Feb 6 11:11:40 2005 UTC revision 12 by twoaday, Thu Apr 14 12:56:25 2005 UTC
# Line 41  HWND activ_hwnd; Line 41  HWND activ_hwnd;
41  LOCK mo_file;  LOCK mo_file;
42  int scard_support = 0;  int scard_support = 0;
43  int debug = 0;  int debug = 0;
44    int mobile = 0;
45  int gpg_read_only = 0;  int gpg_read_only = 0;
46  char gpgver[3];  char gpgver[3];
47    
# Line 156  check_crypto_engine (void) Line 157  check_crypto_engine (void)
157                     ma, mi, pa);                     ma, mi, pa);
158          return rc;          return rc;
159      }      }
160      /* We enable smartcard support for GPG: 1.9.x and >= 1.3.90 */      /* We enable smartcard support for GPG: 1.9.x or >= 1.4.0 */
161      if (ma > 1 || mi >= 9 || mi > 3)      if (ma >= 1 && mi >= 4)
162          scard_support = 1;          scard_support = 1;
163    
164      gpgver[0] = ma;      gpgver[0] = ma;
# Line 186  load_keyserver_conf (int quiet) Line 187  load_keyserver_conf (int quiet)
187  }  }
188    
189    
190    static void
191    enable_mobile_mode (void)
192    {
193        memset (&reg_prefs, 0, sizeof (reg_prefs));
194        reg_prefs.always_trust = 0;
195        reg_prefs.auto_backup = 0;
196        reg_prefs.cache_time = 0;
197        reg_prefs.expert = 0;
198        reg_prefs.keylist_mode = 1;
199        reg_prefs.kserv_conf = m_strdup ("keyserver.conf");
200        reg_prefs.no_zip_mmedia = 1;
201        reg_prefs.use_tmpfiles = 1;
202        reg_prefs.word_wrap = 80;
203        reg_prefs.use_viewer = 0; /* XXX */
204    }
205    
206    char* get_subkey_fingerprint (gpgme_ctx_t ctx, const char *keyid);
207    
208  int WINAPI  int WINAPI
209  WinMain (HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int showcmd)  WinMain (HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int showcmd)
210  {  {
# Line 206  WinMain (HINSTANCE hinst, HINSTANCE hpre Line 225  WinMain (HINSTANCE hinst, HINSTANCE hpre
225      gpgme_set_pgm_string ("WinPT "PGM_VERSION);      gpgme_set_pgm_string ("WinPT "PGM_VERSION);
226    
227      s = PTD_get_version ();      s = PTD_get_version ();
228      if (strcmp (s, "0.8.0"))      if (strcmp (s, "0.8.0")) {
     {  
229          log_box (_("Privacy Tray Dynamic (PTD)"), MB_ERR,          log_box (_("Privacy Tray Dynamic (PTD)"), MB_ERR,
230                   _("Please update your PTD.dll to the newest version, "                   _("Please update your PTD.dll to the newest version, "
231                     "the version (%s) you use is too old."), s);                     "the version (%s) you use is too old."), s);
232          return 0;          return 0;
233      }      }
234    
235      if (gpg_md_selftest ())      if (gpg_md_selftest ()) {
     {  
236          msg_box (NULL, _("Cryptographic selftest failed."),          msg_box (NULL, _("Cryptographic selftest failed."),
237                   _("WinPT Error"), MB_ERR);                   _("WinPT Error"), MB_ERR);
238          return 0;          return 0;
239      }      }
240    
241        if (cmdline && stristr (cmdline, "--mobile"))
242            mobile = 1;
243    
244      set_default_kserver ();      set_default_kserver ();
245      regist_inst_gnupg (1);  
246      regist_inst_winpt (1, &created);      if (!mobile) {
247      if (!created)          regist_inst_gnupg (1);
248      {          regist_inst_winpt (1, &created);
249        }
250        else {
251            enable_mobile_mode ();
252            /* XXX: ask for GPG path */
253            created = 1; /* Disable registry writing */
254        }
255    
256        if (!created) {
257          memset (&reg_prefs, 0, sizeof (reg_prefs));          memset (&reg_prefs, 0, sizeof (reg_prefs));
258          reg_prefs.use_tmpfiles = 1; /* default */          reg_prefs.use_tmpfiles = 1; /* default */
259            reg_prefs.fm.progress = 0; /* XXX: fix the bug and enable it again */
260          get_reg_winpt_prefs (&reg_prefs);          get_reg_winpt_prefs (&reg_prefs);
261          if (!reg_prefs.no_hotkeys)          if (!reg_prefs.no_hotkeys)
262              hotkeys_modify ();              hotkeys_modify ();
263      }      }
264    
265      rc = gnupg_check_homedir ();      rc = gnupg_check_homedir ();
266      if (rc)      if (rc) {
     {  
267          log_box (_("WinPT Error"), MB_ERR,          log_box (_("WinPT Error"), MB_ERR,
268                   _("GPG home directory is not set correctly.\n"                   _("GPG home directory is not set correctly.\n"
269                     "Please check the GPG registry settings:\n%s."),                     "Please check the GPG registry settings:\n%s."),
# Line 264  WinMain (HINSTANCE hinst, HINSTANCE hpre Line 292  WinMain (HINSTANCE hinst, HINSTANCE hpre
292                  gnupg_check_homedir (); /* change gpgProgram if needed */                  gnupg_check_homedir (); /* change gpgProgram if needed */
293              }              }
294          }          }
295          else          else {
         {  
296              msg_box (NULL, _("GPG home directory could not be determited."),              msg_box (NULL, _("GPG home directory could not be determited."),
297                       _("WinPT Error"), MB_ERR);                       _("WinPT Error"), MB_ERR);
298              goto start;              goto start;
# Line 273  WinMain (HINSTANCE hinst, HINSTANCE hpre Line 300  WinMain (HINSTANCE hinst, HINSTANCE hpre
300      }      }
301    
302      rc = check_gnupg_prog ();      rc = check_gnupg_prog ();
303      if (rc)      if (rc) {
     {  
304          if (msg_box (NULL, _("Could not find the GPG binary (gpg.exe).\n"          if (msg_box (NULL, _("Could not find the GPG binary (gpg.exe).\n"
305                               "Do you want to start the GPG preferences to "                               "Do you want to start the GPG preferences to "
306                               "correct  this problem?"), _("WinPT Error"),                               "correct  this problem?"), _("WinPT Error"),
# Line 359  WinMain (HINSTANCE hinst, HINSTANCE hpre Line 385  WinMain (HINSTANCE hinst, HINSTANCE hpre
385          return 0;          return 0;
386      }      }
387    
388      /*if (file_exist_check ("loadimage.exe"))      if (cmdline) {
389          PTD_create_loadimage (NULL);*/          if (stristr (cmdline, "--enable-debug") || stristr (cmdline, "--debug")) {
390                        gpgme_set_debug_mode (1);
391      if (cmdline && stristr (cmdline, "--enable-debug")) {              winpt_debug_msg ();
392          gpgme_set_debug_mode (1);              debug = 1;
393          winpt_debug_msg ();          }
         debug = 1;  
394      }      }
395    
396      wc.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));      wc.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));

Legend:
Removed from v.4  
changed lines
  Added in v.12

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26