From b121adfebc713f8aea6730089db1e7b1b8528f7c Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Tue, 1 Aug 2023 02:04:32 -0500 Subject: [PATCH] Mark Win11 driver mod as DEBUG and remove published name check --- ZuneModCore/ModManager.cs | 2 ++ ZuneModCore/Mods/Win11DriverMod.cs | 23 ++--------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/ZuneModCore/ModManager.cs b/ZuneModCore/ModManager.cs index d9a84b0..fcb288c 100644 --- a/ZuneModCore/ModManager.cs +++ b/ZuneModCore/ModManager.cs @@ -15,7 +15,9 @@ namespace ZuneModCore public static readonly IReadOnlyList AvailableMods = new List { new VideoSyncMod(), +#if DEBUG new Win11DriverMod(), +#endif new FeaturesOverrideMod(), new WebservicesMod(), new BackgroundImageMod(), diff --git a/ZuneModCore/Mods/Win11DriverMod.cs b/ZuneModCore/Mods/Win11DriverMod.cs index b65c5f8..dc060e1 100644 --- a/ZuneModCore/Mods/Win11DriverMod.cs +++ b/ZuneModCore/Mods/Win11DriverMod.cs @@ -73,25 +73,6 @@ namespace ZuneModCore.Mods } await enumProc.WaitForExitAsync(); - //if (zuneInfPublishedName != null) - //{ - // // There may be a corrupted driver from previous attempts, - // // removing it before installing brings better results - // startInfo.Arguments = $"/delete-driver {zuneInfPublishedName} /uninstall"; - // Process deleteProc = new() - // { - // StartInfo = startInfo - // }; - - // deleteProc.Start(); - // while (!deleteProc.StandardOutput.EndOfStream) - // { - // string? currentLine = await deleteProc.StandardOutput.ReadLineAsync(); - // Debug.WriteLine(currentLine); - // } - // await deleteProc.WaitForExitAsync(); - //} - // Copy all .dll.mui files, then install the driver. // This loop generates a batch script that can run as TrustedInstaller // to copy all the necessary files to System32. If we don't run this @@ -124,14 +105,14 @@ namespace ZuneModCore.Mods // Manually copy files and install the driver string? installErrorMsg = null; - using (var procInfo = Win32.ExecTI.CreateProcessAsTrustedInstaller(tiSvc, $"cmd /k {installScriptPath}")) + var procInfo = Win32.ExecTI.CreateProcessAsTrustedInstaller(tiSvc, $"cmd /k {installScriptPath}"); { Debug.WriteLine(procInfo.hProcess.DangerousGetHandle().ToString("X")); Process installProc = Process.GetProcessById(unchecked((int)procInfo!.dwProcessId)); await installProc.WaitForExitAsync(); if (Vanara.PInvoke.Kernel32.GetExitCodeProcess(procInfo.hProcess, out var exitCode) - && (exitCode != 0 || exitCode != 0xc000013A)) + && (exitCode != 0 || exitCode != 0xC000013A)) installErrorMsg = "An unknown error occurred while attempting to install driver."; //Vanara.PInvoke.Kernel32.CloseHandle(procInfo.hProcess.DangerousGetHandle());