/[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 80 by twoaday, Wed Nov 16 11:05:16 2005 UTC revision 85 by twoaday, Fri Nov 18 07:20:40 2005 UTC
# Line 116  regist_inst_gnupg (int create_mokey) Line 116  regist_inst_gnupg (int create_mokey)
116  } /* regist_inst_gpg */  } /* regist_inst_gpg */
117    
118    
119  /* Install WinPT into the W32 registry, if the entry already  /* Install WinPT into the W32 registry, if the entry already
120     exists the function returns immediately.*/     exists the function returns immediately. @with_ext can be
121       used to register some file types (if 1). @created contains
122       1 if the registry key was created.
123       Return value: 0 on success. */
124  int  int
125  regist_inst_winpt (int with_ext, int * created)  regist_inst_winpt (int with_ext, int * created)
126  {  {
# Line 126  regist_inst_winpt (int with_ext, int * c Line 129  regist_inst_winpt (int with_ext, int * c
129      char modpath[MAX_PATH+1];      char modpath[MAX_PATH+1];
130      int rc, i, id, n = 0;      int rc, i, id, n = 0;
131    
132      if( created )      if (created)
133          *created = 0;          *created = 0;
134    
135      p = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions");      p = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions");
136      if (p && *p == '1')      if (p && *p == '1')
137          with_ext = 0;          with_ext = 0;
138      free_if_alloc( p );      free_if_alloc (p);
139    
140      if( with_ext ) {      if (with_ext) {
141          id = msg_box( NULL, _("WinPT can register some GPG file types for you so they can "          id = msg_box (NULL, _("WinPT can register some GPG file types for you so they can "
142                                "be processed with a double click in the explorer.\n"                                "be processed with a double click in the explorer.\n"
143                                "Do you want to continue?"), _("WinPT"), MB_YESNO|MB_INFO );                                "Do you want to continue?"), _("WinPT"), MB_YESNO|MB_INFO);
144          if( id == IDNO ) {          if (id == IDNO) {
145              set_reg_entry( HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1" );              set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");
146              goto start;              goto start;
147          }          }
148          for( i = 0; gpg_filetypes[i].ext; i++ ) {          for (i = 0; gpg_filetypes[i].ext; i++) {
149              rc = RegOpenKeyEx( HKEY_CLASSES_ROOT, gpg_filetypes[i].ext, 0, KEY_READ, &reg );              rc = RegOpenKeyEx (HKEY_CLASSES_ROOT, gpg_filetypes[i].ext, 0, KEY_READ, &reg);
150              if( rc_ok( rc ) ) {              if (rc_ok (rc)) {
151                  RegCloseKey( reg );                  RegCloseKey (reg);
152                  id = log_box( _("WinPT WARNING"), MB_YESNO|MB_INFO,                  id = log_box (_("WinPT WARNING"), MB_YESNO|MB_INFO,
153                                _("It seems there was already a '%s' file type registered by another application.\n"                                _("It seems there was already a '%s' file type registered by another application.\n"
154                                  "Do you want to overwrite it?"), gpg_filetypes[i].ext );                                  "Do you want to overwrite it?"), gpg_filetypes[i].ext);
155                  if( id == IDNO )                  if (id == IDNO)
156                      continue;                      continue;
157              }              }
158              regist_single_filetype( &gpg_filetypes[i] );              regist_single_filetype (&gpg_filetypes[i]);
159              n++;              n++;
160          }          }
161      }      }
162                    
163  start:  start:
164      rc = RegOpenKeyEx( HKEY_CURRENT_USER, WINPT_REG, 0, KEY_READ, &reg );      rc = RegOpenKeyEx (HKEY_CURRENT_USER, WINPT_REG, 0, KEY_READ, &reg);
165      if( rc_ok( rc ) ) {      if (rc_ok (rc)) {  
166          RegCloseKey( reg );          RegCloseKey (reg);
167          rc = RegOpenKeyEx( HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", 0, KEY_READ, &reg );          rc = RegOpenKeyEx (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", 0, KEY_READ, &reg);
168          if( !rc_ok( rc ) ) {          if (!rc_ok (rc)) {
169              RegCreateKey( HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", &reg );              RegCreateKey (HKEY_CURRENT_USER, WINPT_REG"\\Keyserver", &reg);
170              RegCloseKey( reg );              RegCloseKey (reg);
171          }          }
172          p = get_reg_entry_keyserver ("Default");          p = get_reg_entry_keyserver ("Default");
173          if (!p) {          if (!p) {
# Line 173  start: Line 176  start:
176              set_reg_entry_keyserver ("Default_Port", buf);              set_reg_entry_keyserver ("Default_Port", buf);
177              set_reg_entry_keyserver ("Default", DEF_HKP_KEYSERVER);              set_reg_entry_keyserver ("Default", DEF_HKP_KEYSERVER);
178          }          }
179          free_if_alloc( p );          free_if_alloc (p);
180          if( n )          if (n)
181              set_reg_entry( HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1" );              set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");
182          return 0;          return 0;
183      }      }
184      rc = RegCreateKey( HKEY_CURRENT_USER, WINPT_REG, &reg );      rc = RegCreateKey(HKEY_CURRENT_USER, WINPT_REG, &reg);
185      if( !rc_ok( rc ) )      if (!rc_ok (rc))
186          return WPTERR_REGISTRY;          return WPTERR_REGISTRY;
187      if( created )      if (created)
188          *created = 1;          *created = 1;
189      RegCloseKey( reg );      RegCloseKey (reg);
190      if( n )      if (n)
191          set_reg_entry( HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1" );          set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, "Extensions", "1");
192      if ((n=GetModuleFileName (NULL, modpath, MAX_PATH-1)) > 0) {      if ((n=GetModuleFileName (NULL, modpath, MAX_PATH-1)) > 0) {
193          while (n-- > 0) {          while (n-- > 0) {
194              if (modpath[n] == '\\') {              if (modpath[n] == '\\') {

Legend:
Removed from v.80  
changed lines
  Added in v.85

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26