Reorganize project structure.

Move tests/ into ui/ and common/ into driver/.
This commit is contained in:
Nodir Temirkhodjaev 2020-08-29 17:47:32 +03:00
parent 07a723c6ae
commit 4c94096bfc
50 changed files with 72 additions and 62 deletions

View File

@ -1,5 +1,5 @@
#include AddBackslash(SourcePath) + "..\src\common\version.h"
#include AddBackslash(SourcePath) + "..\src\version.h"
#define APP_EXE_NAME "FortFirewall.exe"

View File

@ -1,10 +0,0 @@
SOURCES += \
$$PWD/fortconf.c \
$$PWD/fortlog.c \
$$PWD/fortprov.c
HEADERS += \
$$PWD/common.h \
$$PWD/fortconf.h \
$$PWD/version.h

25
src/driver/Driver.pri Normal file
View File

@ -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
}

View File

@ -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

View File

@ -1,7 +1,5 @@
#ifndef COMMON_H
#define COMMON_H
#include "version.h"
#ifndef FORTDEV_H
#define FORTDEV_H
#define INITGUID
#include <guiddef.h>
@ -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

View File

@ -12,7 +12,9 @@
#include <stddef.h>
#include <ntrxdef.h>
#include "../common/common.h"
#include "../version.h"
#include "common/common.h"
#include "common/fortdev.h"
#include "fortdrv.h"
#define FORT_DEVICE_POOL_TAG 'DwfF'

View File

@ -1,7 +1,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#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

View File

@ -70,7 +70,6 @@
<ResourceCompile Include="fortdrv.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\common.h" />
<ClInclude Include="fortdrv.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -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

View File

@ -1,7 +1,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#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

View File

@ -6,12 +6,13 @@
#include <winioctl.h>
#include <fwpmu.h>
#include "../common/common.h"
#include "../common/fortconf.h"
#include <common/common.h>
#include <common/fortconf.h>
#include <common/fortdev.h>
#include "../common/fortconf.c"
#include "../common/fortlog.c"
#include "../common/fortprov.c"
#include <common/fortconf.c>
#include <common/fortlog.c>
#include <common/fortprov.c>
FortCommon::FortCommon(QObject *parent) : QObject(parent) { }

View File

@ -7,7 +7,7 @@
#include <QRect>
#include <QSettings>
#include "../common/version.h"
#include "../version.h"
QT_FORWARD_DECLARE_CLASS(FirewallConf)

View File

@ -7,7 +7,7 @@
# include <vld.h>
#endif
#include "../common/version.h"
#include "../version.h"
#include "control/controlmanager.h"
#include "control/controlworker.h"
#include "driver/drivermanager.h"

View File

@ -2,7 +2,7 @@
#include <QDataStream>
#include "../../common/version.h"
#include "../../version.h"
#include "../fortmanager.h"
#include "taskupdatechecker.h"

View File

@ -4,7 +4,7 @@
#include <QDebug>
#include <QVariant>
#include "../../common/version.h"
#include "../../version.h"
#include "../util/net/netdownloader.h"
#include "../util/net/netutil.h"
#include "../util/json/jsonutil.h"

View File

@ -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

View File

@ -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 \

View File

@ -8,13 +8,14 @@
#define UINT32 quint32
#define UINT64 quint64
#include "../../common/fortconf.h"
#include "../../common/version.h"
#include <common/fortconf.h>
#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"

View File

@ -3,7 +3,7 @@
#define WIN32_LEAN_AND_MEAN
#include <qt_windows.h>
#include "../../common/version.h"
#include "../../version.h"
#include "dateutil.h"
#define LOGGER_FILE_PREFIX "log_fort_"