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;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace EnvyUpdate
|
namespace EnvyUpdate
|
||||||
|
|
|
@ -387,10 +387,27 @@ namespace EnvyUpdate
|
||||||
RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true);
|
RegistryKey nvlddmkm = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\services\nvlddmkm", true);
|
||||||
return nvlddmkm.GetValueNames().Contains("DCHUVen");
|
return nvlddmkm.GetValueNames().Contains("DCHUVen");
|
||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Assume no DCH driver is installed if key is not found.
|
if (ex.InnerException is NullReferenceException)
|
||||||
return false;
|
{
|
||||||
|
// 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()
|
public static int GetDTCID()
|
||||||
|
|
Reference in a new issue