win: fix uv_get_process_title
Fixes: https://github.com/libuv/libuv/issues/2667
This commit is contained in:
parent
71801576eb
commit
01f4f89503
@ -376,17 +376,12 @@ done:
|
|||||||
|
|
||||||
|
|
||||||
static int uv__get_process_title(void) {
|
static int uv__get_process_title(void) {
|
||||||
WCHAR title_w[MAX_TITLE_LENGTH];
|
WCHAR title_w[MAX_PATH];
|
||||||
DWORD wlen;
|
DWORD wlen;
|
||||||
DWORD err;
|
|
||||||
|
|
||||||
SetLastError(ERROR_SUCCESS);
|
wlen = GetModuleFileNameW(NULL, title_w, MAX_PATH);
|
||||||
wlen = GetConsoleTitleW(title_w, sizeof(title_w) / sizeof(WCHAR));
|
if (wlen == 0)
|
||||||
if (wlen == 0) {
|
return uv_translate_sys_error(GetLastError());
|
||||||
err = GetLastError();
|
|
||||||
if (err != 0)
|
|
||||||
return uv_translate_sys_error(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return uv__convert_utf16_to_utf8(title_w, wlen, &process_title);
|
return uv__convert_utf16_to_utf8(title_w, wlen, &process_title);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user