Export windows_format_system_message utility on Windows

Declare the function in `system.h`, so we can use it in other platform-specific components.
This commit is contained in:
Robert Müller 2023-01-20 21:35:45 +01:00
parent f78fd6bda1
commit f7d3052170
2 changed files with 15 additions and 1 deletions

View file

@ -1437,7 +1437,7 @@ static int priv_net_close_all_sockets(NETSOCKET sock)
}
#if defined(CONF_FAMILY_WINDOWS)
static char *windows_format_system_message(unsigned long error)
char *windows_format_system_message(unsigned long error)
{
WCHAR *wide_message;
const DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_MAX_WIDTH_MASK;

View file

@ -1147,6 +1147,20 @@ void net_unix_set_addr(UNIXSOCKETADDR *addr, const char *path);
*/
void net_unix_close(UNIXSOCKET sock);
#elif defined(CONF_FAMILY_WINDOWS)
/**
* Formats a Windows error code as a human-readable string.
*
* @param error The Windows error code.
*
* @return A new string representing the error code.
*
* @remark Guarantees that result will contain zero-termination.
* @remark The result must be freed after it has been used.
*/
char *windows_format_system_message(unsigned long error);
#endif
/**