From ebb818bbf0d29139922199f38afa8c4d27d0f036 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Tue, 23 Oct 2018 15:44:37 +0200 Subject: [PATCH] win, dl: proper error messages on some systems On some localized Windows 10 machines FormatMessage can fail with ERROR_RESOURCE_TYPE_NOT_FOUND when trying to generate dlopen error message. This adds support for this corner case. PR-URL: https://github.com/libuv/libuv/pull/2052 Reviewed-By: Ben Noordhuis Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig --- src/win/dl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win/dl.c b/src/win/dl.c index 97ac1c1a..5b84555c 100644 --- a/src/win/dl.c +++ b/src/win/dl.c @@ -107,7 +107,8 @@ static int uv__dlerror(uv_lib_t* lib, const char* filename, DWORD errorno) { MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR) &lib->errmsg, 0, NULL); - if (!res && GetLastError() == ERROR_MUI_FILE_NOT_FOUND) { + if (!res && (GetLastError() == ERROR_MUI_FILE_NOT_FOUND || + GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND)) { res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno,