UI: Portable: Uninstall driver on exit

If there is no installed Service or boot-filter.
This commit is contained in:
Nodir Temirkhodjaev 2024-04-30 15:24:07 +03:00
parent be47b3f6b3
commit 13ecc14775
2 changed files with 18 additions and 1 deletions

View File

@ -135,7 +135,7 @@ FortManager::FortManager(QObject *parent) : QObject(parent) { }
FortManager::~FortManager() FortManager::~FortManager()
{ {
if (m_initialized) { if (m_initialized) {
closeDriver(); closeOrRemoveDriver();
} }
deleteManagers(); deleteManagers();
@ -334,6 +334,20 @@ void FortManager::closeDriver()
QCoreApplication::sendPostedEvents(this); QCoreApplication::sendPostedEvents(this);
} }
void FortManager::closeOrRemoveDriver()
{
if (canInstallDriver() && !IoC<FortSettings>()->hasService()) {
const FirewallConf *conf = IoC<ConfManager>()->conf();
if (!conf->bootFilter()) {
removeDriver();
return;
}
}
closeDriver();
}
bool FortManager::canInstallDriver() const bool FortManager::canInstallDriver() const
{ {
const auto settings = IoC<FortSettings>(); const auto settings = IoC<FortSettings>();

View File

@ -44,7 +44,10 @@ private:
bool setupDriver(); bool setupDriver();
void closeDriver(); void closeDriver();
void closeOrRemoveDriver();
bool canInstallDriver() const; bool canInstallDriver() const;
void checkReinstallDriver(); void checkReinstallDriver();
void checkDriverOpened(); void checkDriverOpened();
void checkStartService(); void checkStartService();