ping https://patchew.org/QEMU/[email protected]/ https://lists.gnu.org/archive/html/qemu-devel/2026-06/msg05258.html
On Sun, Jun 21, 2026 at 4:08 PM Evgeny Kolmakov <[email protected]> wrote: > Replace the abort() stub with a proper implementation using > QueryFullProcessImageNameW() and g_utf16_to_utf8() to retrieve > the process executable name on Windows. Returns NULL on error > to match POSIX behavior. > > Signed-off-by: Evgeny Kolmakov <[email protected]> > --- > util/oslib-win32.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/util/oslib-win32.c b/util/oslib-win32.c > index 5f3e8f4d98..2b083b5d7a 100644 > --- a/util/oslib-win32.c > +++ b/util/oslib-win32.c > @@ -287,8 +287,23 @@ bool qemu_finish_async_prealloc_mem(Error **errp) > > char *qemu_get_pid_name(pid_t pid) > { > - /* XXX Implement me */ > - abort(); > + HANDLE hProcess; > + WCHAR path[4096]; > + DWORD size = G_N_ELEMENTS(path); > + char *name = NULL; > + > + hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, > (DWORD)pid); > + if (!hProcess) { > + return NULL; > + } > + > + if (QueryFullProcessImageNameW(hProcess, 0, path, &size)) { > + const WCHAR *base = wcsrchr(path, L'\\'); > + name = g_utf16_to_utf8(base ? base + 1 : path, -1, NULL, NULL, > NULL); > + } > + > + CloseHandle(hProcess); > + return name; > } > > > -- > 2.43.0 > >
