From a62d409575036a70c8c86eb1a8afe4c40f8391d0 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Thu, 17 Apr 2025 14:12:17 +0200 Subject: [PATCH] added windows guide --- README.md | 47 ++++++++++++++++++++++++++++++------ windows-replace-nvxdapix.ps1 | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 windows-replace-nvxdapix.ps1 diff --git a/README.md b/README.md index 0fb34c1..f9ba07c 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,50 @@ # gridd-unlock-patcher > [!note] Credits -> This code is built by `electricsheep49` +> This code is built by `electricsheep49`. The Windows replacement script is written by `lcs`. -Only Linux is supported for executing the patcher, +**Only Linux is supported for executing the patcher**, see **[Releases](https://git.collinwebdesigns.de/oscar.krause/gridd-unlock-patcher/-/releases)**. -The patcher supports both Windows and Linux guests: -- For Windows guests, the GRID daemon is Display.Driver/nvxdapix.dll. - - **TODO**: Where is this installed? Also, **untested**. -- For Linux guests, execute `which nvidia-gridd` to find your GRID daemon. It's probably in /bin/. +The patcher supports both, Windows and Linux guests: -## How to patch +- For Windows guests, the GRID daemon is Display.Driver/nvxdapix.dll +- For Linux guests, execute `which nvidia-gridd` to find your GRID daemon. It's probably in `/bin/`. + +# How to patch + +**Prepare** 1. Download [latest release](https://git.collinwebdesigns.de/oscar.krause/gridd-unlock-patcher/-/releases) 2. Make executable `chmod +x gridd-unlock-patcher` -3. Run patch `gridd-unlock-patcher -g -c /path/to/my_demo_root_certificate.pem` +3. Download your *FastAPI-DLS Root-CA* from `https:///-/config/root-ca` +## Linux + +*This overwrites the given binary, make sure you have a backup!* + +1. Run patch `gridd-unlock-patcher -g $(which nvidia-gridd) -c /path/to/my_root_certificate.pem` +2. Restart `nvidia-gridd` service + +## Windows + +*This overwrites the given dll, make sure you have a backup!* + +1. Download [`windows-replace-nvxdapix.ps1`](windows-replace-nvxdapix.ps1) (written by `lcs`) to the Desktop of your + Windows machine +2. Run + `Get-ChildItem -Path "C:\Windows\System32\DriverStore\FileRepository" -Recurse -Filter "nvxdapix.dll" -ErrorAction SilentlyContinue | Select-Object -First 1` +3. Copy the `nvxdapix.dll` from the resulting path to your Linux host where the `gridd-unlock-patcher` is installed +4. Run patch `gridd-unlock-patcher -g /path/to/nvxdapix.dll -c /path/to/my_root_certificate.pem` +5. Copy the patched `nvxdapix.dll` back to the Desktop of your Windows machine +6. Run `powershell.exe -executionpolicy bypass -file "$HOME\Desktop\gridd-apply-patch.ps1"` as Administrator + +Output should look like + +```shell +PS C:\WINDOWS\system32> powershell.exe -executionpolicy bypass -file "$HOME\Desktop\gridd-apply-patch.ps1" +Searching for nvxdapix.dll in C:\Windows\System32\DriverStore\FileRepository... +Found DLL: C:\Windows\System32\DriverStore\FileRepository\nvgridsw.inf_amd64_847af0d59d1a7293\nvxdapix.dll +Replaced nvxdapix.dll successfully. +PS C:\WINDOWS\system32> +``` diff --git a/windows-replace-nvxdapix.ps1 b/windows-replace-nvxdapix.ps1 new file mode 100644 index 0000000..2459fd9 --- /dev/null +++ b/windows-replace-nvxdapix.ps1 @@ -0,0 +1,44 @@ +# ========== Configuration ========== +$searchRoot = "C:\Windows\System32\DriverStore\FileRepository" +$dllName = "nvxdapix.dll" +$replacementDll = "$HOME\Desktop\nvxdapix.dll" # Path to the patched DLL +$logFile = "$HOME\dll_replacement_log.txt" +# =================================== + +# Search for the DLL +Write-Host "Searching for $dllName in $searchRoot..." +$dllPath = Get-ChildItem -Path $searchRoot -Recurse -Filter $dllName -ErrorAction SilentlyContinue | Select-Object -First 1 + +# Kill the NV service before attempting to replace the DLL +Stop-Service NVDisplay.ContainerLocalSystem + +if ($dllPath) { + $fullPath = $dllPath.FullName + Write-Host "Found DLL: $fullPath" + Add-Content -Path $logFile -Value "Found $dllName at: $fullPath" + + # Take ownership + takeown /F $fullPath | Out-Null + + # Grant full control to administrators + icacls $fullPath /grant Administratoren:F | Out-Null + + # Attempt to stop processes using the DLL (optional: may not apply to DriverStore) + Get-Process | Where-Object { + $_.Modules | Where-Object { $_.FileName -eq $fullPath } + } | ForEach-Object { + Write-Host "Stopping process: $($_.Name) (PID: $($_.Id))" + Stop-Process -Id $_.Id -Force + } + + # Replace the DLL + Copy-Item -Path $replacementDll -Destination $fullPath -Force + Write-Host "Replaced $dllName successfully." + Add-Content -Path $logFile -Value "Replaced $dllName at $fullPath on $(Get-Date)" +} else { + Write-Host "DLL not found." + Add-Content -Path $logFile -Value "Failed to find $dllName in $searchRoot on $(Get-Date)" +} + +# Start the service after the replacement +Start-Service NVDisplay.ContainerLocalSystem