diff --git a/test/osal-windows.cc b/test/osal-windows.cc index 81f1da7f..7d59f657 100644 --- a/test/osal-windows.cc +++ b/test/osal-windows.cc @@ -262,12 +262,18 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) { STARTUPINFOA StartupInfo; GetStartupInfoA(&StartupInfo); - char exename[_MAX_PATH]; + char exename[_MAX_PATH + 1]; DWORD exename_size = sizeof(exename); if (!QueryFullProcessImageNameA(GetCurrentProcess(), 0, exename, &exename_size)) failure_perror("QueryFullProcessImageName()", GetLastError()); + if (exename[1] != ':') { + exename_size = GetModuleFileName(NULL, exename, sizeof(exename)); + if (exename_size >= sizeof(exename)) + return ERROR_BAD_LENGTH; + } + std::string cmdline = "$ "; ArgvQuote(cmdline, thunk_param(config)); @@ -283,7 +289,7 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) { NULL, // Inherit the parent's environment. NULL, // Inherit the parent's current directory. &StartupInfo, &ProcessInformation)) - return GetLastError(); + failure_perror(exename, GetLastError()); CloseHandle(ProcessInformation.hThread); pid = ProcessInformation.dwProcessId;