mirror of
https://github.com/tnodir/fort
synced 2024-11-15 01:47:47 +00:00
Installer: Add option "Block access to network when Fort Firewall is not running".
This commit is contained in:
parent
cb9897ede5
commit
ebf3f2ddeb
@ -32,20 +32,25 @@ SolidCompression=yes
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "provBoot"; Description: "Block access to network when Fort Firewall is not running"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: ".\build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
||||
[Icons]
|
||||
; Start menu shortcut
|
||||
Name: "{group}\{#APP_NAME}"; Filename: "{app}\{#APP_EXE_NAME}"; IconFilename: "{app}\fort.ico"
|
||||
; Unistaller shortcut
|
||||
; Uninstaller shortcut
|
||||
Name: "{group}\{cm:UninstallProgram,{#APP_NAME}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\fort.ico"
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#APP_EXE_NAME}"; Parameters: "-b=1"; Description: "Provider boot"; Flags: runascurrentuser; Tasks: provBoot
|
||||
Filename: "{app}\driver\scripts\install.bat"; Description: "Install driver"; Flags: runascurrentuser
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "{app}\driver\scripts\uninstall.bat"; Flags: runascurrentuser
|
||||
Filename: "{app}\{#APP_EXE_NAME}"; Parameters: "-b=0"; Flags: runascurrentuser
|
||||
|
||||
[UninstallDelete]
|
||||
Type: filesandordirs; Name: "{app}"
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
FortSettings::FortSettings(const QStringList &args,
|
||||
QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
m_hasProvBoot(false),
|
||||
m_provBoot(false)
|
||||
{
|
||||
processArguments(args);
|
||||
setupIni();
|
||||
@ -37,9 +39,10 @@ void FortSettings::processArguments(const QStringList &args)
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
const QCommandLineOption bootOption(
|
||||
"boot", "Block access to network when Fort Firewall is not running.");
|
||||
parser.addOption(bootOption);
|
||||
const QCommandLineOption provBootOption(
|
||||
QStringList() << "b" << "boot",
|
||||
"Block access to network when Fort Firewall is not running.", "boot");
|
||||
parser.addOption(provBootOption);
|
||||
|
||||
const QCommandLineOption profileOption(
|
||||
QStringList() << "p" << "profile",
|
||||
@ -51,7 +54,10 @@ void FortSettings::processArguments(const QStringList &args)
|
||||
|
||||
parser.process(args);
|
||||
|
||||
m_boot = parser.isSet(bootOption);
|
||||
m_hasProvBoot = parser.isSet(provBootOption);
|
||||
if (m_hasProvBoot) {
|
||||
m_provBoot = QVariant(parser.value(provBootOption)).toBool();
|
||||
}
|
||||
|
||||
m_profilePath = parser.value(profileOption);
|
||||
if (m_profilePath.isEmpty()) {
|
||||
|
@ -21,7 +21,8 @@ public:
|
||||
explicit FortSettings(const QStringList &args,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
bool boot() const { return m_boot; }
|
||||
bool hasProvBoot() const { return m_hasProvBoot; }
|
||||
bool provBoot() const { return m_provBoot; }
|
||||
|
||||
bool debug() const { return iniBool("base/debug"); }
|
||||
void setDebug(bool on) { setIniValue("base/debug", on); }
|
||||
@ -75,7 +76,8 @@ private:
|
||||
static QString startupShortcutPath();
|
||||
|
||||
private:
|
||||
uint m_boot : 1;
|
||||
uint m_hasProvBoot : 1;
|
||||
uint m_provBoot : 1;
|
||||
|
||||
QString m_profilePath;
|
||||
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
OsUtil::createGlobalMutex(APP_NAME);
|
||||
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
@ -21,11 +19,15 @@ int main(int argc, char *argv[])
|
||||
FortSettings fortSettings(qApp->arguments());
|
||||
|
||||
// Register booted provider and exit
|
||||
if (fortSettings.boot()) {
|
||||
if (fortSettings.hasProvBoot()) {
|
||||
FortCommon::provUnregister();
|
||||
return FortCommon::provRegister(true);
|
||||
return fortSettings.provBoot()
|
||||
? FortCommon::provRegister(true) : 0;
|
||||
}
|
||||
|
||||
// To check running instance
|
||||
OsUtil::createGlobalMutex(APP_NAME);
|
||||
|
||||
FortManager fortManager(&fortSettings);
|
||||
|
||||
// Error: Cannot open the driver device
|
||||
|
Loading…
Reference in New Issue
Block a user