Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 084c5da

Browse files
committed
HotInstall Backport from Upstream (06/2025)
1 parent 6710527 commit 084c5da

File tree

7 files changed

+281
-6
lines changed

7 files changed

+281
-6
lines changed

Installer/HotInstall.vbproj

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{1A6D20C4-4CF3-478F-A292-21A90B64C1B6}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<StartupObject>Installer.My.MyApplication</StartupObject>
10+
<RootNamespace>Installer</RootNamespace>
11+
<AssemblyName>Installer</AssemblyName>
12+
<FileAlignment>512</FileAlignment>
13+
<MyType>WindowsForms</MyType>
14+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<DefineDebug>true</DefineDebug>
23+
<DefineTrace>true</DefineTrace>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DocumentationFile>Installer.xml</DocumentationFile>
26+
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
27+
<Prefer32Bit>false</Prefer32Bit>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<PlatformTarget>AnyCPU</PlatformTarget>
31+
<DebugType>pdbonly</DebugType>
32+
<DefineDebug>false</DefineDebug>
33+
<DefineTrace>true</DefineTrace>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DocumentationFile>Installer.xml</DocumentationFile>
37+
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
38+
</PropertyGroup>
39+
<PropertyGroup>
40+
<OptionExplicit>On</OptionExplicit>
41+
</PropertyGroup>
42+
<PropertyGroup>
43+
<OptionCompare>Binary</OptionCompare>
44+
</PropertyGroup>
45+
<PropertyGroup>
46+
<OptionStrict>Off</OptionStrict>
47+
</PropertyGroup>
48+
<PropertyGroup>
49+
<OptionInfer>On</OptionInfer>
50+
</PropertyGroup>
51+
<PropertyGroup>
52+
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
53+
</PropertyGroup>
54+
<PropertyGroup>
55+
<ApplicationIcon>logo.ico</ApplicationIcon>
56+
</PropertyGroup>
57+
<ItemGroup>
58+
<Reference Include="INIFileParser, Version=2.5.2.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
59+
<HintPath>..\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
60+
</Reference>
61+
<Reference Include="Microsoft.Dism, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5bba90053b345501, processorArchitecture=MSIL">
62+
<HintPath>..\..\..\..\..\..\packages\Microsoft.Dism.3.3.12\lib\net40\Microsoft.Dism.dll</HintPath>
63+
</Reference>
64+
<Reference Include="System" />
65+
<Reference Include="System.Data" />
66+
<Reference Include="System.Deployment" />
67+
<Reference Include="System.Drawing" />
68+
<Reference Include="System.Management" />
69+
<Reference Include="System.Windows.Forms" />
70+
<Reference Include="System.Xml" />
71+
<Reference Include="System.Core" />
72+
<Reference Include="System.Xml.Linq" />
73+
<Reference Include="System.Data.DataSetExtensions" />
74+
<Reference Include="System.Net.Http" />
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Import Include="Microsoft.VisualBasic" />
78+
<Import Include="System" />
79+
<Import Include="System.Collections" />
80+
<Import Include="System.Collections.Generic" />
81+
<Import Include="System.Data" />
82+
<Import Include="System.Drawing" />
83+
<Import Include="System.Diagnostics" />
84+
<Import Include="System.Windows.Forms" />
85+
<Import Include="System.Linq" />
86+
<Import Include="System.Xml.Linq" />
87+
<Import Include="System.Threading.Tasks" />
88+
</ItemGroup>
89+
<ItemGroup>
90+
<Compile Include="ApplicationEvents.vb" />
91+
<Compile Include="DSC\DiskSpaceChecker.Designer.vb">
92+
<DependentUpon>DiskSpaceChecker.vb</DependentUpon>
93+
</Compile>
94+
<Compile Include="DSC\DiskSpaceChecker.vb">
95+
<SubType>Form</SubType>
96+
</Compile>
97+
<Compile Include="SplashForm.Designer.vb">
98+
<DependentUpon>SplashForm.vb</DependentUpon>
99+
</Compile>
100+
<Compile Include="SplashForm.vb">
101+
<SubType>Form</SubType>
102+
</Compile>
103+
<Compile Include="InstallationStage.vb" />
104+
<Compile Include="MainForm.vb">
105+
<SubType>Form</SubType>
106+
</Compile>
107+
<Compile Include="MainForm.Designer.vb">
108+
<DependentUpon>MainForm.vb</DependentUpon>
109+
<SubType>Form</SubType>
110+
</Compile>
111+
<Compile Include="My Project\AssemblyInfo.vb" />
112+
<Compile Include="My Project\Application.Designer.vb">
113+
<AutoGen>True</AutoGen>
114+
<DependentUpon>Application.myapp</DependentUpon>
115+
</Compile>
116+
<Compile Include="My Project\Resources.Designer.vb">
117+
<AutoGen>True</AutoGen>
118+
<DesignTime>True</DesignTime>
119+
<DependentUpon>Resources.resx</DependentUpon>
120+
</Compile>
121+
<Compile Include="My Project\Settings.Designer.vb">
122+
<AutoGen>True</AutoGen>
123+
<DependentUpon>Settings.settings</DependentUpon>
124+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
125+
</Compile>
126+
<Compile Include="Util\Casters.vb" />
127+
<Compile Include="Util\Converters.vb" />
128+
<Compile Include="Util\DriverHelper.vb" />
129+
<Compile Include="Util\LanguageFileParser.vb" />
130+
<Compile Include="Util\NativeMethods.vb" />
131+
<Compile Include="Util\Utilities.vb" />
132+
<Compile Include="Util\WMIHelper.vb" />
133+
<Compile Include="WizardPage.vb" />
134+
</ItemGroup>
135+
<ItemGroup>
136+
<EmbeddedResource Include="DSC\DiskSpaceChecker.resx">
137+
<DependentUpon>DiskSpaceChecker.vb</DependentUpon>
138+
</EmbeddedResource>
139+
<EmbeddedResource Include="SplashForm.resx">
140+
<DependentUpon>SplashForm.vb</DependentUpon>
141+
</EmbeddedResource>
142+
<EmbeddedResource Include="MainForm.resx">
143+
<DependentUpon>MainForm.vb</DependentUpon>
144+
</EmbeddedResource>
145+
<EmbeddedResource Include="My Project\Resources.resx">
146+
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
147+
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
148+
<CustomToolNamespace>My.Resources</CustomToolNamespace>
149+
<SubType>Designer</SubType>
150+
</EmbeddedResource>
151+
</ItemGroup>
152+
<ItemGroup>
153+
<None Include="Languages\lang_en.ini">
154+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
155+
</None>
156+
<None Include="Languages\lang_es.ini">
157+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
158+
</None>
159+
<None Include="Languages\lang_fr.ini">
160+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161+
</None>
162+
<None Include="Languages\lang_it.ini">
163+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164+
</None>
165+
<None Include="Languages\lang_pt.ini">
166+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
167+
</None>
168+
<None Include="My Project\app.manifest" />
169+
<None Include="My Project\Application.myapp">
170+
<Generator>MyApplicationCodeGenerator</Generator>
171+
<LastGenOutput>Application.Designer.vb</LastGenOutput>
172+
</None>
173+
<None Include="My Project\Settings.settings">
174+
<Generator>SettingsSingleFileGenerator</Generator>
175+
<CustomToolNamespace>My</CustomToolNamespace>
176+
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
177+
</None>
178+
<None Include="App.config" />
179+
<None Include="packages.config" />
180+
</ItemGroup>
181+
<ItemGroup>
182+
<None Include="Resources\hotinstall_step1.png" />
183+
</ItemGroup>
184+
<ItemGroup>
185+
<None Include="Resources\hotinstall_step2.png" />
186+
</ItemGroup>
187+
<ItemGroup>
188+
<None Include="Resources\hotinstall_step3.png" />
189+
</ItemGroup>
190+
<ItemGroup>
191+
<Content Include="logo.ico" />
192+
<Content Include="Resources\SplashScreen\background.jpg">
193+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
194+
</Content>
195+
<None Include="Resources\SplashScreen\logo_aboutdlg_dark.png" />
196+
<None Include="Resources\hotinstall_step3_dm.png" />
197+
</ItemGroup>
198+
<ItemGroup />
199+
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
200+
<PropertyGroup>
201+
<PostBuildEvent>IF EXIST "$(TargetDir)\*.tmp" (
202+
DEL "$(TargetDir)\*.tmp" /f /q
203+
)
204+
break &gt; "$(TargetDir)testbuild"
205+
206+
IF EXIST "$(ProjectDir)..\CopyOutput.ps1" (
207+
CD "$(ProjectDir).."
208+
"%25WINDIR%25\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File "$(ProjectDir)..\CopyOutput.ps1"
209+
)</PostBuildEvent>
210+
</PropertyGroup>
211+
</Project>

Installer/Installer.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<HintPath>..\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
6060
</Reference>
6161
<Reference Include="Microsoft.Dism, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5bba90053b345501, processorArchitecture=MSIL">
62-
<HintPath>..\packages\Microsoft.Dism.3.3.0\lib\net40\Microsoft.Dism.dll</HintPath>
62+
<HintPath>..\packages\Microsoft.Dism.3.3.12\lib\net40\Microsoft.Dism.dll</HintPath>
6363
</Reference>
6464
<Reference Include="System" />
6565
<Reference Include="System.Data" />

Installer/MainForm.vb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Imports System.Management
55
Imports System.ComponentModel
66
Imports System.Drawing
77
Imports System.Text.Encoding
8+
Imports Microsoft.Win32
89

910
Public Class MainForm
1011

@@ -590,6 +591,10 @@ Public Class MainForm
590591
RunBCDConfigurator("/displayorder " & TargetGuid & " /addfirst")
591592
RunBCDConfigurator("/default " & TargetGuid)
592593

594+
' Write removal script
595+
File.WriteAllText(Environment.GetEnvironmentVariable("SYSTEMDRIVE") & "\$DISMTOOLS.~BT\remove.cmd",
596+
String.Format(My.Resources.HI_UninstallScript, TargetGuid), ASCII)
597+
593598
Catch ex As Exception
594599
Throw
595600
End Try
@@ -654,6 +659,16 @@ Public Class MainForm
654659
Try
655660
If TestMode Then Directory.Delete(Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.Windows)), "$DISMTOOLS.~BT"), True)
656661
Directory.Delete(Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.Windows)), "$DISMTOOLS.~WS"), True)
662+
If File.Exists(Environment.GetEnvironmentVariable("SYSTEMDRIVE") & "\$DISMTOOLS.~BT\remove.cmd") Then
663+
' Run on startup (set reg key)
664+
Dim RemovalAdderProcess As New Process()
665+
RemovalAdderProcess.StartInfo.FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "system32", "reg.exe")
666+
RemovalAdderProcess.StartInfo.Arguments = "add " & Quote & "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" & Quote & " /f /v HotInstallDelete /t REG_SZ /d " & Quote & "cmd /c " & Quote & "%SYSTEMDRIVE%\$DISMTOOLS.~BT\remove.cmd" & Quote & Quote
667+
RemovalAdderProcess.StartInfo.CreateNoWindow = True
668+
RemovalAdderProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
669+
RemovalAdderProcess.Start()
670+
RemovalAdderProcess.WaitForExit()
671+
End If
657672
Catch ex As Exception
658673

659674
End Try

Installer/My Project/Resources.Designer.vb

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Installer/My Project/Resources.resx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,38 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
166166
<data name="logo_aboutdlg_dark" type="System.Resources.ResXFileRef, System.Windows.Forms">
167167
<value>..\resources\splashscreen\logo_aboutdlg_dark.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
168168
</data>
169+
<data name="HI_UninstallScript" xml:space="preserve">
170+
<value>@ECHO OFF
171+
SETLOCAL ENABLEDELAYEDEXPANSION
172+
TITLE Revert Installation Changes
173+
174+
IF "%1" NEQ "doit" (
175+
ECHO This device has rebooted to the full Windows installation. Do you want to remove the DISMTools Preinstallation Environment?
176+
CHOICE /C YN /M "Delete the DISMTools Preinstallation Environment BCD entries"
177+
178+
REM for some stupid reason, cmd decides to evaluate errorlevel at parse time, therefore returning 0, regardless of the option chosen in choice command
179+
REM if we delay the expansion, the errorlevel variable is evaluated at execution time rather than parse time (but we have to put exclamation marks instead of percentage signs), allowing us to actually perform the task when the user wants
180+
IF !ERRORLEVEL! EQU 1 (
181+
REM https://stackoverflow.com/a/37669661
182+
ECHO This removal script will launch itself as an administrator now.
183+
ECHO This is because DISMTools operating system installation needs to modify system settings to revert all changes made.
184+
PUSHD %~dp0
185+
MSHTA "javascript: var shell =new ActiveXObject('shell.application'); shell.ShellExecute('%~nx0', 'doit', '', 'runas', 1);close();"
186+
)
187+
EXIT
188+
)
189+
190+
ECHO Setting default boot entries...
191+
BCDEDIT /DEFAULT {{current}}
192+
ECHO Removing DISMTools PE BCD entry...
193+
BCDEDIT /DELETE {0} /F
194+
ECHO Removing HotInstall files...
195+
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v HotInstallDelete /f &gt;NUL 2&gt;&amp;1
196+
IF EXIST "%SYSTEMDRIVE%\$DISMTOOLS.~BT" (
197+
RD "%SYSTEMDRIVE%\$DISMTOOLS.~BT" /S /Q
198+
)
199+
IF EXIST "%SYSTEMDRIVE%\bcdguid.txt" (
200+
DEL "%SYSTEMDRIVE%\bcdguid.txt" /F /Q
201+
)</value>
202+
</data>
169203
</root>

Installer/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="ini-parser" version="2.5.2" targetFramework="net48" />
4-
<package id="Microsoft.Dism" version="3.3.0" targetFramework="net48" />
4+
<package id="Microsoft.Dism" version="3.3.12" targetFramework="net48" />
55
</packages>

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# DT-HotInstall
1+
# HotInstall
22

33
**HotInstall** is an operating system installer that prepares your computer to boot to the DISMTools Preinstallation Environment from within full Windows environments.
44

5-
> [!NOTE]
6-
> This is in experimental stages.
7-
85
## How does it work?
96

107
1. HotInstall copies all files of the disc image, minus the installation image (`install.wim`), to your local disk

0 commit comments

Comments
 (0)