private static bool ReadRegistryValue(RegistryKey key, string valueName, bool defaultValue)
{
try
{
if (key.GetValueKind(valueName) == RegistryValueKind.DWord)
{
return Convert.ToBoolean(key.GetValue(valueName), CultureInfo.InvariantCulture);
}
}
catch (UnauthorizedAccessException exception)
{
LogRegistryException("ReadRegistryValue", exception);
}
catch (IOException exception2)
{
LogRegistryException("ReadRegistryValue", exception2);
}
catch (SecurityException exception3)
{
LogRegistryException("ReadRegistryValue", exception3);
}
catch (ObjectDisposedException exception4)
{
LogRegistryException("ReadRegistryValue", exception4);
}
return defaultValue;
}