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) |
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); |
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 |
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, ®); |
rc = RegCreateKey (HKEY_CURRENT_USER, WINPT_REG, ®); |
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; |
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) { |
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 |
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, ®_key); |
rc = RegOpenKeyEx (root_key, dir, 0, KEY_QUERY_VALUE, ®_key); |
337 |
if( !rc_ok( rc ) ) |
if( !rc_ok( rc ) ) |
417 |
} |
} |
418 |
|
|
419 |
|
|
|
|
|
|
|
|
420 |
int |
int |
421 |
set_reg_entry_mo (const char * value) |
set_reg_entry_mo (const char * value) |
422 |
{ |
{ |
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]); |