mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 18:14:12 +08:00
mdbx-test: workaround for QueryFullProcessImageNameA() bug.
Change-Id: Icd06d7b15f8bef20a9fb75639a7ab7a298fe0120
This commit is contained in:
parent
d6c954cd43
commit
60271687ef
@ -262,12 +262,18 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
|
|||||||
STARTUPINFOA StartupInfo;
|
STARTUPINFOA StartupInfo;
|
||||||
GetStartupInfoA(&StartupInfo);
|
GetStartupInfoA(&StartupInfo);
|
||||||
|
|
||||||
char exename[_MAX_PATH];
|
char exename[_MAX_PATH + 1];
|
||||||
DWORD exename_size = sizeof(exename);
|
DWORD exename_size = sizeof(exename);
|
||||||
if (!QueryFullProcessImageNameA(GetCurrentProcess(), 0, exename,
|
if (!QueryFullProcessImageNameA(GetCurrentProcess(), 0, exename,
|
||||||
&exename_size))
|
&exename_size))
|
||||||
failure_perror("QueryFullProcessImageName()", GetLastError());
|
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 = "$ ";
|
std::string cmdline = "$ ";
|
||||||
ArgvQuote(cmdline, thunk_param(config));
|
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 environment.
|
||||||
NULL, // Inherit the parent's current directory.
|
NULL, // Inherit the parent's current directory.
|
||||||
&StartupInfo, &ProcessInformation))
|
&StartupInfo, &ProcessInformation))
|
||||||
return GetLastError();
|
failure_perror(exename, GetLastError());
|
||||||
|
|
||||||
CloseHandle(ProcessInformation.hThread);
|
CloseHandle(ProcessInformation.hThread);
|
||||||
pid = ProcessInformation.dwProcessId;
|
pid = ProcessInformation.dwProcessId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user