diff --git a/.bin/Scripts/build_pe.ps1 b/.bin/Scripts/build_pe.ps1 index afcc6fe7..4276b152 100644 --- a/.bin/Scripts/build_pe.ps1 +++ b/.bin/Scripts/build_pe.ps1 @@ -499,7 +499,7 @@ if ($MyInvocation.InvocationName -ne ".") { ) Start-Process -FilePath $DISM -ArgumentList $ArgumentList -NoNewWindow -Wait - # Add WK tools + # Add tools Write-Host "Copying tools..." Copy-Item -Path "$Root\WK\$Arch" -Destination "$Mount\.bin" -Recurse -Force Copy-Item -Path "$Root\WK\_include\*" -Destination "$Mount\.bin" -Recurse -Force @@ -538,17 +538,16 @@ if ($MyInvocation.InvocationName -ne ".") { $RegKey = $Hive.OpenSubKey($RegPath) $CurValue = $RegKey.GetValue( "Path", $false, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) - $NewValue = "$CurValue;%SystemDrive%\WK\7-Zip;%SystemDrive%\WK\python;%SystemDrive%\WK\wimlib" + $NewValue = "$CurValue;%SystemDrive%\.bin\7-Zip;%SystemDrive%\.bin\python;%SystemDrive%\.bin\wimlib" Set-ItemProperty -Path "HKLM:\$RegPath" -Name "Path" -Value $NewValue -Force | Out-Null $Hive.close() $RegKey.close() # Replace Notepad - ## Currently broken ## - # $RegPath = "HKLM:\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" - # $NewValue = 'wscript "X:\WK\NotepadPlusPlus\npp.vbs"' - # New-Item -Path $RegPath -Force | Out-Null - # New-ItemProperty -Path $RegPath -Name "Debugger" -Value $NewValue -Force | Out-Null + $RegPath = "HKLM:\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" + $NewValue = 'cmd /c "%SystemDrive%\.bin\NotepadPlusPlus\npp.cmd"' + New-Item -Path $RegPath -Force | Out-Null + New-ItemProperty -Path $RegPath -Name "Debugger" -Value $NewValue -Force | Out-Null # Run garbage collection to release potential stale handles ## Credit: https://jrich523.wordpress.com/2012/03/06/powershell-loading-and-unloading-registry-hives/ diff --git a/WK/_include/NotepadPlusPlus/npp.cmd b/WK/_include/NotepadPlusPlus/npp.cmd new file mode 100644 index 00000000..d387df55 --- /dev/null +++ b/WK/_include/NotepadPlusPlus/npp.cmd @@ -0,0 +1,3 @@ +@echo off + +start "" %SystemDrive%\.bin\NotepadPlusPlus\notepadplusplus.exe %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/WK/_include/NotepadPlusPlus/npp.vbs b/WK/_include/NotepadPlusPlus/npp.vbs deleted file mode 100644 index 3fb12a41..00000000 --- a/WK/_include/NotepadPlusPlus/npp.vbs +++ /dev/null @@ -1,33 +0,0 @@ -'// DISCLAIMER -'// THIS COMES WITH NO WARRANTY, IMPLIED OR OTHERWISE. USE AT YOUR OWN RISK -'// IF YOU ARE NOT COMFORTABLE EDITING THE REGISTRY THEN DO NOT USE THIS SCRIPT -'// -'// NOTES: -'// This affects all users. -'// This will prevent ANY executable named notepad.exe from running located anywhere on this computer!! -'// -'// Save this text to your notepad++ folder as a text file named npp.vbs (some AV don't like vbs, get a different AV :-P ) -'// -'// USAGE -'// 1) -'// Navigate to registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ -'// -' // 2) -'// Add new subkey called notepad.exe -'// This step is what tells windows to use the notepad++ exe, to undo simply delete this key -'// -'// 3) -'// Create new Sting Value called Debugger -'// -'// 4) -'// Modify value and enter wscript.exe "path to npp.vbs" e.g. wscript.exe "C:\Program Files\Notepad++\npp.vbs" - -Option Explicit -Dim sCmd, x -sCmd = """" & LeftB(WScript.ScriptFullName, LenB(WScript.ScriptFullName) - LenB(WScript.ScriptName)) & "notepad++.exe" & """ """ -For x = 1 To WScript.Arguments.Count - 1 - sCmd = sCmd & WScript.Arguments(x) & " " -Next -sCmd = sCmd & """" -CreateObject("WScript.Shell").Run sCmd, 1, True -WScript.Quit \ No newline at end of file