chore: Scope constants in Windows watchdog
This commit is contained in:
parent
84194cf5ef
commit
d8d022e9fe
1 changed files with 7 additions and 6 deletions
|
|
@ -21,11 +21,6 @@
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
#define CURRENT_PROCESS_ID 0
|
|
||||||
|
|
||||||
const auto kStartDelaySeconds = 1;
|
|
||||||
const auto kOutputBufferSize = 4096;
|
|
||||||
|
|
||||||
MSWindowsWatchdog::MSWindowsWatchdog(bool foreground) : m_foreground(foreground)
|
MSWindowsWatchdog::MSWindowsWatchdog(bool foreground) : m_foreground(foreground)
|
||||||
{
|
{
|
||||||
initSasFunc();
|
initSasFunc();
|
||||||
|
|
@ -292,6 +287,8 @@ void MSWindowsWatchdog::setProcessConfig(const std::string &command, bool elevat
|
||||||
|
|
||||||
void MSWindowsWatchdog::outputLoop(void *)
|
void MSWindowsWatchdog::outputLoop(void *)
|
||||||
{
|
{
|
||||||
|
const auto kOutputBufferSize = 4096;
|
||||||
|
|
||||||
// +1 char for \0
|
// +1 char for \0
|
||||||
CHAR buffer[kOutputBufferSize + 1];
|
CHAR buffer[kOutputBufferSize + 1];
|
||||||
|
|
||||||
|
|
@ -368,8 +365,10 @@ void MSWindowsWatchdog::shutdownExistingProcesses()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("shutting down any existing processes");
|
LOG_DEBUG("shutting down any existing processes");
|
||||||
|
|
||||||
|
const auto kAllProcesses = 0;
|
||||||
|
|
||||||
// first we need to take a snapshot of the running processes
|
// first we need to take a snapshot of the running processes
|
||||||
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, CURRENT_PROCESS_ID);
|
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, kAllProcesses);
|
||||||
if (snapshot == INVALID_HANDLE_VALUE) {
|
if (snapshot == INVALID_HANDLE_VALUE) {
|
||||||
LOG((CLOG_ERR "could not get process snapshot"));
|
LOG((CLOG_ERR "could not get process snapshot"));
|
||||||
throw XArch(new XArchEvalWindows);
|
throw XArch(new XArchEvalWindows);
|
||||||
|
|
@ -456,6 +455,8 @@ std::string MSWindowsWatchdog::runActiveDesktopUtility()
|
||||||
|
|
||||||
void MSWindowsWatchdog::handleStartError(const std::string_view &message)
|
void MSWindowsWatchdog::handleStartError(const std::string_view &message)
|
||||||
{
|
{
|
||||||
|
const auto kStartDelaySeconds = 1;
|
||||||
|
|
||||||
m_startFailures++;
|
m_startFailures++;
|
||||||
|
|
||||||
if (!message.empty()) {
|
if (!message.empty()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue