win: fall back to default language in uv_dlerror

PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Marc Schlaich 2014-12-11 10:41:12 +01:00 committed by Bert Belder
parent 6eb2eaa753
commit 4272e0a61a

View File

@ -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);
}