aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2007-11-28 16:31:05 +0000
committerMarcus Brinkmann <[email protected]>2007-11-28 16:31:05 +0000
commit6286b436bdd22361538267d91959576ef11a2bd9 (patch)
tree2ca6237ca01b76d203ba70d7e39f296ecdfd1a9c
parentMade autolog feature for if --enable-fd-passing has not been enabled. (diff)
downloadgpgme-6286b436bdd22361538267d91959576ef11a2bd9.tar.gz
gpgme-6286b436bdd22361538267d91959576ef11a2bd9.zip
2007-11-28 Marcus Brinkmann <[email protected]>
* w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Search for installation directory. Remove old fallback default. (find_program_in_inst_dir): New function.
-rw-r--r--gpgme/ChangeLog6
-rw-r--r--gpgme/w32-util.c43
2 files changed, 41 insertions, 8 deletions
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index 38ad0dd0..f942d83c 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-28 Marcus Brinkmann <[email protected]>
+
+ * w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Search
+ for installation directory. Remove old fallback default.
+ (find_program_in_inst_dir): New function.
+
2007-11-26 Werner Koch <[email protected]>
* engine-gpgsm.c (struct engine_gpgsm): Add field INLINE_DATA and
diff --git a/gpgme/w32-util.c b/gpgme/w32-util.c
index 50a3c92d..60c8396d 100644
--- a/gpgme/w32-util.c
+++ b/gpgme/w32-util.c
@@ -245,6 +245,36 @@ find_program_in_registry (const char *name)
static char *
+find_program_in_inst_dir (const char *name)
+{
+ char *result = NULL;
+ char *tmp;
+
+ tmp = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
+ "Software\\GNU\\GnuPG",
+ "Install Directory");
+ if (!tmp)
+ return NULL;
+
+ result = malloc (strlen (tmp) + 1 + strlen (name) + 1);
+ if (!result)
+ {
+ free (tmp);
+ return NULL;
+ }
+
+ strcpy (stpcpy (stpcpy (result, tmp), "\\"), name);
+ free (tmp);
+ if (access (result, F_OK))
+ {
+ free (result);
+ return NULL;
+ }
+
+ return result;
+}
+
+static char *
find_program_at_standard_place (const char *name)
{
char path[MAX_PATH];
@@ -266,6 +296,7 @@ find_program_at_standard_place (const char *name)
return result;
}
+
const char *
_gpgme_get_gpg_path (void)
{
@@ -275,11 +306,9 @@ _gpgme_get_gpg_path (void)
if (!gpg_program)
gpg_program = find_program_in_registry ("gpgProgram");
if (!gpg_program)
- gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
-#ifdef GPG_PATH
+ gpg_program = find_program_in_inst_dir ("gpg.exe");
if (!gpg_program)
- gpg_program = GPG_PATH;
-#endif
+ gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
UNLOCK (get_path_lock);
return gpg_program;
}
@@ -293,11 +322,9 @@ _gpgme_get_gpgsm_path (void)
if (!gpgsm_program)
gpgsm_program = find_program_in_registry ("gpgsmProgram");
if (!gpgsm_program)
- gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
-#ifdef GPGSM_PATH
+ gpgsm_program = find_program_in_inst_dir ("gpgsm.exe");
if (!gpgsm_program)
- gpgsm_program = GPGSM_PATH;
-#endif
+ gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
UNLOCK (get_path_lock);
return gpgsm_program;
}