/[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 68 by twoaday, Sat Nov 5 12:00:55 2005 UTC revision 76 by twoaday, Thu Nov 10 14:07:06 2005 UTC
# Line 44  static gpg_filetype gpg_filetypes[] = { Line 44  static gpg_filetype gpg_filetypes[] = {
44  };  };
45    
46  struct reg_hotkey_s reg_hotkeys[] = {  struct reg_hotkey_s reg_hotkeys[] = {
47      {"ClipEncrypt", NULL, 0},      {"ClipEncrypt", "", 0},
48      {"ClipDecrypt", NULL, 0},      {"ClipDecrypt", "", 0},
49      {"ClipSign",    NULL, 0},      {"ClipSign",    "", 0},
50      {"ClipSignEnc", NULL, 0},      {"ClipSignEnc", "", 0},
51      {"CwsEncrypt",  NULL, 0},      {"CwsEncrypt",  "", 0},
52      {"CwsDecrypt",  NULL, 0},      {"CwsDecrypt",  "", 0},
53      {"CwsSign",     NULL, 0},      {"CwsSign",     "", 0},
54      {"CwsSignEnc",  NULL, 0},      {"CwsSignEnc",  "", 0},
55      {NULL, NULL, 0}      {NULL, "", 0}
56  };  };
57    
58  winpt_reg_prefs_s reg_prefs;  winpt_reg_prefs_s reg_prefs;
# Line 277  get_reg_entry (HKEY root_key, const char Line 277  get_reg_entry (HKEY root_key, const char
277  {  {
278      int rc;      int rc;
279      char text[384] = {0};      char text[384] = {0};
280      DWORD nbytes, type, n1 = 0;      DWORD nbytes, type;
281      HKEY reg_key = NULL;      HKEY reg_key = NULL;
282      char * p = NULL, * tmp = NULL;      char *p = NULL;
283            
284      rc = RegOpenKeyEx (root_key, dir, 0, KEY_QUERY_VALUE, &reg_key);      rc = RegOpenKeyEx (root_key, dir, 0, KEY_QUERY_VALUE, &reg_key);
285      if( !rc_ok( rc ) )      if( !rc_ok( rc ) )
# Line 380  get_reg_entry_gpg (const char *key) Line 380  get_reg_entry_gpg (const char *key)
380  }  }
381    
382    
383  char *  /* Return if possible the GPG4Win installation directory concatenated
384  get_reg_entry_mo(void)     with the string in @path if given. */
385    char*
386    get_reg_entry_gpg4win (const char *path)
387    {
388        char *p, *pp;
389        p = get_reg_entry (HKEY_LOCAL_MACHINE,
390                           "Software\\GNU\\GnuPG", "Install Directory");
391        if (!p)
392            return NULL;
393        if (!path)
394            return p;
395        pp = new char[strlen (p) + strlen (path) + 4];
396        if (!pp)
397            BUG (NULL);
398        sprintf (pp, "%s\\%s", p, path);
399        free_if_alloc (p);
400        return pp;
401    }
402    
403        
404    char*
405    get_reg_entry_mo (void)
406  {        {      
407      return get_reg_entry(HKEY_CURRENT_USER,      char *p, *pp;
408                           "Control Panel\\Mingw32\\NLS", "MODir");      const char *lang;
409        
410        p = get_reg_entry (HKEY_CURRENT_USER,
411                           "Control Panel\\Mingw32\\NLS", "MODir");
412        if (p)
413            return p;
414        
415        lang = get_gettext_langid ();
416        if (!lang)
417            return NULL;
418        pp = new char[strlen ("share\\xxxxx\\locale\\LC_MESSAGES")+8];
419        if (!pp)
420            BUG (NULL);
421        sprintf (pp, "share\\locale\\%s\\LC_MESSAGES", lang);
422        p = get_reg_entry_gpg4win (pp);
423        free_if_alloc (pp);
424        return p;
425  }  }
426    
427    
# Line 440  int Line 477  int
477  set_reg_winpt_prefs (winpt_reg_prefs_s * opt)  set_reg_winpt_prefs (winpt_reg_prefs_s * opt)
478  {  {
479      char buf[128];      char buf[128];
480      int rc = 0, i;      size_t i;
481        int rc = 0;
482    
483      for (i=1; i < DIM (cfg); i++) {      for (i=1; i < DIM (cfg); i++) {
484          switch (i) {          switch (i) {
# Line 550  int Line 588  int
588  get_reg_winpt_prefs (winpt_reg_prefs_s * opt)  get_reg_winpt_prefs (winpt_reg_prefs_s * opt)
589  {  {
590      char * val = NULL;      char * val = NULL;
591      int i;      size_t i;
592    
593      for (i=1; i < DIM (cfg); i++) {      for (i=1; i < DIM (cfg); i++) {
594          val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[i]);          val = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[i]);

Legend:
Removed from v.68  
changed lines
  Added in v.76

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26