Test 2023 12 19 (#1294)

* Compile Winutil

* Issue #1283, #1280 fixes, more (#1288)

* Explorer Fix

* Wifi, Explorer Crash, WinUtil Icon fixes. First attempt at white theme

* White theme

* Fix for clashing microwin directories if process fails, now new directory will be generated

* * Tested latest Windows 10 (22H2) images work fine
* Made dialog box more clear for issue #1283
* Added better logic for handling takeown /D flag for different locals issue #1280
* Refreshed the UI to more modern look
* Improved white theme
* Regrouped Tweak tab to make more sense
* Advanced tweaks were in a separate column but the button applied both Essential and advanced now they are in the same column and button applies both
* All instant action buttons were moved to Customize preferences column
* Explorer lockup Fix
* Wifi, Explorer Crash, WinUtil Icon fixes.
* Fix for clashing microwin directories if process fails, now new directory will be generated

* Merge all

* Theme improvement, adding icon to the shortcut

* Ability to download oscdimg from github, reorginizing Apps to fit better on more (smaller screens)

* Fixing release branch to WinUtil

* Adding double click to fullscreen

* Update Get-Oscdimg.ps1

---------

Co-authored-by: KonTy <KonTy@github.com>
Co-authored-by: Chris Titus <contact@christitus.com>

* Update winutil.ps1

* remove merc and thorium

* Ashlyn Programs

* Also inject drivers into boot.wim

* copy #1291

new branch

---------

Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: KonTy <9524513+KonTy@users.noreply.github.com>
Co-authored-by: KonTy <KonTy@github.com>
Co-authored-by: Cedric Lewe <0skillallluck@pm.me>
This commit is contained in:
Chris Titus 2023-12-19 13:55:55 -06:00 committed by GitHub
parent 4be4805e7c
commit d02146be0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 10113 additions and 8901 deletions

View File

@ -31,6 +31,10 @@
"winget": "AIMP.AIMP",
"choco": "aimp"
},
"WPFInstallarch": {
"winget": "9MZNMNKSM73X",
"choco": "na"
},
"WPFInstallaudacity": {
"winget": "Audacity.Audacity",
"choco": "audacity"
@ -39,6 +43,14 @@
"winget": "AutoHotkey.AutoHotkey",
"choco": "autohotkey"
},
"WPFInstallbarrier": {
"winget": "DebaucheeOpenSourceGroup.Barrier",
"choco": "barrier"
},
"WPFInstallbat": {
"winget": "sharkdp.bat",
"choco": "bat"
},
"WPFInstallbitwarden": {
"winget": "Bitwarden.Bitwarden",
"choco": "bitwarden"
@ -63,14 +75,22 @@
"winget": "calibre.calibre",
"choco": "calibre"
},
"WPFInstallcarnac": {
"winget": "code52.Carnac",
"choco": "carnac"
},
"WPFInstallcemu": {
"winget": "Cemu.Cemu",
"choco": "cemu"
},
"WPFInstallchatterino": {
"winget": "ChatterinoTeam.Chatterino",
"choco": "chatterino"
},
"WPFInstallchrome": {
"winget": "Google.Chrome",
"choco": "googlechrome"
},
"WPFInstallcopyq": {
"winget": "copyq",
"choco": "copyq"
},
"WPFInstallchromium": {
"winget": "eloston.ungoogled-chromium",
"choco": "chromium"
@ -79,6 +99,10 @@
"winget": "CiderCollective.Cider",
"choco": "cider"
},
"WPFInstallclementine": {
"winget": "Clementine.Clementine",
"choco": "clementine"
},
"WPFInstallclink": {
"winget": "chrisant996.Clink",
"choco": "clink"
@ -87,14 +111,34 @@
"winget": "na",
"choco": "clipgrab"
},
"WPFInstallclonehero": {
"winget": "CloneHeroTeam.CloneHero",
"choco": "na"
},
"WPFInstallcopyq": {
"winget": "hluk.CopyQ",
"choco": "copyq"
},
"WPFInstallcpuz": {
"winget": "CPUID.CPU-Z",
"choco": "cpu-z"
},
"WPFInstallcrystaldiskinfo": {
"winget": "CrystalDewWorld.CrystalDiskInfo",
"choco": "crystaldiskinfo"
},
"WPFInstallcrystaldiskmark": {
"winget": "CrystalDewWorld.CrystalDiskMark",
"choco": "crystaldiskmark"
},
"WPFInstallddu": {
"winget": "ddu",
"choco": "ddu"
},
"WPFInstalldebian": {
"winget": "Debian.Debian",
"choco": "na"
},
"WPFInstalldeluge": {
"winget": "DelugeTeam.Deluge",
"choco": "deluge"
@ -103,6 +147,10 @@
"winget": "devtoys",
"choco": "devToys"
},
"WPFInstalldigikam": {
"winget": "KDE.digikam",
"choco": "digikam"
},
"WPFInstalldiscord": {
"winget": "Discord.Discord",
"choco": "discord"
@ -131,6 +179,10 @@
"winget": "KDE.Dolphin",
"choco": "na"
},
"WPFInstalldoxbox": {
"winget": "DOSBox.DOSBox",
"choco": "dosbox"
},
"WPFInstallduplicati": {
"winget": "Duplicati.Duplicati",
"choco": "duplicati"
@ -147,10 +199,22 @@
"winget": "Microsoft.Edge",
"choco": "microsoft-edge"
},
"WPFInstallefibooteditor": {
"winget": "EFIBootEditor.EFIBootEditor",
"choco": "na"
},
"WPFInstallemulationstation": {
"winget": "Emulationstation.Emulationstation",
"choco": "emulationstation"
},
"WPFInstallepicgames": {
"winget": "EpicGames.EpicGamesLauncher",
"choco": "epicgameslauncher"
},
"WPFInstallerrorlookup": {
"winget": "Henry++.ErrorLookup",
"choco": "na"
},
"WPFInstallesearch": {
"winget": "voidtools.Everything",
"choco": "everything"
@ -159,6 +223,26 @@
"winget": "Balena.Etcher",
"choco": "etcher"
},
"WPFInstallfalkon": {
"winget": "KDE.Falkon",
"choco": "falkon"
},
"WPFInstallfedora": {
"winget": "whitewaterfoundry.fedora-remix-for-wsl",
"choco": "na"
},
"WPFInstallferdium": {
"winget": "Ferdium.Ferdium",
"choco": "ferdium"
},
"WPFInstallfiles": {
"winget": "YairAichenbaum.Files",
"choco": "files"
},
"WPFInstallfirealpaca": {
"winget": "FireAlpaca.FireAlpaca",
"choco": "firealpaca"
},
"WPFInstallfirefox": {
"winget": "Mozilla.Firefox",
"choco": "firefox"
@ -183,6 +267,10 @@
"winget": "Foxit.PhantomPDF",
"choco": "na"
},
"WPFInstallfreecad": {
"winget": "FreeCAD.FreeCAD",
"choco": "freecad"
},
"WPFInstallgeforcenow": {
"winget": "Nvidia.GeForceNow",
"choco": "nvidia-geforce-now"
@ -251,6 +339,10 @@
"winget": "REALiX.HWiNFO",
"choco": "hwinfo"
},
"WPFInstallimgburn": {
"winget": "LIGHTNINGUK.ImgBurn",
"choco": "imgburn"
},
"WPFInstallimageglass": {
"winget": "DuongDieuPhap.ImageGlass",
"choco": "imageglass"
@ -259,6 +351,10 @@
"winget": "Inkscape.Inkscape",
"choco": "inkscape"
},
"WPFInstallitch": {
"winget": "ItchIo.Itch",
"choco": "itch"
},
"WPFInstallitunes": {
"winget": "Apple.iTunes",
"choco": "itunes"
@ -303,6 +399,10 @@
"winget": "Azul.Zulu.20.JDK",
"choco": "na"
},
"WPFInstalljava21": {
"winget": "Azul.Zulu.21.JDK",
"choco": "na"
},
"WPFInstalljdownloader": {
"winget": "AppWork.JDownloader",
"choco": "jdownloader"
@ -339,6 +439,10 @@
"winget": "KDE.Krita",
"choco": "krita"
},
"WPFInstalllbry": {
"winget": "LBRY.LBRY",
"choco": "lbry"
},
"WPFInstalllibreoffice": {
"winget": "TheDocumentFoundation.LibreOffice",
"choco": "libreoffice-fresh"
@ -363,9 +467,13 @@
"winget": "Element.Element",
"choco": "element-desktop"
},
"WPFInstallmercury": {
"winget": "Alex313031.Mercury",
"choco": "na"
"WPFInstallmeld": {
"winget": "Meld.Meld",
"choco": "meld"
},
"WPFInstallmoonlight": {
"winget": "MoonlightGameStreamingProject.Moonlight",
"choco": "moonlight-qt"
},
"WPFInstallmonitorian": {
"winget": "emoacht.Monitorian",
@ -379,6 +487,10 @@
"winget": "mRemoteNG.mRemoteNG",
"choco": "mremoteng"
},
"WPFInstallmspaintide": {
"winget": "MSPaintIDE.MSPaintIDE",
"choco": "na"
},
"WPFInstallmsiafterburner": {
"winget": "Guru3D.Afterburner",
"choco": "msiafterburner"
@ -399,6 +511,10 @@
"winget": "Cyanfish.NAPS2",
"choco": "naps2"
},
"WPFInstallneofetchwin": {
"winget": "nepnep.neofetch-win",
"choco": "na"
},
"WPFInstallneovim": {
"winget": "Neovim.Neovim",
"choco": "neovim"
@ -411,6 +527,10 @@
"winget": "ZeusSoftware.nGlide",
"choco": "na"
},
"WPFInstallnmap": {
"winget": "Insecure.Nmap",
"choco": "nmap"
},
"WPFInstallnodejs": {
"winget": "OpenJS.NodeJS",
"choco": "nodejs"
@ -431,6 +551,10 @@
"winget": "Microsoft.NuGet",
"choco": "nuget.commandline"
},
"WPFInstallnushell": {
"winget": "Nushell.Nushell",
"choco": "nushell"
},
"WPFInstallnvclean": {
"winget": "TechPowerUp.NVCleanstall",
"choco": "na"
@ -459,6 +583,18 @@
"winget": "ONLYOFFICE.DesktopEditors",
"choco": "onlyoffice"
},
"WPFInstallopenscad": {
"winget": "OpenSCAD.OpenSCAD",
"choco": "openscad"
},
"WPFInstallopensuseleap": {
"winget": "9NJGLDP5G04B",
"choco": "na"
},
"WPFInstallopensusetw": {
"winget": "9MSSK2ZXXN11",
"choco": "na"
},
"WPFInstallopenoffice": {
"winget": "Apache.OpenOffice",
"choco": "openoffice"
@ -495,6 +631,10 @@
"winget": "Giorgiotani.Peazip",
"choco": "peazip"
},
"WPFInstallplaynite": {
"winget": "Playnite.Playnite",
"choco": "playnite"
},
"WPFInstallpostman": {
"winget": "Postman.Postman",
"choco": "postman"
@ -527,6 +667,10 @@
"winget": "Microsoft.Sysinternals.ProcessMonitor",
"choco": "procexp"
},
"WPFInstallprucaslicer": {
"winget": "Prusa3d.PrusaSlicer",
"choco": "prusaslicer"
},
"WPFInstallputty": {
"winget": "PuTTY.PuTTY",
"choco": "putty"
@ -539,6 +683,14 @@
"winget": "qBittorrent.qBittorrent",
"choco": "qbittorrent"
},
"WPFInstallqtox": {
"winget": "Tox.qTox",
"choco": "qtox"
},
"WPFInstallrainmeter": {
"winget": "Rainmeter.Rainmeter",
"choco": "na"
},
"WPFInstallrevo": {
"winget": "RevoUninstaller.RevoUninstaller",
"choco": "revo-uninstaller"
@ -575,6 +727,10 @@
"winget": "Nilesoft.Shell",
"choco": "nilesoft-shell"
},
"WPFInstallsidequest": {
"winget": "SideQuestVR.SideQuest",
"choco": "sidequest"
},
"WPFInstallsignal": {
"winget": "OpenWhisperSystems.Signal",
"choco": "signal"
@ -591,6 +747,10 @@
"winget": "SlackTechnologies.Slack",
"choco": "slack"
},
"WPFInstallspotify": {
"winget": "Spotify.Spotify",
"choco": "spotify"
},
"WPFInstallsqlstudio": {
"winget": "Microsoft.SQLServerManagementStudio",
"choco": "sql-server-management-studio"
@ -619,10 +779,22 @@
"winget": "SumatraPDF.SumatraPDF",
"choco": "sumatrapdf"
},
"WPFInstallsunshine": {
"winget": "LizardByte.Sunshine",
"choco": "sunshine"
},
"WPFInstallsuperf4": {
"winget": "StefanSundin.Superf4",
"choco": "superf4"
},
"WPFInstallspacedrive": {
"winget": "spacedrive.Spacedrive",
"choco": "na"
},
"WPFInstalltailscale": {
"winget": "tailscale.tailscale",
"choco": "tailscale"
},
"WPFInstalltcpview": {
"winget": "Microsoft.Sysinternals.TCPView",
"choco": "tcpview"
@ -643,10 +815,6 @@
"winget": "Microsoft.WindowsTerminal",
"choco": "microsoft-windows-terminal"
},
"WPFInstallthorium": {
"winget": "Alex313031.Thorium",
"choco": "na"
},
"WPFInstalltor": {
"Winget": "TorProject.TorBrowser",
"choco": "tor-browser"
@ -663,6 +831,10 @@
"winget": "Mozilla.Thunderbird",
"choco": "thunderbird"
},
"WPFInstalltweeten": {
"winget": "MehediHassan.Tweeten",
"choco": "na"
},
"WPFInstalltwinkletray": {
"Winget": "xanderfrangos.twinkletray",
"choco": "na"
@ -675,10 +847,30 @@
"winget": "Ubisoft.Connect",
"choco": "ubisoft-connect"
},
"WPFInstallubuntu1604": {
"winget": " Canonical.Ubuntu.1604",
"choco": "na"
},
"WPFInstallubuntu1804": {
"winget": " Canonical.Ubuntu.1804",
"choco": "na"
},
"WPFInstallubuntu2004": {
"winget": " Canonical.Ubuntu.2004",
"choco": "na"
},
"WPFInstallubuntu2204": {
"winget": "Canonical.Ubuntu.2204",
"choco": "na"
},
"WPFInstallunity": {
"winget": "Unity.UnityHub",
"choco": "unityhub"
},
"WPFInstallvagrant": {
"winget": "Hashicorp.Vagrant",
"choco": "vagrant"
},
"WPFInstallvc2015_32": {
"winget": "Microsoft.VCRedist.2015+.x86",
"choco": "na"
@ -707,6 +899,10 @@
"winget": "VideoLAN.VLC",
"choco": "vlc"
},
"WPFInstallvmwareplayer": {
"winget": "VMware.WorkstationPlayer",
"choco": "vmware-workstation-player"
},
"WPFInstallvoicemeeter": {
"winget": "VB-Audio.Voicemeeter",
"choco": "voicemeeter"
@ -735,18 +931,34 @@
"winget": "WinMerge.WinMerge",
"choco": "winmerge"
},
"WPFInstallwinpaletter": {
"winget": "Abdelrhman-AK.WinPaletter",
"choco": "WinPaletter"
},
"WPFInstallwinrar": {
"winget": "RARLab.WinRAR",
"choco": "winrar"
},
"WPFIntallwslmanager": {
"Winget": "Bostrot.WSLManager",
"choco": "wsl2-distro-manager"
},
"WPFInstallwinscp": {
"winget": "WinSCP.WinSCP",
"choco": "winscp"
},
"WPFInstallwireguard": {
"winget": "WireGuard.WireGuard",
"choco": "wireguard"
},
"WPFInstallwireshark": {
"winget": "WiresharkFoundation.Wireshark",
"choco": "wireshark"
},
"WPFInstallwisetoys": {
"winget": "WiseCleaner.WiseToys",
"choco": "na"
},
"WPFInstallwiztree": {
"Winget": "AntibodySoftware.WizTree",
"choco": "wiztree"
@ -755,12 +967,48 @@
"winget": "subhra74.XtremeDownloadManager",
"choco": "xdm"
},
"WPFInstallxemu": {
"winget": "xemu-project.xemu",
"choco": "na"
},
"WPFInstallxournal": {
"winget": "Xournal++.Xournal++",
"choco": "xournalplusplus"
},
"WPFInstallxpipe": {
"winget": "xpipe-io.xpipe",
"choco": "xpipe"
},
"WPFInstallyarn": {
"winget": "Yarn.Yarn",
"choco": "yarn"
},
"WPFInstallzerotierone": {
"winget": "ZeroTier.ZeroTierOne",
"choco": "zerotier-one"
},
"WPFInstallzim": {
"winget": "Zimwiki.Zim",
"choco": "zim"
},
"WPFInstallznote": {
"winget": "alagrede.znote",
"choco": "na"
},
"WPFInstallzoom": {
"winget": "Zoom.Zoom",
"choco": "zoom"
},
"WPFInstallzotero": {
"winget": "DigitalScholar.Zotero",
"choco": "zotero"
},
"WPFInstallzoxide": {
"winget": "ajeetdsouza.zoxide",
"choco": "zoxide"
},
"WPFInstallzulip": {
"winget": "Zulip.Zulip",
"choco": "zulip"
}
}

View File

@ -21,8 +21,42 @@
"ButtonForegroundColor": "#000000",
"ButtonBorderThickness": "0",
"ButtonMargin": "0,3,0,3",
"ButtonCornerRadius": "0"
"ButtonCornerRadius": "0",
"ToggleButtonHeight": "40",
"BorderColor": "#000000",
"BorderOpacity": "0.2",
"ShadowPulse": "Forever"
},
"Classic": {
"ComboBoxBackgroundColor": "#FFFFFF",
"LabelboxForegroundColor": "#000000",
"MainForegroundColor": "#000000",
"MainBackgroundColor": "#FFFFFF",
"LabelBackgroundColor": "#FAFAFA",
"GroupBorderBackgroundColor": "#000000",
"ComboBoxForegroundColor": "#000000",
"ButtonInstallBackgroundColor": "#FFFFFF",
"ButtonTweaksBackgroundColor": "#FFFFFF",
"ButtonConfigBackgroundColor": "#FFFFFF",
"ButtonUpdatesBackgroundColor": "#FFFFFF",
"ButtonInstallForegroundColor": "#000000",
"ButtonTweaksForegroundColor": "#000000",
"ButtonConfigForegroundColor": "#000000",
"ButtonUpdatesForegroundColor": "#000000",
"ButtonBackgroundColor": "#F5F5F5",
"ButtonBackgroundPressedColor": "#1A1A1A",
"CheckboxMouseOverColor": "#999999",
"ButtonBackgroundMouseoverColor": "#C2C2C2",
"ButtonBackgroundSelectedColor": "#F0F0F0",
"ButtonForegroundColor": "#000000",
"ButtonBorderThickness": "1",
"ButtonMargin": "1",
"ButtonCornerRadius": "2",
"ToggleButtonHeight": "25",
"BorderColor": "#000000",
"BorderOpacity": "0.2",
"ShadowPulse": "Forever"
},
"Matrix": {
"ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58",
@ -45,6 +79,10 @@
"ButtonForegroundColor": "#9CCC65",
"ButtonBorderThickness": "1",
"ButtonMargin": "1",
"ButtonCornerRadius": "2"
"ButtonCornerRadius": "2",
"ToggleButtonHeight": "25",
"BorderColor": "#FFAC1C",
"BorderOpacity": "0.8",
"ShadowPulse": "0:0:3"
}
}

View File

@ -0,0 +1,27 @@
function ConvertTo-Icon {
<#
.DESCRIPTION
This function will convert PNG to ICO file
.EXAMPLE
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
#>
param( [Parameter(Mandatory=$true)]
$bitmapPath,
$iconPath = "$env:temp\newicon.ico"
)
Add-Type -AssemblyName System.Drawing
if (Test-Path $bitmapPath) {
$b = [System.Drawing.Bitmap]::FromFile($bitmapPath)
$icon = [System.Drawing.Icon]::FromHandle($b.GetHicon())
$file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate')
$icon.Save($file)
$file.Close()
$icon.Dispose()
#explorer "/SELECT,$iconpath"
}
else { Write-Warning "$BitmapPath does not exist" }
}

View File

@ -13,17 +13,27 @@ function Get-LocalizedYesNo {
#>
# Run takeown.exe and capture its output
$takeownOutput = & takeown.exe /? | Out-String
$takeownOutput = & takeown.exe /? | Out-String
# Parse the output and retrieve lines until there are at least 2 characters in the array
$found = $false
$charactersArray = @()
foreach ($line in $takeownOutput -split "`r`n")
{
# skip everything before /D flag help
if ($found)
{
$characters = $line -split '(")([A-Za-z])(")' | Where-Object { $_ -match '^[A-Za-z]$' }
$charactersArray += $characters
# now that /D is found start looking for a single character in double quotes
# in help text there is another string in double quotes but it is not a single character
$regexPattern = '"([a-zA-Z])"'
$charactersArray = [regex]::Matches($line, $regexPattern) | ForEach-Object { $_.Groups[1].Value }
# if ($charactersArray.Count -gt 0) {
# Write-Output "Extracted symbols: $($matches -join ', ')"
# } else {
# Write-Output "No matches found."
# }
if ($charactersArray.Count -ge 2)
{

View File

@ -0,0 +1,28 @@
function Get-Oscdimg {
<#
.DESCRIPTION
This function will get oscdimg file for from github Release foldersand put it into env:temp
.EXAMPLE
Get-Oscdimg
#>
param( [Parameter(Mandatory=$true)]
$oscdimgPath = "$env:TEMP\oscdimg.exe"
)
$githubUserName = "ChrisTitusTech"
$downloadUrl = "https://github.com/$githubUserName/winutil/releases/oscdimg.exe"
Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath
$hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256
$sha256Hash = $hashResult.Hash
Write-Host "[INFO] oscdimg.exe SHA-256 Hash: $sha256Hash"
$expectedHash = "F62B91A06F94019A878DD9D1713FFBA2140B863C131EB78A329B4CCD6102960E" # Replace with the actual expected hash
if ($sha256Hash -eq $expectedHash) {
Write-Host "Hashes match. File is verified."
} else {
Write-Host "Hashes do not match. File may be corrupted or tampered with."
}
}

View File

@ -147,6 +147,7 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
if (-not (Test-Path -Path "$($pathToDelete)")) { return }
$yesNo = Get-LocalizedYesNo
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
# Specify the path to the directory
# $directoryPath = "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup"

View File

@ -55,5 +55,6 @@ function Invoke-WPFButton {
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
"WPFGetIso" {Invoke-WPFGetIso}
"WPFMicrowin" {Invoke-WPFMicrowin}
"WPFCloseButton" {Invoke-CloseButton}
}
}

View File

@ -0,0 +1,12 @@
function Invoke-CloseButton {
<#
.SYNOPSIS
Close application
.PARAMETER Button
#>
$sync["Form"].Close()
Write-Host "Bye bye!"
}

View File

@ -18,25 +18,46 @@ function Invoke-WPFGetIso {
Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | "
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg)
Write-Host "oscdimge.exe on system: $oscdImgFound"
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe)
Write-Host "oscdimg.exe on system: $oscdImgFound"
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound)
{
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, you need to download it first before running this function!")
# the step below needs choco to download oscdimg
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
Write-Host "choco on system: $oscdImgFound"
if (!$chocoFound)
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
if (!$downloadFromGitHub)
{
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
# only show the message to people who did check the box to download from github, if you check the box
# you consent to downloading it, no need to show extra dialogs
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco or github. This might take a long time.")
# the step below needs choco to download oscdimg
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
Write-Host "choco on system: $chocoFound"
if (!$chocoFound)
{
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
return
}
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install windows-adk-oscdimg"
[System.Windows.MessageBox]::Show("oscdimg is installed, now close, reopen PowerShell terminal and re-launch winutil.ps1")
return
}
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install windows-adk-oscdimg"
[System.Windows.MessageBox]::Show("oscdimg is installed, now close, reopen PowerShell terminal and re-launch winutil.ps1 !!!")
return
else {
Get-Oscdimg -oscdimgPath $oscdimgPath
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound) {
$msg = "oscdimg was not downloaded can not proceed"
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
return
}
else {
Write-Host "oscdimg.exe was successfully downloaded from github"
}
}
}
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
@ -49,7 +70,7 @@ function Invoke-WPFGetIso {
if ([string]::IsNullOrEmpty($filePath))
{
Write-Host "No ISO is chosen"
break
return
}
Write-Host "File path $($filePath)"
@ -57,7 +78,7 @@ function Invoke-WPFGetIso {
{
$msg = "File you've chosen doesn't exist"
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
break
return
}
Write-Host "Mounting Iso. Please wait."
@ -70,15 +91,21 @@ function Invoke-WPFGetIso {
$sync.MicrowinIsoDrive.Text = $driveLetter
Write-Host "Setting up mount dir and scratch dirs"
$mountDir = "c:\microwin"
$scratchDir = "c:\microwinscratch"
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$randomNumber = Get-Random -Minimum 1 -Maximum 9999
$randomMicrowin = "Microwin_${timestamp}_${randomNumber}"
$randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}"
$mountDir = Join-Path $env:TEMP $randomMicrowin
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
$sync.MicrowinMountDir.Text = $mountDir
$sync.MicrowinScratchDir.Text = $scratchDir
Write-Host "Done setting up mount dir and scratch dirs"
Write-Host "Scratch dir is $scratchDir"
Write-Host "Image dir is $mountDir"
try {
$data = @($driveLetter, $filePath)
#$data = @($driveLetter, $filePath)
New-Item -ItemType Directory -Force -Path "$($mountDir)" | Out-Null
New-Item -ItemType Directory -Force -Path "$($scratchDir)" | Out-Null
Write-Host "Copying Windows image. This will take awhile, please don't use UI or cancel this step!"
@ -93,7 +120,8 @@ function Invoke-WPFGetIso {
if (-not (Test-Path -Path $wimFile -PathType Leaf))
{
$msg = "install wim file doesn't exist in the image, are you sure you used Windows image??"
$msg = "Install.wim file doesn't exist in the image, this could happen if you use unofficial Windows images, or a Media creation tool, which creates a final image that can not be modified. Please don't use shady images from the internet, use only official images. Here are instructions how to download ISO images if the Microsoft website is not showing the link to download and ISO. https://www.techrepublic.com/article/how-to-download-a-windows-10-iso-file-without-using-the-media-creation-tool/"
Write-Host $msg
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
throw
}

View File

@ -10,6 +10,7 @@ function Invoke-WPFMicrowin {
return
}
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
Write-Host "Index chosen: '$index' from $($sync.MicrowinWindowsFlavors.SelectedValue)"
@ -145,13 +146,11 @@ function Invoke-WPFMicrowin {
{
$pngPath = "$env:TEMP\cttlogo.png"
$icoPath = "$env:TEMP\cttlogo.ico"
Add-Type -AssemblyName System.Drawing
$pngImage = [System.Drawing.Image]::FromFile($pngPath)
$pngImage.Save($icoPath, [System.Drawing.Imaging.ImageFormat]::Icon)
ConvertTo-Icon -bitmapPath $pngPath -iconPath $icoPath
Write-Host "ICO file created at: $icoPath"
Copy-Item "$env:TEMP\cttlogo.png" "$($scratchDir)\Windows\cttlogo.png" -force
Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\cttlogo.ico" -force
$shortcut.IconLocation = "c:\cttlogo.ico"
Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\Windows\cttlogo.ico" -force
$shortcut.IconLocation = "c:\Windows\cttlogo.ico"
}
$shortcut.TargetPath = "powershell.exe"
@ -264,6 +263,20 @@ function Invoke-WPFMicrowin {
# Next step boot image
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
dism /mount-image /imagefile:"$mountDir\sources\boot.wim" /index:2 /mountdir:"$scratchDir"
if ($injectDrivers)
{
$driverPath = $sync.MicrowinDriverLocation.Text
if (Test-Path $driverPath)
{
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
dism /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
}
else
{
Write-Host "Path to drivers is invalid continuing without driver injection"
}
}
Write-Host "Loading registry..."
reg load HKLM\zCOMPONENTS "$($scratchDir)\Windows\System32\config\COMPONENTS" >$null
@ -298,8 +311,19 @@ function Invoke-WPFMicrowin {
dism /unmount-image /mountdir:$scratchDir /commit
Write-Host "Creating ISO image"
# if we downloaded oscdimg from github it will be in the temp directory so use it
# if it is not in temp it is part of ADK and is in global PATH so just set it to oscdimg.exe
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound)
{
$oscdimgPath = "oscdimg.exe"
}
Write-Host "[INFO] Using oscdimg.exe from: $oscdimgPath"
#& oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir $env:temp\microwin.iso
Start-Process -FilePath "oscdimg.exe" -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir $env:temp\microwin.iso" -NoNewWindow -Wait
Start-Process -FilePath $oscdimgPath -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin $mountDir $env:temp\microwin.iso" -NoNewWindow -Wait
if ($copyToUSB)
{
@ -317,10 +341,12 @@ function Invoke-WPFMicrowin {
# Check if the ISO was successfully created - CTT edit
if ($LASTEXITCODE -eq 0) {
Write-Host "Done. ISO image is located here: $env:temp\microwin.iso"
Write-Host "Performing Cleanup"
Write-Host "`n`nPerforming Cleanup..."
Remove-Item -Recurse -Force "$($scratchDir)"
Remove-Item -Recurse -Force "$($mountDir)"
$msg = "Done. ISO image is located here: $env:temp\microwin.iso"
Write-Host $msg
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Information)
} else {
Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed."
}

View File

@ -1,3 +1,4 @@
function Invoke-WPFShortcut {
<#
@ -10,13 +11,19 @@ function Invoke-WPFShortcut {
#>
param($ShortcutToAdd)
Switch ($ShortcutToAdd) {
$iconPath = $null
Switch ($ShortcutToAdd) {
"WinUtil" {
$SourceExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
$IRM = 'irm https://christitus.com/win | iex'
$Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList'
$ArgumentsToSourceExe = "$powershell '$IRM'"
$DestinationName = "WinUtil.lnk"
if (Test-Path -Path "$env:TEMP\cttlogo.png") {
$iconPath = "$env:SystempRoot\cttlogo.ico"
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
}
}
}
@ -30,6 +37,9 @@ function Invoke-WPFShortcut {
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
$Shortcut.TargetPath = $SourceExe
$Shortcut.Arguments = $ArgumentsToSourceExe
if ($iconPath -ne $null) {
$shortcut.IconLocation = $iconPath
}
$Shortcut.Save()
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName)"

View File

@ -161,7 +161,7 @@ $commonKeyEvents = {
# Escape removes focus from the searchbox that way all shortcuts will start workinf again
if ($_.Key -eq "Escape") {
if ($sync.CheckboxFilter.IsFocused)
#if ($sync.CheckboxFilter.IsFocused)
{
$sync.CheckboxFilter.SelectAll()
$sync.CheckboxFilter.Text = ""
@ -232,6 +232,19 @@ $sync["Form"].Add_MouseLeftButtonDown({
$sync["Form"].DragMove()
})
$sync["Form"].Add_MouseDoubleClick({
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal)
{
$sync["Form"].WindowState = [Windows.WindowState]::Maximized;
}
else
{
$sync["Form"].WindowState = [Windows.WindowState]::Normal;
}
})
# setting window icon to make it look more professional
$sync["Form"].Add_Loaded({
@ -243,7 +256,7 @@ $sync["Form"].Add_Loaded({
# File does not exist, download it
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($downloadUrl, $destinationPath)
Write-Output "File downloaded to: $destinationPath"
Write-Host "File downloaded to: $destinationPath"
} else {
Write-Output "File already exists at: $destinationPath"
}
@ -288,6 +301,7 @@ $sync["Form"].Add_Loaded({
# Move the window to that position...
[Void][Window]::MoveWindow($windowHandle, $x, $y, $width, $height, $True)
Invoke-WPFTab "WPFTab1BT"
$sync["Form"].Focus()
})
@ -312,20 +326,6 @@ $sync["CheckboxFilter"].Add_TextChanged({
}
})
$downloadUrl = "https://christitus.com/images/logo-full.png"
$destinationPath = Join-Path $env:TEMP "cttlogo.png"
# Check if the file already exists
if (-not (Test-Path $destinationPath)) {
# File does not exist, download it
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($downloadUrl, $destinationPath)
Write-Output "File downloaded to: $destinationPath"
} else {
Write-Output "File already exists at: $destinationPath"
}
# show current windowsd Product ID
#Write-Host "Your Windows Product Key: $((Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey)"

17124
winutil.ps1 Executable file → Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff