Files
VMwareLauncher/VmwareLauncher/ServiceConfig.cs
2019-03-05 20:24:01 +00:00

27 lines
755 B
C#

using Microsoft.Win32;
namespace VmwareLauncher
{
partial class ServiceConfig
{
/// <summary>
/// Forces the startup type for the specified services to manual.
/// </summary>
/// <param name="svc"></param>
public static void ForceServicesManual (string[] svc)
{
string winServices = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services";
foreach (var service in svc)
{
string currentService = winServices + "\\" + service;
if ((int) Registry.GetValue(currentService, "Start", null) != 3)
{
Registry.SetValue(currentService, "Start", 3);
}
}
}
}
}