From f9d9c5035a7ddfee600763965d412be5bf6b8059 Mon Sep 17 00:00:00 2001 From: houha2 <38798233+houha2@users.noreply.github.com> Date: Fri, 22 Jan 2021 12:16:49 -0800 Subject: Improvements to WFP Inspect Sample (#516) Changes a `NT_ASSERT` to match what the comment above is saying, the previous version caused a system crash if the packet was not inbound and had a auth decision made already. The comment ` // Skip pended connections in the list, for which the auth decision is already taken.` ` // They should not be for inbound connections.` to my understanding means inbound connections should be ignored and ignore connections for which the auth decision was already made. The latter is checked by: ` if (packet->authConnectDecision == 0)` which keeps `found` equal to `FALSE` triggering the packet and list entry to be set to `NULL` here: `if (!found) { listEntry = NULL; packet = NULL; }` Change also updates the .sln and .vxproj files so the sample compiles on VS2019 without any changes - addressing #366 Co-authored-by: Elaine Houha --- network/trans/inspect/inspect.sln | 17 ++++++++++------- network/trans/inspect/sys/inspect.c | 2 +- network/trans/inspect/sys/inspect.vcxproj | 18 ++++++++++-------- network/trans/inspect/sys/inspect.vcxproj.Filters | 13 +++++++++++++ 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/network/trans/inspect/inspect.sln b/network/trans/inspect/inspect.sln index 40b0cead..3f3ae438 100644 --- a/network/trans/inspect/inspect.sln +++ b/network/trans/inspect/inspect.sln @@ -1,28 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 12.0 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inspect", "sys\inspect.vcxproj", "{5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Debug|Win32.ActiveCfg = Debug|Win32 - {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Debug|Win32.Build.0 = Debug|Win32 - {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Release|Win32.ActiveCfg = Release|Win32 - {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Release|Win32.Build.0 = Release|Win32 + {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Debug|Win32.ActiveCfg = Debug|x64 + {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Debug|Win32.Build.0 = Debug|x64 {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Debug|x64.ActiveCfg = Debug|x64 {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Debug|x64.Build.0 = Debug|x64 + {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Release|Win32.ActiveCfg = Release|Win32 + {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Release|Win32.Build.0 = Release|Win32 {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Release|x64.ActiveCfg = Release|x64 {5CF7CFC1-02B4-4938-AC5F-47D743D82E8A}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F084D2B3-2035-4BCE-A4D1-FA6AE812D7A1} + EndGlobalSection EndGlobal diff --git a/network/trans/inspect/sys/inspect.c b/network/trans/inspect/sys/inspect.c index 418daf9a..8dd6b72a 100644 --- a/network/trans/inspect/sys/inspect.c +++ b/network/trans/inspect/sys/inspect.c @@ -1278,7 +1278,7 @@ TLInspectWorker( listEntry ); - NT_ASSERT((packet->direction == FWP_DIRECTION_INBOUND) || + NT_ASSERT((packet->direction != FWP_DIRECTION_INBOUND) || (packet->authConnectDecision == 0)); if (packet->authConnectDecision == 0) diff --git a/network/trans/inspect/sys/inspect.vcxproj b/network/trans/inspect/sys/inspect.vcxproj index 2115972e..c154521d 100644 --- a/network/trans/inspect/sys/inspect.vcxproj +++ b/network/trans/inspect/sys/inspect.vcxproj @@ -23,14 +23,14 @@ $(MSBuildProjectName) 1 Debug - Win32 + Desktop {910EE323-2C33-42E0-B2DD-3C3BB1F4689E} Windows10 False - Universal + Desktop KMDF WindowsKernelModeDriver10.0 Driver @@ -38,7 +38,7 @@ Windows10 True - Universal + Desktop KMDF WindowsKernelModeDriver10.0 Driver @@ -46,7 +46,7 @@ Windows10 False - Universal + Desktop KMDF WindowsKernelModeDriver10.0 Driver @@ -54,7 +54,7 @@ Windows10 True - Universal + Desktop KMDF WindowsKernelModeDriver10.0 Driver @@ -75,7 +75,10 @@ - + + + + inspect @@ -170,7 +173,6 @@ - @@ -179,7 +181,7 @@ - + \ No newline at end of file diff --git a/network/trans/inspect/sys/inspect.vcxproj.Filters b/network/trans/inspect/sys/inspect.vcxproj.Filters index 96fc4202..f4a5dbe0 100644 --- a/network/trans/inspect/sys/inspect.vcxproj.Filters +++ b/network/trans/inspect/sys/inspect.vcxproj.Filters @@ -29,4 +29,17 @@ Source Files + + + Header Files + + + Header Files + + + + + Driver Files + + \ No newline at end of file -- cgit v1.3.1