summaryrefslogtreecommitdiff
path: root/src/w32-add.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2022-03-04 13:41:19 +0100
committerWerner Koch <wk@gnupg.org>2022-03-04 13:58:09 +0100
commit32dad4e4135f0bdc436ed684da753d4b0cdb0ea1 (patch)
tree4ca66f52c77467d7ff932b9440c06e1352032977 /src/w32-add.h
parent666d64d2bc6539d0ca03dea69abc5a8ccdf37be5 (diff)
downloadlibgpg-error-32dad4e4135f0bdc436ed684da753d4b0cdb0ea1.tar.gz
w32: Support file names longer than MAX_PATH.
* src/sysutils.c (any8bitchar): Remove. (_gpgrt_fname_to_wchar): New. (_gpgrt_mkdir): Use instead of plain utf8 conversion. (_gpgrt_access): Reimplement using GetFileAttributesW so that long files names are supported. * src/estream.c (_gpgrt_w32_get_last_err_code): New. (func_file_create_w32): New. (_gpgrt_fopen): Handle the "sysopen" mode flag. Support mapping of /dev/null. (_gpgrt_freopen): Support mapping of /dev/null. * src/w32-gettext.c (load_domain): Allow long file names. * src/visibility.c (gpgrt_free_wchar): Make function public. (gpgrt_fname_to_wchar): Ditto. (gpgrt_utf8_to_wchar): Ditto. (gpgrt_wchar_to_utf8): Ditto. * src/w32-add.h (gpgrt_free_wchar): New prototype. (gpgrt_fname_to_wchar): Ditto. (gpgrt_utf8_to_wchar): Ditto. (gpgrt_wchar_to_utf8): Ditto. * src/gpg-error.def.in: Add them here too.
Diffstat (limited to 'src/w32-add.h')
-rw-r--r--src/w32-add.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/w32-add.h b/src/w32-add.h
index 3428961..74696bd 100644
--- a/src/w32-add.h
+++ b/src/w32-add.h
@@ -61,6 +61,22 @@ size_t gpgrt_w32_iconv (gpgrt_w32_iconv_t cd,
# define iconv(a,b,c,d,e) gpgrt_w32_iconv ((a),(b),(c),(d),(e))
#endif /*GPGRT_ENABLE_W32_ICONV_MACROS*/
+/* Release a wchar_t * buffer. */
+void gpgrt_free_wchar (wchar_t *wstring);
+
+/* Convert an UTF-8 encoded file name to wchar.
+ * Prepend a '\\?\' prefix if needed. */
+wchar_t *gpgrt_fname_to_wchar (const char *fname);
+
+/* Convert an UTF8 string to a WCHAR string. Caller should use
+ * gpgrt_free_wchar to release the result.
+ * Returns NULL on error and sets ERRNO. */
+wchar_t *gpgrt_utf8_to_wchar (const char *string);
+
+/* Convert a WCHAR string to UTF-8. Caller should use gpgrt_free to
+ * release the result. Returns NULL on error and sets ERRNO. */
+char *gpgrt_wchar_to_utf8 (const wchar_t *wstring);
+
/* Query a string in the registry. */
char *gpgrt_w32_reg_query_string (const char *root,
const char *dir,