aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/win32-utils.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-01-31 19:36:27 -0800
committerGuy Harris <guy@alum.mit.edu>2019-02-01 04:17:16 +0000
commitce6b5dba47d296b6e97482c9e734341a0897e0ac (patch)
tree22f79900c5081bfb68c794d0cb8465fea4a4ec05 /wsutil/win32-utils.h
parent768a746ede4e06840846f7b11765edaf494aa994 (diff)
Have win32strerror() return a g_malloc()ated UTF-8 error message.
Use FormatMessageW() to get a UTF-16-encoded Unicode error string, rather than an error string in the local code page, and then convert it from UTF-16 to UTF-8. Make it dynamically-allocated, so it's big enough and so that we are thread-safe. Make the callers free the result. Change-Id: I217aec5a644fa0176a829f181eb05561cb9d10f4 Reviewed-on: https://code.wireshark.org/review/31846 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil/win32-utils.h')
-rw-r--r--wsutil/win32-utils.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/wsutil/win32-utils.h b/wsutil/win32-utils.h
index 553d8f1921..13d06c591c 100644
--- a/wsutil/win32-utils.h
+++ b/wsutil/win32-utils.h
@@ -48,13 +48,14 @@ extern "C" {
WS_DLL_PUBLIC
gchar * protect_arg (const gchar *argv);
-/** Generate a string for a Win32 error.
+/** Generate a string for a Windows error.
*
- * @param error The windows error code
- * @return a localized string containing the corresponding error message
+ * @param error The Windows error code
+ * @return a localized UTF-8 string containing the corresponding error message;
+ * it must be freed with g_free().
*/
WS_DLL_PUBLIC
-const char * win32strerror(DWORD error);
+char * win32strerror(DWORD error);
/** Generate a string for a Win32 exception code.
*