mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
Update Redirector
This commit is contained in:
8
Redirector/Data.cpp
Normal file
8
Redirector/Data.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "Data.h"
|
||||
|
||||
BOOL filterLoopback = FALSE;
|
||||
BOOL filterICMP = TRUE;
|
||||
BOOL filterTCP = TRUE;
|
||||
BOOL filterUDP = TRUE;
|
||||
USHORT tcpLisn = 0;
|
||||
USHORT udpLisn = 0;
|
||||
16
Redirector/Data.h
Normal file
16
Redirector/Data.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#ifndef DATA_H
|
||||
#define DATA_H
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
|
||||
enum {
|
||||
AIO_FILTERLOOPBACK,
|
||||
AIO_FILTERICMP,
|
||||
AIO_FILTERTCP,
|
||||
AIO_FILTERUDP,
|
||||
AIO_TCPLISN,
|
||||
AIO_UDPLISN
|
||||
};
|
||||
|
||||
#endif
|
||||
3
Redirector/EventHandler.cpp
Normal file
3
Redirector/EventHandler.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "EventHandler.h"
|
||||
|
||||
#include "Data.h"
|
||||
5
Redirector/EventHandler.h
Normal file
5
Redirector/EventHandler.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef EVENTHANDLER_H
|
||||
#define EVENTHANDLER_H
|
||||
|
||||
#endif
|
||||
5
Redirector/IPEventHandler.cpp
Normal file
5
Redirector/IPEventHandler.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "IPEventHandler.h"
|
||||
|
||||
#include "Data.h"
|
||||
#include "Utils.h"
|
||||
|
||||
5
Redirector/IPEventHandler.h
Normal file
5
Redirector/IPEventHandler.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef IPEVENTHANDLER_H
|
||||
#define IPEVENTHANDLER_H
|
||||
|
||||
#endif
|
||||
70
Redirector/Redirector.cpp
Normal file
70
Redirector/Redirector.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
#include "Data.h"
|
||||
#include "Utils.h"
|
||||
#include "EventHandler.h"
|
||||
|
||||
extern BOOL filterLoopback;
|
||||
extern BOOL filterICMP;
|
||||
extern BOOL filterTCP;
|
||||
extern BOOL filterUDP;
|
||||
extern USHORT tcpLisn;
|
||||
extern USHORT udpLisn;
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hModule);
|
||||
UNREFERENCED_PARAMETER(ul_reason_for_call);
|
||||
UNREFERENCED_PARAMETER(lpReserved);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) BOOL __cdecl aio_dial(INT name, LPWSTR value)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(name);
|
||||
UNREFERENCED_PARAMETER(value);
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case AIO_FILTERLOOPBACK:
|
||||
break;
|
||||
case AIO_FILTERICMP:
|
||||
break;
|
||||
case AIO_FILTERTCP:
|
||||
break;
|
||||
case AIO_FILTERUDP:
|
||||
break;
|
||||
case AIO_TCPLISN:
|
||||
break;
|
||||
case AIO_UDPLISN:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
__declspec(dllexport) BOOL __cdecl aio_init()
|
||||
{
|
||||
{
|
||||
WSADATA data;
|
||||
UNREFERENCED_PARAMETER(WSAStartup(MAKEWORD(2, 2), &data));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
__declspec(dllexport) VOID __cdecl aio_free()
|
||||
{
|
||||
UNREFERENCED_PARAMETER(WSACleanup());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -19,13 +19,13 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
@@ -47,15 +47,21 @@
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(ProjectDir)bin\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\</IntDir>
|
||||
<TargetExt>.bin</TargetExt>
|
||||
<IncludePath>$(ProjectDir)include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)lib\;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(ProjectDir)bin\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\</IntDir>
|
||||
<TargetExt>.bin</TargetExt>
|
||||
<IncludePath>$(ProjectDir)include\;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(ProjectDir)lib\;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
@@ -66,11 +72,12 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
@@ -85,10 +92,24 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>COPY /Y $(ProjectDir)static\*.dll $(TargetDir) > NUL</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="Data.cpp" />
|
||||
<ClCompile Include="EventHandler.cpp" />
|
||||
<ClCompile Include="IPEventHandler.cpp" />
|
||||
<ClCompile Include="Redirector.cpp" />
|
||||
<ClCompile Include="Utils.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Data.h" />
|
||||
<ClInclude Include="EventHandler.h" />
|
||||
<ClInclude Include="IPEventHandler.h" />
|
||||
<ClInclude Include="Utils.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -1,22 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<Filter Include="Header">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<Filter Include="Source">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>源文件</Filter>
|
||||
<ClCompile Include="Redirector.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EventHandler.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Data.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IPEventHandler.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EventHandler.h">
|
||||
<Filter>Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Data.h">
|
||||
<Filter>Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils.h">
|
||||
<Filter>Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IPEventHandler.h">
|
||||
<Filter>Header</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
Redirector/Utils.cpp
Normal file
19
Redirector/Utils.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "Utils.h"
|
||||
|
||||
#include "Data.h"
|
||||
|
||||
USHORT IPv4Checksum(PBYTE buffer, ULONG64 size)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(buffer);
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
USHORT ICMPChecksum(PBYTE buffer, ULONG64 size)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(buffer);
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
Redirector/Utils.h
Normal file
8
Redirector/Utils.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
USHORT IPv4Checksum(PBYTE buffer, ULONG64 size);
|
||||
USHORT ICMPChecksum(PBYTE buffer, ULONG64 size);
|
||||
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <Windows.h>
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user