Add full implementation: core engine, UI, build fixes, and compilation

- Implement all core modules: disk I/O, partition tables, filesystem
  formatting, recovery, imaging, diagnostics, security, and maintenance
- Implement all UI tabs with full widget layouts and backend integration
- Fix MSVC compilation: NOMINMAX, WIN32_LEAN_AND_MEAN, missing includes
  (winioctl.h, bcrypt.h, shellapi.h, cwctype), type mismatches, and
  POSIX macro conflicts
- Add Guid implementation (Types.cpp), move DiskAccessMode to Types.h
- Add CMake presets with embedded MSVC/SDK environment for Git Bash builds
- Add build scripts, key generation, icon resources, and windeployqt
- Include pre-built hwdiag library and third-party integration
This commit is contained in:
DigiJ
2026-03-11 22:48:12 -07:00
parent 179bb85c4f
commit 8656efda63
104 changed files with 33270 additions and 334 deletions

286
scripts/install_tools.ps1 Normal file
View File

@@ -0,0 +1,286 @@
#Requires -Version 5.1
<#
.SYNOPSIS
Installs or repairs development tools for the SetecPartitionWizard project
using winget (primary), choco (fallback), and pip.
.DESCRIPTION
For each tool, the script checks whether it is already installed and functional.
If not, it attempts installation via winget, then falls back to Chocolatey.
Python packages are installed via pip after Python is confirmed working.
Run from an elevated PowerShell prompt for best results (some winget/choco
installs require admin).
.NOTES
Generated 2026-03-11 by Goju PATH repair agent.
Tools that CANNOT be CLI-installed (MSVC, Qt, Windows SDK) are documented
in docs/tool_compilers.md with manual install instructions.
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Continue'
# ─────────────────────────────────────────────────────────────
# Helper: test if a command is available
# ─────────────────────────────────────────────────────────────
function Test-CommandExists {
param([string]$Command)
$null -ne (Get-Command $Command -ErrorAction SilentlyContinue)
}
function Write-Step {
param([string]$Name, [string]$Status, [string]$Detail = "")
$color = switch ($Status) {
"FOUND" { "Green" }
"INSTALL" { "Cyan" }
"SKIP" { "DarkGray" }
"FAIL" { "Red" }
"OK" { "Green" }
default { "White" }
}
Write-Host " [$Status] $Name" -ForegroundColor $color -NoNewline
if ($Detail) { Write-Host " -- $Detail" -ForegroundColor DarkGray } else { Write-Host "" }
}
# ─────────────────────────────────────────────────────────────
# Check for package managers
# ─────────────────────────────────────────────────────────────
Write-Host "`n=== SetecPartitionWizard Tool Installer ===" -ForegroundColor Cyan
$HasWinget = Test-CommandExists "winget"
$HasChoco = Test-CommandExists "choco"
if ($HasWinget) { Write-Step "winget" "FOUND" } else { Write-Step "winget" "FAIL" "Not available -- winget installs will be skipped" }
if ($HasChoco) { Write-Step "choco" "FOUND" } else { Write-Step "choco" "SKIP" "Not available -- choco fallback disabled" }
# ─────────────────────────────────────────────────────────────
# 1. CMake
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- CMake ---" -ForegroundColor Yellow
$cmakeExe = "C:\Program Files\CMake\bin\cmake.exe"
if (Test-Path $cmakeExe) {
$ver = & $cmakeExe --version 2>&1 | Select-Object -First 1
Write-Step "CMake" "FOUND" $ver
}
else {
Write-Step "CMake" "INSTALL" "Installing via winget..."
if ($HasWinget) {
winget install Kitware.CMake --accept-package-agreements --accept-source-agreements --override '/FORCE /VERYSILENT /NORESTART /ADD_CMAKE_TO_PATH=System'
}
elseif ($HasChoco) {
choco install cmake --installargs '"ADD_CMAKE_TO_PATH=System"' -y --force
}
else {
Write-Step "CMake" "FAIL" "No package manager available. Download from https://cmake.org/download/"
}
}
# ─────────────────────────────────────────────────────────────
# 2. Ninja
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- Ninja ---" -ForegroundColor Yellow
$ninjaExe = "C:\Qt\Tools\Ninja\ninja.exe"
if (Test-Path $ninjaExe) {
$ver = & $ninjaExe --version 2>&1
Write-Step "Ninja" "FOUND" "v$ver (Qt-bundled)"
}
elseif (Test-CommandExists "ninja") {
Write-Step "Ninja" "FOUND" "in PATH"
}
else {
Write-Step "Ninja" "INSTALL" "Installing via winget..."
if ($HasWinget) {
winget install Ninja-build.Ninja --accept-package-agreements --accept-source-agreements
}
elseif ($HasChoco) {
choco install ninja -y
}
else {
Write-Step "Ninja" "FAIL" "Download from https://github.com/nicean/ninja/releases"
}
}
# ─────────────────────────────────────────────────────────────
# 3. Git
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- Git ---" -ForegroundColor Yellow
if (Test-CommandExists "git") {
$ver = git --version 2>&1
Write-Step "Git" "FOUND" $ver
}
else {
Write-Step "Git" "INSTALL" "Installing via winget..."
if ($HasWinget) {
winget install Git.Git --accept-package-agreements --accept-source-agreements --override '/VERYSILENT /NORESTART'
}
elseif ($HasChoco) {
choco install git -y --force
}
}
# ─────────────────────────────────────────────────────────────
# 4. Python
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- Python ---" -ForegroundColor Yellow
$python314 = "C:\Python314\python.exe"
$python313 = "C:\Users\mdavi\AppData\Local\Programs\Python\Python313\python.exe"
if (Test-Path $python314) {
$ver = & $python314 --version 2>&1
Write-Step "Python 3.14" "FOUND" $ver
}
else {
Write-Step "Python 3.14" "SKIP" "Not found at C:\Python314 -- install manually (pre-release)"
}
if (Test-Path $python313) {
$ver = & $python313 --version 2>&1
Write-Step "Python 3.13" "FOUND" $ver
}
else {
Write-Step "Python 3.13" "INSTALL" "Installing via winget..."
if ($HasWinget) {
winget install Python.Python.3.13 --accept-package-agreements --accept-source-agreements
}
elseif ($HasChoco) {
choco install python313 -y
}
}
# Disable WindowsApps python alias (common source of confusion)
Write-Host "`n TIP: If 'python' opens the Microsoft Store, disable the alias:" -ForegroundColor DarkGray
Write-Host " Settings > Apps > Advanced app settings > App execution aliases" -ForegroundColor DarkGray
Write-Host " Turn off 'python.exe' and 'python3.exe' aliases`n" -ForegroundColor DarkGray
# ─────────────────────────────────────────────────────────────
# 5. LLVM / Clang (standalone)
# ─────────────────────────────────────────────────────────────
Write-Host "--- LLVM / Clang ---" -ForegroundColor Yellow
$llvmPaths = @(
"C:\Program Files\LLVM\bin\clang.exe",
"C:\Qt\Tools\llvm-mingw1706_64\bin\clang.exe"
)
$foundLlvm = $false
foreach ($p in $llvmPaths) {
if (Test-Path $p) {
$ver = & $p --version 2>&1 | Select-Object -First 1
Write-Step "Clang" "FOUND" "$ver ($p)"
$foundLlvm = $true
break
}
}
if (-not $foundLlvm) {
Write-Step "Clang" "INSTALL" "Installing standalone LLVM via winget..."
if ($HasWinget) {
winget install LLVM.LLVM --accept-package-agreements --accept-source-agreements --override '/FORCE /VERYSILENT /NORESTART'
}
elseif ($HasChoco) {
choco install llvm -y --force
}
else {
Write-Step "Clang" "FAIL" "Download from https://github.com/llvm/llvm-project/releases"
}
}
# ─────────────────────────────────────────────────────────────
# 6. GitHub CLI
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- GitHub CLI ---" -ForegroundColor Yellow
if (Test-CommandExists "gh") {
$ver = gh --version 2>&1 | Select-Object -First 1
Write-Step "GitHub CLI" "FOUND" $ver
}
else {
Write-Step "GitHub CLI" "INSTALL" "Installing via winget..."
if ($HasWinget) {
winget install GitHub.cli --accept-package-agreements --accept-source-agreements
}
elseif ($HasChoco) {
choco install gh -y
}
}
# ─────────────────────────────────────────────────────────────
# 7. Python packages (pip)
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- Python packages (pip) ---" -ForegroundColor Yellow
# Find the best available python
$PythonExe = $null
if (Test-Path $python314) { $PythonExe = $python314 }
elseif (Test-Path $python313) { $PythonExe = $python313 }
elseif (Test-CommandExists "python") { $PythonExe = "python" }
if ($PythonExe) {
$pipPackages = @(
"Pillow", # Icon/image generation for the app
"jinja2", # Template engine (useful for code generation)
"pyyaml" # YAML parsing
)
foreach ($pkg in $pipPackages) {
Write-Host " Checking $pkg..." -NoNewline
$installed = & $PythonExe -m pip show $pkg 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " already installed" -ForegroundColor Green
}
else {
Write-Host " installing..." -ForegroundColor Cyan
& $PythonExe -m pip install --user $pkg
}
}
}
else {
Write-Step "pip packages" "SKIP" "No Python found"
}
# ─────────────────────────────────────────────────────────────
# 8. MANUAL-ONLY TOOLS (cannot be CLI-installed)
# ─────────────────────────────────────────────────────────────
Write-Host "`n--- Manual-install tools (verification only) ---" -ForegroundColor Yellow
# MSVC
$clExe = "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe"
if (Test-Path $clExe) {
Write-Step "MSVC cl.exe" "FOUND" "v14.44.35207 (VS 2022 Professional)"
}
else {
Write-Step "MSVC cl.exe" "FAIL" "Not found -- install via Visual Studio Installer (see docs/tool_compilers.md)"
}
# Windows SDK
$rcExe = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\rc.exe"
if (Test-Path $rcExe) {
Write-Step "Windows SDK" "FOUND" "10.0.26100.0"
}
else {
Write-Step "Windows SDK" "FAIL" "Not found -- install via Visual Studio Installer (see docs/tool_compilers.md)"
}
# Qt
$qtBinDir = "C:\Qt\6.10.0\msvc2022_64\bin"
if (Test-Path "$qtBinDir\qmake.exe") {
Write-Step "Qt 6.10.0" "FOUND" "msvc2022_64 at $qtBinDir"
}
else {
Write-Step "Qt 6.10.0" "FAIL" "Not found -- install via Qt Online Installer (see docs/tool_compilers.md)"
}
# w64devkit
if (Test-Path "C:\w64devkit\bin\gcc.exe") {
$ver = & "C:\w64devkit\bin\gcc.exe" --version 2>&1 | Select-Object -First 1
Write-Step "w64devkit" "FOUND" $ver
}
else {
Write-Step "w64devkit" "SKIP" "Not found at C:\w64devkit -- download from https://github.com/skeeto/w64devkit/releases"
}
Write-Host "`n=== Tool installation complete ===" -ForegroundColor Green
Write-Host "Run .\repair_path.ps1 next to ensure all paths are registered.`n"

265
scripts/repair_path.ps1 Normal file
View File

@@ -0,0 +1,265 @@
#Requires -Version 5.1
<#
.SYNOPSIS
Repairs the Windows PATH and sets environment variables for the
SetecPartitionWizard C++17/Qt6 build environment.
.DESCRIPTION
This script permanently adds missing dev-tool directories to the User PATH
(via [Environment]::SetEnvironmentVariable) and sets INCLUDE, LIB, Qt6_DIR,
CMAKE_PREFIX_PATH, and other variables needed by CMake/Ninja/MSVC builds.
It does NOT remove any existing PATH entries -- it only appends missing ones.
Run from an elevated or normal PowerShell prompt. After running, open a NEW
terminal for the changes to take effect.
.NOTES
Generated 2026-03-11 by Goju PATH repair agent.
Machine: mdavi / MSYS_NT-10.0-26200
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# ─────────────────────────────────────────────────────────────
# 1. DISCOVERED TOOL PATHS (from system scan 2026-03-11)
# ─────────────────────────────────────────────────────────────
# MSVC 2022 Professional 17.14.14, toolset 14.44.35207
$MsvcVersion = "14.44.35207"
$VsRoot = "C:\Program Files\Microsoft Visual Studio\2022\Professional"
$MsvcBin = "$VsRoot\VC\Tools\MSVC\$MsvcVersion\bin\Hostx64\x64"
$MsvcInclude = "$VsRoot\VC\Tools\MSVC\$MsvcVersion\include"
$MsvcLib = "$VsRoot\VC\Tools\MSVC\$MsvcVersion\lib\x64"
$VcVarsAll = "$VsRoot\VC\Auxiliary\Build\vcvarsall.bat"
$VcVars64 = "$VsRoot\VC\Auxiliary\Build\vcvars64.bat"
# Windows SDK 10.0.26100.0
$SdkVersion = "10.0.26100.0"
$SdkRoot = "C:\Program Files (x86)\Windows Kits\10"
$SdkBin = "$SdkRoot\bin\$SdkVersion\x64"
$SdkIncludeUcrt = "$SdkRoot\Include\$SdkVersion\ucrt"
$SdkIncludeUm = "$SdkRoot\Include\$SdkVersion\um"
$SdkIncludeShared = "$SdkRoot\Include\$SdkVersion\shared"
$SdkLibUcrt = "$SdkRoot\Lib\$SdkVersion\ucrt\x64"
$SdkLibUm = "$SdkRoot\Lib\$SdkVersion\um\x64"
# CMake 3.x (standalone install)
$CmakeBin = "C:\Program Files\CMake\bin"
# Ninja (Qt-bundled)
$NinjaBin = "C:\Qt\Tools\Ninja"
# Qt 6.10.0 MSVC 2022 x64 (primary build kit)
$QtRoot = "C:\Qt\6.10.0\msvc2022_64"
$QtBin = "$QtRoot\bin"
$QtCmake = "$QtRoot\lib\cmake\Qt6"
# Qt Tools CMake (separate from standalone CMake)
$QtCmakeBin = "C:\Qt\Tools\CMake_64\bin"
# Clang/LLVM via Qt llvm-mingw 17.06
$LlvmMingwBin = "C:\Qt\Tools\llvm-mingw1706_64\bin"
# w64devkit (GCC 15.2.0, make, etc.)
$W64DevkitBin = "C:\w64devkit\bin"
# Python 3.14 (primary) and 3.13 (secondary)
$Python314 = "C:\Python314"
$Python313 = "C:\Users\mdavi\AppData\Local\Programs\Python\Python313"
$Python313Scripts = "C:\Users\mdavi\AppData\Local\Programs\Python\Python313\Scripts"
# Git for Windows
$GitCmd = "C:\Program Files\Git\cmd"
# Go (found on system)
$GoBin = "C:\Program Files\Go\bin"
# Chocolatey
$ChocoBin = "C:\ProgramData\chocolatey\bin"
# VS Code
$VsCodeBin = "C:\Users\mdavi\AppData\Local\Programs\Microsoft VS Code\bin"
# GitHub CLI
$GhCliBin = "C:\Program Files\GitHub CLI"
# WinGet LLVM-MinGW (UCRT, installed 2026-03-11)
$WingetLlvmMingw = "C:\Users\mdavi\AppData\Local\Microsoft\WinGet\Packages\MartinStorsjo.LLVM-MinGW.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe\llvm-mingw-20260311-ucrt-x86_64\bin"
# ─────────────────────────────────────────────────────────────
# 2. DEFINE DESIRED PATH ORDER (highest priority first)
# ─────────────────────────────────────────────────────────────
# Priority rationale:
# - MSVC cl.exe and SDK tools first (primary compiler)
# - CMake and Ninja next (build system)
# - Qt bin (for windeployqt, moc, uic, rcc)
# - Python, Git, and other helpers later
$DevToolPaths = @(
$MsvcBin, # cl.exe, link.exe, nmake.exe
$SdkBin, # rc.exe, mt.exe, signtool.exe
$CmakeBin, # cmake.exe, ctest.exe, cpack.exe
$NinjaBin, # ninja.exe
$QtBin, # windeployqt.exe, moc.exe, uic.exe, rcc.exe
$QtCmakeBin, # Qt-bundled cmake (fallback)
$LlvmMingwBin, # clang.exe, clang++.exe (Qt llvm-mingw)
$W64DevkitBin, # gcc.exe, g++.exe, make.exe
$Python314, # python.exe 3.14
$Python313, # python.exe 3.13
$Python313Scripts, # pip.exe, etc.
$GitCmd, # git.exe
$GoBin, # go.exe
$ChocoBin, # choco.exe
$GhCliBin, # gh.exe
$VsCodeBin, # code.exe
$WingetLlvmMingw # winget-installed llvm-mingw
)
# ─────────────────────────────────────────────────────────────
# 3. READ CURRENT USER PATH AND APPEND MISSING ENTRIES
# ─────────────────────────────────────────────────────────────
Write-Host "`n=== SetecPartitionWizard PATH Repair ===" -ForegroundColor Cyan
Write-Host "Scanning current User PATH for missing dev-tool entries...`n"
$CurrentUserPath = [Environment]::GetEnvironmentVariable("Path", "User")
if (-not $CurrentUserPath) { $CurrentUserPath = "" }
# Backup current PATH
$BackupFile = "$env:USERPROFILE\path_backup_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
$CurrentUserPath | Out-File -FilePath $BackupFile -Encoding UTF8
Write-Host " Backed up current User PATH to: $BackupFile" -ForegroundColor DarkGray
# Normalize: split, trim, remove empty, deduplicate (case-insensitive)
$ExistingEntries = $CurrentUserPath -split ';' |
ForEach-Object { $_.Trim().Trim("'").Trim('"').TrimEnd('\') } |
Where-Object { $_ -ne '' }
$ExistingSet = [System.Collections.Generic.HashSet[string]]::new(
[StringComparer]::OrdinalIgnoreCase
)
foreach ($e in $ExistingEntries) { [void]$ExistingSet.Add($e) }
$Added = @()
$AlreadyPresent = @()
foreach ($dir in $DevToolPaths) {
$normalized = $dir.TrimEnd('\')
if ($ExistingSet.Contains($normalized)) {
$AlreadyPresent += $normalized
}
elseif (Test-Path $normalized) {
$Added += $normalized
[void]$ExistingSet.Add($normalized)
}
else {
Write-Host " [SKIP] Not found on disk: $normalized" -ForegroundColor Yellow
}
}
if ($AlreadyPresent.Count -gt 0) {
Write-Host "`n Already in User PATH:" -ForegroundColor Green
$AlreadyPresent | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGreen }
}
if ($Added.Count -gt 0) {
Write-Host "`n Adding to User PATH:" -ForegroundColor Cyan
$Added | ForEach-Object { Write-Host " $_" -ForegroundColor White }
# Build new PATH: existing entries + new entries
$NewPath = (($ExistingEntries + $Added) | Select-Object -Unique) -join ';'
# Safety: check total length
if ($NewPath.Length -gt 30000) {
Write-Warning "New PATH is $($NewPath.Length) chars -- approaching the 32767 limit!"
}
[Environment]::SetEnvironmentVariable("Path", $NewPath, "User")
Write-Host "`n User PATH updated permanently." -ForegroundColor Green
}
else {
Write-Host "`n No new PATH entries needed -- all dev tools already present." -ForegroundColor Green
}
# ─────────────────────────────────────────────────────────────
# 4. SET INCLUDE AND LIB FOR MSVC + WINDOWS SDK
# ─────────────────────────────────────────────────────────────
# Note: These are typically set by vcvars64.bat at session start.
# Setting them permanently in User env makes them available to
# CMake/Ninja even outside a Developer Command Prompt.
Write-Host "`n=== Setting INCLUDE and LIB ===" -ForegroundColor Cyan
$IncludePaths = @(
$MsvcInclude,
$SdkIncludeUcrt,
$SdkIncludeUm,
$SdkIncludeShared
) -join ';'
$LibPaths = @(
$MsvcLib,
$SdkLibUcrt,
$SdkLibUm
) -join ';'
[Environment]::SetEnvironmentVariable("INCLUDE", $IncludePaths, "User")
Write-Host " INCLUDE = $IncludePaths" -ForegroundColor DarkGray
[Environment]::SetEnvironmentVariable("LIB", $LibPaths, "User")
Write-Host " LIB = $LibPaths" -ForegroundColor DarkGray
# ─────────────────────────────────────────────────────────────
# 5. SET Qt AND CMAKE VARIABLES
# ─────────────────────────────────────────────────────────────
Write-Host "`n=== Setting Qt6 / CMake variables ===" -ForegroundColor Cyan
[Environment]::SetEnvironmentVariable("Qt6_DIR", $QtCmake, "User")
Write-Host " Qt6_DIR = $QtCmake"
[Environment]::SetEnvironmentVariable("CMAKE_PREFIX_PATH", $QtRoot, "User")
Write-Host " CMAKE_PREFIX_PATH = $QtRoot"
[Environment]::SetEnvironmentVariable("QT_ROOT", $QtRoot, "User")
Write-Host " QT_ROOT = $QtRoot"
# ─────────────────────────────────────────────────────────────
# 6. VCVARS HELPER FUNCTION (for session-level MSVC setup)
# ─────────────────────────────────────────────────────────────
Write-Host "`n=== vcvars64 helper ===" -ForegroundColor Cyan
Write-Host @"
The MSVC compiler (cl.exe) works best when vcvars64.bat has been sourced
in the current session. The permanent INCLUDE/LIB vars above cover most
CMake/Ninja use cases, but if you need the full VS environment, run:
cmd /k "`"$VcVars64`" & powershell"
Or add this function to your PowerShell profile ($PROFILE):
function Enter-VsDevShell {
Import-Module "`"$VsRoot\Common7\Tools\Microsoft.VisualStudio.DevShell.dll`""
Enter-VsDevShell -VsInstallPath "`"$VsRoot`" -DevCmdArguments `"-arch=amd64`"
}
"@ -ForegroundColor DarkGray
# ─────────────────────────────────────────────────────────────
# 7. SUMMARY
# ─────────────────────────────────────────────────────────────
Write-Host "=== Done ===" -ForegroundColor Green
Write-Host "Open a NEW terminal for all changes to take effect.`n"
# Show final User PATH for verification
Write-Host "Final User PATH entries:" -ForegroundColor Cyan
$FinalPath = [Environment]::GetEnvironmentVariable("Path", "User")
$FinalPath -split ';' | Where-Object { $_ -ne '' } | ForEach-Object {
$marker = if (Test-Path $_) { "[OK]" } else { "[!!]" }
$color = if (Test-Path $_) { "Green" } else { "Red" }
Write-Host " $marker $_" -ForegroundColor $color
}