Skip to content
Permalink
Browse files

BSoD when lghub is installed and running #646

UsbDk BSoD is fixed in version 1.0.22, it is no more needed to close
ghub before starting GIMX (#651).
  • Loading branch information
matlo committed Mar 21, 2020
1 parent b8087fe commit 2a20cb3d4335967ec114b0403190780b3235d069
Showing with 0 additions and 82 deletions.
  1. +0 −82 launcher/gimx-launcher.cpp
@@ -1296,64 +1296,6 @@ void launcherFrame::readDebugStrings(wxArrayString & values)
}

#ifdef WIN32
bool is_running(const wchar_t * exe)
{
HANDLE processes = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (processes == INVALID_HANDLE_VALUE) {
return false;
}

PROCESSENTRY32 entry = {};
entry.dwSize = sizeof(entry);
if (!Process32First(processes, &entry)) {
CloseHandle(processes);
return false;
}

bool found = 0;

do {

found = (wcscmp(exe, entry.szExeFile) == 0);

} while (Process32Next(processes, &entry) && !found);

CloseHandle(processes);

return found;
}

void destroy(const wchar_t * exe)
{
HANDLE processes = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (processes == INVALID_HANDLE_VALUE) {
return;
}

PROCESSENTRY32 entry = {};
entry.dwSize = sizeof(entry);
if (!Process32First(processes, &entry)) {
CloseHandle(processes);
return;
}

do {

if (wcscmp(exe, entry.szExeFile) == 0)
{
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, (DWORD) entry.th32ProcessID);
if (hProcess != NULL)
{
TerminateProcess(hProcess, 9);
CloseHandle(hProcess);
}
}

} while (Process32Next(processes, &entry));

CloseHandle(processes);
}

void runAs(const wxString& cmd, const wxString& params)
{
SHELLEXECUTEINFO shExInfo = SHELLEXECUTEINFO();
@@ -1512,30 +1454,6 @@ void launcherFrame::OnButtonStartClick(wxCommandEvent& event __attribute__((unus
}
}

#ifdef WIN32
const wchar_t * exes[] = { L"lghub.exe", L"lghub_agent.exe" };
bool found = false;
for (unsigned int e = 0; e < sizeof(exes) / sizeof(*exes) && !found; ++e)
{
found = is_running(exes[e]);
}
if (found)
{
int answer = wxMessageBox(_("Logitech G HUB has to be stopped.\nProceed?"), _("Confirm"), wxYES_NO);
if (answer != wxYES)
{
return;
}
for (unsigned int e = 0; e < sizeof(exes) / sizeof(*exes); ++e)
{
if (is_running(exes[e]))
{
destroy(exes[e]);
}
}
}
#endif

#ifndef WIN32
command.Append(wxT("xterm -e gimx"));
#else

0 comments on commit 2a20cb3

Please sign in to comment.
You can’t perform that action at this time.