Files
VMwareLauncher/VmwareLauncher/ServiceControl.cs
Dunestorm 6d7fec03b4 [VMware Launcher 2.0.9.5]
- Refactored code.
- Fixed bug: "#1 Welcome message shows despite VMware not being installed"
2021-03-26 20:20:46 +00:00

43 lines
1.1 KiB
C#

using Microsoft.Win32;
using System;
using System.Collections.Generic;
namespace VMwareLauncher
{
public class ServiceControl
{
public static readonly List<string> VMwareServiceList = new List<string> //Array of services to close
{
"VMnetDHCP",
"VMUSBArbService",
"VMware NAT Service",
"VMwareHostd",
"VMAuthdService" };
public bool ForceServicesManual()
{
bool errors = false;
string winServices = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services";
try
{
foreach (var service in VMwareServiceList)
{
string currentService = winServices + "\\" + service;
if ((int)Registry.GetValue(currentService, "Start", null) != 3)
{
Registry.SetValue(currentService, "Start", 3);
}
}
}
catch (Exception)
{
errors = true;
throw;
}
return errors;
}
}
}