add workaround for registry read error
This commit is contained in:
parent
a42641fdce
commit
babacb68dd
2 changed files with 21 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace EnvyUpdate
|
||||
|
|
|
@ -387,11 +387,28 @@ namespace EnvyUpdate
|
|||
RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true);
|
||||
return nvlddmkm.GetValueNames().Contains("DCHUVen");
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.InnerException is NullReferenceException)
|
||||
{
|
||||
// Assume no DCH driver is installed if key is not found.
|
||||
return false;
|
||||
}
|
||||
else if (ex.InnerException is System.Security.SecurityException)
|
||||
{
|
||||
//Registry reading error. Check for existance of file nvsvs.dll instead.
|
||||
if (System.IO.File.Exists(Path.Combine(Environment.SystemDirectory, "nvsvs.dll")))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("An error has occured. Please report this on GitHub.\nError:" + ex.Message);
|
||||
Environment.Exit(20);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int GetDTCID()
|
||||
{
|
||||
|
|
Reference in a new issue