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