diff --git a/Rapr/Utils/DismUtil.cs b/Rapr/Utils/DismUtil.cs index accb58b..0edb92b 100644 --- a/Rapr/Utils/DismUtil.cs +++ b/Rapr/Utils/DismUtil.cs @@ -41,6 +41,13 @@ public DismUtil(string imagePath) { return false; } + catch (BadImageFormatException ex) + { + // A DismApi.dll for the other architecture was found on the search path. This mostly + // happens on Windows 7, which has no DismApi.dll in System32. Treat DISM as unavailable. + Trace.TraceWarning($"DismApi.dll could not be loaded: {ex.Message}"); + return false; + } return true; })(); @@ -67,6 +74,12 @@ public DismUtil(string imagePath) { return false; } + catch (BadImageFormatException ex) + { + // Same as in IsDismAvailable. + Trace.TraceWarning($"DismApi.dll could not be loaded: {ex.Message}"); + return false; + } return true; })();