Skip to content
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

Refactor: use recursive lookup to find executable paths #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions patcher.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Write-Host '[+] Attempting to Test Sign Driver'
$inf2cat = ''
$signtool = ''

$inf2cat_paths = 'C:/Program Files (x86)/Windows Kits/10/bin/x86/Inf2Cat.exe', 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/Inf2Cat.exe', 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17134.0/x86/Inf2Cat.exe', 'C:/WinDDK/7600.16385.1/bin/selfsign/Inf2Cat.exe'
$signtool_paths = 'C:/Program Files (x86)/Windows Kits/10/Tools/bin/i386/signtool.exe', 'C:/WinDDK/7600.16385.1/bin/amd64/signtool.exe'
$inf2cat_paths = dir -Path C:\ -Filter Inf2cat.exe -Recurse -ErrorAction SilentlyContinue | %{$_.FullName}
$signtool_paths = dir -Path C:\ -Filter signtool.exe -Recurse -ErrorAction SilentlyContinue | %{$_.FullName}

foreach($path in $inf2cat_paths)
{
Expand All @@ -110,12 +110,12 @@ foreach($path in $signtool_paths)

if(-Not(Test-Path $inf2cat))
{
Write-Host "[!] Failure: Unable to locate inf2cat, see/edit script for expected paths"
Write-Host "[!] Failure: Unable to locate inf2cat, edit script to enter path manually"
exit
}
if(-Not(Test-Path $signtool))
{
Write-Host "[!] Failure: Unable to locate signtool, see/edit script for expected paths"
Write-Host "[!] Failure: Unable to locate signtool, edit script to enter path manually"
exit
}

Expand Down Expand Up @@ -154,4 +154,4 @@ Write-Host ' [+] Signing Catalog File'

$catalog_path = $directory + './nv_disp.cat'
& $signtool sign /v /n SKSoftware /t http://timestamp.verisign.com/scripts/timstamp.dll $catalog_path
& $signtool sign /v /n SKSOftware /t http://timestamp.verisign.com/scripts/timstamp.dll $sys_unpacked
& $signtool sign /v /n SKSOftware /t http://timestamp.verisign.com/scripts/timstamp.dll $sys_unpacked