Repository navigation
Treat DISM as unavailable when DismApi.dll can't be loaded - #480
Merged
Merged
Conversation
DismUtil.IsDismAvailable (and SupportExportAllDrivers) check for DISM with Marshal.Prelink and only handled DllNotFoundException and EntryPointNotFoundException. If the DismApi.dll found on the search path is for the other architecture, Prelink throws BadImageFormatException. Because IsDismAvailable is evaluated in the DismUtil type initializer, this surfaces as a TypeInitializationException and the app crashes on startup. Windows 8 and later always find the matching DLL in System32 first. Windows 7 has none there, so it falls back to the rest of the search path. Since the DISM menu item's state is computed at startup on every OS, a mismatched DismApi.dll anywhere on that path is enough to crash Windows 7. Catch BadImageFormatException as well and treat DISM as unavailable, so the app falls back to PnpUtil as it already does when the DLL is missing. Refs lostindark#479
Closed
Contributor
Author
|
The reporter confirmed in #479 that the CI build from this PR starts normally on their Win 7 x64 machine, so the fix is verified on the affected system. Ready to merge whenever you are :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #479. The crash signature the reporter posted (method token 0x19a in Rapr 1.0.36.0) resolves to
DismUtil.<.cctor>b__29_0, theIsDismAvailablecheck, andBadImageFormatExceptionthere can only come fromMarshal.Prelinkfailing to loadDismApi.dll.