mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
service provider now uses a case-insensitive dictionary key, eliminating KeyNotFoundException errors
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@574 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -215,6 +215,23 @@ namespace ProcessHacker
|
||||
{
|
||||
textDescription.Text = "";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (ServiceController controller = new ServiceController(
|
||||
listServices.SelectedItems[0].Name))
|
||||
{
|
||||
if (controller.DependentServices.Length == 0)
|
||||
buttonDependents.Enabled = false;
|
||||
if (controller.ServicesDependedOn.Length == 0)
|
||||
buttonDependencies.Enabled = false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
buttonDependents.Enabled = false;
|
||||
buttonDependencies.Enabled = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -126,8 +126,16 @@ namespace ProcessHacker
|
||||
/// Creates a new instance of the Provider class.
|
||||
/// </summary>
|
||||
public Provider()
|
||||
: this(null)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the Provider class, specifying a
|
||||
/// custom equality comparer.
|
||||
/// </summary>
|
||||
public Provider(IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
_dictionary = new Dictionary<TKey, TValue>();
|
||||
_dictionary = new Dictionary<TKey, TValue>(comparer);
|
||||
|
||||
_thread = new Thread(new ThreadStart(Update));
|
||||
_thread.SetApartmentState(ApartmentState.STA);
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace ProcessHacker
|
||||
public class ServiceProvider : Provider<string, ServiceItem>
|
||||
{
|
||||
public ServiceProvider()
|
||||
: base()
|
||||
: base(StringComparer.InvariantCultureIgnoreCase) // Windows is case-insensitive with services
|
||||
{
|
||||
this.ProviderUpdate += new ProviderUpdateOnce(UpdateOnce);
|
||||
this.ProviderUpdate += new ProviderUpdateOnce(UpdateOnce);
|
||||
}
|
||||
|
||||
public void UpdateServiceConfig(string name, Win32.QUERY_SERVICE_CONFIG config)
|
||||
|
||||
Reference in New Issue
Block a user