mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Deprecate ATL based IPC wrapper library (#2248)
* Deprecate ATL based IPC wrapper library * C# projects now use named pipe server implementations from two_way_pipe_message through the interop C++/Cli library. * Added Unit testing to interop library
This commit is contained in:
parent
81551104ce
commit
63d989cab4
@ -189,16 +189,9 @@ EndProject
|
|||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{C3081D9A-1586-441A-B5F4-ED815B3719C1}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{C3081D9A-1586-441A-B5F4-ED815B3719C1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Runner", "src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj", "{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Runner", "src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj", "{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121} = {F88B6FD1-14BD-48DB-85C2-6C51B8045121}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.PowerToys.Settings.TwoWayIPCLib", "src\core\Microsoft.PowerToys.Settings.TwoWayIPCLib\TwoWayIPCLib.vcxproj", "{F88B6FD1-14BD-48DB-85C2-6C51B8045121}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\core\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{A7D5099E-F0FD-4BF3-8522-5A682759F915}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\core\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{A7D5099E-F0FD-4BF3-8522-5A682759F915}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.PowerToys.Settings.IPCWrapperPS", "src\core\Microsoft.PowerToys.Settings.IPCWrapperPS\Microsoft.PowerToys.Settings.IPCWrapperPS.vcxproj", "{C073B057-B157-40F0-8678-1DCD119D841C}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.editorconfig = .editorconfig
|
.editorconfig = .editorconfig
|
||||||
@ -213,6 +206,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interop", "src\common\inter
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common-md-flag", "src\common\common-md-flag\common-md-flag.vcxproj", "{985B3F2F-CEED-4C0A-A249-69257E719145}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common-md-flag", "src\common\common-md-flag\common-md-flag.vcxproj", "{985B3F2F-CEED-4C0A-A249-69257E719145}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "interop-tests", "src\common\interop-tests\interop-tests.csproj", "{437AD818-3F1F-4CA5-A79B-25233A157026}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
@ -375,16 +370,11 @@ Global
|
|||||||
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}.Debug|x64.Build.0 = Debug|x64
|
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}.Debug|x64.Build.0 = Debug|x64
|
||||||
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}.Release|x64.ActiveCfg = Release|x64
|
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}.Release|x64.ActiveCfg = Release|x64
|
||||||
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}.Release|x64.Build.0 = Release|x64
|
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}.Release|x64.Build.0 = Release|x64
|
||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121}.Release|x64.Build.0 = Release|x64
|
|
||||||
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x64.ActiveCfg = Debug|x64
|
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x64.Build.0 = Debug|x64
|
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x64.Build.0 = Debug|x64
|
||||||
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.ActiveCfg = Release|x64
|
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.ActiveCfg = Release|x64
|
||||||
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.Build.0 = Release|x64
|
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.Build.0 = Release|x64
|
||||||
{C073B057-B157-40F0-8678-1DCD119D841C}.Debug|x64.ActiveCfg = Debug|x64
|
{A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.Deploy.0 = Release|x64
|
||||||
{C073B057-B157-40F0-8678-1DCD119D841C}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.ActiveCfg = Debug|x64
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.Build.0 = Debug|x64
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.Build.0 = Debug|x64
|
||||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.ActiveCfg = Release|x64
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.ActiveCfg = Release|x64
|
||||||
@ -401,6 +391,10 @@ Global
|
|||||||
{985B3F2F-CEED-4C0A-A249-69257E719145}.Debug|x64.Build.0 = Debug|x64
|
{985B3F2F-CEED-4C0A-A249-69257E719145}.Debug|x64.Build.0 = Debug|x64
|
||||||
{985B3F2F-CEED-4C0A-A249-69257E719145}.Release|x64.ActiveCfg = Release|x64
|
{985B3F2F-CEED-4C0A-A249-69257E719145}.Release|x64.ActiveCfg = Release|x64
|
||||||
{985B3F2F-CEED-4C0A-A249-69257E719145}.Release|x64.Build.0 = Release|x64
|
{985B3F2F-CEED-4C0A-A249-69257E719145}.Release|x64.Build.0 = Release|x64
|
||||||
|
{437AD818-3F1F-4CA5-A79B-25233A157026}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{437AD818-3F1F-4CA5-A79B-25233A157026}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{437AD818-3F1F-4CA5-A79B-25233A157026}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{437AD818-3F1F-4CA5-A79B-25233A157026}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -449,13 +443,12 @@ Global
|
|||||||
{217DF501-135C-4E38-BFC8-99D4821032EA} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
{217DF501-135C-4E38-BFC8-99D4821032EA} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||||
{47310AB4-9034-4BD1-8D8B-E88AD21A171B} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
{47310AB4-9034-4BD1-8D8B-E88AD21A171B} = {2F305555-C296-497E-AC20-5FA1B237996A}
|
||||||
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
{F88B6FD1-14BD-48DB-85C2-6C51B8045121} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
|
||||||
{A7D5099E-F0FD-4BF3-8522-5A682759F915} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{A7D5099E-F0FD-4BF3-8522-5A682759F915} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
{C073B057-B157-40F0-8678-1DCD119D841C} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
|
||||||
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
{A80355C2-780D-4245-BD80-25B8DE698EE3} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
{A80355C2-780D-4245-BD80-25B8DE698EE3} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
|
||||||
{F055103B-F80B-4D0C-BF48-057C55620033} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
{F055103B-F80B-4D0C-BF48-057C55620033} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||||
{985B3F2F-CEED-4C0A-A249-69257E719145} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
{985B3F2F-CEED-4C0A-A249-69257E719145} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||||
|
{437AD818-3F1F-4CA5-A79B-25233A157026} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||||
|
@ -86,11 +86,14 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\keyboard_layout.h" />
|
<ClInclude Include="..\keyboard_layout.h" />
|
||||||
<ClInclude Include="..\keyboard_layout_impl.h" />
|
<ClInclude Include="..\keyboard_layout_impl.h" />
|
||||||
|
<ClInclude Include="..\two_way_pipe_message_ipc.h" />
|
||||||
|
<ClInclude Include="..\two_way_pipe_message_ipc_impl.h" />
|
||||||
<ClInclude Include="framework.h" />
|
<ClInclude Include="framework.h" />
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\keyboard_layout.cpp" />
|
<ClCompile Include="..\keyboard_layout.cpp" />
|
||||||
|
<ClCompile Include="..\two_way_pipe_message_ipc.cpp" />
|
||||||
<ClCompile Include="pch.cpp">
|
<ClCompile Include="pch.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
@ -27,6 +27,12 @@
|
|||||||
<ClInclude Include="..\keyboard_layout_impl.h">
|
<ClInclude Include="..\keyboard_layout_impl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\two_way_pipe_message_ipc.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\two_way_pipe_message_ipc_impl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="pch.cpp">
|
<ClCompile Include="pch.cpp">
|
||||||
@ -35,5 +41,8 @@
|
|||||||
<ClCompile Include="..\keyboard_layout.cpp">
|
<ClCompile Include="..\keyboard_layout.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\two_way_pipe_message_ipc.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -126,6 +126,7 @@
|
|||||||
<ClInclude Include="notifications.h" />
|
<ClInclude Include="notifications.h" />
|
||||||
<ClInclude Include="shared_constants.h" />
|
<ClInclude Include="shared_constants.h" />
|
||||||
<ClInclude Include="timeutil.h" />
|
<ClInclude Include="timeutil.h" />
|
||||||
|
<ClInclude Include="two_way_pipe_message_ipc.h" />
|
||||||
<ClInclude Include="VersionHelper.h" />
|
<ClInclude Include="VersionHelper.h" />
|
||||||
<ClInclude Include="window_helpers.h" />
|
<ClInclude Include="window_helpers.h" />
|
||||||
<ClInclude Include="icon_helpers.h" />
|
<ClInclude Include="icon_helpers.h" />
|
||||||
@ -140,7 +141,7 @@
|
|||||||
<ClInclude Include="common.h" />
|
<ClInclude Include="common.h" />
|
||||||
<ClInclude Include="Telemetry\ProjectTelemetry.h" />
|
<ClInclude Include="Telemetry\ProjectTelemetry.h" />
|
||||||
<ClInclude Include="Telemetry\TraceLoggingDefines.h" />
|
<ClInclude Include="Telemetry\TraceLoggingDefines.h" />
|
||||||
<ClInclude Include="two_way_pipe_message_ipc.h" />
|
<ClInclude Include="two_way_pipe_message_ipc_impl.h" />
|
||||||
<ClInclude Include="version.h" />
|
<ClInclude Include="version.h" />
|
||||||
<ClInclude Include="windows_colors.h" />
|
<ClInclude Include="windows_colors.h" />
|
||||||
<ClInclude Include="winstore.h" />
|
<ClInclude Include="winstore.h" />
|
||||||
@ -167,6 +168,7 @@
|
|||||||
<ClCompile Include="tasklist_positions.cpp" />
|
<ClCompile Include="tasklist_positions.cpp" />
|
||||||
<ClCompile Include="common.cpp" />
|
<ClCompile Include="common.cpp" />
|
||||||
<ClCompile Include="version.cpp" />
|
<ClCompile Include="version.cpp" />
|
||||||
|
<ClCompile Include="two_way_pipe_message_ipc.cpp" />
|
||||||
<ClCompile Include="VersionHelper.cpp" />
|
<ClCompile Include="VersionHelper.cpp" />
|
||||||
<ClCompile Include="windows_colors.cpp" />
|
<ClCompile Include="windows_colors.cpp" />
|
||||||
<ClCompile Include="window_helpers.cpp" />
|
<ClCompile Include="window_helpers.cpp" />
|
||||||
|
@ -51,9 +51,6 @@
|
|||||||
<ClInclude Include="Telemetry\TraceLoggingDefines.h">
|
<ClInclude Include="Telemetry\TraceLoggingDefines.h">
|
||||||
<Filter>Header Files\Telemetry</Filter>
|
<Filter>Header Files\Telemetry</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="two_way_pipe_message_ipc.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="async_message_queue.h">
|
<ClInclude Include="async_message_queue.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -108,6 +105,12 @@
|
|||||||
<ClInclude Include="keyboard_layout.h">
|
<ClInclude Include="keyboard_layout.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="two_way_pipe_message_ipc_impl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="two_way_pipe_message_ipc.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="d2d_svg.cpp">
|
<ClCompile Include="d2d_svg.cpp">
|
||||||
@ -174,6 +177,9 @@
|
|||||||
<ClCompile Include="version.cpp">
|
<ClCompile Include="version.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="two_way_pipe_message_ipc.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
20
src/common/interop-tests/Properties/AssemblyInfo.cs
Normal file
20
src/common/interop-tests/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("interop-tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("interop-tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
[assembly: Guid("437ad818-3f1f-4ca5-a79b-25233a157026")]
|
||||||
|
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
55
src/common/interop-tests/UnitTest1.cs
Normal file
55
src/common/interop-tests/UnitTest1.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using System.IO.Pipes;
|
||||||
|
using interop;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace interop_tests
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTest1
|
||||||
|
{
|
||||||
|
private string SERVER_SIDE = "\\\\.\\pipe\\serverside";
|
||||||
|
private string CLIENT_SIDE = "\\\\.\\pipe\\clientside";
|
||||||
|
|
||||||
|
private TwoWayPipeMessageIPCManaged clientPipe;
|
||||||
|
|
||||||
|
[TestInitialize]
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
clientPipe = new TwoWayPipeMessageIPCManaged(CLIENT_SIDE, SERVER_SIDE, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCleanup]
|
||||||
|
public void Cleanup()
|
||||||
|
{
|
||||||
|
clientPipe.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestSend()
|
||||||
|
{
|
||||||
|
var testString = "This string is a test\n";
|
||||||
|
var reset = new AutoResetEvent(false);
|
||||||
|
|
||||||
|
var serverPipe = new TwoWayPipeMessageIPCManaged(
|
||||||
|
SERVER_SIDE,
|
||||||
|
CLIENT_SIDE,
|
||||||
|
(string msg) =>
|
||||||
|
{
|
||||||
|
Assert.AreEqual(testString, msg);
|
||||||
|
reset.Set();
|
||||||
|
});
|
||||||
|
serverPipe.Start();
|
||||||
|
clientPipe.Start();
|
||||||
|
|
||||||
|
clientPipe.Send(testString);
|
||||||
|
reset.WaitOne();
|
||||||
|
|
||||||
|
serverPipe.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
77
src/common/interop-tests/interop-tests.csproj
Normal file
77
src/common/interop-tests/interop-tests.csproj
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{437AD818-3F1F-4CA5-A79B-25233A157026}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>interop_tests</RootNamespace>
|
||||||
|
<AssemblyName>interop-tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||||
|
<IsCodedUITest>False</IsCodedUITest>
|
||||||
|
<TestProjectType>UnitTest</TestProjectType>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="UnitTest1.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\interop\interop.vcxproj">
|
||||||
|
<Project>{f055103b-f80b-4d0c-bf48-057c55620033}</Project>
|
||||||
|
<Name>interop</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||||
|
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||||
|
</Project>
|
5
src/common/interop-tests/packages.config
Normal file
5
src/common/interop-tests/packages.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net472" />
|
||||||
|
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net472" />
|
||||||
|
</packages>
|
@ -1,12 +1,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <common\keyboard_layout.h>
|
#include <common\keyboard_layout.h>
|
||||||
|
#include <common\two_way_pipe_message_ipc.h>
|
||||||
|
#include <msclr\marshal.h>
|
||||||
|
#include <msclr\marshal_cppstd.h>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
using namespace System;
|
using namespace System;
|
||||||
|
using namespace System::Runtime::InteropServices;
|
||||||
|
|
||||||
//https://docs.microsoft.com/en-us/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
|
//https://docs.microsoft.com/en-us/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
|
||||||
namespace interop
|
namespace interop
|
||||||
{
|
{
|
||||||
public ref class LayoutMapManaged
|
public
|
||||||
|
ref class LayoutMapManaged
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LayoutMapManaged() :
|
LayoutMapManaged() :
|
||||||
@ -17,12 +24,11 @@ public ref class LayoutMapManaged
|
|||||||
delete _map;
|
delete _map;
|
||||||
}
|
}
|
||||||
|
|
||||||
String ^ GetKeyName(DWORD key)
|
String ^ GetKeyName(DWORD key) {
|
||||||
{
|
|
||||||
return gcnew String(_map->GetKeyName(key).c_str());
|
return gcnew String(_map->GetKeyName(key).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Updatelayout()
|
void Updatelayout()
|
||||||
{
|
{
|
||||||
_map->UpdateLayout();
|
_map->UpdateLayout();
|
||||||
}
|
}
|
||||||
@ -36,5 +42,65 @@ public ref class LayoutMapManaged
|
|||||||
private:
|
private:
|
||||||
LayoutMap* _map;
|
LayoutMap* _map;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
public
|
||||||
|
ref class TwoWayPipeMessageIPCManaged
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
delegate void ReadCallback(String ^ message);
|
||||||
|
|
||||||
|
TwoWayPipeMessageIPCManaged(String ^ inputPipeName, String ^ outputPipeName, ReadCallback ^ callback)
|
||||||
|
{
|
||||||
|
_wrapperCallback = gcnew InternalReadCallback(this, &TwoWayPipeMessageIPCManaged::ReadCallbackHelper);
|
||||||
|
_callback = callback;
|
||||||
|
|
||||||
|
TwoWayPipeMessageIPC::callback_function cb = nullptr;
|
||||||
|
if (callback != nullptr)
|
||||||
|
{
|
||||||
|
cb = (TwoWayPipeMessageIPC::callback_function)(void*)Marshal::GetFunctionPointerForDelegate(_wrapperCallback);
|
||||||
|
}
|
||||||
|
_pipe = new TwoWayPipeMessageIPC(
|
||||||
|
msclr::interop::marshal_as<std::wstring>(inputPipeName),
|
||||||
|
msclr::interop::marshal_as<std::wstring>(outputPipeName),
|
||||||
|
cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
~TwoWayPipeMessageIPCManaged()
|
||||||
|
{
|
||||||
|
delete _pipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Send(String ^ msg)
|
||||||
|
{
|
||||||
|
_pipe->send(msclr::interop::marshal_as<std::wstring>(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
_pipe->start(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void End()
|
||||||
|
{
|
||||||
|
_pipe->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
!TwoWayPipeMessageIPCManaged()
|
||||||
|
{
|
||||||
|
delete _pipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
delegate void InternalReadCallback(const std::wstring& msg);
|
||||||
|
|
||||||
|
TwoWayPipeMessageIPC* _pipe;
|
||||||
|
ReadCallback ^ _callback;
|
||||||
|
InternalReadCallback ^ _wrapperCallback;
|
||||||
|
|
||||||
|
void ReadCallbackHelper(const std::wstring& msg)
|
||||||
|
{
|
||||||
|
_callback(gcnew String(msg.c_str()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
498
src/common/two_way_pipe_message_ipc.cpp
Normal file
498
src/common/two_way_pipe_message_ipc.cpp
Normal file
@ -0,0 +1,498 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "two_way_pipe_message_ipc_impl.h"
|
||||||
|
|
||||||
|
#pragma comment(lib, "advapi32.lib")
|
||||||
|
|
||||||
|
TwoWayPipeMessageIPC::TwoWayPipeMessageIPC(
|
||||||
|
std::wstring _input_pipe_name,
|
||||||
|
std::wstring _output_pipe_name,
|
||||||
|
callback_function p_func) :
|
||||||
|
impl(new TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl(
|
||||||
|
_input_pipe_name,
|
||||||
|
_output_pipe_name,
|
||||||
|
p_func))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TwoWayPipeMessageIPC::~TwoWayPipeMessageIPC()
|
||||||
|
{
|
||||||
|
delete impl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::send(std::wstring msg)
|
||||||
|
{
|
||||||
|
impl->send(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::start(HANDLE _restricted_pipe_token)
|
||||||
|
{
|
||||||
|
impl->start(_restricted_pipe_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::end()
|
||||||
|
{
|
||||||
|
impl->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::TwoWayPipeMessageIPCImpl(
|
||||||
|
std::wstring _input_pipe_name,
|
||||||
|
std::wstring _output_pipe_name,
|
||||||
|
callback_function p_func)
|
||||||
|
{
|
||||||
|
input_pipe_name = _input_pipe_name;
|
||||||
|
output_pipe_name = _output_pipe_name;
|
||||||
|
dispatch_inc_message_function = p_func;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::send(std::wstring msg)
|
||||||
|
{
|
||||||
|
output_queue.queue_message(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::start(HANDLE _restricted_pipe_token)
|
||||||
|
{
|
||||||
|
output_queue_thread = std::thread(&TwoWayPipeMessageIPCImpl::consume_output_queue_thread, this);
|
||||||
|
input_queue_thread = std::thread(&TwoWayPipeMessageIPCImpl::consume_input_queue_thread, this);
|
||||||
|
input_pipe_thread = std::thread(&TwoWayPipeMessageIPCImpl::start_named_pipe_server, this, _restricted_pipe_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::end()
|
||||||
|
{
|
||||||
|
closed = true;
|
||||||
|
input_queue.interrupt();
|
||||||
|
input_queue_thread.join();
|
||||||
|
output_queue.interrupt();
|
||||||
|
output_queue_thread.join();
|
||||||
|
pipe_connect_handle_mutex.lock();
|
||||||
|
if (current_connect_pipe_handle != NULL)
|
||||||
|
{
|
||||||
|
//Cancels the Pipe currently waiting for a connection.
|
||||||
|
CancelIoEx(current_connect_pipe_handle, NULL);
|
||||||
|
}
|
||||||
|
pipe_connect_handle_mutex.unlock();
|
||||||
|
input_pipe_thread.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::send_pipe_message(std::wstring message)
|
||||||
|
{
|
||||||
|
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-client
|
||||||
|
HANDLE output_pipe_handle;
|
||||||
|
const wchar_t* message_send = message.c_str();
|
||||||
|
BOOL fSuccess = FALSE;
|
||||||
|
DWORD cbToWrite, cbWritten, dwMode;
|
||||||
|
const wchar_t* lpszPipename = output_pipe_name.c_str();
|
||||||
|
|
||||||
|
// Try to open a named pipe; wait for it, if necessary.
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
output_pipe_handle = CreateFile(
|
||||||
|
lpszPipename, // 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 (output_pipe_handle != INVALID_HANDLE_VALUE)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Exit if an error other than ERROR_PIPE_BUSY occurs.
|
||||||
|
DWORD curr_error = 0;
|
||||||
|
if ((curr_error = GetLastError()) != ERROR_PIPE_BUSY)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// All pipe instances are busy, so wait for 20 seconds.
|
||||||
|
|
||||||
|
if (!WaitNamedPipe(lpszPipename, 20000))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dwMode = PIPE_READMODE_MESSAGE;
|
||||||
|
fSuccess = SetNamedPipeHandleState(
|
||||||
|
output_pipe_handle, // pipe handle
|
||||||
|
&dwMode, // new pipe mode
|
||||||
|
NULL, // don't set maximum bytes
|
||||||
|
NULL); // don't set maximum time
|
||||||
|
if (!fSuccess)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a message to the pipe server.
|
||||||
|
|
||||||
|
cbToWrite = (lstrlen(message_send)) * sizeof(WCHAR); // no need to send final '\0'. Pipe is in message mode.
|
||||||
|
|
||||||
|
fSuccess = WriteFile(
|
||||||
|
output_pipe_handle, // pipe handle
|
||||||
|
message_send, // message
|
||||||
|
cbToWrite, // message length
|
||||||
|
&cbWritten, // bytes written
|
||||||
|
NULL); // not overlapped
|
||||||
|
if (!fSuccess)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CloseHandle(output_pipe_handle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::consume_output_queue_thread()
|
||||||
|
{
|
||||||
|
while (!closed)
|
||||||
|
{
|
||||||
|
std::wstring message = output_queue.pop_message();
|
||||||
|
if (message.length() == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
send_pipe_message(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken, PSID* ppsid)
|
||||||
|
{
|
||||||
|
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
|
||||||
|
BOOL bSuccess = FALSE;
|
||||||
|
DWORD dwIndex;
|
||||||
|
DWORD dwLength = 0;
|
||||||
|
PTOKEN_GROUPS ptg = NULL;
|
||||||
|
|
||||||
|
// Verify the parameter passed in is not NULL.
|
||||||
|
if (NULL == ppsid)
|
||||||
|
goto Cleanup;
|
||||||
|
|
||||||
|
// Get required buffer size and allocate the TOKEN_GROUPS buffer.
|
||||||
|
|
||||||
|
if (!GetTokenInformation(
|
||||||
|
hToken, // handle to the access token
|
||||||
|
TokenGroups, // get information about the token's groups
|
||||||
|
(LPVOID)ptg, // pointer to TOKEN_GROUPS buffer
|
||||||
|
0, // size of buffer
|
||||||
|
&dwLength // receives required buffer size
|
||||||
|
))
|
||||||
|
{
|
||||||
|
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
goto Cleanup;
|
||||||
|
|
||||||
|
ptg = (PTOKEN_GROUPS)HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
dwLength);
|
||||||
|
|
||||||
|
if (ptg == NULL)
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the token group information from the access token.
|
||||||
|
|
||||||
|
if (!GetTokenInformation(
|
||||||
|
hToken, // handle to the access token
|
||||||
|
TokenGroups, // get information about the token's groups
|
||||||
|
(LPVOID)ptg, // pointer to TOKEN_GROUPS buffer
|
||||||
|
dwLength, // size of buffer
|
||||||
|
&dwLength // receives required buffer size
|
||||||
|
))
|
||||||
|
{
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through the groups to find the logon SID.
|
||||||
|
|
||||||
|
for (dwIndex = 0; dwIndex < ptg->GroupCount; dwIndex++)
|
||||||
|
if ((ptg->Groups[dwIndex].Attributes & SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID)
|
||||||
|
{
|
||||||
|
// Found the logon SID; make a copy of it.
|
||||||
|
|
||||||
|
dwLength = GetLengthSid(ptg->Groups[dwIndex].Sid);
|
||||||
|
*ppsid = (PSID)HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
dwLength);
|
||||||
|
if (*ppsid == NULL)
|
||||||
|
goto Cleanup;
|
||||||
|
if (!CopySid(dwLength, *ppsid, ptg->Groups[dwIndex].Sid))
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bSuccess = TRUE;
|
||||||
|
|
||||||
|
Cleanup:
|
||||||
|
|
||||||
|
// Free the buffer for the token groups.
|
||||||
|
|
||||||
|
if (ptg != NULL)
|
||||||
|
HeapFree(GetProcessHeap(), 0, (LPVOID)ptg);
|
||||||
|
|
||||||
|
return bSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::FreeLogonSID(PSID* ppsid)
|
||||||
|
{
|
||||||
|
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
|
||||||
|
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
|
||||||
|
}
|
||||||
|
|
||||||
|
int TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::change_pipe_security_allow_restricted_token(HANDLE handle, HANDLE token)
|
||||||
|
{
|
||||||
|
PACL old_dacl, new_dacl;
|
||||||
|
PSECURITY_DESCRIPTOR sd;
|
||||||
|
EXPLICIT_ACCESS ea;
|
||||||
|
PSID user_restricted;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if (!GetLogonSID(token, &user_restricted))
|
||||||
|
{
|
||||||
|
error = 5; // No access error.
|
||||||
|
goto Ldone;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetSecurityInfo(handle,
|
||||||
|
SE_KERNEL_OBJECT,
|
||||||
|
DACL_SECURITY_INFORMATION,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&old_dacl,
|
||||||
|
NULL,
|
||||||
|
&sd))
|
||||||
|
{
|
||||||
|
error = GetLastError();
|
||||||
|
goto Lclean_sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&ea, 0, sizeof(EXPLICIT_ACCESS));
|
||||||
|
ea.grfAccessPermissions |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
|
||||||
|
ea.grfAccessPermissions |= GENERIC_WRITE | FILE_READ_ATTRIBUTES;
|
||||||
|
ea.grfAccessPermissions |= SYNCHRONIZE;
|
||||||
|
ea.grfAccessMode = SET_ACCESS;
|
||||||
|
ea.grfInheritance = NO_INHERITANCE;
|
||||||
|
ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||||
|
ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
|
||||||
|
ea.Trustee.ptstrName = (LPTSTR)user_restricted;
|
||||||
|
|
||||||
|
if (SetEntriesInAcl(1, &ea, old_dacl, &new_dacl))
|
||||||
|
{
|
||||||
|
error = GetLastError();
|
||||||
|
goto Lclean_sd;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SetSecurityInfo(handle,
|
||||||
|
SE_KERNEL_OBJECT,
|
||||||
|
DACL_SECURITY_INFORMATION,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
new_dacl,
|
||||||
|
NULL))
|
||||||
|
{
|
||||||
|
error = GetLastError();
|
||||||
|
goto Lclean_dacl;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = 0;
|
||||||
|
|
||||||
|
Lclean_dacl:
|
||||||
|
LocalFree((HLOCAL)new_dacl);
|
||||||
|
Lclean_sd:
|
||||||
|
LocalFree((HLOCAL)sd);
|
||||||
|
Lclean_sid:
|
||||||
|
FreeLogonSID(&user_restricted);
|
||||||
|
Ldone:
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::create_medium_integrity_token()
|
||||||
|
{
|
||||||
|
HANDLE restricted_token_handle;
|
||||||
|
SAFER_LEVEL_HANDLE level_handle = NULL;
|
||||||
|
DWORD sid_size = SECURITY_MAX_SID_SIZE;
|
||||||
|
BYTE medium_sid[SECURITY_MAX_SID_SIZE];
|
||||||
|
if (!SaferCreateLevel(SAFER_SCOPEID_USER, SAFER_LEVELID_NORMALUSER, SAFER_LEVEL_OPEN, &level_handle, NULL))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!SaferComputeTokenFromLevel(level_handle, NULL, &restricted_token_handle, 0, NULL))
|
||||||
|
{
|
||||||
|
SaferCloseLevel(level_handle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
SaferCloseLevel(level_handle);
|
||||||
|
|
||||||
|
if (!CreateWellKnownSid(WinMediumLabelSid, nullptr, medium_sid, &sid_size))
|
||||||
|
{
|
||||||
|
CloseHandle(restricted_token_handle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TOKEN_MANDATORY_LABEL integrity_level = { 0 };
|
||||||
|
integrity_level.Label.Attributes = SE_GROUP_INTEGRITY;
|
||||||
|
integrity_level.Label.Sid = reinterpret_cast<PSID>(medium_sid);
|
||||||
|
|
||||||
|
if (!SetTokenInformation(restricted_token_handle, TokenIntegrityLevel, &integrity_level, sizeof(integrity_level)))
|
||||||
|
{
|
||||||
|
CloseHandle(restricted_token_handle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return restricted_token_handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::handle_pipe_connection(HANDLE input_pipe_handle)
|
||||||
|
{
|
||||||
|
//Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
|
||||||
|
HANDLE hHeap = GetProcessHeap();
|
||||||
|
uint8_t* pchRequest = (uint8_t*)HeapAlloc(hHeap, 0, BUFSIZE * sizeof(uint8_t));
|
||||||
|
|
||||||
|
DWORD cbBytesRead = 0, cbReplyBytes = 0, cbWritten = 0;
|
||||||
|
BOOL fSuccess = FALSE;
|
||||||
|
|
||||||
|
// Do some extra error checking since the app will keep running even if this thread fails.
|
||||||
|
std::list<std::vector<uint8_t>> message_parts;
|
||||||
|
|
||||||
|
if (input_pipe_handle == NULL)
|
||||||
|
{
|
||||||
|
if (pchRequest != NULL)
|
||||||
|
HeapFree(hHeap, 0, pchRequest);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pchRequest == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop until done reading
|
||||||
|
do
|
||||||
|
{
|
||||||
|
// Read client requests from the pipe. This simplistic code only allows messages
|
||||||
|
// up to BUFSIZE characters in length.
|
||||||
|
ZeroMemory(pchRequest, BUFSIZE * sizeof(uint8_t));
|
||||||
|
fSuccess = ReadFile(
|
||||||
|
input_pipe_handle, // handle to pipe
|
||||||
|
pchRequest, // buffer to receive data
|
||||||
|
BUFSIZE * sizeof(uint8_t), // size of buffer
|
||||||
|
&cbBytesRead, // number of bytes read
|
||||||
|
NULL); // not overlapped I/O
|
||||||
|
|
||||||
|
if (!fSuccess && GetLastError() != ERROR_MORE_DATA)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::vector<uint8_t> part_vector;
|
||||||
|
part_vector.reserve(cbBytesRead);
|
||||||
|
std::copy(pchRequest, pchRequest + cbBytesRead, std::back_inserter(part_vector));
|
||||||
|
message_parts.push_back(part_vector);
|
||||||
|
} while (!fSuccess);
|
||||||
|
|
||||||
|
if (fSuccess)
|
||||||
|
{
|
||||||
|
// Reconstruct the total_message.
|
||||||
|
std::vector<uint8_t> reconstructed_message;
|
||||||
|
size_t total_size = 0;
|
||||||
|
for (auto& part_vector : message_parts)
|
||||||
|
{
|
||||||
|
total_size += part_vector.size();
|
||||||
|
}
|
||||||
|
reconstructed_message.reserve(total_size);
|
||||||
|
for (auto& part_vector : message_parts)
|
||||||
|
{
|
||||||
|
std::move(part_vector.begin(), part_vector.end(), std::back_inserter(reconstructed_message));
|
||||||
|
}
|
||||||
|
std::wstring unicode_msg;
|
||||||
|
unicode_msg.assign(reinterpret_cast<std::wstring::const_pointer>(reconstructed_message.data()), reconstructed_message.size() / sizeof(std::wstring::value_type));
|
||||||
|
input_queue.queue_message(unicode_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush the pipe to allow the client to read the pipe's contents
|
||||||
|
// before disconnecting. Then disconnect the pipe, and close the
|
||||||
|
// handle to this pipe instance.
|
||||||
|
|
||||||
|
FlushFileBuffers(input_pipe_handle);
|
||||||
|
DisconnectNamedPipe(input_pipe_handle);
|
||||||
|
CloseHandle(input_pipe_handle);
|
||||||
|
|
||||||
|
HeapFree(hHeap, 0, pchRequest);
|
||||||
|
|
||||||
|
printf("InstanceThread exitting.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::start_named_pipe_server(HANDLE token)
|
||||||
|
{
|
||||||
|
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
|
||||||
|
const wchar_t* pipe_name = input_pipe_name.c_str();
|
||||||
|
BOOL connected = FALSE;
|
||||||
|
HANDLE connect_pipe_handle = INVALID_HANDLE_VALUE;
|
||||||
|
while (!closed)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::unique_lock lock(pipe_connect_handle_mutex);
|
||||||
|
connect_pipe_handle = CreateNamedPipe(
|
||||||
|
pipe_name,
|
||||||
|
PIPE_ACCESS_DUPLEX |
|
||||||
|
WRITE_DAC,
|
||||||
|
PIPE_TYPE_MESSAGE |
|
||||||
|
PIPE_READMODE_MESSAGE |
|
||||||
|
PIPE_WAIT,
|
||||||
|
PIPE_UNLIMITED_INSTANCES,
|
||||||
|
BUFSIZE,
|
||||||
|
BUFSIZE,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (connect_pipe_handle == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (token != NULL)
|
||||||
|
{
|
||||||
|
int err = change_pipe_security_allow_restricted_token(connect_pipe_handle, token);
|
||||||
|
}
|
||||||
|
current_connect_pipe_handle = connect_pipe_handle;
|
||||||
|
}
|
||||||
|
connected = ConnectNamedPipe(connect_pipe_handle, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
|
||||||
|
{
|
||||||
|
std::unique_lock lock(pipe_connect_handle_mutex);
|
||||||
|
current_connect_pipe_handle = NULL;
|
||||||
|
}
|
||||||
|
if (connected)
|
||||||
|
{
|
||||||
|
std::thread(&TwoWayPipeMessageIPCImpl::handle_pipe_connection, this, connect_pipe_handle).detach();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Client could not connect.
|
||||||
|
CloseHandle(connect_pipe_handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::consume_input_queue_thread()
|
||||||
|
{
|
||||||
|
while (!closed)
|
||||||
|
{
|
||||||
|
outgoing_message = L"";
|
||||||
|
std::wstring message = input_queue.pop_message();
|
||||||
|
if (message.length() == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if callback method exists first before trying to call it.
|
||||||
|
// otherwise just store the response message in a variable.
|
||||||
|
if (dispatch_inc_message_function != nullptr)
|
||||||
|
{
|
||||||
|
dispatch_inc_message_function(message);
|
||||||
|
}
|
||||||
|
outgoing_message = message;
|
||||||
|
}
|
||||||
|
}
|
@ -1,485 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Windows.h>
|
|
||||||
#include "async_message_queue.h"
|
|
||||||
#include <WinSafer.h>
|
|
||||||
#include <Sddl.h>
|
|
||||||
#include <accctrl.h>
|
|
||||||
#include <aclapi.h>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
class TwoWayPipeMessageIPC
|
class TwoWayPipeMessageIPC
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void (*callback_function)(const std::wstring&);
|
typedef void (*callback_function)(const std::wstring&);
|
||||||
void send(std::wstring msg)
|
TwoWayPipeMessageIPC(
|
||||||
{
|
std::wstring _input_pipe_name,
|
||||||
output_queue.queue_message(msg);
|
std::wstring _output_pipe_name,
|
||||||
}
|
callback_function p_func);
|
||||||
TwoWayPipeMessageIPC(std::wstring _input_pipe_name, std::wstring _output_pipe_name, callback_function p_func)
|
~TwoWayPipeMessageIPC();
|
||||||
{
|
void send(std::wstring msg);
|
||||||
input_pipe_name = _input_pipe_name;
|
void start(HANDLE _restricted_pipe_token);
|
||||||
output_pipe_name = _output_pipe_name;
|
void end();
|
||||||
dispatch_inc_message_function = p_func;
|
|
||||||
}
|
|
||||||
void start(HANDLE _restricted_pipe_token)
|
|
||||||
{
|
|
||||||
output_queue_thread = std::thread(&TwoWayPipeMessageIPC::consume_output_queue_thread, this);
|
|
||||||
input_queue_thread = std::thread(&TwoWayPipeMessageIPC::consume_input_queue_thread, this);
|
|
||||||
input_pipe_thread = std::thread(&TwoWayPipeMessageIPC::start_named_pipe_server, this, _restricted_pipe_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void end()
|
|
||||||
{
|
|
||||||
closed = true;
|
|
||||||
input_queue.interrupt();
|
|
||||||
input_queue_thread.join();
|
|
||||||
output_queue.interrupt();
|
|
||||||
output_queue_thread.join();
|
|
||||||
pipe_connect_handle_mutex.lock();
|
|
||||||
if (current_connect_pipe_handle != NULL)
|
|
||||||
{
|
|
||||||
//Cancels the Pipe currently waiting for a connection.
|
|
||||||
CancelIoEx(current_connect_pipe_handle, NULL);
|
|
||||||
}
|
|
||||||
pipe_connect_handle_mutex.unlock();
|
|
||||||
input_pipe_thread.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AsyncMessageQueue input_queue;
|
class TwoWayPipeMessageIPCImpl;
|
||||||
AsyncMessageQueue output_queue;
|
TwoWayPipeMessageIPCImpl* impl;
|
||||||
std::wstring output_pipe_name;
|
};
|
||||||
std::wstring input_pipe_name;
|
|
||||||
std::thread input_queue_thread;
|
|
||||||
std::thread output_queue_thread;
|
|
||||||
std::thread input_pipe_thread;
|
|
||||||
std::mutex pipe_connect_handle_mutex; // For manipulating the current_connect_pipe
|
|
||||||
std::wstring outgoing_message; // Store the updated json settings.
|
|
||||||
|
|
||||||
HANDLE current_connect_pipe_handle = NULL;
|
|
||||||
bool closed = false;
|
|
||||||
TwoWayPipeMessageIPC::callback_function dispatch_inc_message_function;
|
|
||||||
const DWORD BUFSIZE = 1024;
|
|
||||||
|
|
||||||
void send_pipe_message(std::wstring message)
|
|
||||||
{
|
|
||||||
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-client
|
|
||||||
HANDLE output_pipe_handle;
|
|
||||||
const wchar_t* message_send = message.c_str();
|
|
||||||
BOOL fSuccess = FALSE;
|
|
||||||
DWORD cbToWrite, cbWritten, dwMode;
|
|
||||||
const wchar_t* lpszPipename = output_pipe_name.c_str();
|
|
||||||
|
|
||||||
// Try to open a named pipe; wait for it, if necessary.
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
output_pipe_handle = CreateFile(
|
|
||||||
lpszPipename, // 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 (output_pipe_handle != INVALID_HANDLE_VALUE)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Exit if an error other than ERROR_PIPE_BUSY occurs.
|
|
||||||
DWORD curr_error = 0;
|
|
||||||
if ((curr_error = GetLastError()) != ERROR_PIPE_BUSY)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// All pipe instances are busy, so wait for 20 seconds.
|
|
||||||
|
|
||||||
if (!WaitNamedPipe(lpszPipename, 20000))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dwMode = PIPE_READMODE_MESSAGE;
|
|
||||||
fSuccess = SetNamedPipeHandleState(
|
|
||||||
output_pipe_handle, // pipe handle
|
|
||||||
&dwMode, // new pipe mode
|
|
||||||
NULL, // don't set maximum bytes
|
|
||||||
NULL); // don't set maximum time
|
|
||||||
if (!fSuccess)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send a message to the pipe server.
|
|
||||||
|
|
||||||
cbToWrite = (lstrlen(message_send)) * sizeof(WCHAR); // no need to send final '\0'. Pipe is in message mode.
|
|
||||||
|
|
||||||
fSuccess = WriteFile(
|
|
||||||
output_pipe_handle, // pipe handle
|
|
||||||
message_send, // message
|
|
||||||
cbToWrite, // message length
|
|
||||||
&cbWritten, // bytes written
|
|
||||||
NULL); // not overlapped
|
|
||||||
if (!fSuccess)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CloseHandle(output_pipe_handle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
void consume_output_queue_thread()
|
|
||||||
{
|
|
||||||
while (!closed)
|
|
||||||
{
|
|
||||||
std::wstring message = output_queue.pop_message();
|
|
||||||
if (message.length() == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
send_pipe_message(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL GetLogonSID(HANDLE hToken, PSID* ppsid)
|
|
||||||
{
|
|
||||||
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
|
|
||||||
BOOL bSuccess = FALSE;
|
|
||||||
DWORD dwIndex;
|
|
||||||
DWORD dwLength = 0;
|
|
||||||
PTOKEN_GROUPS ptg = NULL;
|
|
||||||
|
|
||||||
// Verify the parameter passed in is not NULL.
|
|
||||||
if (NULL == ppsid)
|
|
||||||
goto Cleanup;
|
|
||||||
|
|
||||||
// Get required buffer size and allocate the TOKEN_GROUPS buffer.
|
|
||||||
|
|
||||||
if (!GetTokenInformation(
|
|
||||||
hToken, // handle to the access token
|
|
||||||
TokenGroups, // get information about the token's groups
|
|
||||||
(LPVOID)ptg, // pointer to TOKEN_GROUPS buffer
|
|
||||||
0, // size of buffer
|
|
||||||
&dwLength // receives required buffer size
|
|
||||||
))
|
|
||||||
{
|
|
||||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
|
||||||
goto Cleanup;
|
|
||||||
|
|
||||||
ptg = (PTOKEN_GROUPS)HeapAlloc(GetProcessHeap(),
|
|
||||||
HEAP_ZERO_MEMORY,
|
|
||||||
dwLength);
|
|
||||||
|
|
||||||
if (ptg == NULL)
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the token group information from the access token.
|
|
||||||
|
|
||||||
if (!GetTokenInformation(
|
|
||||||
hToken, // handle to the access token
|
|
||||||
TokenGroups, // get information about the token's groups
|
|
||||||
(LPVOID)ptg, // pointer to TOKEN_GROUPS buffer
|
|
||||||
dwLength, // size of buffer
|
|
||||||
&dwLength // receives required buffer size
|
|
||||||
))
|
|
||||||
{
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through the groups to find the logon SID.
|
|
||||||
|
|
||||||
for (dwIndex = 0; dwIndex < ptg->GroupCount; dwIndex++)
|
|
||||||
if ((ptg->Groups[dwIndex].Attributes & SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID)
|
|
||||||
{
|
|
||||||
// Found the logon SID; make a copy of it.
|
|
||||||
|
|
||||||
dwLength = GetLengthSid(ptg->Groups[dwIndex].Sid);
|
|
||||||
*ppsid = (PSID)HeapAlloc(GetProcessHeap(),
|
|
||||||
HEAP_ZERO_MEMORY,
|
|
||||||
dwLength);
|
|
||||||
if (*ppsid == NULL)
|
|
||||||
goto Cleanup;
|
|
||||||
if (!CopySid(dwLength, *ppsid, ptg->Groups[dwIndex].Sid))
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bSuccess = TRUE;
|
|
||||||
|
|
||||||
Cleanup:
|
|
||||||
|
|
||||||
// Free the buffer for the token groups.
|
|
||||||
|
|
||||||
if (ptg != NULL)
|
|
||||||
HeapFree(GetProcessHeap(), 0, (LPVOID)ptg);
|
|
||||||
|
|
||||||
return bSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID FreeLogonSID(PSID* ppsid)
|
|
||||||
{
|
|
||||||
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
|
|
||||||
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
|
|
||||||
}
|
|
||||||
|
|
||||||
int change_pipe_security_allow_restricted_token(HANDLE handle, HANDLE token)
|
|
||||||
{
|
|
||||||
PACL old_dacl, new_dacl;
|
|
||||||
PSECURITY_DESCRIPTOR sd;
|
|
||||||
EXPLICIT_ACCESS ea;
|
|
||||||
PSID user_restricted;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
if (!GetLogonSID(token, &user_restricted))
|
|
||||||
{
|
|
||||||
error = 5; // No access error.
|
|
||||||
goto Ldone;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetSecurityInfo(handle,
|
|
||||||
SE_KERNEL_OBJECT,
|
|
||||||
DACL_SECURITY_INFORMATION,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&old_dacl,
|
|
||||||
NULL,
|
|
||||||
&sd))
|
|
||||||
{
|
|
||||||
error = GetLastError();
|
|
||||||
goto Lclean_sid;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&ea, 0, sizeof(EXPLICIT_ACCESS));
|
|
||||||
ea.grfAccessPermissions |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
|
|
||||||
ea.grfAccessPermissions |= GENERIC_WRITE | FILE_READ_ATTRIBUTES;
|
|
||||||
ea.grfAccessPermissions |= SYNCHRONIZE;
|
|
||||||
ea.grfAccessMode = SET_ACCESS;
|
|
||||||
ea.grfInheritance = NO_INHERITANCE;
|
|
||||||
ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
|
||||||
ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
|
|
||||||
ea.Trustee.ptstrName = (LPTSTR)user_restricted;
|
|
||||||
|
|
||||||
if (SetEntriesInAcl(1, &ea, old_dacl, &new_dacl))
|
|
||||||
{
|
|
||||||
error = GetLastError();
|
|
||||||
goto Lclean_sd;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SetSecurityInfo(handle,
|
|
||||||
SE_KERNEL_OBJECT,
|
|
||||||
DACL_SECURITY_INFORMATION,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
new_dacl,
|
|
||||||
NULL))
|
|
||||||
{
|
|
||||||
error = GetLastError();
|
|
||||||
goto Lclean_dacl;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = 0;
|
|
||||||
|
|
||||||
Lclean_dacl:
|
|
||||||
LocalFree((HLOCAL)new_dacl);
|
|
||||||
Lclean_sd:
|
|
||||||
LocalFree((HLOCAL)sd);
|
|
||||||
Lclean_sid:
|
|
||||||
FreeLogonSID(&user_restricted);
|
|
||||||
Ldone:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
HANDLE create_medium_integrity_token()
|
|
||||||
{
|
|
||||||
HANDLE restricted_token_handle;
|
|
||||||
SAFER_LEVEL_HANDLE level_handle = NULL;
|
|
||||||
DWORD sid_size = SECURITY_MAX_SID_SIZE;
|
|
||||||
BYTE medium_sid[SECURITY_MAX_SID_SIZE];
|
|
||||||
if (!SaferCreateLevel(SAFER_SCOPEID_USER, SAFER_LEVELID_NORMALUSER, SAFER_LEVEL_OPEN, &level_handle, NULL))
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!SaferComputeTokenFromLevel(level_handle, NULL, &restricted_token_handle, 0, NULL))
|
|
||||||
{
|
|
||||||
SaferCloseLevel(level_handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
SaferCloseLevel(level_handle);
|
|
||||||
|
|
||||||
if (!CreateWellKnownSid(WinMediumLabelSid, nullptr, medium_sid, &sid_size))
|
|
||||||
{
|
|
||||||
CloseHandle(restricted_token_handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TOKEN_MANDATORY_LABEL integrity_level = { 0 };
|
|
||||||
integrity_level.Label.Attributes = SE_GROUP_INTEGRITY;
|
|
||||||
integrity_level.Label.Sid = reinterpret_cast<PSID>(medium_sid);
|
|
||||||
|
|
||||||
if (!SetTokenInformation(restricted_token_handle, TokenIntegrityLevel, &integrity_level, sizeof(integrity_level)))
|
|
||||||
{
|
|
||||||
CloseHandle(restricted_token_handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return restricted_token_handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_pipe_connection(HANDLE input_pipe_handle)
|
|
||||||
{
|
|
||||||
//Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
|
|
||||||
HANDLE hHeap = GetProcessHeap();
|
|
||||||
uint8_t* pchRequest = (uint8_t*)HeapAlloc(hHeap, 0, BUFSIZE * sizeof(uint8_t));
|
|
||||||
|
|
||||||
DWORD cbBytesRead = 0, cbReplyBytes = 0, cbWritten = 0;
|
|
||||||
BOOL fSuccess = FALSE;
|
|
||||||
|
|
||||||
// Do some extra error checking since the app will keep running even if this thread fails.
|
|
||||||
std::list<std::vector<uint8_t>> message_parts;
|
|
||||||
|
|
||||||
if (input_pipe_handle == NULL)
|
|
||||||
{
|
|
||||||
if (pchRequest != NULL)
|
|
||||||
HeapFree(hHeap, 0, pchRequest);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pchRequest == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop until done reading
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// Read client requests from the pipe. This simplistic code only allows messages
|
|
||||||
// up to BUFSIZE characters in length.
|
|
||||||
ZeroMemory(pchRequest, BUFSIZE * sizeof(uint8_t));
|
|
||||||
fSuccess = ReadFile(
|
|
||||||
input_pipe_handle, // handle to pipe
|
|
||||||
pchRequest, // buffer to receive data
|
|
||||||
BUFSIZE * sizeof(uint8_t), // size of buffer
|
|
||||||
&cbBytesRead, // number of bytes read
|
|
||||||
NULL); // not overlapped I/O
|
|
||||||
|
|
||||||
if (!fSuccess && GetLastError() != ERROR_MORE_DATA)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
std::vector<uint8_t> part_vector;
|
|
||||||
part_vector.reserve(cbBytesRead);
|
|
||||||
std::copy(pchRequest, pchRequest + cbBytesRead, std::back_inserter(part_vector));
|
|
||||||
message_parts.push_back(part_vector);
|
|
||||||
} while (!fSuccess);
|
|
||||||
|
|
||||||
if (fSuccess)
|
|
||||||
{
|
|
||||||
// Reconstruct the total_message.
|
|
||||||
std::vector<uint8_t> reconstructed_message;
|
|
||||||
size_t total_size = 0;
|
|
||||||
for (auto& part_vector : message_parts)
|
|
||||||
{
|
|
||||||
total_size += part_vector.size();
|
|
||||||
}
|
|
||||||
reconstructed_message.reserve(total_size);
|
|
||||||
for (auto& part_vector : message_parts)
|
|
||||||
{
|
|
||||||
std::move(part_vector.begin(), part_vector.end(), std::back_inserter(reconstructed_message));
|
|
||||||
}
|
|
||||||
std::wstring unicode_msg;
|
|
||||||
unicode_msg.assign(reinterpret_cast<std::wstring::const_pointer>(reconstructed_message.data()), reconstructed_message.size() / sizeof(std::wstring::value_type));
|
|
||||||
input_queue.queue_message(unicode_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush the pipe to allow the client to read the pipe's contents
|
|
||||||
// before disconnecting. Then disconnect the pipe, and close the
|
|
||||||
// handle to this pipe instance.
|
|
||||||
|
|
||||||
FlushFileBuffers(input_pipe_handle);
|
|
||||||
DisconnectNamedPipe(input_pipe_handle);
|
|
||||||
CloseHandle(input_pipe_handle);
|
|
||||||
|
|
||||||
HeapFree(hHeap, 0, pchRequest);
|
|
||||||
|
|
||||||
printf("InstanceThread exitting.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void start_named_pipe_server(HANDLE token)
|
|
||||||
{
|
|
||||||
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
|
|
||||||
const wchar_t* pipe_name = input_pipe_name.c_str();
|
|
||||||
BOOL connected = FALSE;
|
|
||||||
HANDLE connect_pipe_handle = INVALID_HANDLE_VALUE;
|
|
||||||
while (!closed)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::unique_lock lock(pipe_connect_handle_mutex);
|
|
||||||
connect_pipe_handle = CreateNamedPipe(
|
|
||||||
pipe_name,
|
|
||||||
PIPE_ACCESS_DUPLEX |
|
|
||||||
WRITE_DAC,
|
|
||||||
PIPE_TYPE_MESSAGE |
|
|
||||||
PIPE_READMODE_MESSAGE |
|
|
||||||
PIPE_WAIT,
|
|
||||||
PIPE_UNLIMITED_INSTANCES,
|
|
||||||
BUFSIZE,
|
|
||||||
BUFSIZE,
|
|
||||||
0,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (connect_pipe_handle == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token != NULL)
|
|
||||||
{
|
|
||||||
int err = change_pipe_security_allow_restricted_token(connect_pipe_handle, token);
|
|
||||||
}
|
|
||||||
current_connect_pipe_handle = connect_pipe_handle;
|
|
||||||
}
|
|
||||||
connected = ConnectNamedPipe(connect_pipe_handle, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
|
|
||||||
{
|
|
||||||
std::unique_lock lock(pipe_connect_handle_mutex);
|
|
||||||
current_connect_pipe_handle = NULL;
|
|
||||||
}
|
|
||||||
if (connected)
|
|
||||||
{
|
|
||||||
std::thread(&TwoWayPipeMessageIPC::handle_pipe_connection, this, connect_pipe_handle).detach();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Client could not connect.
|
|
||||||
CloseHandle(connect_pipe_handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void consume_input_queue_thread()
|
|
||||||
{
|
|
||||||
while (!closed)
|
|
||||||
{
|
|
||||||
outgoing_message = L"";
|
|
||||||
std::wstring message = input_queue.pop_message();
|
|
||||||
if (message.length() == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if callback method exists first before trying to call it.
|
|
||||||
// otherwise just store the response message in a variable.
|
|
||||||
if (dispatch_inc_message_function != nullptr)
|
|
||||||
{
|
|
||||||
dispatch_inc_message_function(message);
|
|
||||||
}
|
|
||||||
outgoing_message = message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
43
src/common/two_way_pipe_message_ipc_impl.h
Normal file
43
src/common/two_way_pipe_message_ipc_impl.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Windows.h>
|
||||||
|
#include "async_message_queue.h"
|
||||||
|
#include <WinSafer.h>
|
||||||
|
#include <accctrl.h>
|
||||||
|
#include <aclapi.h>
|
||||||
|
#include <list>
|
||||||
|
#include "two_way_pipe_message_ipc.h"
|
||||||
|
|
||||||
|
class TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void send(std::wstring msg);
|
||||||
|
TwoWayPipeMessageIPCImpl(std::wstring _input_pipe_name, std::wstring _output_pipe_name, callback_function p_func);
|
||||||
|
void start(HANDLE _restricted_pipe_token);
|
||||||
|
void end();
|
||||||
|
|
||||||
|
private:
|
||||||
|
AsyncMessageQueue input_queue;
|
||||||
|
AsyncMessageQueue output_queue;
|
||||||
|
std::wstring output_pipe_name;
|
||||||
|
std::wstring input_pipe_name;
|
||||||
|
std::thread input_queue_thread;
|
||||||
|
std::thread output_queue_thread;
|
||||||
|
std::thread input_pipe_thread;
|
||||||
|
std::mutex pipe_connect_handle_mutex; // For manipulating the current_connect_pipe
|
||||||
|
std::wstring outgoing_message; // Store the updated json settings.
|
||||||
|
|
||||||
|
HANDLE current_connect_pipe_handle = NULL;
|
||||||
|
bool closed = false;
|
||||||
|
TwoWayPipeMessageIPC::callback_function dispatch_inc_message_function;
|
||||||
|
const DWORD BUFSIZE = 1024;
|
||||||
|
|
||||||
|
void send_pipe_message(std::wstring message);
|
||||||
|
void consume_output_queue_thread();
|
||||||
|
BOOL GetLogonSID(HANDLE hToken, PSID* ppsid);
|
||||||
|
VOID FreeLogonSID(PSID* ppsid);
|
||||||
|
int change_pipe_security_allow_restricted_token(HANDLE handle, HANDLE token);
|
||||||
|
HANDLE create_medium_integrity_token();
|
||||||
|
void handle_pipe_connection(HANDLE input_pipe_handle);
|
||||||
|
void start_named_pipe_server(HANDLE token);
|
||||||
|
void consume_input_queue_thread();
|
||||||
|
};
|
@ -1,210 +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>
|
|
||||||
<ProjectGuid>{C073B057-B157-40F0-8678-1DCD119D841C}</ProjectGuid>
|
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
||||||
<Keyword>AtlPSProj</Keyword>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<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|x64'">
|
|
||||||
<IntDir>$(Configuration)PS\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<IntDir>$(Configuration)PS\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<IntDir>$(Configuration)PS\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<IntDir>$(Configuration)PS\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>Microsoft.PowerToys.Settings.IPCWrapperPS.def</ModuleDefinitionFile>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>if exist dlldata.c goto :END
|
|
||||||
echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project.
|
|
||||||
Exit 1
|
|
||||||
:END
|
|
||||||
</Command>
|
|
||||||
<Message>Checking for required files</Message>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>WIN32;REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>Microsoft.PowerToys.Settings.IPCWrapperPS.def</ModuleDefinitionFile>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>if exist dlldata.c goto :END
|
|
||||||
echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project.
|
|
||||||
Exit 1
|
|
||||||
:END
|
|
||||||
</Command>
|
|
||||||
<Message>Checking for required files</Message>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>WIN32;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>Microsoft.PowerToys.Settings.IPCWrapperPS.def</ModuleDefinitionFile>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>if exist dlldata.c goto :END
|
|
||||||
echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project.
|
|
||||||
Exit 1
|
|
||||||
:END
|
|
||||||
</Command>
|
|
||||||
<Message>Checking for required files</Message>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<ModuleDefinitionFile>Microsoft.PowerToys.Settings.IPCWrapperPS.def</ModuleDefinitionFile>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>if exist dlldata.c goto :END
|
|
||||||
echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project.
|
|
||||||
Exit 1
|
|
||||||
:END
|
|
||||||
</Command>
|
|
||||||
<Message>Checking for required files</Message>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\Microsoft.PowerToys.Settings.IPCWrapperps.def" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\dlldata.c">
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\MicrosoftPowerToysSettingsIPCWrapper_i.c">
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\MicrosoftPowerToysSettingsIPCWrapper_p.c">
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Generated Files">
|
|
||||||
<UniqueIdentifier>{48f2eb30-48be-400a-88ce-8f93929d29c8}</UniqueIdentifier>
|
|
||||||
<SourceControlFiles>False</SourceControlFiles>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;c++;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>
|
|
||||||
<None Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\Microsoft.PowerToys.Settings.IPCWrapperps.def">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\MicrosoftPowerToysSettingsIPCWrapper_i.c">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\MicrosoftPowerToysSettingsIPCWrapper_p.c">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\core\Microsoft.PowerToys.Settings.IPCWrapper\dlldata.c">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,72 +0,0 @@
|
|||||||
// TwoWayIPCLib.cpp : Implementation of DLL Exports.
|
|
||||||
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "framework.h"
|
|
||||||
#include "resource.h"
|
|
||||||
#include "TwoWayIPCLib_i.h"
|
|
||||||
#include "dllmain.h"
|
|
||||||
|
|
||||||
using namespace ATL;
|
|
||||||
|
|
||||||
// Used to determine whether the DLL can be unloaded by OLE.
|
|
||||||
_Use_decl_annotations_
|
|
||||||
STDAPI DllCanUnloadNow(void)
|
|
||||||
{
|
|
||||||
return _AtlModule.DllCanUnloadNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns a class factory to create an object of the requested type.
|
|
||||||
_Use_decl_annotations_
|
|
||||||
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
|
|
||||||
{
|
|
||||||
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
|
|
||||||
}
|
|
||||||
|
|
||||||
// DllRegisterServer - Adds entries to the system registry.
|
|
||||||
_Use_decl_annotations_
|
|
||||||
STDAPI DllRegisterServer(void)
|
|
||||||
{
|
|
||||||
// registers object, typelib and all interfaces in typelib
|
|
||||||
HRESULT hr = _AtlModule.DllRegisterServer();
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DllUnregisterServer - Removes entries from the system registry.
|
|
||||||
_Use_decl_annotations_
|
|
||||||
STDAPI DllUnregisterServer(void)
|
|
||||||
{
|
|
||||||
HRESULT hr = _AtlModule.DllUnregisterServer();
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DllInstall - Adds/Removes entries to the system registry per user per machine.
|
|
||||||
STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine)
|
|
||||||
{
|
|
||||||
HRESULT hr = E_FAIL;
|
|
||||||
static const wchar_t szUserSwitch[] = L"user";
|
|
||||||
|
|
||||||
if (pszCmdLine != nullptr)
|
|
||||||
{
|
|
||||||
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
|
|
||||||
{
|
|
||||||
ATL::AtlSetPerUserRegistration(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bInstall)
|
|
||||||
{
|
|
||||||
hr = DllRegisterServer();
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
DllUnregisterServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hr = DllUnregisterServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
; TwoWayIPCLib.def : Declares the module parameters.
|
|
||||||
|
|
||||||
LIBRARY
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
DllCanUnloadNow PRIVATE
|
|
||||||
DllGetClassObject PRIVATE
|
|
||||||
DllRegisterServer PRIVATE
|
|
||||||
DllUnregisterServer PRIVATE
|
|
||||||
DllInstall PRIVATE
|
|
@ -1,48 +0,0 @@
|
|||||||
// TwoWayIPCLib.idl : IDL source for TwoWayIPCLib
|
|
||||||
//
|
|
||||||
|
|
||||||
// This file will be processed by the MIDL tool to
|
|
||||||
// produce the type library (TwoWayIPCLib.tlb) and marshalling code.
|
|
||||||
|
|
||||||
import "oaidl.idl";
|
|
||||||
import "ocidl.idl";
|
|
||||||
|
|
||||||
[
|
|
||||||
local,
|
|
||||||
object,
|
|
||||||
uuid(8160da0a-c224-485c-b5ba-66484f212cf4),
|
|
||||||
dual,
|
|
||||||
nonextensible,
|
|
||||||
pointer_default(unique)
|
|
||||||
]
|
|
||||||
interface ITwoWayIPCManager : IDispatch
|
|
||||||
{
|
|
||||||
[id(1)] HRESULT SendMessage([in] BSTR message);
|
|
||||||
[id(2)] HRESULT Initialize([in] BSTR runnerPipeName, [in] BSTR settingsPipeName);
|
|
||||||
};
|
|
||||||
[
|
|
||||||
uuid(7e00d5a3-11df-45c1-a675-96e408bd5bf5),
|
|
||||||
version(1.0),
|
|
||||||
]
|
|
||||||
library TwoWayIPCLibLib
|
|
||||||
{
|
|
||||||
importlib("stdole2.tlb");
|
|
||||||
[
|
|
||||||
uuid(62d4786d-c6be-4e2a-8362-0f3ed73d3321)
|
|
||||||
]
|
|
||||||
dispinterface _ITwoWayIPCManagerEvents
|
|
||||||
{
|
|
||||||
properties:
|
|
||||||
methods:
|
|
||||||
};
|
|
||||||
[
|
|
||||||
uuid(cbd4dd85-c226-425f-af85-66de72bc5f7e)
|
|
||||||
]
|
|
||||||
coclass TwoWayIPCManager
|
|
||||||
{
|
|
||||||
[default] interface ITwoWayIPCManager;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
import "shobjidl.idl";
|
|
@ -1,129 +0,0 @@
|
|||||||
// Microsoft Visual C++ generated resource script.
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⌀椀渀挀氀甀搀攀 ∀爀攀猀漀甀爀挀攀⸀栀∀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⌀搀攀昀椀渀攀 䄀倀匀吀唀䐀䤀伀开刀䔀䄀䐀伀一䰀夀开匀夀䴀䈀伀䰀匀ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 䜀攀渀攀爀愀琀攀搀 昀爀漀洀 琀栀攀 吀䔀堀吀䤀一䌀䰀唀䐀䔀 ㈀ 爀攀猀漀甀爀挀攀⸀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⌀椀昀渀搀攀昀 䄀倀匀吀唀䐀䤀伀开䤀一嘀伀䬀䔀䐀ഀ<EFBFBD>
|
|
||||||
⌀椀渀挀氀甀搀攀 ∀琀愀爀最攀琀瘀攀爀⸀栀∀ഀ<EFBFBD>
|
|
||||||
⌀攀渀搀椀昀ഀ<EFBFBD>
|
|
||||||
⌀椀渀挀氀甀搀攀 ∀眀椀渀爀攀猀⸀栀∀ഀ<EFBFBD>
|
|
||||||
⌀椀渀挀氀甀搀攀 ∀瘀攀爀爀猀爀挀⸀栀∀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⌀甀渀搀攀昀 䄀倀匀吀唀䐀䤀伀开刀䔀䄀䐀伀一䰀夀开匀夀䴀䈀伀䰀匀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 䔀渀最氀椀猀栀 ⠀唀渀椀琀攀搀 匀琀愀琀攀猀⤀ 爀攀猀漀甀爀挀攀猀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⌀椀昀 ℀搀攀昀椀渀攀搀⠀䄀䘀堀开刀䔀匀伀唀刀䌀䔀开䐀䰀䰀⤀ 簀簀 搀攀昀椀渀攀搀⠀䄀䘀堀开吀䄀刀䜀开䔀一唀⤀ഀ<EFBFBD>
|
|
||||||
䰀䄀一䜀唀䄀䜀䔀 䰀䄀一䜀开䔀一䜀䰀䤀匀䠀Ⰰ 匀唀䈀䰀䄀一䜀开䔀一䜀䰀䤀匀䠀开唀匀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⌀椀昀搀攀昀 䄀倀匀吀唀䐀䤀伀开䤀一嘀伀䬀䔀䐀ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 吀䔀堀吀䤀一䌀䰀唀䐀䔀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
吀䔀堀吀䤀一䌀䰀唀䐀䔀 ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
∀爀攀猀漀甀爀挀攀⸀栀尀 ∀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
㈀ 吀䔀堀吀䤀一䌀䰀唀䐀䔀 ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
∀⌀椀昀渀搀攀昀 䄀倀匀吀唀䐀䤀伀开䤀一嘀伀䬀䔀䐀尀爀尀渀∀ഀ<EFBFBD>
|
|
||||||
∀⌀椀渀挀氀甀搀攀 ∀∀琀愀爀最攀琀瘀攀爀⸀栀∀∀尀爀尀渀∀ഀ<EFBFBD>
|
|
||||||
∀⌀攀渀搀椀昀尀爀尀渀∀ഀ<EFBFBD>
|
|
||||||
∀⌀椀渀挀氀甀搀攀 ∀∀眀椀渀爀攀猀⸀栀∀∀尀爀尀渀∀ഀ<EFBFBD>
|
|
||||||
∀⌀椀渀挀氀甀搀攀 ∀∀瘀攀爀爀猀爀挀⸀栀∀∀尀爀尀渀∀ഀ<EFBFBD>
|
|
||||||
∀尀 ∀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
㌀ 吀䔀堀吀䤀一䌀䰀唀䐀䔀 ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
∀ 吀夀倀䔀䰀䤀䈀 ∀∀吀眀漀圀愀礀䤀倀䌀䰀椀戀⸀琀氀戀∀∀尀爀尀渀∀ഀ<EFBFBD>
|
|
||||||
∀尀 ∀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⌀攀渀搀椀昀 ⼀⼀ 䄀倀匀吀唀䐀䤀伀开䤀一嘀伀䬀䔀䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 嘀攀爀猀椀漀渀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
嘀匀开嘀䔀刀匀䤀伀一开䤀一䘀伀 嘀䔀刀匀䤀伀一䤀一䘀伀ഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀嘀䔀刀匀䤀伀一 Ⰰ Ⰰ Ⰰഀ<EFBFBD>
|
|
||||||
倀刀伀䐀唀䌀吀嘀䔀刀匀䤀伀一 Ⰰ Ⰰ Ⰰഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀䘀䰀䄀䜀匀䴀䄀匀䬀 砀㌀昀䰀ഀ<EFBFBD>
|
|
||||||
⌀椀昀搀攀昀 开䐀䔀䈀唀䜀ഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀䘀䰀䄀䜀匀 砀䰀ഀ<EFBFBD>
|
|
||||||
⌀攀氀猀攀ഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀䘀䰀䄀䜀匀 砀 䰀ഀ<EFBFBD>
|
|
||||||
⌀攀渀搀椀昀ഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀伀匀 砀㐀 㐀䰀ഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀吀夀倀䔀 砀㈀䰀ഀ<EFBFBD>
|
|
||||||
䘀䤀䰀䔀匀唀䈀吀夀倀䔀 砀 䰀ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
䈀䰀伀䌀䬀 ∀匀琀爀椀渀最䘀椀氀攀䤀渀昀漀∀ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
䈀䰀伀䌀䬀 ∀ 㐀 㤀 㐀䈀 ∀ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀䌀漀洀瀀愀渀礀一愀洀攀∀Ⰰ ∀吀伀䐀伀㨀 㰀䌀漀洀瀀愀渀礀 渀愀洀攀㸀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀䘀椀氀攀䐀攀猀挀爀椀瀀琀椀漀渀∀Ⰰ ∀吀伀䐀伀㨀 㰀䘀椀氀攀 搀攀猀挀爀椀瀀琀椀漀渀㸀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀䘀椀氀攀嘀攀爀猀椀漀渀∀Ⰰ ∀⸀ ⸀ ⸀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀䰀攀最愀氀䌀漀瀀礀爀椀最栀琀∀Ⰰ ∀吀伀䐀伀㨀 ⠀挀⤀ 㰀䌀漀洀瀀愀渀礀 渀愀洀攀㸀⸀ 䄀氀氀 爀椀最栀琀猀 爀攀猀攀爀瘀攀搀⸀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀䤀渀琀攀爀渀愀氀一愀洀攀∀Ⰰ ∀吀眀漀圀愀礀䤀倀䌀䰀椀戀⸀搀氀氀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀伀爀椀最椀渀愀氀䘀椀氀攀渀愀洀攀∀Ⰰ ∀吀眀漀圀愀礀䤀倀䌀䰀椀戀⸀搀氀氀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀倀爀漀搀甀挀琀一愀洀攀∀Ⰰ ∀吀伀䐀伀㨀 㰀倀爀漀搀甀挀琀 渀愀洀攀㸀∀ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀倀爀漀搀甀挀琀嘀攀爀猀椀漀渀∀Ⰰ ∀⸀ ⸀ ⸀∀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
䈀䰀伀䌀䬀 ∀嘀愀爀䘀椀氀攀䤀渀昀漀∀ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
嘀䄀䰀唀䔀 ∀吀爀愀渀猀氀愀琀椀漀渀∀Ⰰ 砀㐀 㤀Ⰰ ㈀ ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 刀䔀䜀䤀匀吀刀夀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
䤀䐀刀开吀圀伀圀䄀夀䤀倀䌀䰀䤀䈀 刀䔀䜀䤀匀吀刀夀 ∀吀眀漀圀愀礀䤀倀䌀䰀椀戀⸀爀最猀∀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
䤀䐀刀开吀圀伀圀䄀夀䤀倀䌀䴀䄀一䄀䜀䔀刀 刀䔀䜀䤀匀吀刀夀 ∀吀眀漀圀愀礀䤀倀䌀䴀愀渀愀最攀爀⸀爀最猀∀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 匀琀爀椀渀最 吀愀戀氀攀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
匀吀刀䤀一䜀吀䄀䈀䰀䔀ഀ<EFBFBD>
|
|
||||||
䈀䔀䜀䤀一ഀ<EFBFBD>
|
|
||||||
䤀䐀匀开倀刀伀䨀一䄀䴀䔀 ∀吀眀漀圀愀礀䤀倀䌀䰀椀戀∀ഀ<EFBFBD>
|
|
||||||
䔀一䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⌀攀渀搀椀昀 ⼀⼀ 䔀渀最氀椀猀栀 ⠀唀渀椀琀攀搀 匀琀愀琀攀猀⤀ 爀攀猀漀甀爀挀攀猀ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⌀椀昀渀搀攀昀 䄀倀匀吀唀䐀䤀伀开䤀一嘀伀䬀䔀䐀ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
⼀⼀ 䜀攀渀攀爀愀琀攀搀 昀爀漀洀 琀栀攀 吀䔀堀吀䤀一䌀䰀唀䐀䔀 ㌀ 爀攀猀漀甀爀挀攀⸀ഀ<EFBFBD>
|
|
||||||
⼀⼀ഀ<EFBFBD>
|
|
||||||
吀夀倀䔀䰀䤀䈀 ∀吀眀漀圀愀礀䤀倀䌀䰀椀戀⸀琀氀戀∀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀⼀ഀ<EFBFBD>
|
|
||||||
⌀攀渀搀椀昀 ⼀⼀ 渀漀琀 䄀倀匀吀唀䐀䤀伀开䤀一嘀伀䬀䔀䐀ഀ<EFBFBD>
|
|
||||||
ഀ<EFBFBD>
|
|
||||||
<EFBFBD>
|
|
@ -1,3 +0,0 @@
|
|||||||
HKCR
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,296 +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>
|
|
||||||
<ProjectGuid>{F88B6FD1-14BD-48DB-85C2-6C51B8045121}</ProjectGuid>
|
|
||||||
<Keyword>AtlProj</Keyword>
|
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
||||||
<ProjectName>Microsoft.PowerToys.Settings.TwoWayIPCLib</ProjectName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<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|x64'">
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)</OutDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)</OutDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>..\..\..\common\inc;..\..\..\common\Telemetry;..\;..\..\;..\..\..\deps\cpprestsdk\include;..\..\..\common;..\..\..\;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
|
||||||
</ClCompile>
|
|
||||||
<Midl>
|
|
||||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<HeaderFileName>TwoWayIPCLib_i.h</HeaderFileName>
|
|
||||||
<InterfaceIdentifierFileName>TwoWayIPCLib_i.c</InterfaceIdentifierFileName>
|
|
||||||
<ProxyFileName>TwoWayIPCLib_p.c</ProxyFileName>
|
|
||||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
|
||||||
<TypeLibraryName>$(IntDir)TwoWayIPCLib.tlb</TypeLibraryName>
|
|
||||||
<DllDataFileName />
|
|
||||||
<ValidateAllParameters>true</ValidateAllParameters>
|
|
||||||
</Midl>
|
|
||||||
<ResourceCompile>
|
|
||||||
<Culture>0x0409</Culture>
|
|
||||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<ModuleDefinitionFile>.\TwoWayIPCLib.def</ModuleDefinitionFile>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
<PerUserRedirection>true</PerUserRedirection>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Midl>
|
|
||||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
|
||||||
<TargetEnvironment>Win32</TargetEnvironment>
|
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<HeaderFileName>TwoWayIPCLib_i.h</HeaderFileName>
|
|
||||||
<InterfaceIdentifierFileName>TwoWayIPCLib_i.c</InterfaceIdentifierFileName>
|
|
||||||
<ProxyFileName>TwoWayIPCLib_p.c</ProxyFileName>
|
|
||||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
|
||||||
<TypeLibraryName>$(IntDir)TwoWayIPCLib.tlb</TypeLibraryName>
|
|
||||||
<DllDataFileName />
|
|
||||||
<ValidateAllParameters>true</ValidateAllParameters>
|
|
||||||
</Midl>
|
|
||||||
<ResourceCompile>
|
|
||||||
<Culture>0x0409</Culture>
|
|
||||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<ModuleDefinitionFile>.\TwoWayIPCLib.def</ModuleDefinitionFile>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Midl>
|
|
||||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
|
||||||
<TargetEnvironment>Win32</TargetEnvironment>
|
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<HeaderFileName>TwoWayIPCLib_i.h</HeaderFileName>
|
|
||||||
<InterfaceIdentifierFileName>TwoWayIPCLib_i.c</InterfaceIdentifierFileName>
|
|
||||||
<ProxyFileName>TwoWayIPCLib_p.c</ProxyFileName>
|
|
||||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
|
||||||
<TypeLibraryName>$(IntDir)TwoWayIPCLib.tlb</TypeLibraryName>
|
|
||||||
<DllDataFileName />
|
|
||||||
<ValidateAllParameters>true</ValidateAllParameters>
|
|
||||||
</Midl>
|
|
||||||
<ResourceCompile>
|
|
||||||
<Culture>0x0409</Culture>
|
|
||||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<ModuleDefinitionFile>.\TwoWayIPCLib.def</ModuleDefinitionFile>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
|
||||||
<AdditionalIncludeDirectories>..\..\..\common\inc;..\..\..\common\Telemetry;..\;..\..\;..\..\..\deps\cpprestsdk\include;..\..\..\common;..\..\..\;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
|
||||||
<SupportJustMyCode>true</SupportJustMyCode>
|
|
||||||
</ClCompile>
|
|
||||||
<Midl>
|
|
||||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<HeaderFileName>TwoWayIPCLib_i.h</HeaderFileName>
|
|
||||||
<InterfaceIdentifierFileName>TwoWayIPCLib_i.c</InterfaceIdentifierFileName>
|
|
||||||
<ProxyFileName>TwoWayIPCLib_p.c</ProxyFileName>
|
|
||||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
|
||||||
<TypeLibraryName>$(IntDir)TwoWayIPCLib.tlb</TypeLibraryName>
|
|
||||||
<DllDataFileName />
|
|
||||||
<ValidateAllParameters>true</ValidateAllParameters>
|
|
||||||
</Midl>
|
|
||||||
<ResourceCompile>
|
|
||||||
<Culture>0x0409</Culture>
|
|
||||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<ModuleDefinitionFile>.\TwoWayIPCLib.def</ModuleDefinitionFile>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<RegisterOutput>true</RegisterOutput>
|
|
||||||
<PerUserRedirection>true</PerUserRedirection>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="dllmain.h" />
|
|
||||||
<ClInclude Include="framework.h" />
|
|
||||||
<ClInclude Include="pch.h" />
|
|
||||||
<ClInclude Include="Resource.h" />
|
|
||||||
<ClInclude Include="targetver.h" />
|
|
||||||
<ClInclude Include="TwoWayIPCLib_i.h" />
|
|
||||||
<ClInclude Include="TwoWayIPCManager.h" />
|
|
||||||
<ClInclude Include="_ITwoWayIPCManagerEvents_CP.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="dllmain.cpp">
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="pch.cpp">
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TwoWayIPCLib.cpp" />
|
|
||||||
<ClCompile Include="TwoWayIPCLib_i.c">
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
</PrecompiledHeader>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TwoWayIPCManager.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="TwoWayIPCLib.rc" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="TwoWayIPCLib.def" />
|
|
||||||
<None Include="TwoWayIPCLib.rgs" />
|
|
||||||
<None Include="TwoWayIPCManager.rgs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Midl Include="TwoWayIPCLib.idl" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\common\common.vcxproj">
|
|
||||||
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
@ -1,85 +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;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;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>
|
|
||||||
<Filter Include="Generated Files">
|
|
||||||
<UniqueIdentifier>{27e408d7-3292-4c84-9621-bd3b4a4925d3}</UniqueIdentifier>
|
|
||||||
<SourceControlFiles>False</SourceControlFiles>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="framework.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="targetver.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Resource.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="dllmain.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TwoWayIPCLib_i.h">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="pch.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="_ITwoWayIPCManagerEvents_CP.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TwoWayIPCManager.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="TwoWayIPCLib.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="dllmain.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TwoWayIPCLib_i.c">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="pch.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TwoWayIPCManager.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="TwoWayIPCLib.rc">
|
|
||||||
<Filter>Resource Files</Filter>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="TwoWayIPCLib.rgs">
|
|
||||||
<Filter>Resource Files</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="TwoWayIPCLib.def">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="TwoWayIPCManager.rgs">
|
|
||||||
<Filter>Resource Files</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Midl Include="TwoWayIPCLib.idl">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</Midl>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
LIBRARY
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
DllGetClassObject PRIVATE
|
|
||||||
DllCanUnloadNow PRIVATE
|
|
||||||
DllRegisterServer PRIVATE
|
|
||||||
DllUnregisterServer PRIVATE
|
|
@ -1,54 +0,0 @@
|
|||||||
// TwoWayIPCManager.cpp : Implementation of CTwoWayIPCManager
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "TwoWayIPCManager.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default constructor, initialized the IPC variabl to null.
|
|
||||||
*/
|
|
||||||
CTwoWayIPCManager::CTwoWayIPCManager()
|
|
||||||
{
|
|
||||||
this->m_MessagePipe = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CTwoWayIPCManager::~CTwoWayIPCManager()
|
|
||||||
{
|
|
||||||
delete this->m_MessagePipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send IPC Message.
|
|
||||||
*/
|
|
||||||
STDMETHODIMP CTwoWayIPCManager::SendMessage(BSTR message)
|
|
||||||
{
|
|
||||||
wstring strMessage = (PCWSTR)message;
|
|
||||||
this->m_MessagePipe->send(strMessage);
|
|
||||||
wcout << "sending message" << L"\n";
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This method is meant to initialize the IPC constructor and
|
|
||||||
* and start the threading process.
|
|
||||||
*/
|
|
||||||
STDMETHODIMP CTwoWayIPCManager::Initialize(BSTR runnerPipeName, BSTR settingsPipeName)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
wstring powertoys_pipe_name = (PCWSTR)runnerPipeName;
|
|
||||||
wstring settings_pipe_name = (PCWSTR)settingsPipeName;
|
|
||||||
|
|
||||||
this->m_MessagePipe = new TwoWayPipeMessageIPC(powertoys_pipe_name, settings_pipe_name, nullptr);
|
|
||||||
this->m_MessagePipe->start(nullptr);
|
|
||||||
}
|
|
||||||
catch (std::exception exp)
|
|
||||||
{
|
|
||||||
S_FALSE;
|
|
||||||
}
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
// TwoWayIPCManager.h : Declaration of the CTwoWayIPCManager
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "resource.h" // main symbols
|
|
||||||
|
|
||||||
#include "TwoWayIPCLib_i.h"
|
|
||||||
#include "_ITwoWayIPCManagerEvents_CP.h"
|
|
||||||
#include "common/two_way_pipe_message_ipc.h"
|
|
||||||
|
|
||||||
using namespace ATL;
|
|
||||||
|
|
||||||
// CTwoWayIPCManager
|
|
||||||
|
|
||||||
class ATL_NO_VTABLE CTwoWayIPCManager :
|
|
||||||
public CComObjectRootEx<CComSingleThreadModel>,
|
|
||||||
public CComCoClass<CTwoWayIPCManager, &CLSID_TwoWayIPCManager>,
|
|
||||||
public IConnectionPointContainerImpl<CTwoWayIPCManager>,
|
|
||||||
public CProxy_ITwoWayIPCManagerEvents<CTwoWayIPCManager>,
|
|
||||||
public IDispatchImpl<ITwoWayIPCManager, &IID_ITwoWayIPCManager, &LIBID_TwoWayIPCLibLib, /*wMajor =*/1, /*wMinor =*/0>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CTwoWayIPCManager();
|
|
||||||
~CTwoWayIPCManager();
|
|
||||||
|
|
||||||
DECLARE_REGISTRY_RESOURCEID(106)
|
|
||||||
|
|
||||||
BEGIN_COM_MAP(CTwoWayIPCManager)
|
|
||||||
COM_INTERFACE_ENTRY(ITwoWayIPCManager)
|
|
||||||
COM_INTERFACE_ENTRY(IDispatch)
|
|
||||||
COM_INTERFACE_ENTRY(IConnectionPointContainer)
|
|
||||||
END_COM_MAP()
|
|
||||||
|
|
||||||
BEGIN_CONNECTION_POINT_MAP(CTwoWayIPCManager)
|
|
||||||
CONNECTION_POINT_ENTRY(__uuidof(_ITwoWayIPCManagerEvents))
|
|
||||||
END_CONNECTION_POINT_MAP()
|
|
||||||
|
|
||||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
||||||
|
|
||||||
HRESULT FinalConstruct()
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FinalRelease()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHOD(SendMessage)
|
|
||||||
(BSTR message);
|
|
||||||
|
|
||||||
STDMETHOD(Initialize)
|
|
||||||
(BSTR runnerPipeName, BSTR settingsPipeName);
|
|
||||||
|
|
||||||
private:
|
|
||||||
TwoWayPipeMessageIPC* m_MessagePipe;
|
|
||||||
BSTR m_message_from_runner;
|
|
||||||
};
|
|
||||||
|
|
||||||
OBJECT_ENTRY_AUTO(__uuidof(TwoWayIPCManager), CTwoWayIPCManager)
|
|
@ -1,26 +0,0 @@
|
|||||||
HKCR
|
|
||||||
{
|
|
||||||
TwoWayIPCLib.TwoWayIPCManager.1 = s 'TwoWayIPCManager class'
|
|
||||||
{
|
|
||||||
CLSID = s '{cbd4dd85-c226-425f-af85-66de72bc5f7e}'
|
|
||||||
}
|
|
||||||
TwoWayIPCLib.TwoWayIPCManager = s 'TwoWayIPCManager class'
|
|
||||||
{
|
|
||||||
CurVer = s 'TwoWayIPCLib.TwoWayIPCManager.1'
|
|
||||||
}
|
|
||||||
NoRemove CLSID
|
|
||||||
{
|
|
||||||
ForceRemove {cbd4dd85-c226-425f-af85-66de72bc5f7e} = s 'TwoWayIPCManager class'
|
|
||||||
{
|
|
||||||
ProgID = s 'TwoWayIPCLib.TwoWayIPCManager.1'
|
|
||||||
VersionIndependentProgID = s 'TwoWayIPCLib.TwoWayIPCManager'
|
|
||||||
ForceRemove Programmable
|
|
||||||
InprocServer32 = s '%MODULE%'
|
|
||||||
{
|
|
||||||
val ThreadingModel = s 'Apartment'
|
|
||||||
}
|
|
||||||
TypeLib = s '{7e00d5a3-11df-45c1-a675-96e408bd5bf5}'
|
|
||||||
Version = s '1.0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
class CProxy_ITwoWayIPCManagerEvents :
|
|
||||||
public ATL::IConnectionPointImpl<T, &__uuidof(_ITwoWayIPCManagerEvents)>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
};
|
|
@ -1,16 +0,0 @@
|
|||||||
// dllmain.cpp : Implementation of DllMain.
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "framework.h"
|
|
||||||
#include "resource.h"
|
|
||||||
#include "TwoWayIPCLib_i.h"
|
|
||||||
#include "dllmain.h"
|
|
||||||
|
|
||||||
CTwoWayIPCLibModule _AtlModule;
|
|
||||||
|
|
||||||
// DLL Entry Point
|
|
||||||
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
|
||||||
{
|
|
||||||
hInstance;
|
|
||||||
return _AtlModule.DllMain(dwReason, lpReserved);
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// dllmain.h : Declaration of module class.
|
|
||||||
|
|
||||||
class CTwoWayIPCLibModule : public ATL::CAtlDllModuleT< CTwoWayIPCLibModule >
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
DECLARE_LIBID(LIBID_TwoWayIPCLibLib)
|
|
||||||
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_TWOWAYIPCLIB, "{7e00d5a3-11df-45c1-a675-96e408bd5bf5}")
|
|
||||||
};
|
|
||||||
|
|
||||||
extern class CTwoWayIPCLibModule _AtlModule;
|
|
@ -1,21 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef STRICT
|
|
||||||
#define STRICT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "targetver.h"
|
|
||||||
|
|
||||||
#define _ATL_APARTMENT_THREADED
|
|
||||||
|
|
||||||
#define _ATL_NO_AUTOMATIC_NAMESPACE
|
|
||||||
|
|
||||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
|
||||||
|
|
||||||
|
|
||||||
#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
|
|
||||||
|
|
||||||
#include "resource.h"
|
|
||||||
#include <atlbase.h>
|
|
||||||
#include <atlcom.h>
|
|
||||||
#include <atlctl.h>
|
|
@ -1,5 +0,0 @@
|
|||||||
// pch.cpp: source file corresponding to the pre-compiled header
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
|
|
||||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
|
@ -1,13 +0,0 @@
|
|||||||
// pch.h: This is a precompiled header file.
|
|
||||||
// Files listed below are compiled only once, improving build performance for future builds.
|
|
||||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
|
||||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
|
||||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
|
||||||
|
|
||||||
#ifndef PCH_H
|
|
||||||
#define PCH_H
|
|
||||||
|
|
||||||
// add headers that you want to pre-compile here
|
|
||||||
#include "framework.h"
|
|
||||||
|
|
||||||
#endif //PCH_H
|
|
@ -1,18 +0,0 @@
|
|||||||
//{{NO_DEPENDENCIES}}
|
|
||||||
// Microsoft Visual C++ generated include file.
|
|
||||||
// Used by TwoWayIPCLib.rc
|
|
||||||
//
|
|
||||||
#define IDS_PROJNAME 100
|
|
||||||
#define IDR_TWOWAYIPCLIB 101
|
|
||||||
#define IDR_TWOWAYIPCMANAGER 106
|
|
||||||
|
|
||||||
// Next default values for new objects
|
|
||||||
//
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 201
|
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
|
||||||
#define _APS_NEXT_CONTROL_VALUE 201
|
|
||||||
#define _APS_NEXT_SYMED_VALUE 107
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
|
||||||
|
|
||||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
|
||||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
|
||||||
|
|
||||||
#include <SDKDDKVer.h>
|
|
@ -28,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
// send IPC Message
|
// send IPC Message
|
||||||
shellPage.SetDefaultSndMessageCallback(msg =>
|
shellPage.SetDefaultSndMessageCallback(msg =>
|
||||||
{
|
{
|
||||||
Program.GetTwoWayIPCManager().SendMessage(msg);
|
Program.GetTwoWayIPCManager().Send(msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\common\interop\interop.vcxproj" />
|
||||||
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" />
|
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using TwoWayIPCLibLib;
|
using interop;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Runner
|
namespace Microsoft.PowerToys.Settings.UI.Runner
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
// Create an instance of the IPC wrapper.
|
// Create an instance of the IPC wrapper.
|
||||||
private static ITwoWayIPCManager ipcmanager = new TwoWayIPCManager();
|
private static TwoWayPipeMessageIPCManaged ipcmanager;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
@ -23,7 +23,8 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
|
|
||||||
if (args.Length > 1)
|
if (args.Length > 1)
|
||||||
{
|
{
|
||||||
ipcmanager.Initialize(args[1], args[0]);
|
ipcmanager = new TwoWayPipeMessageIPCManaged(args[1], args[0], null);
|
||||||
|
ipcmanager.Start();
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -37,7 +38,7 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ITwoWayIPCManager GetTwoWayIPCManager()
|
public static TwoWayPipeMessageIPCManaged GetTwoWayIPCManager()
|
||||||
{
|
{
|
||||||
return ipcmanager;
|
return ipcmanager;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include <common/dpi_aware.h>
|
#include <common/dpi_aware.h>
|
||||||
#include <common/common.h>
|
#include <common/common.h>
|
||||||
|
#include <Sddl.h>
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user