Require explicit opt-in to enable process injection on windows

* This option (in spite of large warnings) continues to be a pitfall for new and
  experienced users alike, trying to use process injection without good reason
  and getting into trouble when it breaks.
This commit is contained in:
baldurk
2021-05-24 16:51:43 +01:00
parent 399f1c59e0
commit 2ddf567fec
5 changed files with 63 additions and 5 deletions
@@ -221,6 +221,7 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
#endif
ui->AllowGlobalHook->setChecked(m_Ctx.Config().AllowGlobalHook);
ui->AllowProcessInject->setChecked(m_Ctx.Config().AllowProcessInject);
ui->EventBrowser_TimeUnit->setCurrentIndex((int)m_Ctx.Config().EventBrowser_TimeUnit);
ui->EventBrowser_AddFake->setChecked(m_Ctx.Config().EventBrowser_AddFake);
@@ -248,6 +249,12 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
ui->globalHookLabel->setToolTip(disabledTooltip);
}
// process injection is not supported on non-Windows
#if !defined(Q_OS_WIN32)
ui->injectProcLabel->setVisible(false);
ui->AllowProcessInject->setVisible(false);
#endif
m_Init = false;
QObject::connect(ui->Font_GlobalScale->lineEdit(), &QLineEdit::returnPressed, this,
@@ -390,6 +397,16 @@ void SettingsDialog::on_AllowGlobalHook_toggled(bool checked)
m_Ctx.GetCaptureDialog()->UpdateGlobalHook();
}
void SettingsDialog::on_AllowProcessInject_toggled(bool checked)
{
m_Ctx.Config().AllowProcessInject = ui->AllowProcessInject->isChecked();
m_Ctx.Config().Save();
if(m_Ctx.HasCaptureDialog())
m_Ctx.GetCaptureDialog()->UpdateGlobalHook();
}
void SettingsDialog::on_CheckUpdate_AllowChecks_toggled(bool checked)
{
m_Ctx.Config().CheckUpdate_AllowChecks = ui->CheckUpdate_AllowChecks->isChecked();