mirror of
https://github.com/keylase/nvidia-patch.git
synced 2026-11-28 17:01:29 +00:00
- Rewrite Patch.ps1 around a read-only pre-flight plan that refuses missing wrappers, wrong wrapper PE architecture, stale or wrapper backups, and a non-NVIDIA file at the original path before anything is changed. - Use takeown/icacls instead of Set-Acl, record each owner SID and whether an Administrators ACE already existed, and restore both so a temporary unlock is undone on rollback and after a successful move. - Stage the wrapper as a .nvfbcwrp-tmp copy, verify SHA-256 after every copy and move, and revert recorded copy, move and ACL steps in reverse when any target fails. - Add -Unattended and -SkipGenuineCheck switches, quote elevation arguments correctly for Windows PowerShell 5.1, and replace pause/Read-Host with explicit exit codes. - RunPatch.bat confines ExecutionPolicy Bypass to its own process and propagates the exit code; README.md documents the re-run, refusal and manual-restore behavior. - Target: win/nvfbcwrp
19 lines
567 B
Batchfile
19 lines
567 B
Batchfile
@echo off
|
|
cd /d "%~dp0"
|
|
if not exist "%~dp0Patch.ps1" (
|
|
echo "Patch.ps1" is not found next to this file.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
REM -ExecutionPolicy Bypass applies to this process only. Scripts downloaded as a zip
|
|
REM carry the Mark-of-the-Web, so the default policy would refuse to run them.
|
|
REM The policy setting itself is not changed.
|
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Patch.ps1" %*
|
|
set "RC=%ERRORLEVEL%"
|
|
if not "%RC%"=="0" (
|
|
echo.
|
|
echo Patch failed with exit code %RC%. See the messages above.
|
|
pause
|
|
)
|
|
exit /b %RC%
|