Skip to content

Commit

Permalink
v2.1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Jan 7, 2024
1 parent 2f259b2 commit 99fdc37
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 25 deletions.
36 changes: 21 additions & 15 deletions DriverUpdater/DismProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public bool InstallApps(IEnumerable<(string, string)> deps)
return true;
}

public bool InstallDrivers(IEnumerable<string> infFiles)
public bool InstallDrivers(IEnumerable<string> infFiles, bool IsUpgrade)
{
Logging.Log("Enumerating existing drivers...");

Expand All @@ -166,27 +166,33 @@ public bool InstallDrivers(IEnumerable<string> infFiles)
return false;
}

Logging.Log("Uninstalling drivers...");
long Progress;
DateTime startTime;

long Progress = 0;
DateTime startTime = DateTime.Now;

foreach (string driver in existingDrivers)
if (IsUpgrade)
{
Console.Title = $"Driver Updater - RemoveOfflineDriver - {driver}";
Logging.ShowProgress(Progress++, existingDrivers.Length, startTime, false);
Logging.Log("Uninstalling drivers...");

ntStatus = RemoveOfflineDriver(driver);
if ((ntStatus & 0x80000000) != 0)
Progress = 0;
startTime = DateTime.Now;

foreach (string driver in existingDrivers)
{
Logging.Log("");
Logging.Log($"RemoveOfflineDriver: ntStatus=0x{ntStatus:X8}, driver={driver}", Logging.LoggingLevel.Error);
Console.Title = $"Driver Updater - RemoveOfflineDriver - {driver}";
Logging.ShowProgress(Progress++, existingDrivers.Length, startTime, false);

return false;
ntStatus = RemoveOfflineDriver(driver);
if ((ntStatus & 0x80000000) != 0)
{
Logging.Log("");
Logging.Log($"RemoveOfflineDriver: ntStatus=0x{ntStatus:X8}, driver={driver}", Logging.LoggingLevel.Error);

return false;
}
}
Logging.ShowProgress(existingDrivers.Length, existingDrivers.Length, startTime, false);
Logging.Log("");
}
Logging.ShowProgress(existingDrivers.Length, existingDrivers.Length, startTime, false);
Logging.Log("");

Logging.Log("Installing new drivers...");

Expand Down
28 changes: 20 additions & 8 deletions DriverUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,31 @@ private static void DriverUpdaterAction(string Definition, string DriverRepo, st

try
{
bool result = ResealForPnPFirstBootUx(DevicePart);
bool upgrade = ResealForPnPFirstBootUx(DevicePart);
// true = first boot completed
// false = first boot not completed

if (result)
if (upgrade)
{
Logging.Log("The device has already been booted once. Reinstalling Board Support Package.");
}
else
{
result = Install(Definition, DriverRepo, DevicePart);
Logging.Log("The device has not been booted yet. Installing Board Support Package for the first time prior to first boot.");
}

if (result)
bool result = Install(Definition, DriverRepo, DevicePart, upgrade);

if (result)
{
if (upgrade)
{
Logging.Log("Fixing potential registry left overs");
new RegistryFixer(DevicePart).FixRegistryPaths();
Logging.Log("Enabling Cks");
new CksLicensing(DevicePart).SetLicensedState();
}

Logging.Log("Enabling Cks");
new CksLicensing(DevicePart).SetLicensedState();
}
}
catch (Exception ex)
Expand Down Expand Up @@ -188,7 +200,7 @@ private static bool ResealForPnPFirstBootUx(string DevicePart)
return result;
}

private static bool Install(string Definition, string DriverRepo, string DrivePath)
private static bool Install(string Definition, string DriverRepo, string DrivePath, bool IsUpgrade)
{
Logging.Log("Reading definition file...");
DefinitionParser definitionParser = new(Definition);
Expand Down Expand Up @@ -261,7 +273,7 @@ private static bool Install(string Definition, string DriverRepo, string DrivePa

using DismProvider dismProvider = new(DrivePath);

return dismProvider.InstallDrivers(driverPathsToInstall) && dismProvider.InstallDepApps(appPaths) && dismProvider.InstallApps(appPaths);
return dismProvider.InstallDrivers(driverPathsToInstall, IsUpgrade) && dismProvider.InstallDepApps(appPaths) && dismProvider.InstallApps(appPaths);
}

private static bool OnlineInstall(string Definition, string DriverRepo)
Expand Down
4 changes: 2 additions & 2 deletions DriverUpdater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
[assembly: AssemblyCopyright("Copyright © LumiaWoA and DuoWoA authors")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]

0 comments on commit 99fdc37

Please sign in to comment.