Skip to content

Commit

Permalink
Fix windows 7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
vlabo committed Oct 5, 2022
1 parent 5ade7f0 commit 3e29cb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pm_kext/pm_kext.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>false</Driver_SpectreMitigation>
<ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
<_NT_TARGET_VERSION>0x0601</_NT_TARGET_VERSION>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>false</Driver_SpectreMitigation>
<ALLOW_DATE_TIME>0</ALLOW_DATE_TIME>
<_NT_TARGET_VERSION>0x0601</_NT_TARGET_VERSION>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
Expand Down
1 change: 1 addition & 0 deletions pm_kext/src/pm_callouts.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ void classifyOutboundIPv6(

// Used for freeing the packet info memory when clearing the packet cache
static void freePacketInfo(PortmasterPacketInfo *info, verdict_t verdict) {
UNREFERENCED_PARAMETER(verdict);
if(info != NULL) {
portmasterFree(info);
}
Expand Down
10 changes: 8 additions & 2 deletions pm_kext/src/pm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@
*/

void *portmasterMalloc(size_t size, bool paged) {
POOL_TYPE poolFlag = (paged ? POOL_FLAG_PAGED : POOL_FLAG_NON_PAGED);
POOL_TYPE poolFlag = (paged ? PagedPool : NonPagedPool);
if (size == 0) {
return NULL;
}
void *pv = ExAllocatePool2(poolFlag, size, PORTMASTER_TAG); // Memory is zero initialized unless POOL_FLAG_UNINITIALIZED is specified.
// ExAllocatePoolWithTag is depercated but there is no working (tests) alternative for it in the old Windows versions
// ExAllocatePoolZero -> complies but crashes the kernel
// ExAllocatePool2 -> avaliable with Windows 10, version 2004 and after (release around 2020)
void *pv = ExAllocatePoolWithTag(poolFlag, size, PORTMASTER_TAG);
if (pv != 0) {
RtlZeroMemory(pv, size);
}
return pv;
}

Expand Down

0 comments on commit 3e29cb6

Please sign in to comment.