/[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 127 by twoaday, Thu Dec 8 09:26:32 2005 UTC revision 128 by twoaday, Mon Dec 19 13:05:59 2005 UTC
# Line 61  winpt_reg_prefs_s reg_prefs; Line 61  winpt_reg_prefs_s reg_prefs;
61  #define WINPT_REG "Software\\WinPT"  #define WINPT_REG "Software\\WinPT"
62    
63    
64    /* Return != 0 if GPG4win is installed. */
65    int
66    is_gpg4win_installed (void)
67    {
68        char *p;
69    
70        p = get_reg_entry_gpg4win (NULL);
71        if (!p)
72            return 0;
73        if (dir_exist_check (p)) {
74            free_if_alloc (p);
75            return 0;
76        }
77        free_if_alloc (p);
78        return -1;
79    }
80    
81    
82  /* Return != 0 if GPGee is installed. */  /* Return != 0 if GPGee is installed. */
83  int  int
84  is_gpgee_installed (void)  is_gpgee_installed (void)
# Line 93  free_reg_prefs (void) Line 111  free_reg_prefs (void)
111  static int  static int
112  regist_single_filetype (gpg_filetype *gfile)  regist_single_filetype (gpg_filetype *gfile)
113  {  {
114      char icon[256], prog[256];      char icon[256];
115        char prog[256];
116            
117      memset (&icon, 0, sizeof (icon));      memset (&icon, 0, sizeof (icon));
118      GetModuleFileName (glob_hinst, prog, sizeof (prog)-1);      GetModuleFileName (glob_hinst, prog, sizeof (prog)-1);
# Line 132  regist_inst_gnupg (int create_mokey) Line 151  regist_inst_gnupg (int create_mokey)
151      }      }
152    
153      return 0;      return 0;
154  } /* regist_inst_gpg */  }
155    
156    
157  /* Install WinPT into the W32 registry, if the entry already  /* Install WinPT into the W32 registry, if the entry already
# Line 197  start: Line 216  start:
216          }          }
217          free_if_alloc (p);          free_if_alloc (p);
218          if (n)          if (n)
219              set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");              set_reg_entry( HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1" );
220          return 0;          return 0;
221      }      }
222      rc = RegCreateKey (HKEY_CURRENT_USER, WINPT_REG, &reg);      rc = RegCreateKey (HKEY_CURRENT_USER, WINPT_REG, &reg);
# Line 224  start: Line 243  start:
243  /* Create a new filetype in the W32 registry.  /* Create a new filetype in the W32 registry.
244     We should really care of errors! Otherwise we can damage the registry! */     We should really care of errors! Otherwise we can damage the registry! */
245  int  int
246  create_file_type( const char *exefile, const char *ext, const char *extname, char *iconfile )  create_file_type (const char *exefile, const char *ext,
247                      const char *extname, char *iconfile)
248  {  {
249      int rc;      int rc;
250      HKEY reg = NULL;      HKEY reg = NULL;
# Line 290  expand_path (const char *path) Line 310  expand_path (const char *path)
310          return NULL;          return NULL;
311      len += 1;      len += 1;
312      p = new char[len+1];      p = new char[len+1];
313      if( !p )      if (!p)
314          return NULL;          return NULL;
315      len = ExpandEnvironmentStrings (path, p, len);      len = ExpandEnvironmentStrings (path, p, len);
316      if (!len) {      if (!len) {
# Line 298  expand_path (const char *path) Line 318  expand_path (const char *path)
318          return NULL;          return NULL;
319      }      }
320      return p;      return p;
321  } /* expand_path */  }
322    
323    
324  /* Retrieve a registry entry with the directory given in @dir  /* Retrieve a registry entry with the directory given in @dir
# Line 311  get_reg_entry (HKEY root_key, const char Line 331  get_reg_entry (HKEY root_key, const char
331      char text[384] = {0};      char text[384] = {0};
332      DWORD nbytes, type;      DWORD nbytes, type;
333      HKEY reg_key = NULL;      HKEY reg_key = NULL;
334      char *p = NULL;      char * p = NULL;
335            
336      rc = RegOpenKeyEx (root_key, dir, 0, KEY_QUERY_VALUE, &reg_key);      rc = RegOpenKeyEx (root_key, dir, 0, KEY_QUERY_VALUE, &reg_key);
337      if( !rc_ok( rc ) )      if( !rc_ok( rc ) )
# Line 397  set_reg_entry_gpg (const char * key, con Line 417  set_reg_entry_gpg (const char * key, con
417  }  }
418    
419    
   
   
420  int  int
421  set_reg_entry_mo (const char * value)  set_reg_entry_mo (const char * value)
422  {        {      
# Line 493  set_reg_winpt_single (int id, int val) Line 511  set_reg_winpt_single (int id, int val)
511  int  int
512  get_reg_winpt_single (int id)  get_reg_winpt_single (int id)
513  {  {
514      char *buf = NULL;      char * buf = NULL;
515      int val = 0;      int val = 0;
516    
517      buf = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[id]);      buf = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[id]);

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26