Skip to content

Commit

Permalink
[PE Helper] Detect architectures in Test Environment creator
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingWonders committed Feb 23, 2025
1 parent afe2089 commit 39aeb4f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MainForm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,8 @@ Public Class MainForm
SaveOnSettingsIni = False
LoadDTSettings(0)
Exit Sub
Else
SaveOnSettingsIni = True
End If
ElseIf DTSettingForm.RichTextBox1.Text.Contains("SaveOnSettingsIni=1") Then
SaveOnSettingsIni = True
Expand Down
55 changes: 55 additions & 0 deletions Panels/ISOFiles/NewTestingEnv.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Public Class NewTestingEnv

Dim progressMessages() As String = New String(2) {"Status", "Creating project. This can take some time. Please wait...", "The project has been created"}
Dim success As Boolean
Dim architectures() As String = New String(3) {"x86", "amd64", "arm", "arm64"}

Private Sub NewTestingEnv_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Select Case MainForm.Language
Expand Down Expand Up @@ -225,6 +226,60 @@ Public Class NewTestingEnv
Text = ""
Win10Title.Visible = True
End If

' Declare path constant for Windows ADK
Dim ADKPath As String = Path.Combine(If(Environment.Is64BitOperatingSystem,
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)), "Windows Kits", "10",
"Assessment and Deployment Kit")
' Check ADK status
If Not Directory.Exists(ADKPath) Then
DynaLog.LogMessage("ADK installation directory " & Quote & ADKPath & Quote & " is not found in this system. Either it has not been installed or it has been installed somewhere else.")
Select Case MainForm.Language
Case 0
Select Case My.Computer.Info.InstalledUICulture.ThreeLetterWindowsLanguageName
Case "ENU", "ENG"
Process.Start("https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install")
Case "ESN"
Process.Start("https://learn.microsoft.com/es-es/windows-hardware/get-started/adk-install")
Case "FRA"
Process.Start("https://learn.microsoft.com/fr-fr/windows-hardware/get-started/adk-install")
Case "PTB", "PTG"
Process.Start("https://learn.microsoft.com/pt-pt/windows-hardware/get-started/adk-install")
Case "ITA"
Process.Start("https://learn.microsoft.com/it-it/windows-hardware/get-started/adk-install")
End Select
Case 1
Process.Start("https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install")
Case 2
Process.Start("https://learn.microsoft.com/es-es/windows-hardware/get-started/adk-install")
Case 3
Process.Start("https://learn.microsoft.com/fr-fr/windows-hardware/get-started/adk-install")
Case 4
Process.Start("https://learn.microsoft.com/pt-pt/windows-hardware/get-started/adk-install")
Case 5
Process.Start("https://learn.microsoft.com/it-it/windows-hardware/get-started/adk-install")
End Select
Close()
End If

' Restore combobox architecture items
ComboBox1.Items.Clear()
ComboBox1.Items.AddRange(architectures)
' Remove architectures incompatible with the system ADK
For Each architecture In architectures
Dim WimPath As String = Path.Combine(ADKPath, "Windows Preinstallation Environment", architecture, "en-us", "winpe.wim")
DynaLog.LogMessage("Testing if architecture " & architecture & " is supported by the ADK installed in this system...")
If Not File.Exists(WimPath) Then
DynaLog.LogMessage("- Windows PE WIM " & Quote & WimPath & Quote & " is not present. Removing architecture option...")
ComboBox1.Items.Remove(architecture)
End If
Next
' If we are left with no architectures, add them back
If ComboBox1.Items.Count = 0 Then
DynaLog.LogMessage("For some reason we excluded all of them. This could be because of incorrect detections. Adding back...")
ComboBox1.Items.AddRange(architectures)
End If
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Expand Down

0 comments on commit 39aeb4f

Please sign in to comment.