mirror of https://github.com/winsw/winsw
Make `<delayedAutoStart>`/`<beeponshutdown>`/`<interactive>` a boolean
parent
4d187eb882
commit
ddab4150ac
|
@ -180,7 +180,7 @@ SECTION: Service management
|
||||||
Enables the Delayed Automatic Start if 'Automatic' is specified in the 'startmode' field.
|
Enables the Delayed Automatic Start if 'Automatic' is specified in the 'startmode' field.
|
||||||
See the WinSW documentation to get info about supported platform versions and limitations.
|
See the WinSW documentation to get info about supported platform versions and limitations.
|
||||||
-->
|
-->
|
||||||
<!--<delayedAutoStart/>-->
|
<!--<delayedAutoStart>true</delayedAutoStart>-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
OPTION: depend
|
OPTION: depend
|
||||||
|
@ -196,7 +196,7 @@ SECTION: Service management
|
||||||
Indicates the service can interactwith the desktop.
|
Indicates the service can interactwith the desktop.
|
||||||
-->
|
-->
|
||||||
<!--
|
<!--
|
||||||
<interactive/>
|
<interactive>true</interactive>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -281,7 +281,7 @@ SECTION: Other options
|
||||||
Indicates the service should beep when finished on shutdown (if it's supported by OS).
|
Indicates the service should beep when finished on shutdown (if it's supported by OS).
|
||||||
-->
|
-->
|
||||||
<!--
|
<!--
|
||||||
<beeponshutdown/>
|
<beeponshutdown>true</beeponshutdown>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -31,6 +31,9 @@ namespace WinSW.Native
|
||||||
[DllImport(Libraries.Advapi32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "ChangeServiceConfig2W")]
|
[DllImport(Libraries.Advapi32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "ChangeServiceConfig2W")]
|
||||||
internal static extern bool ChangeServiceConfig2(IntPtr serviceHandle, ServiceConfigInfoLevels infoLevel, in SERVICE_DELAYED_AUTO_START_INFO info);
|
internal static extern bool ChangeServiceConfig2(IntPtr serviceHandle, ServiceConfigInfoLevels infoLevel, in SERVICE_DELAYED_AUTO_START_INFO info);
|
||||||
|
|
||||||
|
[DllImport(Libraries.Advapi32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "ChangeServiceConfig2W")]
|
||||||
|
internal static extern bool ChangeServiceConfig2(IntPtr serviceHandle, ServiceConfigInfoLevels infoLevel, in SERVICE_PRESHUTDOWN_INFO info);
|
||||||
|
|
||||||
[DllImport(Libraries.Advapi32)]
|
[DllImport(Libraries.Advapi32)]
|
||||||
internal static extern bool CloseServiceHandle(IntPtr objectHandle);
|
internal static extern bool CloseServiceHandle(IntPtr objectHandle);
|
||||||
|
|
||||||
|
@ -164,6 +167,11 @@ namespace WinSW.Native
|
||||||
public unsafe SC_ACTION* Actions;
|
public unsafe SC_ACTION* Actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal struct SERVICE_PRESHUTDOWN_INFO
|
||||||
|
{
|
||||||
|
public int PreshutdownTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
internal struct SERVICE_STATUS
|
internal struct SERVICE_STATUS
|
||||||
{
|
{
|
||||||
public ServiceType ServiceType;
|
public ServiceType ServiceType;
|
||||||
|
|
|
@ -572,18 +572,18 @@ namespace WinSW
|
||||||
/// True if the service should be installed with the DelayedAutoStart flag.
|
/// True if the service should be installed with the DelayedAutoStart flag.
|
||||||
/// This setting will be applyed only during the install command and only when the Automatic start mode is configured.
|
/// This setting will be applyed only during the install command and only when the Automatic start mode is configured.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DelayedAutoStart => this.dom.SelectSingleNode("//delayedAutoStart") != null;
|
public bool DelayedAutoStart => this.SingleBoolElement("delayedAutoStart", Defaults.DelayedAutoStart);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if the service should beep when finished on shutdown.
|
/// True if the service should beep when finished on shutdown.
|
||||||
/// This doesn't work on some OSes. See http://msdn.microsoft.com/en-us/library/ms679277%28VS.85%29.aspx
|
/// This doesn't work on some OSes. See http://msdn.microsoft.com/en-us/library/ms679277%28VS.85%29.aspx
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool BeepOnShutdown => this.dom.SelectSingleNode("//beeponshutdown") != null;
|
public bool BeepOnShutdown => this.SingleBoolElement("beeponshutdown", Defaults.DelayedAutoStart);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if the service can interact with the desktop.
|
/// True if the service can interact with the desktop.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Interactive => this.dom.SelectSingleNode("//interactive") != null;
|
public bool Interactive => this.SingleBoolElement("interactive", Defaults.DelayedAutoStart);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Environment variable overrides
|
/// Environment variable overrides
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace WinSW.Tests.Util
|
||||||
|
|
||||||
public ConfigXmlBuilder WithDelayedAutoStart()
|
public ConfigXmlBuilder WithDelayedAutoStart()
|
||||||
{
|
{
|
||||||
return this.WithRawEntry("<delayedAutoStart/>");
|
return this.WithRawEntry("<delayedAutoStart>true</delayedAutoStart>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue