-
Notifications
You must be signed in to change notification settings - Fork 6
Add NDIS Driver Fix tool to resolve unsigned driver issue in HLK2022 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Added PowerShell script for fixing NDIS driver signatures - Included configuration file for driver management - Added .gitignore for the tool directory Resolves issue where NDIS drivers lack proper signatures in HLK2022 testing environment. Signed-off-by: Zhang JianMing <zhangjianming.zjm@alibaba-inc.com>
Summary of ChangesHello @zjmletang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new tool designed to resolve a critical issue in the HLK2022 testing environment where NDIS drivers are found to be unsigned. The tool, consisting of a PowerShell script and a configuration file, automates the process of identifying these unsigned drivers and replacing them with properly signed versions from existing backup locations within the HLK installation, thereby ensuring test stability and compliance. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a PowerShell script to fix issues with unsigned NDIS drivers in the HLK environment. The script is well-structured and addresses the problem described. My review includes a few suggestions to improve its robustness and performance. Specifically, I've recommended dynamically determining the HLK installation path instead of hardcoding it, using a more efficient method for collecting unsigned drivers, and reconsidering the use of Start-Sleep at the end of the script. These changes will make the script more reliable and maintainable.
| Write-Output "" | ||
|
|
||
| # Base path for HLK installation | ||
| $hlkBasePath = "C:\Program Files (x86)\Windows Kits\10\Hardware Lab Kit\Tests\amd64\NetHlk" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HLK base path is hardcoded. This will cause the script to fail if the Hardware Lab Kit is installed in a different location or on a different drive. It's more robust to determine this path dynamically by querying the registry, with a fallback to the default path if the registry key is not found. I'd also recommend adding a check to ensure the path exists before proceeding.
$kitRootPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction SilentlyContinue).KitsRoot10
$hlkBasePath = if ($kitRootPath) {
Join-Path $kitRootPath "Hardware Lab Kit\Tests\amd64\NetHlk"
}
else {
Write-Warning "Could not find HLK installation path in registry. Falling back to default."
"C:\Program Files (x86)\Windows Kits\10\Hardware Lab Kit\Tests\amd64\NetHlk"
}
if (-not (Test-Path $hlkBasePath)) {
Write-Error "HLK path not found at '$hlkBasePath'. Script cannot continue."
}
| $unsignedCount = 0 | ||
| $unsignedDrivers = @() | ||
|
|
||
| foreach ($driver in $protocolDrivers) { | ||
| $isSigned = Test-DriverSigned -FilePath $driver.FullName | ||
| if (-not $isSigned) { | ||
| Write-Output " [UNSIGNED] $($driver.Name)" | ||
| $unsignedCount++ | ||
| $unsignedDrivers += $driver | ||
| } | ||
| else { | ||
| Write-Output " [SIGNED] $($driver.Name)" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appending elements to an array using += inside a loop is inefficient as it recreates the array on each addition. A more idiomatic and performant approach in PowerShell is to capture the output of the loop directly. This avoids the overhead of repeated array copying.
$unsignedDrivers = @(foreach ($driver in $protocolDrivers) {
$isSigned = Test-DriverSigned -FilePath $driver.FullName
if (-not $isSigned) {
Write-Output " [UNSIGNED] $($driver.Name)"
$driver # Output the driver object to be collected in the array
}
else {
Write-Output " [SIGNED] $($driver.Name)"
}
})
$unsignedCount = $unsignedDrivers.Count
| # Wait a few seconds to ensure output is visible | ||
| Start-Sleep -Seconds 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Start-Sleep at the end of the script introduces an unconditional 5-second delay. This is likely unnecessary for automated execution (as suggested by the config.json) and can slow down processes. If a pause is required for interactive debugging, it's better to use Read-Host 'Press Enter to continue...' and perhaps make it conditional (e.g., based on a script parameter). For purely automated runs, this can be removed.
Resolves issue where NDIS drivers lack proper signatures in HLK2022 testing environment.