Skip to content

fix: verify driver registration before reporting success - #25

Merged
iamlinjunhong merged 1 commit into
mainfrom
codex/nonadmin-installer-verification
Aug 26, 2026
Merged

fix: verify driver registration before reporting success#25
iamlinjunhong merged 1 commit into
mainfrom
codex/nonadmin-installer-verification

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Collaborator

Problem

On Windows, a non-elevated call to myodbc-installer.exe -d -a can receive TRUE from SQLInstallDriverExW even though the Driver Manager did not persist the system driver registration. The utility then prints Success and 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 contained ODBC_ERROR_WRITING_SYSINFO_FAILED, but the API still returned TRUE.

Fix

After SQLInstallDriverExW returns 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:

bin\myodbc-installer.exe -d -a -n "MatrixOne ODBC non-admin probe" -t "DRIVER=C:\path\myodbc9w.dll;SETUP=C:\path\myodbc9S.dll"

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:

./test/windows/Test-NonAdminDriverRegistration.ps1 -PackageRoot C:\path\to\portable-package

Before / after

  • Before: exit 0, false success, no registration.
  • After: exit 1, explicit postcondition failure plus Driver Manager diagnostics, no registry residue.

Test scope

  • Windows 11 x64, non-elevated process.
  • Regression proved failing against the unmodified executable and passing against the rebuilt executable.
  • myodbc-installer RelWithDebInfo target rebuilt successfully with Visual Studio 2022.
  • git diff --check passed.
  • Existing elevated MSI/ZIP install, repair, upgrade, downgrade, coexistence, uninstall and reinstall coverage remains in the Windows package workflow.

@iamlinjunhong
iamlinjunhong merged commit 71fe713 into main Aug 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant