mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
Added Constructor to create WinService with an existing Connection to a Service Manager
This commit is contained in:
parent
d658cc25e7
commit
5a484c1896
@ -52,6 +52,13 @@ public:
|
|||||||
WinService(const std::string& name);
|
WinService(const std::string& name);
|
||||||
/// Creates the WinService, using the given service name.
|
/// Creates the WinService, using the given service name.
|
||||||
|
|
||||||
|
|
||||||
|
WinService(SC_HANDLE scmHandle, const std::string& name);
|
||||||
|
/// Creates the WinService, using the given connection to
|
||||||
|
/// a Windows Service Manager and the given service name.
|
||||||
|
///
|
||||||
|
/// The class will close the given scmHandle on destruction
|
||||||
|
|
||||||
~WinService();
|
~WinService();
|
||||||
/// Destroys the WinService.
|
/// Destroys the WinService.
|
||||||
|
|
||||||
|
@ -47,6 +47,13 @@ WinService::WinService(const std::string& name):
|
|||||||
if (!_scmHandle) throw SystemException("cannot open Service Control Manager");
|
if (!_scmHandle) throw SystemException("cannot open Service Control Manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WinService::WinService(SC_HANDLE scmHandle, const std::string& name):
|
||||||
|
_scmHandle(scmHandle),
|
||||||
|
_name(name),
|
||||||
|
_svcHandle(0)
|
||||||
|
{
|
||||||
|
if (!_scmHandle) throw SystemException("Service Control Manager not connected");
|
||||||
|
}
|
||||||
|
|
||||||
WinService::~WinService()
|
WinService::~WinService()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="debug_shared|Win32">
|
<ProjectConfiguration Include="debug_shared|Win32">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<RootNamespace>TestSuite</RootNamespace>
|
<RootNamespace>TestSuite</RootNamespace>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
@ -63,27 +63,27 @@
|
|||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings"/>
|
<ImportGroup Label="ExtensionSettings" />
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros"/>
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_ProjectFileVersion>15.0.27625.0</_ProjectFileVersion>
|
<_ProjectFileVersion>15.0.27625.0</_ProjectFileVersion>
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">TestSuited</TargetName>
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">TestSuited</TargetName>
|
||||||
@ -136,7 +136,7 @@
|
|||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader/>
|
<PrecompiledHeader />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<CompileAs>Default</CompileAs>
|
<CompileAs>Default</CompileAs>
|
||||||
@ -167,9 +167,9 @@
|
|||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader/>
|
<PrecompiledHeader />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat/>
|
<DebugInformationFormat />
|
||||||
<CompileAs>Default</CompileAs>
|
<CompileAs>Default</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@ -196,7 +196,7 @@
|
|||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader/>
|
<PrecompiledHeader />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<CompileAs>Default</CompileAs>
|
<CompileAs>Default</CompileAs>
|
||||||
@ -227,9 +227,9 @@
|
|||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader/>
|
<PrecompiledHeader />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat/>
|
<DebugInformationFormat />
|
||||||
<CompileAs>Default</CompileAs>
|
<CompileAs>Default</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@ -256,7 +256,7 @@
|
|||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader/>
|
<PrecompiledHeader />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<CompileAs>Default</CompileAs>
|
<CompileAs>Default</CompileAs>
|
||||||
@ -287,9 +287,9 @@
|
|||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<PrecompiledHeader/>
|
<PrecompiledHeader />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat/>
|
<DebugInformationFormat />
|
||||||
<CompileAs>Default</CompileAs>
|
<CompileAs>Default</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@ -304,60 +304,62 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="src\AbstractConfigurationTest.h"/>
|
<ClInclude Include="src\AbstractConfigurationTest.h" />
|
||||||
<ClInclude Include="src\ConfigurationMapperTest.h"/>
|
<ClInclude Include="src\ConfigurationMapperTest.h" />
|
||||||
<ClInclude Include="src\ConfigurationTestSuite.h"/>
|
<ClInclude Include="src\ConfigurationTestSuite.h" />
|
||||||
<ClInclude Include="src\ConfigurationViewTest.h"/>
|
<ClInclude Include="src\ConfigurationViewTest.h" />
|
||||||
<ClInclude Include="src\FilesystemConfigurationTest.h"/>
|
<ClInclude Include="src\FilesystemConfigurationTest.h" />
|
||||||
<ClInclude Include="src\HelpFormatterTest.h"/>
|
<ClInclude Include="src\HelpFormatterTest.h" />
|
||||||
<ClInclude Include="src\IniFileConfigurationTest.h"/>
|
<ClInclude Include="src\IniFileConfigurationTest.h" />
|
||||||
<ClInclude Include="src\JSONConfigurationTest.h"/>
|
<ClInclude Include="src\JSONConfigurationTest.h" />
|
||||||
<ClInclude Include="src\LayeredConfigurationTest.h"/>
|
<ClInclude Include="src\LayeredConfigurationTest.h" />
|
||||||
<ClInclude Include="src\LoggingConfiguratorTest.h"/>
|
<ClInclude Include="src\LoggingConfiguratorTest.h" />
|
||||||
<ClInclude Include="src\MapConfigurationTest.h"/>
|
<ClInclude Include="src\MapConfigurationTest.h" />
|
||||||
<ClInclude Include="src\OptionProcessorTest.h"/>
|
<ClInclude Include="src\OptionProcessorTest.h" />
|
||||||
<ClInclude Include="src\OptionSetTest.h"/>
|
<ClInclude Include="src\OptionSetTest.h" />
|
||||||
<ClInclude Include="src\OptionsTestSuite.h"/>
|
<ClInclude Include="src\OptionsTestSuite.h" />
|
||||||
<ClInclude Include="src\OptionTest.h"/>
|
<ClInclude Include="src\OptionTest.h" />
|
||||||
<ClInclude Include="src\PropertyFileConfigurationTest.h"/>
|
<ClInclude Include="src\PropertyFileConfigurationTest.h" />
|
||||||
<ClInclude Include="src\SystemConfigurationTest.h"/>
|
<ClInclude Include="src\SystemConfigurationTest.h" />
|
||||||
<ClInclude Include="src\TimerTest.h"/>
|
<ClInclude Include="src\TimerTest.h" />
|
||||||
<ClInclude Include="src\TimerTestSuite.h"/>
|
<ClInclude Include="src\TimerTestSuite.h" />
|
||||||
<ClInclude Include="src\UtilTestSuite.h"/>
|
<ClInclude Include="src\UtilTestSuite.h" />
|
||||||
<ClInclude Include="src\ValidatorTest.h"/>
|
<ClInclude Include="src\ValidatorTest.h" />
|
||||||
<ClInclude Include="src\WinConfigurationTest.h"/>
|
<ClInclude Include="src\WinConfigurationTest.h" />
|
||||||
<ClInclude Include="src\WindowsTestSuite.h"/>
|
<ClInclude Include="src\WindowsTestSuite.h" />
|
||||||
<ClInclude Include="src\WinRegistryTest.h"/>
|
<ClInclude Include="src\WinRegistryTest.h" />
|
||||||
<ClInclude Include="src\XMLConfigurationTest.h"/>
|
<ClInclude Include="src\WinServiceTest.h" />
|
||||||
|
<ClInclude Include="src\XMLConfigurationTest.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\AbstractConfigurationTest.cpp"/>
|
<ClCompile Include="src\AbstractConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\ConfigurationMapperTest.cpp"/>
|
<ClCompile Include="src\ConfigurationMapperTest.cpp" />
|
||||||
<ClCompile Include="src\ConfigurationTestSuite.cpp"/>
|
<ClCompile Include="src\ConfigurationTestSuite.cpp" />
|
||||||
<ClCompile Include="src\ConfigurationViewTest.cpp"/>
|
<ClCompile Include="src\ConfigurationViewTest.cpp" />
|
||||||
<ClCompile Include="src\Driver.cpp"/>
|
<ClCompile Include="src\Driver.cpp" />
|
||||||
<ClCompile Include="src\FilesystemConfigurationTest.cpp"/>
|
<ClCompile Include="src\FilesystemConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\HelpFormatterTest.cpp"/>
|
<ClCompile Include="src\HelpFormatterTest.cpp" />
|
||||||
<ClCompile Include="src\IniFileConfigurationTest.cpp"/>
|
<ClCompile Include="src\IniFileConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\JSONConfigurationTest.cpp"/>
|
<ClCompile Include="src\JSONConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\LayeredConfigurationTest.cpp"/>
|
<ClCompile Include="src\LayeredConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp"/>
|
<ClCompile Include="src\LoggingConfiguratorTest.cpp" />
|
||||||
<ClCompile Include="src\MapConfigurationTest.cpp"/>
|
<ClCompile Include="src\MapConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\OptionProcessorTest.cpp"/>
|
<ClCompile Include="src\OptionProcessorTest.cpp" />
|
||||||
<ClCompile Include="src\OptionSetTest.cpp"/>
|
<ClCompile Include="src\OptionSetTest.cpp" />
|
||||||
<ClCompile Include="src\OptionsTestSuite.cpp"/>
|
<ClCompile Include="src\OptionsTestSuite.cpp" />
|
||||||
<ClCompile Include="src\OptionTest.cpp"/>
|
<ClCompile Include="src\OptionTest.cpp" />
|
||||||
<ClCompile Include="src\PropertyFileConfigurationTest.cpp"/>
|
<ClCompile Include="src\PropertyFileConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\SystemConfigurationTest.cpp"/>
|
<ClCompile Include="src\SystemConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\TimerTest.cpp"/>
|
<ClCompile Include="src\TimerTest.cpp" />
|
||||||
<ClCompile Include="src\TimerTestSuite.cpp"/>
|
<ClCompile Include="src\TimerTestSuite.cpp" />
|
||||||
<ClCompile Include="src\UtilTestSuite.cpp"/>
|
<ClCompile Include="src\UtilTestSuite.cpp" />
|
||||||
<ClCompile Include="src\ValidatorTest.cpp"/>
|
<ClCompile Include="src\ValidatorTest.cpp" />
|
||||||
<ClCompile Include="src\WinConfigurationTest.cpp"/>
|
<ClCompile Include="src\WinConfigurationTest.cpp" />
|
||||||
<ClCompile Include="src\WindowsTestSuite.cpp"/>
|
<ClCompile Include="src\WindowsTestSuite.cpp" />
|
||||||
<ClCompile Include="src\WinRegistryTest.cpp"/>
|
<ClCompile Include="src\WinRegistryTest.cpp" />
|
||||||
<ClCompile Include="src\XMLConfigurationTest.cpp"/>
|
<ClCompile Include="src\WinServiceTest.cpp" />
|
||||||
|
<ClCompile Include="src\XMLConfigurationTest.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets"/>
|
<ImportGroup Label="ExtensionTargets" />
|
||||||
</Project>
|
</Project>
|
@ -138,6 +138,9 @@
|
|||||||
<ClInclude Include="src\TimerTestSuite.h">
|
<ClInclude Include="src\TimerTestSuite.h">
|
||||||
<Filter>Timer\Header Files</Filter>
|
<Filter>Timer\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\WinServiceTest.h">
|
||||||
|
<Filter>Windows\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\UtilTestSuite.cpp">
|
<ClCompile Include="src\UtilTestSuite.cpp">
|
||||||
@ -218,5 +221,8 @@
|
|||||||
<ClCompile Include="src\TimerTestSuite.cpp">
|
<ClCompile Include="src\TimerTestSuite.cpp">
|
||||||
<Filter>Timer\Source Files</Filter>
|
<Filter>Timer\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\WinServiceTest.cpp">
|
||||||
|
<Filter>Windows\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
43
Util/testsuite/src/WinServiceTest.cpp
Normal file
43
Util/testsuite/src/WinServiceTest.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "WinServiceTest.h"
|
||||||
|
#include "CppUnit/TestCaller.h"
|
||||||
|
#include "CppUnit/TestSuite.h"
|
||||||
|
#include "Poco/Util/WinService.h"
|
||||||
|
|
||||||
|
using Poco::Util::WinService;
|
||||||
|
|
||||||
|
|
||||||
|
WinServiceTest::WinServiceTest(const std::string& name) : CppUnit::TestCase(name) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WinServiceTest::~WinServiceTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinServiceTest::testServiceCouldCreatedWithExistingConnection() {
|
||||||
|
|
||||||
|
SC_HANDLE scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
|
assertTrue(scmHandle);
|
||||||
|
|
||||||
|
WinService spoolerService{ scmHandle, "Spooler" };
|
||||||
|
|
||||||
|
assertTrue(spoolerService.isRegistered());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinServiceTest::setUp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinServiceTest::tearDown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CppUnit::Test* WinServiceTest::suite() {
|
||||||
|
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("WinServiceTest");
|
||||||
|
|
||||||
|
CppUnit_addTest(pSuite, WinServiceTest, testServiceCouldCreatedWithExistingConnection);
|
||||||
|
|
||||||
|
return pSuite;
|
||||||
|
}
|
25
Util/testsuite/src/WinServiceTest.h
Normal file
25
Util/testsuite/src/WinServiceTest.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef WinServiceTest_INCLUDED
|
||||||
|
#define WinServiceTest_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Util/Util.h"
|
||||||
|
#include "CppUnit/TestCase.h"
|
||||||
|
|
||||||
|
|
||||||
|
class WinServiceTest : public CppUnit::TestCase {
|
||||||
|
public:
|
||||||
|
WinServiceTest(const std::string& name);
|
||||||
|
~WinServiceTest();
|
||||||
|
|
||||||
|
void testServiceCouldCreatedWithExistingConnection();
|
||||||
|
|
||||||
|
void setUp();
|
||||||
|
void tearDown();
|
||||||
|
|
||||||
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // WinServiceTest_INCLUDED
|
@ -11,6 +11,7 @@
|
|||||||
#include "WindowsTestSuite.h"
|
#include "WindowsTestSuite.h"
|
||||||
#include "WinRegistryTest.h"
|
#include "WinRegistryTest.h"
|
||||||
#include "WinConfigurationTest.h"
|
#include "WinConfigurationTest.h"
|
||||||
|
#include "WinServiceTest.h"
|
||||||
|
|
||||||
|
|
||||||
CppUnit::Test* WindowsTestSuite::suite()
|
CppUnit::Test* WindowsTestSuite::suite()
|
||||||
@ -19,6 +20,7 @@ CppUnit::Test* WindowsTestSuite::suite()
|
|||||||
|
|
||||||
pSuite->addTest(WinRegistryTest::suite());
|
pSuite->addTest(WinRegistryTest::suite());
|
||||||
pSuite->addTest(WinConfigurationTest::suite());
|
pSuite->addTest(WinConfigurationTest::suite());
|
||||||
|
pSuite->addTest(WinServiceTest::suite());
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
}
|
}
|
||||||
|
20
components
20
components
@ -4,22 +4,4 @@ Encodings
|
|||||||
XML
|
XML
|
||||||
JSON
|
JSON
|
||||||
Util
|
Util
|
||||||
Net
|
Net
|
||||||
Crypto
|
|
||||||
NetSSL_OpenSSL
|
|
||||||
NetSSL_Win
|
|
||||||
Data
|
|
||||||
Data/SQLite
|
|
||||||
Data/ODBC
|
|
||||||
Data/MySQL
|
|
||||||
Data/PostgreSQL
|
|
||||||
Zip
|
|
||||||
PageCompiler
|
|
||||||
PageCompiler/File2Page
|
|
||||||
JWT
|
|
||||||
PDF
|
|
||||||
CppParser
|
|
||||||
MongoDB
|
|
||||||
Redis
|
|
||||||
PocoDoc
|
|
||||||
ProGen
|
|
25
components - Kopie
Normal file
25
components - Kopie
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
CppUnit
|
||||||
|
Foundation
|
||||||
|
Encodings
|
||||||
|
XML
|
||||||
|
JSON
|
||||||
|
Util
|
||||||
|
Net
|
||||||
|
Crypto
|
||||||
|
NetSSL_OpenSSL
|
||||||
|
NetSSL_Win
|
||||||
|
Data
|
||||||
|
Data/SQLite
|
||||||
|
Data/ODBC
|
||||||
|
Data/MySQL
|
||||||
|
Data/PostgreSQL
|
||||||
|
Zip
|
||||||
|
PageCompiler
|
||||||
|
PageCompiler/File2Page
|
||||||
|
JWT
|
||||||
|
PDF
|
||||||
|
CppParser
|
||||||
|
MongoDB
|
||||||
|
Redis
|
||||||
|
PocoDoc
|
||||||
|
ProGen
|
Loading…
Reference in New Issue
Block a user