refactor: add simple c# client
This commit is contained in:
parent
eb7bfc779b
commit
7ad3ff4081
@ -1,95 +0,0 @@
|
|||||||
// Client.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <Windows.h>
|
|
||||||
|
|
||||||
HANDLE hPipe;
|
|
||||||
DWORD dwWritten;
|
|
||||||
BOOL fSuccess = FALSE;
|
|
||||||
DWORD cbRead, cbToWrite, cbWritten, dwMode;
|
|
||||||
|
|
||||||
int CreatePipe(std::wstring name)
|
|
||||||
{
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
hPipe = CreateFileW(
|
|
||||||
name.c_str(), // pipe name
|
|
||||||
GENERIC_READ | // read and write access
|
|
||||||
GENERIC_WRITE,
|
|
||||||
0, // no sharing
|
|
||||||
NULL, // default security attributes
|
|
||||||
OPEN_EXISTING, // opens existing pipe
|
|
||||||
0, // default attributes
|
|
||||||
NULL); // no template file
|
|
||||||
|
|
||||||
// Break if the pipe handle is valid.
|
|
||||||
|
|
||||||
if (hPipe != INVALID_HANDLE_VALUE)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Exit if an error other than ERROR_PIPE_BUSY occurs.
|
|
||||||
|
|
||||||
if (GetLastError() != ERROR_PIPE_BUSY)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dwMode = PIPE_READMODE_MESSAGE;
|
|
||||||
fSuccess = SetNamedPipeHandleState(
|
|
||||||
hPipe, // pipe handle
|
|
||||||
&dwMode, // new pipe mode
|
|
||||||
NULL, // don't set maximum bytes
|
|
||||||
NULL); // don't set maximum time
|
|
||||||
if (!fSuccess)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring ReadMessage()
|
|
||||||
{
|
|
||||||
wchar_t chBuf[10240];
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// Read from the pipe.
|
|
||||||
|
|
||||||
fSuccess = ReadFile(
|
|
||||||
hPipe, // pipe handle
|
|
||||||
chBuf, // buffer to receive reply
|
|
||||||
10240 * sizeof(wchar_t), // size of buffer
|
|
||||||
&cbRead, // number of bytes read
|
|
||||||
NULL); // not overlapped
|
|
||||||
|
|
||||||
if (!fSuccess && GetLastError() != ERROR_MORE_DATA)
|
|
||||||
break;
|
|
||||||
} while (!fSuccess);
|
|
||||||
|
|
||||||
return std::wstring(chBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
CreatePipe(L"\\\\.\\pipe\\PipeL2Bot");
|
|
||||||
std::cout << "Connected to the connection pipe" << std::endl;
|
|
||||||
|
|
||||||
auto name = ReadMessage();
|
|
||||||
CloseHandle(hPipe);
|
|
||||||
std::wcout << L"Received main pipe name: " << name << std::endl;
|
|
||||||
|
|
||||||
std::cin.get();
|
|
||||||
CreatePipe(name);
|
|
||||||
|
|
||||||
const std::wstring message = L"invalidate";
|
|
||||||
DWORD written;
|
|
||||||
WriteFile(hPipe, message.c_str(), message.size() + 1, &written, NULL);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
const auto msg = ReadMessage();
|
|
||||||
std::wcout << msg << std::endl;
|
|
||||||
}
|
|
||||||
std::cin.get();
|
|
||||||
}
|
|
@ -1,151 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<VCProjectVersion>16.0</VCProjectVersion>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<ProjectGuid>{d5e220d4-cba9-465c-8d1a-b97cc5e5e825}</ProjectGuid>
|
|
||||||
<RootNamespace>Client</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="Shared">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir)$(Configuration)\$(ProjectName)\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir)$(Configuration)\$(ProjectName)\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="Client.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<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="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<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="Client.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
42
L2Bot.sln
42
L2Bot.sln
@ -15,58 +15,80 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "L2BotDll", "L2BotDll\L2BotD
|
|||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806} = {54FBE631-3F9B-458C-9DB2-43A868CDB806}
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806} = {54FBE631-3F9B-458C-9DB2-43A868CDB806}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client", "Client\Client.vcxproj", "{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectionLibrary", "InjectionLibrary\InjectionLibrary.vcxproj", "{54FBE631-3F9B-458C-9DB2-43A868CDB806}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InjectionLibrary", "InjectionLibrary\InjectionLibrary.vcxproj", "{54FBE631-3F9B-458C-9DB2-43A868CDB806}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "TestClient\TestClient.csproj", "{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x64.ActiveCfg = Debug|x64
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x64.Build.0 = Debug|x64
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x64.Build.0 = Debug|x64
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x86.ActiveCfg = Debug|Win32
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x86.Build.0 = Debug|Win32
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|Any CPU.Build.0 = Release|x64
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x64.ActiveCfg = Release|x64
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x64.ActiveCfg = Release|x64
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x64.Build.0 = Release|x64
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x64.Build.0 = Release|x64
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x86.ActiveCfg = Release|Win32
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x86.Build.0 = Release|Win32
|
{504A5403-BA08-46DF-AA8A-B79993B56BCA}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x64.ActiveCfg = Debug|x64
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x64.Build.0 = Debug|x64
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x64.Build.0 = Debug|x64
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x86.ActiveCfg = Debug|Win32
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x86.Build.0 = Debug|Win32
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|Any CPU.Build.0 = Release|x64
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x64.ActiveCfg = Release|x64
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x64.ActiveCfg = Release|x64
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x64.Build.0 = Release|x64
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x64.Build.0 = Release|x64
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x86.ActiveCfg = Release|Win32
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x86.Build.0 = Release|Win32
|
{28B1B2BC-BB6C-483E-B18D-E532A29ED8EA}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x64.ActiveCfg = Debug|x64
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x64.Build.0 = Debug|x64
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x64.Build.0 = Debug|x64
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x86.ActiveCfg = Debug|Win32
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x86.Build.0 = Debug|Win32
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|Any CPU.Build.0 = Release|x64
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x64.ActiveCfg = Release|x64
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x64.ActiveCfg = Release|x64
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x64.Build.0 = Release|x64
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x64.Build.0 = Release|x64
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x86.ActiveCfg = Release|Win32
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x86.Build.0 = Release|Win32
|
{F077B130-780F-4C72-AF56-E98B104A2A7D}.Release|x86.Build.0 = Release|Win32
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Debug|x64.ActiveCfg = Debug|x64
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Debug|x64.Build.0 = Debug|x64
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Release|x64.Build.0 = Release|x64
|
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{D5E220D4-CBA9-465C-8D1A-B97CC5E5E825}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x64.ActiveCfg = Debug|x64
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x64.Build.0 = Debug|x64
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x64.Build.0 = Debug|x64
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x86.ActiveCfg = Debug|Win32
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x86.Build.0 = Debug|Win32
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|Any CPU.Build.0 = Release|x64
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x64.ActiveCfg = Release|x64
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x64.ActiveCfg = Release|x64
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x64.Build.0 = Release|x64
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x64.Build.0 = Release|x64
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x86.ActiveCfg = Release|Win32
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x86.Build.0 = Release|Win32
|
{54FBE631-3F9B-458C-9DB2-43A868CDB806}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{D3E7234A-C1B0-4CA8-B9D2-04BF9DD991D2}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -29,8 +29,8 @@ public:
|
|||||||
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
||||||
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
|
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
|
||||||
PIPE_UNLIMITED_INSTANCES,
|
PIPE_UNLIMITED_INSTANCES,
|
||||||
BUFFER_SIZE * sizeof(char),
|
BUFFER_SIZE * sizeof(wchar_t),
|
||||||
BUFFER_SIZE * sizeof(char),
|
BUFFER_SIZE * sizeof(wchar_t),
|
||||||
NMPWAIT_USE_DEFAULT_WAIT,
|
NMPWAIT_USE_DEFAULT_WAIT,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
@ -65,6 +65,8 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::wstring preparedMessage = message + L"\n";
|
||||||
|
|
||||||
DWORD written;
|
DWORD written;
|
||||||
const auto result = WriteFile(m_Pipe, message.c_str(), (message.size() + 1) * sizeof(wchar_t), &written, &m_WritingOverlapped);
|
const auto result = WriteFile(m_Pipe, message.c_str(), (message.size() + 1) * sizeof(wchar_t), &written, &m_WritingOverlapped);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
const auto mainPipeName = GenerateUUID();
|
const auto mainPipeName = GenerateUUID();
|
||||||
|
|
||||||
m_ConnectionPipe.Send(L"\\\\.\\pipe\\" + mainPipeName);
|
m_ConnectionPipe.Send(mainPipeName);
|
||||||
|
|
||||||
OutputDebugStringA("Name of main pipe sended");
|
OutputDebugStringA("Name of main pipe sended");
|
||||||
|
|
||||||
|
12
TestClient/Directory.Build.Props
Normal file
12
TestClient/Directory.Build.Props
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
|
<BaseOutputPath>$(SolutionDir)$(Configuration)\bin\</BaseOutputPath>
|
||||||
|
<BaseIntermediateOutputPath>$(SolutionDir)$(Configuration)\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
|
||||||
|
<MSBuildProjectExtensionsPath>$(SolutionDir)$(Configuration)\$(MSBuildProjectName)\ext\</MSBuildProjectExtensionsPath>
|
||||||
|
<PackageOutputPath>$(BaseOutputPath)</PackageOutputPath>
|
||||||
|
<OutputPath>$(BaseOutputPath)</OutputPath>
|
||||||
|
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
57
TestClient/Program.cs
Normal file
57
TestClient/Program.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.IO.Pipes;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
private static void Main(string[] args)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
var clientPipe = new NamedPipeClientStream("PipeL2Bot");
|
||||||
|
clientPipe.Connect();
|
||||||
|
clientPipe.ReadMode = PipeTransmissionMode.Message;
|
||||||
|
|
||||||
|
Console.WriteLine("Connected to connection pipe");
|
||||||
|
|
||||||
|
byte[] buffer = new byte[16384 * 2];
|
||||||
|
int read = clientPipe.Read(buffer, 0, buffer.Length);
|
||||||
|
|
||||||
|
if (clientPipe.IsConnected)
|
||||||
|
{
|
||||||
|
string pipeName = Encoding.Unicode.GetString(buffer).TrimEnd('\0');
|
||||||
|
Console.WriteLine("Received connection pipe name " + pipeName);
|
||||||
|
|
||||||
|
var mainPipe = new NamedPipeClientStream(pipeName);
|
||||||
|
mainPipe.Connect();
|
||||||
|
mainPipe.ReadMode = PipeTransmissionMode.Message;
|
||||||
|
|
||||||
|
Console.WriteLine("Connected to main pipe");
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
byte[] buffer1 = new byte[16384 * 2];
|
||||||
|
int read1 = mainPipe.Read(buffer1, 0, buffer1.Length);
|
||||||
|
|
||||||
|
if (mainPipe.IsConnected)
|
||||||
|
{
|
||||||
|
string message = Encoding.Unicode.GetString(buffer1).TrimEnd('\0');
|
||||||
|
Console.WriteLine(message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Disconnected from main pipe");
|
||||||
|
Console.WriteLine("Disconnected from connection pipe");
|
||||||
|
|
||||||
|
mainPipe.Close();
|
||||||
|
mainPipe.Dispose();
|
||||||
|
clientPipe.Close();
|
||||||
|
clientPipe.Dispose();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
TestClient/TestClient.csproj
Normal file
10
TestClient/TestClient.csproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue
Block a user