aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix calling CancelSynchronousIo.NIIBE Yutaka2024-07-051-2/+2
| | | | | | | | | * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Use HANDLE. -- GnuPG-bug-id: 6634 Signed-off-by: NIIBE Yutaka <[email protected]>
* Don't use ath_self, but get thread ID directly.NIIBE Yutaka2024-07-051-2/+1
| | | | | | | | | | | * src/debug.c [HAVE_W32_SYSTEM or __linux] (tid_log_callback): Use native thread ID call for Windows and Linux, ifdef-out-ed. (debug_init): Only call gpgrt_log_set_pid_suffix_cb for relevant systems. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* doc: Fix typos in documentation and source code commentsIngo Klöcker2023-10-131-3/+3
| | | | | | | | -- Anonymous contribution Signed-off-by: Ingo Klöcker <[email protected]>
* core,w32: More robust detection of GnuPG Desktop dir layoutWerner Koch2023-02-011-20/+75
| | | | | | | | | | * src/w32-util.c (INST_TYPE_GPG4WIN, INST_TYPE_GPGDESK): New to replace the numeric constants. (find_version_file): New. (_gpgme_get_gpgconf_path): Guess a default for inst_type. -- GnuPG-bug-id: 6362
* core: New global flags "inst-type".Werner Koch2022-10-261-4/+46
| | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_global_flag): Add flag "inst-type". * src/w32-util.c (_gpgme_set_get_inst_type): New. (INST_TYPE_GPG4WIN_DIR): New. (INST_TYPE_GPGDESK_DIR): New. (_gpgme_get_gpgconf_path): Implement this flag. Replace fixed strings by the macros. * src/posix-util.c (_gpgme_set_get_inst_type): New dummy. -- This is intended for use by Kleopatra to reliable find the expected GnuPG installation.
* w32: Add another fallback to look for gpgconf.exeAndre Heinecke2022-08-121-2/+10
| | | | | | | | | | | | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Add fallback for GnuPG VS-Desktop install scheme. -- GnuPG VS-Desktop has the install layout: %PROGRAMFILES%\GnuPG VS-Desktop\bin\libgpgme.dll %PROGRAMFILES%\GnuPG VS-Desktop\GnuPG\bin\gpgconf.exe This fallback is of course only required if the registry string pointing to the correct install directory is broken. GnuPG-Bug-Id: T6131
* core: Support dirinfo("socketdir")Werner Koch2021-11-251-10/+11
| | | | | | | | | | | | | | | | | | | * src/dirinfo.c (WANT_SOCKETDIR): New. (dirinfo): Add field socketdir. (parse_output): Support "socketdir". (get_gpgconf_item): Return socketdir. * tests/t-engine-info.c (main): Add socketdir to the output. * src/w32-util.c (_gpgme_create_process_utf8): Fix indentation. -- GnuPG-bug-id: 5613 This is not strictly necessary because we could deduce this from one of the other socket info items but it is more clean to have a dedicated info item. The socketdir item is available for 5 years now (GnuPG commit 8e3fa5a4b205c534de2142e5d071712f957cf06a)
* core,w32: Silence compiler warnings.Werner Koch2019-11-271-2/+3
| | | | | | | * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Add some casts. -- Signed-off-by: Werner Koch <[email protected]>
* core: Improve the debug messages even more.Werner Koch2019-06-051-7/+7
| | | | | | | | | | | | | | | * src/debug.c (_gpgme_debug): Add arg LINE. Chnage all callers. (_gpgme_debug_begin): Remove. * src/debug.h (TRACE_SEQ): Use the LINE arg of _gpgme_debug. -- This includes chnages to always print fds in decimal as weel as tweaking the TARCE_SEQ function to make use of the new machinery. The standard 'tag' can now always be NULL and no tag information will be printed. Signed-off-by: Werner Koch <[email protected]>
* core,w32: Fix minor potential memleakAndre Heinecke2019-04-091-0/+2
| | | | | * src/w32-util.c (_gpgme_create_process_utf8): Free converted startup info strings.
* core,w32: Fix new w32-util functionsAndre Heinecke2019-04-091-3/+25
| | | | | | | | | | | | | | * src/w32-util.c (_gpgme_access): Respect mode parameter. (_gpgme_create_process_utf8): Convert startupinfo, too. -- This both did not show up in testing as we only use mode F_OK and STARTUPINFOA is basically the same as STARTUPINFOW. Fixes commit: a82e3a0ae57a48ba173e282a050680751006c074 GnuPG-Bug-Id: T4453
* core,w32: Improve handling of Unicode pathsAndre Heinecke2019-04-091-8/+97
| | | | | | | | | | | | | | | | | | | | | | * src/dirinfo.c (get_gpgconf_item): Use _gpgme_access. * src/posix-util.c (_gpgme_access): Add forward to normal access. * src/sys-util.h (_gpgme_access): New for posix and w32. * src/w32-io.c (_gpgme_io_spawn): Use _gpgme_crate_process_utf8. * src/w32-util.c (utf8_to_wchar, utf8_to_wchar0): The usual w32 conv. (find_program_in_dir): Use _gpgme_access. (find_program_at_standard_place): Use wchar API and convert to UTF-8. (_gpgme_access): Convert UTF-8 to wchar and use wchar API. (_gpgme_create_process_utf8): Convert UTF-8 to wchar and use wchar API. -- While we should not say that we have full support for unicode path installations of GnuPG, this ensures that GPGME works if GPGME itself is installed in a unicode path. e.g.: Libreoffice supports this. GnuPG-Bug-Id: T4453 Based on a patch provided by Egor Pugin. Thanks.
* core,w32: Fix missing sentinel in dir name builder.Werner Koch2019-02-191-1/+1
| | | | | | | | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Add NULL top strconcat. -- Fortunately this is called early and the stack like cleared out so that we have not seen wrong behaviour until now. We should really fix all these annoying HANDLE/int cast warnings and alike so that real bugs are not drowned by them. GnuPG-bug-id: 4369 Signed-off-by: Werner Koch <[email protected]>
* core: Remove old debug helper functionWerner Koch2018-11-161-2/+4
| | | | | | | * src/debug.c (_gpgme_debug): Remove. (_gpgme_debugf): Rename to _gpgme_debug. Signed-off-by: Werner Koch <[email protected]>
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-161-5/+5
| | | | | | | | | | | | | | | | * src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros and remove the TRACE_BEG1 et al. Change all users to always pass a format string. (TRACE): Ditto. * src/debug.c (_gpgme_debugf): New. * configure.ac <GCC>: Add -Wno-format-zero-length. -- This makes it easier for use to enable format checks. The zero-length format is required to allow for an empty format due to the comman problematic of __VA_ARGS__. Signed-off-by: Werner Koch <[email protected]>
* Add SPDX identifiers to most source filesWerner Koch2018-11-161-2/+3
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* w32: Fix and improve CancelSynchronousIo use.Werner Koch2018-11-021-4/+6
| | | | | | | | | * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL and print trace info only on error. -- Fixes-commit: 63ba09b541dabbe838253926896e721cb9be564a Signed-off-by: Werner Koch <[email protected]>
* w32: Use CancelSynchronousIo in destroy_reader.Werner Koch2018-11-011-3/+39
| | | | | | | | | | | * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): New. * src/w32-io.c (destroy_reader): Use it here. -- This has not been tested but should on Vista and later help to fix a possible hang. Signed-off-by: Werner Koch <[email protected]>
* w32: Remove all support for WindowsCEWerner Koch2018-10-311-78/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Remove WindwosCE support. * contrib/: Remove all; it was only used for WindowsCE. * src/w32-ce.c, src/w32-ce.h: Remove files. * src/Makefile.am (system_components): Remove these files. * src/ath.c, src/ath.h: Remove W32CE support. * src/data-compat.c (gpgme_data_new_from_filepart): Ditto. (gpgme_data_new_from_file): Ditto. * src/debug.c (debug_init, _gpgme_debug): Ditto. * src/gpgme-tool.c (gpgme_server): Ditto. (main): Ditto. * src/priv-io.h: Do not include w32-ce.h. * src/util.h: Remove WindowsCE support. * src/w32-io.c: Ditto. * src/w32-util.c: Ditto. * src/debug.h (TRACE_SUC4): New. -- There is no more hardware to test our code, the support for Windows CE terminated along time ago. Note that our code worked only with the old WindowsCE with that overall system limit of 31 processes. Signed-off-by: Werner Koch <[email protected]>
* doc: convert more links to equivalent https:// URLsDaniel Kahn Gillmor2018-10-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core, w32: Add w64 handling for regkeysAndre Heinecke2018-05-171-3/+22
| | | | | | | | | | | | | | | * src/w32-util.c (_gpgme_get_gpg_path): Use new defines. (GNUPG_REGKEY_2): x64 aware regkey as used by GnuPG in Gpg4win 2.x (GNUPG_REGKEY_3): x64 aware regkey as used by GnuPG in Gpg4win 3.x (_gpgme_get_gpgconf_path): Use new regkeys. Add another fallback. -- This should fix more "unsupported protocol" issues if Gpg4win / GnuPG is installed in a non standard path on 64bit systems. The regkey handling is similar to that of gpgex and gpgol. GnuPG-Bug-Id: T3988
* core: Replace all calls to *sprintf by gpgrt_*sprintf.Werner Koch2017-02-021-2/+3
| | | | | | | | | | | | | | * configure.ac (vasprintf): Remove check. * src/vasprintf.c: Remove file. * src/util.h (vasprintf, asprintf): Remove prototypes. Replace all calls to vasprintf and asprintf by gpgrt_vasprintf or gpgrt_asprintf. Also take care to use gpgrt_free on the returned value. * src/w32-util.c (_gpgme_get_gpgconf_path): Replace a gpgrt_asprintf by _gpgme_strconcat. (snprintf): New macro to use gpgrt_snprintf instead of the system's standard snprintf. Signed-off-by: Werner Koch <[email protected]>
* doc: Replace http: by https: in core source files.Werner Koch2016-11-161-1/+1
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* w32: Fix locating gpgconf on 64 bit systems.Werner Koch2016-11-041-2/+11
| | | | | | | | | | | | * src/w32-util.c (find_program_at_standard_place): Use access to check whether the binary is at CSIDL_PROGRAM_FILES before testing CSIDL_PROGRAM_FILESX86. -- Suggested-by: ticho Fixes-commit: a82e9b182f62966207cad0972be6fa284329a5a1 GnuPG-bug-id: 2814 Signed-off-by: Werner Koch <[email protected]>
* core: Fix w32 crash in find_program_in_dirAndre Heinecke2016-10-101-1/+1
| | | | | | | | * src/w32-util.c (find_program_in_dir): Fix call to _gpgme_strconcat. -- This fixes a crash introduced by dc39552d0 because it tried to concat a strlen.
* core: Fix error checking in _gpgme_mkstemp.Werner Koch2016-09-221-1/+3
| | | | | | | * src/w32-util.c (_gpgme_mkstemp): Fix error checking. (dlopen): Mark FLAGS as unused. Signed-off-by: Werner Koch <[email protected]>
* core: New helper function _gpgme_strconcat.Werner Koch2016-09-221-24/+11
| | | | | | | | | | | | | | | | | | | | | | * src/conversion.c: Include stdarg.h. (do_strconcat): New. (_gpgme_strconcat): New. * src/util.h: Provide fallback for GPGRT_ATTR_SENTINEL. (_gpgme_strconcat): New with sentinel. * src/w32-util.c (find_program_in_dir): Replace malloc and stpcpy by _gpgme_strconcat. (find_program_at_standard_place): Ditto. (_gpgme_set_default_gpg_name): Ditto. (_gpgme_set_default_gpgconf_name): Ditto. (_gpgme_mkstemp): Ditto. (_gpgme_set_override_inst_dir): Repalce malloc and strcpy by strdup. -- The function has been taken from gnupg/common/stringhelp.c and license changed to LPGLv2.1+. I am the original author of that code. Signed-off-by: Werner Koch <[email protected]>
* w32: Fallback to 2.1 reg key for gpgconf searchAndre Heinecke2016-07-051-3/+14
| | | | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Fallback to 2.1 installer registry key. -- Finding gpgconf is utterly important so we should be as compatible as possible.
* w32: Avoid conflict with Mingw-w64 version 4.0.4-1Werner Koch2015-12-091-2/+2
| | | | | | | | | | | * src/w32-util.c (mkstemp): Rename to my_mkstemp. Change caller. -- For some reason the linker seems to use the mkstemp now provided by mingw instead of our static symbol. Strange. Reported-by: Andrej Kacian <[email protected]> Signed-off-by: Werner Koch <[email protected]>
* w32: Improve locating gpgconf on 64 bit systems.Werner Koch2015-10-281-2/+7
| | | | | | | * src/w32-util.c (find_program_at_standard_place): Fallback to CSIDL_PROGRAM_FILESX86. Signed-off-by: Werner Koch <[email protected]>
* w32: Add new global flag "w32-inst-dir".Werner Koch2015-10-281-1/+29
| | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_global_flag): Add flag "w32-inst-dir"; * src/posix-util.c (_gpgme_set_override_inst_dir): New stub. * src/w32-util.c (override_inst_dir): New var. (_gpgme_get_inst_dir): Return this var is set. (_gpgme_set_override_inst_dir): New. -- See https://lists.gnupg.org/pipermail/gnupg-devel/2015-September/030267.html for background. Signed-off-by: Werner Koch <[email protected]>
* w32: Look for gpgconf in the new GnuPG 2.1 install dir.Werner Koch2015-08-241-6/+13
| | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Try another location of gpgconf.exe. Signed-off-by: Werner Koch <[email protected]>
* w32: Expect gpgme-w32spawn.exe only in the gpgme installation dir.Werner Koch2015-08-241-58/+65
| | | | | | | | | | | | | | | * src/w32-util.c (find_program_at_standard_place): Remove. (_gpgme_get_gpg_path): Make the search order more explicit. (_gpgme_get_gpgconf_path): Ditto. (_gpgme_get_w32spawn_path): Search only in the inst_dir. -- This tries to avoid possible unclear bug reports by removing the fallback to the current gpg4win installation directory for the gpgme helper. It is expected that users of gpgme installing their own gpgme version also install the matching helper. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix memleak in an error code paths.Werner Koch2014-04-151-1/+4
| | | | | | | | | * src/w32-io.c (create_writer): Free CTX in cased of bad FD. * src/w32-util.c (_gpgme_mkstemp): Free TMPNAME in case of a failed mkstemp. -- Found by Hans-Christoph Steiner with cppcheck.
* Add global flags disable-gpgconf, gpgconf-name, and gpg-name.Werner Koch2014-01-061-7/+93
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_global_flag): Add names "disable-gpgconf", "gpgconf-name", and "gpg-name". * src/dirinfo.c (_gpgme_dirinfo_disable_gpgconf): New. (get_gpgconf_item): Minor debug info change. * src/posix-util.c (default_gpg_name, default_gpgconf_name): Add vars. (_gpgme_set_default_gpg_name): New. (_gpgme_set_default_gpgconf_name): New. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars. (walk_path): Add debug output on failure. * src/w32-util.c (default_gpg_name, default_gpgconf_name): Add vars. (replace_slashes): New. (get_basename): New. (_gpgme_set_default_gpg_name): New. (_gpgme_set_default_gpgconf_name): New. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars. * tests/t-engine-info.c (main): Add --verbose and --set-global-flag options. -- Note that the Windows part has not been tested.
* Locate engine names only at runtime and prefer GnuPG-2.Werner Koch2013-12-271-55/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION) (NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related checks. Do not check for any engine version. (HAVE_ASSUAN): Remove AM conditional. * src/Makefile.am: Remove separate component vars and always build all engines but uiserver. * src/dirinfo.c (WANT_GPGCONF_NAME): New. (struct dirinfo): Add field gpgconf_name. (_gpgme_get_default_gpgconf_name): Use WANT_GPGCONF_NAME. (get_gpgconf_item): Set gpgconf name and adjust for _gpgme_get_*_path now returning a malloced string. * src/engine.c (engine_ops): Always init all engines except for uiserver. * src/posix-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove unused functions. (walk_path): New. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path ): Re-implement using walk_path. * src/w32-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove unused functions. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Return a malloced string. * src/engine-g13.c (g13_get_req_version): Use a hardwired string with the required version. This info belongs into this file. * src/engine-gpg.c (gpg_get_req_version): Ditto. * src/engine-gpgconf.c (gpgconf_get_req_version): Ditto. * src/engine-gpgsm.c (gpgsm_get_req_version): Ditto. * tests/t-engine-info.c: Replace now useless test by an info output. * tests/gpg/Makefile.am (GPG, GPG_AGENT): Hardwire gpg and gpg-agent. * tests/gpgsm/Makefile.am (GPGSM): Hardwire gpgsm. Signed-off-by: Werner Koch <[email protected]>
* Prefer GnuPG-2 engines over GnuPG-1.Werner Koch2013-08-021-23/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/util.h: Move some prototypes to ... * src/sys-util.h: New. * src/Makefile.am (main_sources): Add sys-util.h. * configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S. * src/dirinfo.c: Include sys-util.h. (WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME) (WANT_UISRV_SOCKET): New. (dirinfo): Add corresponding fields. (parse_output): Add arg COMPONENTS and set new fields. (read_gpgconf_dirs): Add arg components and act upon it. (get_gpgconf_item): Call read_gpgconf_dirs two times. Add debug output. (_gpgme_get_default_gpg_name): New. (_gpgme_get_default_gpgsm_name): New. (_gpgme_get_default_g13_name): New. (_gpgme_get_default_gpgconf_name): New. (_gpgme_get_default_uisrv_socket): New. * src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c * src/engine-gpgsm.c, src/engine-uiserver.c: Change to use _gpgme_get_default_ instead of those from sys-util.h. * src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h. (_gpgme_get_uiserver_socket_path): Remove. * src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h. (_gpgme_get_uiserver_socket_path): Remove. -- The default engines names are now taken from the output of gpgconf. If gpgconf is not installed gpg 1 is assumed and locate the same was as gpgconf.
* w32: Try to locate gpg in the gpgme installation dir.Werner Koch2013-08-021-73/+156
| | | | | | | | | | | | | * src/w32-util.c (my_hmodule): New. (wchar_to_utf8): New. (DllMain): New. (_gpgme_get_inst_dir): New. (find_program_in_dir): New. (find_program_in_inst_dir): Add arg INST_DIR. (_gpgme_get_gpg_path): Get inst_dir before acquiring the lock. (_gpgme_get_gpgconf_path): Ditto. (_gpgme_get_g13_path): Ditto. (_gpgme_get_w32spawn_path): Ditto.
* w32: Hacks for building with 32 bit mingw64.Werner Koch2013-02-261-1/+5
| | | | | | | | | | | | | | * configure.ac (INSERT__TYPEDEFS_FOR_GPGME_H): Add hacks for 32 bit mingw64. * src/util.h [W32]: Include winsock2.h before windows to make mingw64 happy. * src/w32-util.c (_WIN32_IE): Need to use 5.1 for mingw64. -- It is not clear to me what mingw64 wants to achieve with their POSIX hacks. In particular the off64_t stuff looks quite strange given that Windows has a pretty stable API for close to 2 decades. Thus I can't say whether it will really work when build with that toolchain.
* Remove all trailing whitespace from source filesWerner Koch2012-09-251-14/+14
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* Merge commit 'a2b9adafe46c55a2c26dd46163055bbdf3526835'Marcus Brinkmann2011-02-021-15/+15
|\
| * 2011-02-02 Marcus Brinkmann <[email protected]>Marcus Brinkmann2011-02-021-15/+15
| | | | | | | | | | | | * w32-util.c (mkstemp): Don't use CreateFile instead of open (the function is not used on Windows CE, and the callers were not adjusted).
* | 2010-11-15 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-11-151-1/+1
| | | | | | | | | | * w32-util.c (_gpgme_w32ce_get_debug_envvar): Fix return value.
* | Hopefully last changes for building with MSC.Werner Koch2010-11-031-3/+3
| |
* | More include guards.Werner Koch2010-11-031-3/+6
|/ | | | | | Provide access for Wince. Install dummy sehmap.h
* Might now build for CE using MSC.Werner Koch2010-11-021-8/+25
|
* First take on changes to allow building with MSC for W32CE.Werner Koch2010-11-021-5/+13
| | | | | Fixed regression in plain W32 build.
* Fix last changeWerner Koch2010-10-071-1/+1
|
* Enable debugging feature for W32CE.Werner Koch2010-10-071-0/+21
| | | | | kFreeBSD portability fix.
* 2010-05-11 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-111-105/+84
| | | | | | | | | | | | | | | | | | | | * w32-util.c: Include ath.h (HAVE_ALLOW_SET_FOREGROUND_WINDOW) [!HAVE_W32CE_SYSTEM]: Define it. (RTLD_LAZY, dlopen, dlsym, dlclose) [!HAVE_ALLOW_SET_FORGROUND_WINDOW]: Don't define anymore. (_gpgme_allow_set_foreground_window) [!HAVE_ALLOW_SET_FOREGROUND_WINDOW]: Make it a stub. (read_w32_registry_string): Use FooA variants of Windows functions instead of Foo (which dispatches depending on UNICODE). [!HAVE_W32CE_SYSTEM]: Don't check environment. (w32_shgetfolderpath): Remove. (find_program_at_standard_place): Call SHGetSpecialFolderPath (which is available on all Windows systems and also Windows CE). (mkstemp): Use ath_self instead of getpid. (_gpgme_mkstemp): Use GetTempPathA instead of GetTempPath.