CEL_Payroll/Ease.SvcHost/RegistryHelper.cs

29 lines
846 B
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Microsoft.Win32;
using System.Reflection;
namespace Ease.SvcHost
{
public class RegistryHelper
{
public static RegistryKey GetServiceKey(string name)
{
RegistryKey system = Registry.LocalMachine.OpenSubKey("System");
RegistryKey currentControlSet = system.OpenSubKey("CurrentControlSet");
RegistryKey services = currentControlSet.OpenSubKey("Services");
return services.OpenSubKey(name, true);
}
public static RegistryKey GetParameterKey(string name)
{
RegistryKey system = Registry.LocalMachine.OpenSubKey("System");
RegistryKey currentControlSet = system.OpenSubKey("CurrentControlSet");
RegistryKey services = currentControlSet.OpenSubKey("Services");
RegistryKey service = services.OpenSubKey(name);
return service.OpenSubKey("Parameters");
}
private RegistryHelper() {}
}
}