Skip to content

Added scripts and projects to create self-extracting installer on Windows#37

Merged
5656hcx merged 2 commits into
mainfrom
driver-installer2
May 19, 2026
Merged

Added scripts and projects to create self-extracting installer on Windows#37
5656hcx merged 2 commits into
mainfrom
driver-installer2

Conversation

@5656hcx
Copy link
Copy Markdown
Contributor

@5656hcx 5656hcx commented May 13, 2026

Add Windows driver installer tool and build pipeline

Summary

This PR introduces a complete Windows driver installation solution: a native qdinstall tool for low-level driver management, a self-extracting C# installer executable for end-user distribution, and the build scripts that tie everything together for x86, x64, and arm64 platforms.

Changes

1. New: qdinstall tool (src/windows/tools/qdinstall/)

A native C++ command-line utility for driver lifecycle management:

Flag Action
-i Install — removes stale drivers via qdclr.exe, installs all .inf drivers using pnputil, triggers device re-enumeration, and registers the installation in the Windows registry (Add/Remove Programs).
-x Uninstall — cleans the DriverStore via qdclr.exe, removes registry entries, and re-enumerates the device tree.
-v Show package version and currently-installed version from registry.
-g Print the registered installation path.
-p <path> Specify the installation directory (used by the outer installer).
  • Supports x86, x64, and arm64 platforms.
  • Registers under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Qualcomm USB Drivers.

Files: main.cpp, main.h, registry.cpp, registry.h, qdinstall.sln, qdinstall.vcxproj

2. New: Self-extracting installer (build/build-installer.ps1)

A PowerShell script that:

  1. Packages the payload — stages target/Drivers/ and target/Tools/ into a zip, promoting qdclr.exe and qdinstall.exe to the payload root for direct execution.
  2. Compiles a C# self-extracting EXE — embeds the payload zip as a .NET manifest resource and compiles via csc.exe (Framework 4.0). The resulting executable:
    • Supports --install (default), --uninstall, and --version flags.
    • Auto-elevates to administrator via UAC (runas verb).
    • On install: extracts payload to a temp directory, uninstalls legacy packages (qualcomm_userspace_driver, qud, qud.slt, qud.internal) via qpm-cli, runs qdinstall.exe -i -p <installPath>, then copies all files to %ProgramFiles%\Qualcomm\Qualcomm USB Drivers.
    • On uninstall: reads the uninstall command from the registry, executes it, and deletes the installation directory.
  3. Reads version from src/windows/qcversion.h and stamps it into the assembly metadata.

3. New: Build scripts (build/)

Script Purpose
build_tools.ps1 Builds all tool projects (qcdev, qdcfg, qdclr, qdinstall, wwansvc) via MSBuild with auto-detection of Visual Studio. Supports platform-specific fallback (e.g., x86-only tools build as x86 regardless of target).
build-installer.ps1 Assembles payload and compiles the C# self-extracting installer (see above).
build_installer.bat Top-level orchestrator — loops over x86/x64/arm64, invokes build_tools.ps1, build-installer.ps1, and sign.ps1 for each architecture. Produces qcom_usb_kernel_drivers_{x86,x64,arm64}.exe.

4. Renames

  • build_all.batbuild_drivers.bat (clarifies scope — driver .sys/.inf build only)
  • build.ps1build_drivers.ps1 (same)

Install Flow

qcom_usb_kernel_drivers_x64.exe (C# self-extractor)
  → UAC elevation
  → Extract payload.zip to %TEMP%
  → Uninstall legacy packages via qpm-cli
  → Run qdinstall.exe -i -p "%ProgramFiles%\Qualcomm\Qualcomm USB Drivers"
      → qdclr.exe (remove old DriverStore entries)
      → pnputil /add-driver *.inf /install /force
      → Device tree re-enumeration
      → Registry registration (Add/Remove Programs)
  → Copy payload to install path

Uninstall Flow

qcom_usb_kernel_drivers_x64.exe /uninstall, or uninstall from control panel
  → UAC elevation
  → Fetch uninstall string from registry
  → Run qdinstall.exe -x
      → qdclr.exe (remove DriverStore entries)
      → Remove registry registration
  → Delete the installation directory

Testing

  • Built installers for all three architectures.
  • Verified install and uninstall flows on Windows.

Let me know if you'd like any adjustments, or toggle to Act mode if you want me to save this to a file.

Signed-off-by: chehan <chehan@qti.qualcomm.com>
@5656hcx 5656hcx requested review from rohimish-qc and shasaror May 13, 2026 00:35
@5656hcx 5656hcx self-assigned this May 13, 2026
Signed-off-by: chehan <chehan@qti.qualcomm.com>
@5656hcx 5656hcx force-pushed the driver-installer2 branch from 76ae52d to 1f77973 Compare May 18, 2026 21:17
@5656hcx 5656hcx merged commit 0524f28 into main May 19, 2026
10 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.

2 participants