diff --git a/README.md b/README.md index dea9a543..d2266a7c 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,10 @@ Fort is a simple firewall for Windows 7+. ## Supported OS versions -OS | Version | Architectures -----------------|-------------------------------|-------------- -Windows | 7 SP1+, 8.1, 10 | x86, x64 + Asset | OS | Version | Architectures +-------------------------|----------|------------------|-------------- + \*-windows.\* | Windows | 7 SP1+, 8.1, 10 | x86, x64 + \*-windows10-x86_64.\* | Windows | 10 v2004+ | x64 ----- diff --git a/src/driver/fortdrv.h b/src/driver/fortdrv.h index 7c05defa..f6ada290 100644 --- a/src/driver/fortdrv.h +++ b/src/driver/fortdrv.h @@ -5,14 +5,19 @@ /* WDM for Development in User Mode */ #if !defined(FORT_DRIVER) -# include "wdm/um_wdm.h" -# include "wdm/um_ndis.h" -# include "wdm/um_fwpsk.h" # include "wdm/um_fwpmk.h" +# include "wdm/um_fwpsk.h" +# include "wdm/um_ndis.h" +# include "wdm/um_wdm.h" #endif -#define fort_mem_alloc(size, tag) ExAllocatePoolWithTag(NonPagedPool, (size), (tag)) -#define fort_mem_free(p, tag) ExFreePoolWithTag((p), (tag)) +#if defined(FORT_WIN7_COMPAT) +# define fort_mem_alloc(size, tag) ExAllocatePoolWithTag(NonPagedPool, (size), (tag)) +#else +# define fort_mem_alloc(size, tag) \ + ExAllocatePool2(POOL_FLAG_UNINITIALIZED | POOL_FLAG_NON_PAGED, (size), (tag)) +#endif +#define fort_mem_free(p, tag) ExFreePoolWithTag((p), (tag)) #define fort_request_complete_info(irp, status, info) \ do { \ diff --git a/src/driver/fortdrv.vcxproj b/src/driver/fortdrv.vcxproj index 4b0c9841..929896cf 100644 --- a/src/driver/fortdrv.vcxproj +++ b/src/driver/fortdrv.vcxproj @@ -27,7 +27,8 @@ - WindowsV6.3 + WindowsV6.3 + Windows10 $(DDK_LIB_PATH)\BufferOverflowK.lib WindowsKernelModeDriver10.0 Driver diff --git a/src/driver/wdm/um_wdm.c b/src/driver/wdm/um_wdm.c index a9630e8e..93a22afe 100644 --- a/src/driver/wdm/um_wdm.c +++ b/src/driver/wdm/um_wdm.c @@ -21,6 +21,13 @@ void ExFreePoolWithTag(PVOID p, ULONG tag) HeapFree(GetProcessHeap(), 0, p); } +PVOID ExAllocatePool2(POOL_FLAGS flags, SIZE_T size, ULONG tag) +{ + UNUSED(flags); + UNUSED(tag); + return HeapAlloc(GetProcessHeap(), 0, size); +} + PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP irp) { UNUSED(irp); diff --git a/src/driver/wdm/um_wdm.h b/src/driver/wdm/um_wdm.h index fbf09828..d07a1a7f 100644 --- a/src/driver/wdm/um_wdm.h +++ b/src/driver/wdm/um_wdm.h @@ -176,6 +176,12 @@ FORT_API ULONG DbgPrintEx(ULONG componentId, ULONG level, PCSTR format, ...); FORT_API PVOID ExAllocatePoolWithTag(PVOID type, SIZE_T size, ULONG tag); FORT_API void ExFreePoolWithTag(PVOID p, ULONG tag); +typedef ULONG64 POOL_FLAGS; +#define POOL_FLAG_UNINITIALIZED 0x0000000000000002UI64 // Don't zero-initialize allocation +#define POOL_FLAG_NON_PAGED 0x0000000000000040UI64 // Non paged pool NX +#define POOL_FLAG_PAGED 0x0000000000000100UI64 // Paged pool +FORT_API PVOID ExAllocatePool2(POOL_FLAGS flags, SIZE_T size, ULONG tag); + FORT_API PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP irp); FORT_API void IoMarkIrpPending(PIRP irp); FORT_API PDRIVER_CANCEL IoSetCancelRoutine(PIRP irp, PDRIVER_CANCEL routine);