Skip to content

Commit

Permalink
DISMTools 0.5.1 Update 1 (#170)
Browse files Browse the repository at this point in the history
* [Issue Template] Update templates

* Update assembly information

* [PE Helper] Add a way to go back to disk selection

* [PE Helper] Make progress output cleaner

* [Unattended answer file] Make form sizable

* [Exceptions] Update Exception Reporting Link

* [Task] Add Trusted Desktop checks for WinPE 4

* [Info Saver] Classify preposterous dates as such

* [Build] Remove hidden flag from portable marker

* [Info Dialog] Improve DISM API reliability

* [PE Helper] Improve compatibility with PWSH 7 and customize stuff

* [Unattended answer file] Change name of target file

* [Unattended answer file] Fix flow layout panel sizes

* [PE Helper] Use %TEMP% for scratch operations

Do not use the program directory by default for scratch directory operations. Only use it if the regular scratch directory in %TEMP% can't be created

* [Startup] Fixed visual issue for first mounted image

* [Task] Improve reliability of appinstaller parser

* [Unattended answer file] Show UnattendGen exit code in Hex

* [Unattended answer file] Fixed parse problems for settings with ampersands

* [Image information] Add feature update detection for Selenium

* [Mounted image manager] Clear list if no images are mounted

* [Exceptions] Improve reporting

* [Tree View] Fix mount dir action issue (#165)

* [Task] Fixed attribute filter for directories

* [PE Helper] Call Test Environment creator without profiles

* [Unattended answer file] Updated UnattendGen

* [Unattended answer file] Add component config and other goodies

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

* [Task] Fix capability identity identification issue
  • Loading branch information
CodingWonders authored Sep 28, 2024
1 parent d90d3af commit caa41f6
Show file tree
Hide file tree
Showing 36 changed files with 732 additions and 382 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Please describe the bug you're experiencing. Examples:

- *When doing something, the program crashes*

**IF YOU HAVE ENCOUNTERED A PROGRAM EXCEPTION, YOU NEED TO USE ITS RESPECTIVE TEMPLATE. Go to the issue types and select "Program exception"**

**How does it happen?**
Please provide the steps necessary to reproduce this bug:

Expand All @@ -26,6 +28,4 @@ If applicable, add screenshots to help explain your problem.


**Additional context**
Add any other context about the problem here.

**NOTE:** in the case of a program exception, you need to paste the error information in the first section. Remove example information beforehand.
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/program-exception.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Program exception
about: Noticed an internal error? Please tell us more!
title: 'Program exception'
labels: bug, good first issue
assignees: CodingWonders

---

If you have run into an internal error (program exception), we would like to learn more about it. When an error occurs, its information will be copied to your clipboard. If you can't find error information on your clipboard, a local copy was also saved at `<program directory>\Logs\Errors`.

**PLEASE PROVIDE DETAILS ABOUT THE EXCEPTION, OR YOUR ISSUE WILL BE CLOSED WITHIN 4 HOURS**

**Exception information**: please tell us what happened below:

<!-- Exception Information. If you have the local copy on hand, please attach it -->

**How did it happen?** What steps did you perform in order to experience this problem?

<!-- Steps -->
203 changes: 106 additions & 97 deletions ApplicationEvents.vb
Original file line number Diff line number Diff line change
@@ -1,98 +1,107 @@
Imports Microsoft.Win32
Imports Microsoft.VisualBasic.ControlChars
Imports System.Management
Imports System.IO
Imports System.Text.Encoding

Namespace My
' Los siguientes eventos están disponibles para MyApplication:
'
' Inicio: se desencadena cuando se inicia la aplicación, antes de que se cree el formulario de inicio.
' Apagado: generado después de cerrar todos los formularios de la aplicación. Este evento no se genera si la aplicación termina de forma anómala.
' UnhandledException: generado si la aplicación detecta una excepción no controlada.
' StartupNextInstance: se desencadena cuando se inicia una aplicación de instancia única y la aplicación ya está activa.
' NetworkAvailabilityChanged: se desencadena cuando la conexión de red está conectada o desconectada.
Partial Friend Class MyApplication

Private Sub Start(sender As Object, e As EventArgs) Handles Me.Startup
AddHandler Microsoft.Win32.SystemEvents.UserPreferenceChanged, AddressOf SysEvts_UserPreferenceChanged
AddHandler Microsoft.Win32.SystemEvents.DisplaySettingsChanging, AddressOf SysEvts_DisplaySettingsChanging
AddHandler Microsoft.Win32.SystemEvents.DisplaySettingsChanged, AddressOf SysEvts_DisplaySettingsChanged
End Sub

Private Sub CatchEmAll(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
ExceptionForm.ErrorText.Text = e.Exception.ToString() & CrLf & CrLf &
"Error Message: " & e.Exception.Message & CrLf & CrLf &
"Error Code (HRESULT): " & Hex(e.Exception.HResult)
Try
' 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")
Dim BIOS_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Name, Description, SMBIOSBIOSVersion FROM Win32_BIOS")
Dim Proc_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Name, Caption, Manufacturer, Family FROM Win32_Processor")
Dim CS_Results As ManagementObjectCollection = CS_Searcher.Get()
Dim BIOS_Results As ManagementObjectCollection = BIOS_Searcher.Get()
Dim Proc_Results As ManagementObjectCollection = Proc_Searcher.Get()
ExceptionForm.ErrorText.AppendText(CrLf & CrLf &
"Machine information:" & CrLf)
For Each CS_Result As ManagementObject In CS_Results
ExceptionForm.ErrorText.AppendText(" - Computer manufacturer: " & CS_Result("Manufacturer") & CrLf &
" - Computer model: " & CS_Result("Model") & CrLf)
Next
For Each BIOS_Result As ManagementObject In BIOS_Results
ExceptionForm.ErrorText.AppendText(" - BIOS name/description: " & BIOS_Result("Name") & " " & BIOS_Result("Description") & CrLf &
" - System Management BIOS (SMBIOS) version: " & BIOS_Result("SMBIOSBIOSVersion") & CrLf & CrLf)
Next
ExceptionForm.ErrorText.AppendText("Operating system information:" & CrLf &
" - OS name: " & My.Computer.Info.OSFullName & CrLf &
" - OS version: " & My.Computer.Info.OSVersion & CrLf &
" - OS Platform: " & My.Computer.Info.OSPlatform & CrLf &
" - Is a 64-bit system? " & If(Environment.Is64BitOperatingSystem, "Yes", "No") & CrLf & CrLf &
"Processor information:" & CrLf)
For Each Proc_Result As ManagementObject In Proc_Results
ExceptionForm.ErrorText.AppendText(" - Processor name: " & Proc_Result("Name") & CrLf &
" - Processor caption: " & Proc_Result("Caption") & CrLf &
" - Processor manufacturer: " & Proc_Result("Manufacturer") & CrLf &
" - Processor family (WMI type): " & Proc_Result("Family") & CrLf &
" NOTE: refer to the following website to get the exact family type of your processor:" & CrLf &
" https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor" & CrLf & CrLf)
Next
ExceptionForm.ErrorText.AppendText("This information is gathered to help isolate the issue to a specific hardware or software configuration. " &
"No information that can be used to identify the user or the exact system is gathered." & CrLf & CrLf &
"If you don't want to send this information to the developers, paste the text that was copied to the clipboard in a text editor, remove this information, and copy the new text again.")
Catch ex As Exception
' Could not get basic machine information
End Try
Try
If Not Directory.Exists(Path.Combine(Windows.Forms.Application.StartupPath, "logs", "errors")) Then
Directory.CreateDirectory(Path.Combine(Windows.Forms.Application.StartupPath, "logs", "errors"))
End If
File.WriteAllText(Path.Combine(Windows.Forms.Application.StartupPath, "logs", "errors") & "\DT-Error-" & Now.ToString().Replace("/", "-").Trim().Replace(":", "-").Trim() & ".log", ExceptionForm.ErrorText.Text, UTF8)
Catch ex As Exception
' Could not save error information
End Try
ExceptionForm.ShowDialog()
If ExceptionForm.DialogResult = DialogResult.OK Then
e.ExitApplication = False
ElseIf ExceptionForm.DialogResult = DialogResult.Cancel Then
e.ExitApplication = True
End If
End Sub

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

Private Sub SysEvts_DisplaySettingsChanged(sender As Object, e As EventArgs)
' Do nothing
End Sub

Private Sub SysEvts_DisplaySettingsChanging(sender As Object, e As EventArgs)
' Do nothing
End Sub

End Class

Imports Microsoft.Win32
Imports Microsoft.VisualBasic.ControlChars
Imports System.Management
Imports System.IO
Imports System.Text.Encoding

Namespace My

' Los siguientes eventos están disponibles para MyApplication:
'
' Inicio: se desencadena cuando se inicia la aplicación, antes de que se cree el formulario de inicio.
' Apagado: generado después de cerrar todos los formularios de la aplicación. Este evento no se genera si la aplicación termina de forma anómala.
' UnhandledException: generado si la aplicación detecta una excepción no controlada.
' StartupNextInstance: se desencadena cuando se inicia una aplicación de instancia única y la aplicación ya está activa.
' NetworkAvailabilityChanged: se desencadena cuando la conexión de red está conectada o desconectada.
Partial Friend Class MyApplication

Private Sub Start(sender As Object, e As EventArgs) Handles Me.Startup
AddHandler Microsoft.Win32.SystemEvents.UserPreferenceChanged, AddressOf SysEvts_UserPreferenceChanged
AddHandler Microsoft.Win32.SystemEvents.DisplaySettingsChanging, AddressOf SysEvts_DisplaySettingsChanging
AddHandler Microsoft.Win32.SystemEvents.DisplaySettingsChanged, AddressOf SysEvts_DisplaySettingsChanged
End Sub

Private Sub CatchEmAll(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
ExceptionForm.ErrorText.Text = e.Exception.ToString() & CrLf & CrLf &
"Error Message: " & e.Exception.Message & CrLf & CrLf &
"Error Code (HRESULT): " & Hex(e.Exception.HResult)
Try
' Get version of DISMTools that threw the exception. Include program version, branch, and (possibly) build time
' in the case of nightly installers
ExceptionForm.ErrorText.AppendText(CrLf & CrLf &
"Program information:" & CrLf &
" - DISMTools Version: " & My.Application.Info.Version.ToString() & CrLf &
" - 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 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")
Dim BIOS_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Name, Description, SMBIOSBIOSVersion FROM Win32_BIOS")
Dim Proc_Searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT Name, Caption, Manufacturer, Family FROM Win32_Processor")
Dim CS_Results As ManagementObjectCollection = CS_Searcher.Get()
Dim BIOS_Results As ManagementObjectCollection = BIOS_Searcher.Get()
Dim Proc_Results As ManagementObjectCollection = Proc_Searcher.Get()
ExceptionForm.ErrorText.AppendText(CrLf &
"Machine information:" & CrLf)
For Each CS_Result As ManagementObject In CS_Results
ExceptionForm.ErrorText.AppendText(" - Computer manufacturer: " & CS_Result("Manufacturer") & CrLf &
" - Computer model: " & CS_Result("Model") & CrLf)
Next
For Each BIOS_Result As ManagementObject In BIOS_Results
ExceptionForm.ErrorText.AppendText(" - BIOS name/description: " & BIOS_Result("Name") & " " & BIOS_Result("Description") & CrLf &
" - System Management BIOS (SMBIOS) version: " & BIOS_Result("SMBIOSBIOSVersion") & CrLf & CrLf)
Next
ExceptionForm.ErrorText.AppendText("Operating system information:" & CrLf &
" - OS name: " & My.Computer.Info.OSFullName & CrLf &
" - OS version: " & My.Computer.Info.OSVersion & CrLf &
" - OS Platform: " & My.Computer.Info.OSPlatform & CrLf &
" - Is a 64-bit system? " & If(Environment.Is64BitOperatingSystem, "Yes", "No") & CrLf & CrLf &
"Processor information:" & CrLf)
For Each Proc_Result As ManagementObject In Proc_Results
ExceptionForm.ErrorText.AppendText(" - Processor name: " & Proc_Result("Name") & CrLf &
" - Processor caption: " & Proc_Result("Caption") & CrLf &
" - Processor manufacturer: " & Proc_Result("Manufacturer") & CrLf &
" - Processor family (WMI type): " & Proc_Result("Family") & CrLf &
" NOTE: refer to the following website to get the exact family type of your processor:" & CrLf &
" https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor" & CrLf & CrLf)
Next
ExceptionForm.ErrorText.AppendText("This information is gathered to help isolate the issue to a specific hardware or software configuration. " &
"No information that can be used to identify the user or the exact system is gathered." & CrLf & CrLf &
"If you don't want to send this information to the developers, paste the text that was copied to the clipboard in a text editor, remove this information, and copy the new text again.")
Catch ex As Exception
' Could not get basic machine information
End Try
Try
If Not Directory.Exists(Path.Combine(Windows.Forms.Application.StartupPath, "logs", "errors")) Then
Directory.CreateDirectory(Path.Combine(Windows.Forms.Application.StartupPath, "logs", "errors"))
End If
File.WriteAllText(Path.Combine(Windows.Forms.Application.StartupPath, "logs", "errors") & "\DT-Error-" & Now.ToString().Replace("/", "-").Trim().Replace(":", "-").Trim() & ".log", ExceptionForm.ErrorText.Text, UTF8)
Catch ex As Exception
' Could not save error information
End Try
ExceptionForm.ShowDialog()
If ExceptionForm.DialogResult = DialogResult.OK Then
e.ExitApplication = False
ElseIf ExceptionForm.DialogResult = DialogResult.Cancel Then
e.ExitApplication = True
End If
End Sub

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

Private Sub SysEvts_DisplaySettingsChanged(sender As Object, e As EventArgs)
' Do nothing
End Sub

Private Sub SysEvts_DisplaySettingsChanging(sender As Object, e As EventArgs)
' Do nothing
End Sub

End Class


End Namespace

End Namespace

1 change: 0 additions & 1 deletion DISMTools.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,6 @@ SET COPY_DOCS="Yes"
ECHO Generating program structure...
IF EXIST "$(SolutionDir)portable" (
COPY "$(SolutionDir)portable" . /Y
ATTRIB portable +H
)
IF NOT EXIST bin (
md "bin"
Expand Down
Loading

0 comments on commit caa41f6

Please sign in to comment.