w32: Add new API fucntion gpgrt_w32_reg_query_string.

Authored by werner on Nov 17 2017, 5:25 PM.


w32: Add new API fucntion gpgrt_w32_reg_query_string.

* src/w32-reg.c: New.
* src/w32-add.h: Add gpgrt_w32_reg_query_string.
* src/visibility.c (gpgrt_w32_reg_query_string): New wrapper.
* src/gpg-error.def.in: Add gpgrt_w32_reg_query_string.
* configure.ac (ac_check_funcs): Add stpcpy.
* src/Makefile.am (arch_sources): Add w32-reg.c
(socklibs): New.
(libgpg_error_la_LIBADD): Add socklibs.
* src/gpgrt-int.h (xfree, xtrymalloc, xtrycalloc)
(xtryrealloc): New internal macros.
(_gpgrt_stpcpy, stpcpy): New replacement fucntion and macro.
* src/logging.c (_gpgrt_logv_internal): Use new registry query
function and add standard registry key.

This also fixes the build failure on Widnwos for logging.c.

The code for gpgrt_w32_reg_query_string has been taken from the
function read_w32_registry_string in w32-utils.c in the GPGME package.

  • Signed-off-by: Werner Koch <wk@gnupg.org>


wernerNov 17 2017, 5:25 PM
rE0d8d46c76a32: core: New API functions gpgrt_strdup and gpgrt_strconcat.
aheinecke added inline comments.

I find it nice to have that in gpgrt. But *nitpicky* I would find it nicer if we would handle Unicode in new code.
Here this would mean using the wide char variant and then converting the result with wchar_to_utf8. And note that the return value is utf-8.

It's just a comment not a todo but I don't know how i can just comment in phabricator.

werner added inline comments.Nov 20 2017, 8:37 AM

That is a good idea. Some versions of that code already had utf-8 support. The GPGME version just missed it. doc is entirely missing right now but for sure I will mention utf-9.