win: fix uv_get_process_title
Fixes: https://github.com/libuv/libuv/issues/2667
This commit is contained in:
parent
4839e28d50
commit
f492f56b34
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user