diff options
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs')
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs index 9c499c9c5..77201bc38 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs @@ -65,7 +65,11 @@ namespace HandBrake.Interop.Interop { try { - TryInit(); + bool passed = TryInit(); + if (!passed) + { + failedWithHardware = true; + } } catch (Exception e) { @@ -86,12 +90,25 @@ namespace HandBrake.Interop.Interop } [HandleProcessCorruptedStateExceptions] - static void TryInit() + static bool TryInit() { - if (HBFunctions.hb_global_init() == -1) + try { - throw new InvalidOperationException("HB global init failed."); + if (HBFunctions.hb_global_init() == -1) + { + throw new InvalidOperationException("HB global init failed."); + } } + catch (AccessViolationException e) + { + return false; + } + catch (Exception e) + { + return false; + } + + return true; } /// <summary> |