Implemented BasicDisplay autostart enable/disable tasks

master
Inga 🏳‍🌈 5 years ago
parent ee3de9516b
commit 4a588b5d5c
  1. 2
      RadeonResetBugFixService/Constants.cs
  2. 2
      RadeonResetBugFixService/MainHandler.cs
  3. 2
      RadeonResetBugFixService/RadeonResetBugFixService.csproj
  4. 17
      RadeonResetBugFixService/Tasks/DisableBasicDisplayStartupTask.cs
  5. 17
      RadeonResetBugFixService/Tasks/EnableBasicDisplayStartupTask.cs

@ -5,5 +5,7 @@
static class Constants
{
public static TimeSpan ServiceTimeout { get; } = TimeSpan.FromMinutes(5);
public static string BasicDisplayRegistryKey { get; } = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BasicDisplay";
}
}

@ -49,6 +49,7 @@
logger,
new ITask[]
{
new EnableBasicDisplayStartupTask(),
new SleepTask(TimeSpan.FromSeconds(20)),
new DisableVirtualVideoTask(this.StartupDevicesStatus),
new EnableAmdVideoTask(this.StartupDevicesStatus),
@ -88,6 +89,7 @@
new EnableVirtualVideoTask(this.ShutdownDevicesStatus),
new LastResortDevicesRestoreTask(this.StartupDevicesStatus),
new LastResortDevicesRestoreTask(this.StartupDevicesStatus), // just in case
new DisableBasicDisplayStartupTask(),
});
}
}

@ -73,6 +73,8 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Logging\TaskLoggerWrapper.cs" />
<Compile Include="Tasks\DisableBasicDisplayStartupTask.cs" />
<Compile Include="Tasks\EnableBasicDisplayStartupTask.cs" />
<Compile Include="Tasks\FixMonitorTask.cs" />
<Compile Include="Tasks\LastResortDevicesRestoreTask.cs" />
<Compile Include="Tasks\SleepTask.cs" />

@ -0,0 +1,17 @@
namespace RadeonResetBugFixService.Tasks
{
using Microsoft.Win32;
using Contracts;
class DisableBasicDisplayStartupTask : ITask
{
string ITask.TaskName => "Disabling basic display automatic start";
void ITask.Run(ILogger logger)
{
var originalValue = Registry.GetValue(Constants.BasicDisplayRegistryKey, "Start", -1);
logger.Log($"Original start value {originalValue}");
Registry.SetValue(Constants.BasicDisplayRegistryKey, "Start", 4);
}
}
}

@ -0,0 +1,17 @@
namespace RadeonResetBugFixService.Tasks
{
using Microsoft.Win32;
using Contracts;
class EnableBasicDisplayStartupTask : ITask
{
string ITask.TaskName => "Enabling basic display automatic start";
void ITask.Run(ILogger logger)
{
var originalValue = Registry.GetValue(Constants.BasicDisplayRegistryKey, "Start", -1);
logger.Log($"Original start value {originalValue}");
Registry.SetValue(Constants.BasicDisplayRegistryKey, "Start", 3);
}
}
}
Loading…
Cancel
Save