core: Fail loudly in case w32 spawner not found
* src/w32-io.c (_gpgme_io_spawn): Show a message box in case gpgme-w32spawn.exe not found. -- Otherwise every engine call will just fail with unsupported protocol. Even in the debug output the problem was not made clear because CreateProcess will fail with error code 87 (Invalid Parameter) because spawnhelper is NULL. The helpful error message for ERROR_INVALID_PARAMETER would have been: "is 'NULL' correctly installed" As GpgME basically becomes useless on Windows without the spawnhelper we want to fail very loud in that case.
This commit is contained in:
parent
64194b0f8d
commit
9cf983b019
26
src/w32-io.c
26
src/w32-io.c
@ -50,6 +50,7 @@
|
|||||||
#include "sema.h"
|
#include "sema.h"
|
||||||
#include "priv-io.h"
|
#include "priv-io.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "sys-util.h"
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: Optimize. */
|
/* FIXME: Optimize. */
|
||||||
@ -1605,6 +1606,31 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
|
|||||||
cr_flags |= DETACHED_PROCESS;
|
cr_flags |= DETACHED_PROCESS;
|
||||||
cr_flags |= GetPriorityClass (GetCurrentProcess ());
|
cr_flags |= GetPriorityClass (GetCurrentProcess ());
|
||||||
spawnhelper = _gpgme_get_w32spawn_path ();
|
spawnhelper = _gpgme_get_w32spawn_path ();
|
||||||
|
if (!spawnhelper)
|
||||||
|
{
|
||||||
|
/* This is a common mistake for new users of gpgme not to include
|
||||||
|
gpgme-w32spawn.exe with their binary. So we want to make
|
||||||
|
this transparent to developers. If users have somehow messed
|
||||||
|
up their installation this should also be properly communicated
|
||||||
|
as otherwise calls to gnupg will result in unsupported protocol
|
||||||
|
errors that do not explain a lot. */
|
||||||
|
char *msg;
|
||||||
|
gpgrt_asprintf (&msg, "gpgme-w32spawn.exe was not found in the "
|
||||||
|
"detected installation directory of GpgME"
|
||||||
|
"\n\t\"%s\"\n\n"
|
||||||
|
"Crypto operations will not work.\n\n"
|
||||||
|
"If you see this it indicates a problem "
|
||||||
|
"with your installation.\n"
|
||||||
|
"Please report the problem to your "
|
||||||
|
"distributor of GpgME.\n\n"
|
||||||
|
"Developers Note: The install dir can be "
|
||||||
|
"manually set with: gpgme_set_global_flag",
|
||||||
|
_gpgme_get_inst_dir ());
|
||||||
|
MessageBoxA (NULL, msg, "GpgME not installed correctly", MB_OK);
|
||||||
|
free (msg);
|
||||||
|
gpg_err_set_errno (EIO);
|
||||||
|
return TRACE_SYSRES (-1);
|
||||||
|
}
|
||||||
if (!CreateProcessA (spawnhelper,
|
if (!CreateProcessA (spawnhelper,
|
||||||
arg_string,
|
arg_string,
|
||||||
&sec_attr, /* process security attributes */
|
&sec_attr, /* process security attributes */
|
||||||
|
Loading…
Reference in New Issue
Block a user