diff --git a/deploy/FortFirewall.iss b/deploy/FortFirewall.iss index 37cfdea0..bcf90612 100644 --- a/deploy/FortFirewall.iss +++ b/deploy/FortFirewall.iss @@ -1,5 +1,5 @@ -#include AddBackslash(SourcePath) + "..\src\common\version.h" +#include AddBackslash(SourcePath) + "..\src\version.h" #define APP_EXE_NAME "FortFirewall.exe" diff --git a/src/common/Common.pri b/src/common/Common.pri deleted file mode 100644 index 2acb9f1b..00000000 --- a/src/common/Common.pri +++ /dev/null @@ -1,10 +0,0 @@ - -SOURCES += \ - $$PWD/fortconf.c \ - $$PWD/fortlog.c \ - $$PWD/fortprov.c - -HEADERS += \ - $$PWD/common.h \ - $$PWD/fortconf.h \ - $$PWD/version.h diff --git a/src/driver/Driver.pri b/src/driver/Driver.pri new file mode 100644 index 00000000..35ce80cb --- /dev/null +++ b/src/driver/Driver.pri @@ -0,0 +1,25 @@ +INCLUDEPATH += $$PWD + +SOURCES += \ + $$PWD/common/fortconf.c \ + $$PWD/common/fortlog.c \ + $$PWD/common/fortprov.c + +HEADERS += \ + $$PWD/common/common.h \ + $$PWD/common/fortconf.h \ + $$PWD/common/fortdev.h + +# Kernel Driver +installer_build { + BUILDCMD = MSBuild $$PWD/fortdrv.vcxproj /p:OutDir=./;IntDir=$$OUT_PWD/driver/ + + fortdrv32.target = $$PWD/fortfw32.sys + fortdrv32.commands = $$BUILDCMD /p:Platform=Win32 + + fortdrv64.target = $$PWD/fortfw64.sys + fortdrv64.commands = $$BUILDCMD /p:Platform=x64 + + QMAKE_EXTRA_TARGETS += fortdrv32 fortdrv64 + PRE_TARGETDEPS += $$fortdrv32.target $$fortdrv64.target +} diff --git a/src/driver/common/common.h b/src/driver/common/common.h new file mode 100644 index 00000000..3a71caf6 --- /dev/null +++ b/src/driver/common/common.h @@ -0,0 +1,16 @@ +#ifndef COMMON_H +#define COMMON_H + +#ifndef NT_SUCCESS +#define NT_SUCCESS(status) ((LONG) (status) >= 0) +#endif + +#define FORT_STATUS_USER_ERROR STATUS_INVALID_PARAMETER +#define FORT_ERROR_USER_ERROR ERROR_INVALID_PARAMETER + +/* Convert system time to seconds since 1970 */ +#define SECSPERDAY 86400 +#define SECS_1601_TO_1970 ((369 * 365 + 89) * (INT64) SECSPERDAY) /* 1601 to 1970 is 369 years plus 89 leap days */ +#define fort_system_to_unix_time(system_time) ((system_time) / 10000000 - SECS_1601_TO_1970) + +#endif COMMON_H diff --git a/src/common/fortconf.c b/src/driver/common/fortconf.c similarity index 100% rename from src/common/fortconf.c rename to src/driver/common/fortconf.c diff --git a/src/common/fortconf.h b/src/driver/common/fortconf.h similarity index 100% rename from src/common/fortconf.h rename to src/driver/common/fortconf.h diff --git a/src/common/common.h b/src/driver/common/fortdev.h similarity index 86% rename from src/common/common.h rename to src/driver/common/fortdev.h index 5f16174e..e3698a20 100644 --- a/src/common/common.h +++ b/src/driver/common/fortdev.h @@ -1,7 +1,5 @@ -#ifndef COMMON_H -#define COMMON_H - -#include "version.h" +#ifndef FORTDEV_H +#define FORTDEV_H #define INITGUID #include @@ -88,17 +86,4 @@ DEFINE_GUID(FORT_GUID_FILTER_REAUTH_OUT, #define FORT_IOCTL_SETZONES FORT_CTL_CODE(6, FILE_WRITE_DATA) #define FORT_IOCTL_SETZONEFLAG FORT_CTL_CODE(7, FILE_WRITE_DATA) - -#ifndef NT_SUCCESS -#define NT_SUCCESS(status) ((LONG) (status) >= 0) -#endif - -#define FORT_STATUS_USER_ERROR STATUS_INVALID_PARAMETER -#define FORT_ERROR_USER_ERROR ERROR_INVALID_PARAMETER - -/* Convert system time to seconds since 1970 */ -#define SECSPERDAY 86400 -#define SECS_1601_TO_1970 ((369 * 365 + 89) * (INT64) SECSPERDAY) /* 1601 to 1970 is 369 years plus 89 leap days */ -#define fort_system_to_unix_time(system_time) ((system_time) / 10000000 - SECS_1601_TO_1970) - -#endif COMMON_H +#endif FORTDEV_H diff --git a/src/common/fortlog.c b/src/driver/common/fortlog.c similarity index 100% rename from src/common/fortlog.c rename to src/driver/common/fortlog.c diff --git a/src/common/fortprov.c b/src/driver/common/fortprov.c similarity index 100% rename from src/common/fortprov.c rename to src/driver/common/fortprov.c diff --git a/src/common/wildmatch.c b/src/driver/common/wildmatch.c similarity index 100% rename from src/common/wildmatch.c rename to src/driver/common/wildmatch.c diff --git a/src/driver/fortdrv.c b/src/driver/fortdrv.c index 980b944c..314227f1 100644 --- a/src/driver/fortdrv.c +++ b/src/driver/fortdrv.c @@ -12,7 +12,9 @@ #include #include -#include "../common/common.h" +#include "../version.h" +#include "common/common.h" +#include "common/fortdev.h" #include "fortdrv.h" #define FORT_DEVICE_POOL_TAG 'DwfF' diff --git a/src/driver/fortdrv.rc b/src/driver/fortdrv.rc index 78dc9ebc..9f252969 100644 --- a/src/driver/fortdrv.rc +++ b/src/driver/fortdrv.rc @@ -1,7 +1,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include "../common/version.h" +#include "../version.h" #define VER_FILEVERSION APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,DRIVER_VERSION #define VER_FILEVERSION_STR APP_VERSION_STR diff --git a/src/driver/fortdrv.vcxproj b/src/driver/fortdrv.vcxproj index 3bc4b62a..35464f4b 100644 --- a/src/driver/fortdrv.vcxproj +++ b/src/driver/fortdrv.vcxproj @@ -70,7 +70,6 @@ - diff --git a/src/ui/FortFirewall.pro b/src/ui/FortFirewall.pro index ec0bada6..b0655011 100644 --- a/src/ui/FortFirewall.pro +++ b/src/ui/FortFirewall.pro @@ -121,6 +121,7 @@ SOURCES += \ util/worker/workerobject.cpp HEADERS += \ + ../version.h \ conf/addressgroup.h \ conf/appgroup.h \ conf/confmanager.h \ @@ -232,7 +233,8 @@ HEADERS += \ util/worker/workermanager.h \ util/worker/workerobject.h -include(../common/Common.pri) +# Driver integration +include(../driver/Driver.pri) # Images RESOURCES += fort-images.qrc @@ -265,20 +267,6 @@ LIBS += -lfwpuclnt -lkernel32 -luser32 -luuid -lversion -lws2_32 RC_FILE = FortFirewall.rc OTHER_FILES += $${RC_FILE} -# Kernel Driver -installer_build { - BUILDCMD = MSBuild $$PWD/../driver/fortdrv.vcxproj /p:OutDir=./;IntDir=$$OUT_PWD/driver/ - - fortdrv32.target = $$PWD/../driver/fortfw32.sys - fortdrv32.commands = $$BUILDCMD /p:Platform=Win32 - - fortdrv64.target = $$PWD/../driver/fortfw64.sys - fortdrv64.commands = $$BUILDCMD /p:Platform=x64 - - QMAKE_EXTRA_TARGETS += fortdrv32 fortdrv64 - PRE_TARGETDEPS += $$fortdrv32.target $$fortdrv64.target -} - # Visual Leak Detector visual_leak_detector { VLD_PATH = D:/Utils/Dev/VisualLeakDetector diff --git a/src/ui/FortFirewall.rc b/src/ui/FortFirewall.rc index c3cca484..d1138c0b 100644 --- a/src/ui/FortFirewall.rc +++ b/src/ui/FortFirewall.rc @@ -1,7 +1,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include "../common/version.h" +#include "../version.h" #define VER_FILEVERSION APP_VERSION_MAJOR,APP_VERSION_MINOR,APP_VERSION_PATCH,0 #define VER_FILEVERSION_STR APP_VERSION_STR diff --git a/src/ui/fortcommon.cpp b/src/ui/fortcommon.cpp index ee2d3264..d78c4d8b 100644 --- a/src/ui/fortcommon.cpp +++ b/src/ui/fortcommon.cpp @@ -6,12 +6,13 @@ #include #include -#include "../common/common.h" -#include "../common/fortconf.h" +#include +#include +#include -#include "../common/fortconf.c" -#include "../common/fortlog.c" -#include "../common/fortprov.c" +#include +#include +#include FortCommon::FortCommon(QObject *parent) : QObject(parent) { } diff --git a/src/ui/fortsettings.h b/src/ui/fortsettings.h index ce93c1cd..1c339571 100644 --- a/src/ui/fortsettings.h +++ b/src/ui/fortsettings.h @@ -7,7 +7,7 @@ #include #include -#include "../common/version.h" +#include "../version.h" QT_FORWARD_DECLARE_CLASS(FirewallConf) diff --git a/src/ui/main.cpp b/src/ui/main.cpp index ce2f2a92..6b58ad25 100644 --- a/src/ui/main.cpp +++ b/src/ui/main.cpp @@ -7,7 +7,7 @@ # include #endif -#include "../common/version.h" +#include "../version.h" #include "control/controlmanager.h" #include "control/controlworker.h" #include "driver/drivermanager.h" diff --git a/src/ui/task/taskinfoupdatechecker.cpp b/src/ui/task/taskinfoupdatechecker.cpp index 77975045..2a584416 100644 --- a/src/ui/task/taskinfoupdatechecker.cpp +++ b/src/ui/task/taskinfoupdatechecker.cpp @@ -2,7 +2,7 @@ #include -#include "../../common/version.h" +#include "../../version.h" #include "../fortmanager.h" #include "taskupdatechecker.h" diff --git a/src/ui/task/taskupdatechecker.cpp b/src/ui/task/taskupdatechecker.cpp index 02afe8f1..11b34300 100644 --- a/src/ui/task/taskupdatechecker.cpp +++ b/src/ui/task/taskupdatechecker.cpp @@ -4,7 +4,7 @@ #include #include -#include "../../common/version.h" +#include "../../version.h" #include "../util/net/netdownloader.h" #include "../util/net/netutil.h" #include "../util/json/jsonutil.h" diff --git a/src/tests/FortFirewallTest.pro b/src/ui/tests/FortFirewallTest.pro similarity index 100% rename from src/tests/FortFirewallTest.pro rename to src/ui/tests/FortFirewallTest.pro diff --git a/src/tests/common/Test.pri b/src/ui/tests/common/Test.pri similarity index 79% rename from src/tests/common/Test.pri rename to src/ui/tests/common/Test.pri index ba3013e3..78d2b123 100644 --- a/src/tests/common/Test.pri +++ b/src/ui/tests/common/Test.pri @@ -6,7 +6,7 @@ CONFIG -= app_bundle TARGET = test TEMPLATE = app -UIPATH = $$PWD/../../ui +UIPATH = $$PWD/../.. INCLUDEPATH += $$UIPATH INCLUDEPATH += $$PWD @@ -19,5 +19,8 @@ HEADERS += \ $$PWD/commontest.h \ test.h +# Driver integration +include(../../../driver/Driver.pri) + # Windows LIBS += -lfwpuclnt -lkernel32 -luser32 -luuid -lws2_32 diff --git a/src/tests/common/commontest.h b/src/ui/tests/common/commontest.h similarity index 100% rename from src/tests/common/commontest.h rename to src/ui/tests/common/commontest.h diff --git a/src/tests/common/main.cpp b/src/ui/tests/common/main.cpp similarity index 100% rename from src/tests/common/main.cpp rename to src/ui/tests/common/main.cpp diff --git a/src/tests/confutil/ConfUtil.pro b/src/ui/tests/confutil/ConfUtil.pro similarity index 100% rename from src/tests/confutil/ConfUtil.pro rename to src/ui/tests/confutil/ConfUtil.pro diff --git a/src/tests/confutil/test.cpp b/src/ui/tests/confutil/test.cpp similarity index 100% rename from src/tests/confutil/test.cpp rename to src/ui/tests/confutil/test.cpp diff --git a/src/tests/confutil/test.h b/src/ui/tests/confutil/test.h similarity index 100% rename from src/tests/confutil/test.h rename to src/ui/tests/confutil/test.h diff --git a/src/tests/fileutil/FileUtil.pro b/src/ui/tests/fileutil/FileUtil.pro similarity index 100% rename from src/tests/fileutil/FileUtil.pro rename to src/ui/tests/fileutil/FileUtil.pro diff --git a/src/tests/fileutil/test.cpp b/src/ui/tests/fileutil/test.cpp similarity index 100% rename from src/tests/fileutil/test.cpp rename to src/ui/tests/fileutil/test.cpp diff --git a/src/tests/fileutil/test.h b/src/ui/tests/fileutil/test.h similarity index 100% rename from src/tests/fileutil/test.h rename to src/ui/tests/fileutil/test.h diff --git a/src/tests/logbuffer/LogBuffer.pro b/src/ui/tests/logbuffer/LogBuffer.pro similarity index 100% rename from src/tests/logbuffer/LogBuffer.pro rename to src/ui/tests/logbuffer/LogBuffer.pro diff --git a/src/tests/logbuffer/test.cpp b/src/ui/tests/logbuffer/test.cpp similarity index 100% rename from src/tests/logbuffer/test.cpp rename to src/ui/tests/logbuffer/test.cpp diff --git a/src/tests/logbuffer/test.h b/src/ui/tests/logbuffer/test.h similarity index 100% rename from src/tests/logbuffer/test.h rename to src/ui/tests/logbuffer/test.h diff --git a/src/tests/logreader/LogReader.pro b/src/ui/tests/logreader/LogReader.pro similarity index 96% rename from src/tests/logreader/LogReader.pro rename to src/ui/tests/logreader/LogReader.pro index fbdc21e3..8402a62d 100644 --- a/src/tests/logreader/LogReader.pro +++ b/src/ui/tests/logreader/LogReader.pro @@ -32,7 +32,7 @@ HEADERS += \ $$UIPATH/log/logentryprocnew.h \ $$UIPATH/log/logentrystattraf.h \ $$UIPATH/util/conf/addressrange.h \ - $$UIPATH/util/conf/confappswalker.cpp \ + $$UIPATH/util/conf/confappswalker.h \ $$UIPATH/util/conf/confutil.h \ $$UIPATH/util/dateutil.h \ $$UIPATH/util/device.h \ diff --git a/src/tests/logreader/test.cpp b/src/ui/tests/logreader/test.cpp similarity index 100% rename from src/tests/logreader/test.cpp rename to src/ui/tests/logreader/test.cpp diff --git a/src/tests/logreader/test.h b/src/ui/tests/logreader/test.h similarity index 100% rename from src/tests/logreader/test.h rename to src/ui/tests/logreader/test.h diff --git a/src/tests/netutil/NetUtil.pro b/src/ui/tests/netutil/NetUtil.pro similarity index 100% rename from src/tests/netutil/NetUtil.pro rename to src/ui/tests/netutil/NetUtil.pro diff --git a/src/tests/netutil/data/tasix-mrlg.html b/src/ui/tests/netutil/data/tasix-mrlg.html similarity index 100% rename from src/tests/netutil/data/tasix-mrlg.html rename to src/ui/tests/netutil/data/tasix-mrlg.html diff --git a/src/tests/netutil/test.cpp b/src/ui/tests/netutil/test.cpp similarity index 100% rename from src/tests/netutil/test.cpp rename to src/ui/tests/netutil/test.cpp diff --git a/src/tests/netutil/test.h b/src/ui/tests/netutil/test.h similarity index 100% rename from src/tests/netutil/test.h rename to src/ui/tests/netutil/test.h diff --git a/src/tests/stat/Stat.pro b/src/ui/tests/stat/Stat.pro similarity index 100% rename from src/tests/stat/Stat.pro rename to src/ui/tests/stat/Stat.pro diff --git a/src/tests/stat/data.qrc b/src/ui/tests/stat/data.qrc similarity index 100% rename from src/tests/stat/data.qrc rename to src/ui/tests/stat/data.qrc diff --git a/src/tests/stat/data/migrations/1.sql b/src/ui/tests/stat/data/migrations/1.sql similarity index 100% rename from src/tests/stat/data/migrations/1.sql rename to src/ui/tests/stat/data/migrations/1.sql diff --git a/src/tests/stat/data/migrations/2.sql b/src/ui/tests/stat/data/migrations/2.sql similarity index 100% rename from src/tests/stat/data/migrations/2.sql rename to src/ui/tests/stat/data/migrations/2.sql diff --git a/src/tests/stat/data/migrations/3.sql b/src/ui/tests/stat/data/migrations/3.sql similarity index 100% rename from src/tests/stat/data/migrations/3.sql rename to src/ui/tests/stat/data/migrations/3.sql diff --git a/src/tests/stat/test.cpp b/src/ui/tests/stat/test.cpp similarity index 100% rename from src/tests/stat/test.cpp rename to src/ui/tests/stat/test.cpp diff --git a/src/tests/stat/test.h b/src/ui/tests/stat/test.h similarity index 100% rename from src/tests/stat/test.h rename to src/ui/tests/stat/test.h diff --git a/src/ui/util/conf/confutil.cpp b/src/ui/util/conf/confutil.cpp index 284df3dd..f7499f87 100644 --- a/src/ui/util/conf/confutil.cpp +++ b/src/ui/util/conf/confutil.cpp @@ -8,13 +8,14 @@ #define UINT32 quint32 #define UINT64 quint64 -#include "../../common/fortconf.h" -#include "../../common/version.h" +#include + #include "../../conf/addressgroup.h" #include "../../conf/appgroup.h" #include "../../conf/firewallconf.h" #include "../../fortcommon.h" #include "../../util/conf/confappswalker.h" +#include "../../version.h" #include "../dateutil.h" #include "../envmanager.h" #include "../fileutil.h" diff --git a/src/ui/util/logger.cpp b/src/ui/util/logger.cpp index 13aa62e2..c61ed041 100644 --- a/src/ui/util/logger.cpp +++ b/src/ui/util/logger.cpp @@ -3,7 +3,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include "../../common/version.h" +#include "../../version.h" #include "dateutil.h" #define LOGGER_FILE_PREFIX "log_fort_" diff --git a/src/common/version.h b/src/version.h similarity index 100% rename from src/common/version.h rename to src/version.h