27 lines
755 B
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|