mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
w32: Add code to support a portable use of GnuPG.
* common/homedir.c (w32_bin_is_bin, w32_portable_app) [W32]: New. (check_portable_app) [W32]: New. (standard_homedir, default_homedir) [W32]: Support the portable flag. (w32_rootdir, w32_commondir) [W32]: Ditto. (gnupg_bindir, gnupg_cachedir, dirmngr_socket_name) [W32]: Ditto. * common/logging.h (JNLIB_LOG_NO_REGISTRY): New. * common/logging.c (no_registry): New variable. (log_set_prefix, log_get_prefix): Set/get that variable. (do_logv): Do not check the registry if that variable is set. -- Beware: This code has not been tested because it is not yet possible to build GnuPG 2.1 for Windows. However, the code will be the base for an implementation in 2.0. A portable use of GnuPG under Windows means that GnuPG uses a home directory depending on the location of the actual binary. No registry variables are considered. The portable mode is enabled if in the installation directory of the the binary "gpgconf.exe" and a file "gpgconf.ctl" are found. The latter file is empty or consists only of empty or '#' comment lines. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
db4651734f
commit
9ff72e4e7e
5 changed files with 214 additions and 62 deletions
|
@ -96,6 +96,9 @@ static char prefix_buffer[80];
|
|||
static int with_time;
|
||||
static int with_prefix;
|
||||
static int with_pid;
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
static int no_registry;
|
||||
#endif
|
||||
static int (*get_pid_suffix_cb)(unsigned long *r_value);
|
||||
static int running_detached;
|
||||
static int force_prefixes;
|
||||
|
@ -561,6 +564,9 @@ log_set_prefix (const char *text, unsigned int flags)
|
|||
with_time = (flags & JNLIB_LOG_WITH_TIME);
|
||||
with_pid = (flags & JNLIB_LOG_WITH_PID);
|
||||
running_detached = (flags & JNLIB_LOG_RUN_DETACHED);
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
no_registry = (flags & JNLIB_LOG_NO_REGISTRY);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -578,6 +584,10 @@ log_get_prefix (unsigned int *flags)
|
|||
*flags |= JNLIB_LOG_WITH_PID;
|
||||
if (running_detached)
|
||||
*flags |= JNLIB_LOG_RUN_DETACHED;
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (no_registry)
|
||||
*flags |= JNLIB_LOG_NO_REGISTRY;
|
||||
#endif
|
||||
}
|
||||
return prefix_buffer;
|
||||
}
|
||||
|
@ -624,8 +634,10 @@ do_logv (int level, int ignore_arg_ptr, const char *fmt, va_list arg_ptr)
|
|||
#ifdef HAVE_W32_SYSTEM
|
||||
char *tmp;
|
||||
|
||||
tmp = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG",
|
||||
"DefaultLogFile");
|
||||
tmp = (no_registry
|
||||
? NULL
|
||||
: read_w32_registry_string (NULL, "Software\\GNU\\GnuPG",
|
||||
"DefaultLogFile"));
|
||||
log_set_file (tmp && *tmp? tmp : NULL);
|
||||
jnlib_free (tmp);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue