Imported 2.x Project Files
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VMwareLauncher
|
||||
{
|
||||
public class ServiceControl
|
||||
{
|
||||
public static readonly List<string> DefaultVmwareServices = new List<string> { "VMnetDHCP", "VMUSBArbService", "VMware NAT Service", "VMwareHostd", "VMAuthdService" }; //Array of services to close
|
||||
public List<string> ServiceList { get; set; }
|
||||
|
||||
public bool ForceServicesManual()
|
||||
{
|
||||
bool errors = false;
|
||||
string winServices = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services";
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var service in ServiceList)
|
||||
{
|
||||
string currentService = winServices + "\\" + service;
|
||||
if ((int)Registry.GetValue(currentService, "Start", null) != 3)
|
||||
{
|
||||
Registry.SetValue(currentService, "Start", 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
errors = true;
|
||||
throw;
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user