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

Diff of /trunk/Src/wptRegistry.cpp

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

revision 128 by twoaday, Mon Dec 19 13:05:59 2005 UTC revision 167 by twoaday, Thu Jan 26 10:17:17 2006 UTC
# Line 36  Line 36 
36    
37  #define rc_ok(rc) ((rc) == ERROR_SUCCESS)  #define rc_ok(rc) ((rc) == ERROR_SUCCESS)
38    
 static gpg_filetype gpg_filetypes[] = {  
     {"GPG Detached Signature", ".sig", 1},  
     {"GPG Encrypted Data",     ".gpg", 2},  
     {"GPG Armored Data",       ".asc", 2},  
     {0}  
 };  
39    
40    
41  struct reg_hotkey_s reg_hotkeys[] = {  struct reg_hotkey_s reg_hotkeys[] = {
# Line 161  regist_inst_gnupg (int create_mokey) Line 155  regist_inst_gnupg (int create_mokey)
155     Return value: 0 on success. */     Return value: 0 on success. */
156  int  int
157  regist_inst_winpt (int with_ext, int *created)  regist_inst_winpt (int with_ext, int *created)
158  {  {    
159      HKEY reg;      HKEY reg;
160      char *p = NULL;      char *p = NULL;
161      char modpath[MAX_PATH+1];      char modpath[MAX_PATH+1];
162      int rc, i, id, n = 0;      int rc, i, id, n = 0;
163    
164        gpg_filetype gpg_filetypes[] = {
165            {_("GPG Detached Signature"), ".sig", 1},
166            {_("GPG Encrypted Data"),     ".gpg", 2},
167            {_("GPG Armored Data"),       ".asc", 2},
168            {0}
169        };
170    
171      if (created)      if (created)
172          *created = 0;          *created = 0;
173    
# Line 203  start: Line 204  start:
204      if (rc_ok (rc)) {      if (rc_ok (rc)) {
205          RegCloseKey (reg);          RegCloseKey (reg);
206          rc = RegOpenKeyEx (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", 0, KEY_READ, &reg);          rc = RegOpenKeyEx (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", 0, KEY_READ, &reg);
207          if( !rc_ok (rc)) {          if (!rc_ok (rc)) {
208              RegCreateKey (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", &reg);              RegCreateKey (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", &reg);
209              RegCloseKey (reg);              RegCloseKey (reg);
210          }          }
# Line 225  start: Line 226  start:
226      if (created)      if (created)
227          *created = 1;          *created = 1;
228      RegCloseKey (reg);      RegCloseKey (reg);
229      if (n)      if (n > 0 || is_gpgee_installed ())
230          set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");          set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");
231      if ((n=GetModuleFileName (NULL, modpath, MAX_PATH-1)) > 0) {      if ((n=GetModuleFileName (NULL, modpath, MAX_PATH-1)) > 0) {
232          while (n-- > 0) {          while (n-- > 0) {
# Line 425  set_reg_entry_mo (const char * value) Line 426  set_reg_entry_mo (const char * value)
426  }  }
427    
428    
429  char *  char*
430  get_reg_entry_gpg (const char *key)  get_reg_entry_gpg (const char *key)
431  {  {
432      return get_reg_entry (HKEY_CURRENT_USER, "Software\\GNU\\GnuPG", key);      char *p;
433        p = get_reg_entry (HKEY_CURRENT_USER, "Software\\GNU\\GnuPG", key);
434        if (!p || strlen (p) == 0) {
435            free_if_alloc (p);
436            return NULL;
437        }
438        return p;
439  }  }
440    
441    
# Line 586  set_reg_winpt_prefs (winpt_reg_prefs_s * Line 593  set_reg_winpt_prefs (winpt_reg_prefs_s *
593          if (rc)          if (rc)
594              goto leave;              goto leave;
595      }      }
     if (opt->kserv_conf) {  
         rc = set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "KeyserverConfig",  
                             opt->kserv_conf);  
         if (rc)  
             goto leave;  
     }  
596    
597      for (i=0; reg_hotkeys[i].reg_entry; i++) {      for (i=0; reg_hotkeys[i].reg_entry; i++) {
598          strcpy (buf, " ");          strcpy (buf, " ");
# Line 702  get_reg_winpt_prefs (winpt_reg_prefs_s * Line 703  get_reg_winpt_prefs (winpt_reg_prefs_s *
703      if (val && val[0] != ' ')      if (val && val[0] != ' ')
704          opt->backup.path = m_strdup (val);          opt->backup.path = m_strdup (val);
705      free_if_alloc (val);      free_if_alloc (val);
   
     val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "KeyserverConfig");  
     if (val && val[0] != ' ')  
         opt->kserv_conf = m_strdup (val);  
     free_if_alloc (val);  
706            
707      for (i=0; reg_hotkeys[i].reg_entry; i++) {      for (i=0; reg_hotkeys[i].reg_entry; i++) {
708          val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, reg_hotkeys[i].reg_entry);          val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, reg_hotkeys[i].reg_entry);

Legend:
Removed from v.128  
changed lines
  Added in v.167

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26