Update PE setup sections

This commit is contained in:
2Shirt 2024-05-30 01:51:58 -07:00
parent 27f87819f1
commit 1330befd13
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
12 changed files with 62 additions and 11 deletions

0
setup/build_pe.cmd Executable file → Normal file
View file

View file

@ -2,5 +2,4 @@
[LaunchApps]
wpeinit
wpeutil updatebootinfo
cd /d "%SystemDrive%"
"%SystemDrive%\Program Files\ConEmu\ConEmu64.exe", /cmd cmd /k cd "%SystemDrive%"
"%SystemDrive%\Program Files\ConEmu\ConEmu64.exe", /cmd cmd /k "%SystemDrive%\tools\menu.cmd"

View file

@ -7,7 +7,7 @@ if (Test-Path Env:\DEBUG) {
Set-PSDebug -Trace 1
}
# TODO REMOVE v
$KitNameShort = "WK"
$KitNameShort = "1201"
# TODO REMOVE ^
$Arch = "amd64"
$Host.UI.RawUI.WindowTitle = "Wizard Kit: Windows PE Build Tool"
@ -16,6 +16,7 @@ $SetupDir = (Get-Item $WD -Force).Parent.FullName
$Root = (Get-Item $SetupDir -Force).Parent.FullName
$BuildDir = "$SetupDir\BUILD_PE"
$BinDir = "$BuildDir\bin"
$ToolsDir = "$BuildDir\tools"
$OutDir = "$SetupDir\OUT_PE"
$LogDir = "$BuildDir\Logs"
$Temp = "$BuildDir\Temp"
@ -64,9 +65,14 @@ function FindDynamicUrl ($SourcePage, $RegEx) {
}
function MakeClean {
$Folders = @(
"$BuildDir\bin",
"$BuildDir\mount",
"$BuildDir\pe_files")
"$BuildDir\pe_files",
"$BuildDir\tools")
# $Folders = @(
# "$BuildDir\bin",
# "$BuildDir\mount",
# "$BuildDir\pe_files",
# "$BuildDir\tools")
foreach ($f in $Folders) {
if (Test-Path $f) {
Write-Host -ForegroundColor "Yellow" ("Found: {0}" -f $f)
@ -116,7 +122,7 @@ if ($MyInvocation.InvocationName -ne ".") {
$DownloadErrors = 0
DownloadFile -Path $Temp -Name "7z-installer.msi" -Url $Sources.'7-Zip'
DownloadFile -Path $Temp -Name "ConEmuPack.7z" -Url $Sources.'ConEmu'
DownloadFile -Path $Temp -Name "notepadplusplus.zip" -Url $Sources.'Notepad++'
DownloadFile -Path $Temp -Name "notepadplusplus.7z" -Url $Sources.'Notepad++'
DownloadFile -Path $Temp -Name "ntpwedit.zip" -Url $Sources.'NTPWEdit'
DownloadFile -Path $Temp -Name "wimlib.zip" -Url $Sources.'wimlib'
@ -128,6 +134,7 @@ if ($MyInvocation.InvocationName -ne ".") {
## Extract ##
Copy-Item -Path "$SetupDir\pe\bin" -Destination "$BinDir" -Recurse -Force
Copy-Item -Path "$SetupDir\pe\tools" -Destination "$ToolsDir" -Recurse -Force
# 7-Zip
Write-Host "Extracting: 7-Zip"
@ -234,6 +241,16 @@ if ($MyInvocation.InvocationName -ne ".") {
"WinPE-WMI",
"WinPE-SecureStartup"
)
# $WinPEPackages = @(
# "WinPE-EnhancedStorage",
# "WinPE-FMAPI",
# "WinPE-WMI",
# "WinPE-SecureStartup",
# "WinPE-NetFX",
# "WinPE-Scripting",
# "WinPE-PowerShell",
# "WinPE-StorageWMI"
# )
foreach ($Package in $WinPEPackages) {
$PackagePath = ("{0}\{1}\WinPE_OCs\{2}.cab" -f $Env:WinPERoot, $Arch, $Package)
Write-Host " $Package..."
@ -255,6 +272,8 @@ if ($MyInvocation.InvocationName -ne ".") {
# Add tools
Write-Host "Copying tools..."
Copy-Item -Path "$BinDir\*" -Destination "$Mount\Program Files" -Recurse -Force
New-Item -Path "$Mount\tools" -ItemType "directory" -Force | Out-Null
Copy-Item -Path "$ToolsDir\*" -Destination "$Mount\tools" -Recurse -Force
Copy-Item -Path "$Root\Images\WinPE.jpg" -Destination "$Mount\Program Files\ConEmu\ConEmu.jpg" -Recurse -Force
# Add System32 items
@ -288,13 +307,9 @@ if ($MyInvocation.InvocationName -ne ".") {
$Hive.close()
$RegKey.close()
# Hasleo Disk Clone
# $ArgumentList = @("import", "$SetupDir\pe\Hasleo.reg")
# Start-Process -FilePath $Reg -ArgumentList $ArgumentList -NoNewWindow -Wait
# Replace Notepad
$RegPath = "HKLM:\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe"
$NewValue = 'cmd /c "%SystemDrive%\.bin\NotepadPlusPlus\npp.cmd"'
$NewValue = 'cmd /c "%SystemDrive%\tools\npp.cmd"'
New-Item -Path $RegPath -Force | Out-Null
New-ItemProperty -Path $RegPath -Name "Debugger" -Value $NewValue -Force | Out-Null

View file

@ -0,0 +1 @@
clone_app = 'X:\Program Files\Some\tool.exe'

11
setup/pe/tools/menu.cmd Normal file
View file

@ -0,0 +1,11 @@
@echo off
pushd %~dp0
wpeutil EnableFirewall
:loop
cls
pe-menu.exe
goto loop
:done
popd

3
setup/pe/tools/npp.cmd Normal file
View file

@ -0,0 +1,3 @@
@echo off
start "" "%PROGRAMFILES%\NotepadPlusPlus\notepad++.exe" %2 %3 %4 %5 %6 %7 %8 %9

View file

@ -0,0 +1,2 @@
con_emu = 'X:\Program Files\ConEmu\ConEmu64.exe'
tools = []

View file

@ -0,0 +1,4 @@
name = 'Deja-Vu'
command = 'X:\tools\deja-vu.exe'
use_conemu = true
separator = false

View file

@ -0,0 +1,4 @@
name = ''
command = ''
use_conemu = false
separator = true

View file

@ -0,0 +1,4 @@
name = 'Diskpart'
command = 'X:\Windows\System32\diskpart.exe'
use_conemu = true
separator = false

View file

@ -0,0 +1,4 @@
name = 'Registry Editor'
command = 'X:\Windows\regedit.exe'
use_conemu = false
separator = false

View file

@ -0,0 +1,4 @@
name = 'NTPWEdit'
command = 'X:\Program Files\NTPWEdit\ntpwedit.exe'
use_conemu = false
separator = false