summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
authorMartin Tournoij <martin@arp242.net>2021-07-24 13:57:29 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-24 13:57:29 +0200
commit1a3e5747b7df7ddda312bbfd18e04fc2122001fb (patch)
treedf3916d14b86db869aa32ce5a032e4d7dc09f0fa /src/os_win32.c
parent5a234eb18e6e43408755bb24e813330306c11629 (diff)
downloadvim-git-1a3e5747b7df7ddda312bbfd18e04fc2122001fb.tar.gz
patch 8.2.3208: dynamic library load error does not mention why it failedv8.2.3208
Problem: Dynamic library load error does not mention why it failed. Solution: Add the error message. (Martin Tournoij, closes #8621)
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index eff2269f8..91bd18a8b 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -716,7 +716,7 @@ dyn_libintl_init(void)
if (p_verbose > 0)
{
verbose_enter();
- semsg(_(e_loadlib), GETTEXT_DLL);
+ semsg(_(e_loadlib), GETTEXT_DLL, GetWin32Error());
verbose_leave();
}
return 0;
@@ -8353,3 +8353,19 @@ resize_console_buf(void)
}
}
#endif
+
+ char *
+GetWin32Error(void)
+{
+ char *msg = NULL;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
+ if (msg != NULL)
+ {
+ // remove trailing \r\n
+ char *pcrlf = strstr(msg, "\r\n");
+ if (pcrlf != NULL)
+ *pcrlf = '\0';
+ }
+ return msg;
+}