Fixes for recent windows SDK changes

This commit is contained in:
Jack Andersen 2020-08-22 17:28:34 -10:00
parent 41432143fd
commit 7f63cabaea
1 changed files with 7 additions and 5 deletions

View File

@ -47,7 +47,9 @@
#define FOREGROUND_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
#endif
#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Wformat-truncation"
#endif
void logvisorBp() {}
@ -91,18 +93,18 @@ void RegisterThreadName(const char* name) {
void KillProcessTree() {
DWORD myprocID = GetCurrentProcessId();
PROCESSENTRY32 pe = {};
pe.dwSize = sizeof(PROCESSENTRY32);
PROCESSENTRY32W pe = {};
pe.dwSize = sizeof(pe);
HANDLE hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (::Process32First(hSnap, &pe)) {
if (::Process32FirstW(hSnap, &pe)) {
BOOL bContinue = TRUE;
// kill child processes
while (bContinue) {
// only kill child processes and let console window remain
if (pe.th32ParentProcessID == myprocID && wcscmp(pe.szExeFile, L"conhost.exe")) {
if (pe.th32ParentProcessID == myprocID && std::wcscmp(pe.szExeFile, L"conhost.exe") != 0) {
HANDLE hChildProc = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
if (hChildProc) {
@ -111,7 +113,7 @@ void KillProcessTree() {
}
}
bContinue = ::Process32Next(hSnap, &pe);
bContinue = ::Process32NextW(hSnap, &pe);
}
}
}