From 4272e0a61a829c29cd7cde9adfe2c1eeea384cb6 Mon Sep 17 00:00:00 2001 From: Marc Schlaich Date: Thu, 11 Dec 2014 10:41:12 +0100 Subject: [PATCH] win: fall back to default language in uv_dlerror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/libuv/libuv/pull/59 Reviewed-By: Bert Belder Reviewed-By: Saúl Ibarra Corretgé --- src/win/dl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/win/dl.c b/src/win/dl.c index 059cef80..f7fca81c 100644 --- a/src/win/dl.c +++ b/src/win/dl.c @@ -97,6 +97,13 @@ static int uv__dlerror(uv_lib_t* lib, int errorno) { FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR) &lib->errmsg, 0, NULL); + if (!res && GetLastError() == ERROR_MUI_FILE_NOT_FOUND) { + res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, + 0, (LPSTR) &lib->errmsg, 0, NULL); + } + if (!res) { uv__format_fallback_error(lib, errorno); }