Skip to content

Commit

Permalink
DISMTools 0.6 Preview 4 (Beta 2) (#175)
Browse files Browse the repository at this point in the history
* Update assembly information

* DISMTools Nightly Installer

* [PE Helper] Improvements for 0.6 Preview 4 (#173)

* [PE Helper] Major improvements

- Reduced the marquee animation speed to 25ms, making it faster
- Replaced tabs with spaces for a more consistent indentation. Pre-processing from CTT's Windows Utility (see licenses!)

* DISMTools Nightly Installer

* Update Extensibility Suite

Make OSCDIMG not appear in a new window (keep in parity with the rest of the PE Helper extenal process callers)

* DISMTools Nightly Installer

---------

Co-authored-by: CodingWonders <[email protected]>

* DISMTools Nightly Installer

* [Requirement] Require .NET 4.8

* DISMTools Nightly Installer

* [AppEvent] Stop detector temporarily

* DISMTools Nightly Installer

* [AppEvent] Reinstate SizeChanged event

* DISMTools Nightly Installer

* [Tools] New Registry Hive Control Panel

* DISMTools Nightly Installer

* [AppEvent] Restart detector a second time

* DISMTools Nightly Installer

* [PE Helper] Add README to ISOs

* DISMTools Nightly Installer

* [Info Saver] Use UTF-8 encoding for HTML reports

* DISMTools Nightly Installer

* [ISO Creator] Improve reliability of API

* DISMTools Nightly Installer

* [Info Saver] Open external links in default web browser

* DISMTools Nightly Installer

* [AppEvent] Delay image detector restart

* DISMTools Nightly Installer

* [Tools] Add links for languages and FoDs ISO download

* DISMTools Nightly Installer

* [AppEvent] Improve reporting

* DISMTools Nightly Installer

* [REL] Update What's New section and Update Info files

* DISMTools Nightly Installer

---------

Co-authored-by: CodingWonders <[email protected]>
  • Loading branch information
CodingWonders and CodingWonders authored Oct 12, 2024
1 parent 7ff46b7 commit cd93ec1
Show file tree
Hide file tree
Showing 23 changed files with 3,791 additions and 1,169 deletions.
39 changes: 39 additions & 0 deletions ApplicationEvents.vb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ Namespace My
" - Preview release? " & If(DISMTools.MainForm.dtBranch.Contains("preview"), "Yes", "No") & CrLf &
" - Branch: " & DISMTools.MainForm.dtBranch & CrLf &
" - Build time: " & DISMTools.PrgAbout.RetrieveLinkerTimestamp(My.Application.Info.DirectoryPath & "\" & My.Application.Info.AssemblyName & ".exe").ToString("yyMMdd-HHmm"))
' Get image information if a project has been loaded
If DISMTools.MainForm.isProjectLoaded And Not DISMTools.MainForm.OnlineManagement Then
Try
ExceptionForm.ErrorText.AppendText(CrLf &
"Information about the image loaded in this project:" & CrLf &
" - Image name: " & DISMTools.MainForm.Label46.Text & CrLf &
" - Image description: " & DISMTools.MainForm.Label47.Text & CrLf &
" - Image version: " & DISMTools.MainForm.Label48.Text)
Catch ex As Exception
' Don't get this info
End Try
End If
' Get basic information about the system. This does not include any personally identifiable information (PII) or
' serial numbers that can identify the computer this program is run on
Dim CS_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Manufacturer, Model FROM Win32_ComputerSystem")
Expand Down Expand Up @@ -93,13 +105,40 @@ Namespace My

Private Sub SysEvts_UserPreferenceChanged(sender As Object, e As Microsoft.Win32.UserPreferenceChangedEventArgs)
Debug.WriteLine(Date.UtcNow & " UTC - User Preference Category: " & e.Category.ToString())

' Prevent the program from freezing. This is a fix for a very long-standing bug that was introduced with the mounted image detector,
' where the program would randomly freeze and never come back. And, even while the program itself was still responding, its UI thread
' wasn't.
'
' This is a problem with Windows Forms that has been present since .NET Framework 2.0. More on that here:
' https://www.ikriv.com/dev/dotnet/MysteriousHang
'
' Even though this bug took a year and a half to fix, a lot was gathered from previous attempts at fixing this problem:
' 1. It's random
' 2. It affects all versions of Windows supported by this program (Win8.1-Win11, incl. servers)
' 3. It happens when the following conditions occur:
' - The mounted image detector is running
' - This event is triggered
'
' This fixes the problem by temporarily stopping the mounted image detector, doing the event code, and restarting it afterward.
' It hasn't caused any freezes for me yet, but I may be proven wrong.
If DISMTools.MainForm.MountedImageDetectorBW.IsBusy Then
DISMTools.MainForm.MountedImageDetectorBW.CancelAsync()
End If
If e.Category = UserPreferenceCategory.General And DISMTools.MainForm.ColorMode = 0 Then
Dim currentTime As DateTime = DateTime.Now
If currentTime - lastThemeChangeTime > debounceInterval Then
DISMTools.MainForm.ChangePrgColors(0)
lastThemeChangeTime = currentTime
End If
End If
Try
Threading.Thread.Sleep(1000)
Call DISMTools.MainForm.MountedImageDetectorBW.RunWorkerAsync()
Threading.Thread.Sleep(250)
Catch ex As Exception
DISMTools.MainForm.MountedImageDetectorBWRestarterTimer.Enabled = True
End Try
End Sub

Private Sub SysEvts_DisplaySettingsChanged(sender As Object, e As EventArgs)
Expand Down
24 changes: 24 additions & 0 deletions DISMTools.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,12 @@
<Compile Include="Panels\Img_Ops\ProvisioningPkgs\AddProvisioningPkg.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Panels\Img_Ops\Registry\RegistryControlPanel.Designer.vb">
<DependentUpon>RegistryControlPanel.vb</DependentUpon>
</Compile>
<Compile Include="Panels\Img_Ops\Registry\RegistryControlPanel.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Panels\Img_Ops\Switch\ImgIndexSwitch.Designer.vb">
<DependentUpon>ImgIndexSwitch.vb</DependentUpon>
</Compile>
Expand Down Expand Up @@ -982,6 +988,9 @@
<EmbeddedResource Include="Panels\Img_Ops\ProvisioningPkgs\AddProvisioningPkg.resx">
<DependentUpon>AddProvisioningPkg.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Panels\Img_Ops\Registry\RegistryControlPanel.resx">
<DependentUpon>RegistryControlPanel.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Panels\Img_Ops\Switch\ImgIndexSwitch.resx">
<DependentUpon>ImgIndexSwitch.vb</DependentUpon>
</EmbeddedResource>
Expand Down Expand Up @@ -1340,6 +1349,9 @@
<Content Include="Helpers\extps1\PE_Helper\backgrounds\winpe_x86.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Helpers\extps1\PE_Helper\files\README1ST.TXT">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Helpers\extps1\PE_Helper\tools\DIM\amd64\DT-DIM.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -1760,6 +1772,9 @@ ECHO Generating program structure...
IF EXIST "$(SolutionDir)portable" (
COPY "$(SolutionDir)portable" . /Y
)
IF EXIST "$(SolutionDir)Helpers\extps1\PE_Helper\Compile.ps1" (
"\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -executionpolicy bypass -noprofile -nologo -file "$(SolutionDir)Helpers\extps1\PE_Helper\Compile.ps1"
)
IF NOT EXIST bin (
md "bin"
md "bin\exthelpers"
Expand All @@ -1771,6 +1786,15 @@ IF NOT EXIST bin (
move "helpers\extps1\*.*" "bin\extps1"
md "bin\extps1\PE_Helper"
xcopy "helpers\extps1\PE_Helper\*.*" "bin\extps1\PE_Helper" /cehyi
IF EXIST "$(SolutionDir)helpers\extps1\PE_Helper\Compile.ps1" (
:: Compile the script with CTT's compilation script (license in source code and About section)
ECHO Invoking pre-processing...
COPY "$(SolutionDir)helpers\extps1\PE_Helper\Compile.ps1" "$(TargetDir)bin\extps1\PE_Helper\Compile.ps1"
COPY "$(SolutionDir)helpers\extps1\PE_Helper\tools\Invoke-Preprocessing.ps1" "$(TargetDir)bin\extps1\PE_Helper\tools\Invoke-Preprocessing.ps1"
"\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -executionpolicy bypass -noprofile -nologo -file "$(TargetDir)bin\extps1\PE_Helper\Compile.ps1"
DEL "$(TargetDir)bin\extps1\PE_Helper\Compile.ps1" /F /Q
DEL "$(TargetDir)bin\extps1\PE_Helper\tools\Invoke-Preprocessing.ps1" /F /Q
)
IF EXIST HELPERS (
rd HELPERS /s /q
)
Expand Down
61 changes: 61 additions & 0 deletions Helpers/extps1/PE_Helper/Compile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This is a heavily modified compilation script for the Preinstallation Environment Helper, originally from the Windows Utility (WinUtil)
#
# Original license (affects both this script and the pre-processor):
#
# MIT License
#
# Copyright (c) 2022 CT Tech Group LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

$workingdir = $PSScriptRoot

Push-Location
Set-Location $workingdir

# Variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $workingdir
$sync.configs = @{}

function Update-Progress {
param (
[Parameter(Mandatory, position=0)]
[string]$StatusMessage,

[Parameter(Mandatory, position=1)]
[ValidateRange(0,100)]
[int]$Percent,

[Parameter(position=2)]
[string]$Activity = "Compiling"
)

Write-Progress -Activity $Activity -Status $StatusMessage -PercentComplete $Percent
}

Update-Progress "Pre-req: Running Preprocessor..." 0

# Dot source the 'Invoke-Preprocessing' Function from 'tools/Invoke-Preprocessing.ps1' Script
$preprocessingFilePath = ".\tools\Invoke-Preprocessing.ps1"
. $preprocessingFilePath

$excludedFiles = @('.\tools\DIM\', "$preprocessingFilePath", '*.png', '*.exe')
$msg = "Pre-req: Code Formatting"
Invoke-Preprocessing -WorkingDir "$workingdir" -ExcludedFiles $excludedFiles -ProgressStatusMessage $msg -ThrowExceptionOnEmptyFilesList
Loading

0 comments on commit cd93ec1

Please sign in to comment.