fix: verify driver registration before reporting success - #25
Merged
Conversation
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.
Problem
On Windows, a non-elevated call to
myodbc-installer.exe -d -acan receiveTRUEfromSQLInstallDriverExWeven though the Driver Manager did not persist the system driver registration. The utility then printsSuccessand exits 0, leaving deployment automation with a false-positive installation result.Root cause
add_driver()trusted the API return value without verifying the registration postcondition. On the reproduced Windows 11 x64 environment, installer diagnostics already containedODBC_ERROR_WRITING_SYSINFO_FAILED, but the API still returnedTRUE.Fix
After
SQLInstallDriverExWreturns success, look the driver up through the same installer profile APIs used by the list command. Report success only when the registration is observable; otherwise print the installer diagnostics and return 1.Minimal reproduction
From a non-elevated PowerShell process:
Before this change, the command exited 0 and printed
Success: Usage count is 1, while no corresponding HKLM/HKCU ODBC registration existed.The added regression can be run with:
Before / after
Test scope
myodbc-installerRelWithDebInfo target rebuilt successfully with Visual Studio 2022.git diff --checkpassed.