mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
Update nfapinet interop
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net5.0-windows7.0</TargetFramework>
|
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<Configurations>Debug;Release</Configurations>
|
|
||||||
<Platforms>x64</Platforms>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<DebugSymbols>false</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{53397641-35CA-4336-8E22-2CE12EF476AC}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{53397641-35CA-4336-8E22-2CE12EF476AC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interop.nfapinet", "Interop.nfapinet\Interop.nfapinet.csproj", "{2C968ADF-4822-46A9-A7D9-D05A61CB14DE}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
@@ -22,10 +20,6 @@ Global
|
|||||||
{53397641-35CA-4336-8E22-2CE12EF476AC}.Debug|x64.ActiveCfg = Debug|x64
|
{53397641-35CA-4336-8E22-2CE12EF476AC}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{53397641-35CA-4336-8E22-2CE12EF476AC}.Debug|x64.Build.0 = Debug|x64
|
{53397641-35CA-4336-8E22-2CE12EF476AC}.Debug|x64.Build.0 = Debug|x64
|
||||||
{53397641-35CA-4336-8E22-2CE12EF476AC}.Release|x64.ActiveCfg = Release|x64
|
{53397641-35CA-4336-8E22-2CE12EF476AC}.Release|x64.ActiveCfg = Release|x64
|
||||||
{2C968ADF-4822-46A9-A7D9-D05A61CB14DE}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{2C968ADF-4822-46A9-A7D9-D05A61CB14DE}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{2C968ADF-4822-46A9-A7D9-D05A61CB14DE}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{2C968ADF-4822-46A9-A7D9-D05A61CB14DE}.Release|x64.Build.0 = Release|x64
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
|
using Netch.Interops;
|
||||||
using Netch.Models;
|
using Netch.Models;
|
||||||
using Netch.Servers.Shadowsocks;
|
using Netch.Servers.Shadowsocks;
|
||||||
using Netch.Servers.Socks5;
|
using Netch.Servers.Socks5;
|
||||||
using Netch.Utils;
|
using Netch.Utils;
|
||||||
using nfapinet;
|
|
||||||
using static Netch.Interops.RedirectorInterop;
|
using static Netch.Interops.RedirectorInterop;
|
||||||
|
|
||||||
namespace Netch.Controllers
|
namespace Netch.Controllers
|
||||||
|
|||||||
20
Netch/Interops/NFAPI.cs
Normal file
20
Netch/Interops/NFAPI.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Netch.Interops
|
||||||
|
{
|
||||||
|
public static class NFAPI
|
||||||
|
{
|
||||||
|
private const string nfapinet_bin = "nfapinet.dll";
|
||||||
|
|
||||||
|
[DllImport(nfapinet_bin, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern NF_STATUS nf_registerDriver(string driverName);
|
||||||
|
|
||||||
|
[DllImport(nfapinet_bin, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern NF_STATUS nf_unRegisterDriver(string driverName);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Netch/Interops/NF_STATUS.cs
Normal file
11
Netch/Interops/NF_STATUS.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Netch.Interops
|
||||||
|
{
|
||||||
|
public enum NF_STATUS : int
|
||||||
|
{
|
||||||
|
NF_STATUS_SUCCESS = 0,
|
||||||
|
NF_STATUS_FAIL = -1,
|
||||||
|
NF_STATUS_INVALID_ENDPOINT_ID = -2,
|
||||||
|
NF_STATUS_NOT_INITIALIZED = -3,
|
||||||
|
NF_STATUS_IO_ERROR = -4
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,10 +54,6 @@
|
|||||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
|
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Interop.nfapinet\Interop.nfapinet.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove=".gitignore" />
|
<None Remove=".gitignore" />
|
||||||
<None Visible="false" Include="..\binaries\**" LinkBase="bin" CopyToPublishDirectory="PreserveNewest" CopyToOutputDirectory="PreserveNewest" />
|
<None Visible="false" Include="..\binaries\**" LinkBase="bin" CopyToPublishDirectory="PreserveNewest" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
|||||||
Reference in New Issue
Block a user