Repository navigation
Remove dead code and some duplication - #487
Merged
Merged
Conversation
SetupAPI.GetDeviceDriverInfo and everything only it used (the SetupDi* imports, the 32/64-bit SP_DRVINFO structs, registry and device property helpers) have no callers; device information comes from ConfigManager (cfgmgr32). SetupAPI keeps the signer lookup and the add/delete calls.
It read and wrote the AppCompatFlags RUNASADMIN registry flag for the executable, but nothing calls it. The app requests elevation through its manifest instead.
DismUtil and NativeDriverStore both handle the online case by calling SetupAPI and turning a Win32Exception into false, with identical blocks in each. Move that into SetupAPI.TryAddDriver and TryDeleteDriver.
Six SuppressMessage attributes still had the "<Pending>" placeholder. The CA1031 ones are UI handlers that log and report any failure; the IDE1006 ones keep the DismApi.dll export name.
indep-arg
marked this pull request as ready for review
October 28, 2026 01:06
Contributor
Author
|
Tested the build from this PR: deleting and re-adding a driver package works with both the native and DISM stores. |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the driver-store utility cleanup and consolidation.
No open issues 🎉
What changed in this PR
This PR simplifies DriverStoreExplorer’s driver-store utilities by removing unused code and consolidating online add/delete handling, with no intended behavior change.
Changes:
- Removes unused SetupAPI device-enumeration code and the registry-backed
RunAsAdminproperty. - Shares online driver add/delete wrappers between the DISM and native backends.
- Replaces six placeholder analyzer suppression justifications with explanations.
| File | Description |
|---|---|
Rapr/Utils/SetupAPI.cs |
Removes unused device-enumeration infrastructure and adds shared add/delete wrappers. |
Rapr/Utils/NativeDriverStore.cs |
Delegates online add/delete operations to the shared wrappers. |
Rapr/Utils/DismUtil.cs |
Uses shared wrappers and explains native-function naming suppressions. |
Rapr/DSEFormHelper.cs |
Removes the unused AppCompat registry property and related declarations. |
Rapr/DSEForm.cs |
Explains four general-exception suppression justifications; no logic changes. |
Review effort: Balanced
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.
No behavior change, one commit each:
SetupAPI.GetDeviceDriverInfoand everything only it used (the SetupDi* imports, the 32/64-bit SP_DRVINFO structs, the property helpers) had no callers. Device info comes from ConfigManager. About 500 lines.DSEFormHelper.RunAsAdmin, which read and wrote the AppCompatFlags registry value, wasn't used.SetupAPI.TryAddDriver/TryDeleteDriver."<Pending>"analyzer suppression justifications.