Skip to content

Commit

Permalink
[BUGFIX] In util::process_start_time: fixed value returned on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Jan 31, 2025
1 parent ad266de commit f97f8a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/time_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LONGLONG util::FileTime_to_POSIX(FILETIME ft)
LONGLONG util::process_start_time(IN DWORD pid)
{
static auto mod = GetModuleHandleA("ntdll.dll");
if (!mod) return false;
if (!mod) return INVALID_TIME;

static auto pNtQuerySystemInformation = reinterpret_cast<decltype(&NtQuerySystemInformation)>(GetProcAddress(mod, "NtQuerySystemInformation"));
if (!pNtQuerySystemInformation) return false;
Expand All @@ -69,15 +69,15 @@ LONGLONG util::process_start_time(IN DWORD pid)
status = pNtQuerySystemInformation(SystemProcessInformation, bBuf.buf, bBuf.buf_size, &ret_len);
if (status == STATUS_INFO_LENGTH_MISMATCH) {
if (!bBuf.alloc(ret_len)) {
return false;
return INVALID_TIME;
}
continue; // try again
}
break; //other error, or success
};

if (status != STATUS_SUCCESS) {
return false;
return INVALID_TIME;
}

bool found = false;
Expand Down

0 comments on commit f97f8a9

Please sign in to comment.