diff --git a/src/win/util.c b/src/win/util.c index ded589c75..fec07b269 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -376,17 +376,12 @@ done: static int uv__get_process_title(void) { - WCHAR title_w[MAX_TITLE_LENGTH]; + WCHAR title_w[MAX_PATH]; DWORD wlen; - DWORD err; - SetLastError(ERROR_SUCCESS); - wlen = GetConsoleTitleW(title_w, sizeof(title_w) / sizeof(WCHAR)); - if (wlen == 0) { - err = GetLastError(); - if (err != 0) - return uv_translate_sys_error(err); - } + wlen = GetModuleFileNameW(NULL, title_w, MAX_PATH); + if (wlen == 0) + return uv_translate_sys_error(GetLastError()); return uv__convert_utf16_to_utf8(title_w, wlen, &process_title); }