Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Microsoft Recommended Block Rules auto update #472

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions AppControl Manager/Logic/Main/BasePolicyCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ internal static void SetAutoUpdateDriverBlockRules()


#region Register Task
// Register the scheduled task. If the task's state is disabled, it will be overwritten with a new task that is enabled
// Register the scheduled task.
// If the task's state is disabled or its configuration is invalid, it will be replaced with a new correct task as this step is overwriting.
using ManagementClass registerClass = new(scope, new ManagementPath("PS_ScheduledTask"), null);

// Prepare method parameters to register the task
Expand All @@ -163,10 +164,6 @@ internal static void SetAutoUpdateDriverBlockRules()

Logger.Write("Successfully created the Microsoft Recommended Driver Block Rules auto updater scheduled task.");


Logger.Write("Displaying extra info about the Microsoft recommended Drivers block list");
_ = DriversBlockListInfoGathering();

}

internal sealed class DriverBlockListInfo
Expand Down Expand Up @@ -312,9 +309,6 @@ internal static void DeployDriversBlockRules(string StagingArea)
CiToolHelper.RefreshPolicy();

Logger.Write("SiPolicy.p7b has been deployed and policies refreshed.");

Logger.Write("Displaying extra info about the Microsoft recommended Drivers block list");
_ = DriversBlockListInfoGathering();
}


Expand Down Expand Up @@ -368,9 +362,6 @@ internal static void GetDriversBlockRules(string StagingArea)

CiRuleOptions.Set(filePath: xmlPath, rulesToRemove: [CiRuleOptions.PolicyRuleOptions.EnabledAuditMode]);

Logger.Write($"Displaying extra info about the {name}");
_ = DriversBlockListInfoGathering();

// The final path where the XML policy file will be located
string savePathLocation = Path.Combine(GlobalVars.UserConfigDir, $"{name}.xml");

Expand Down
5 changes: 2 additions & 3 deletions AppControl Manager/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@
Width="16" Height="16"
Margin="8,0,4,0"/>

<!-- App title bar -->
<TextBlock x:Name="TitleBarTextBlock"
Text="App title"
<!-- App title bar -->
<TextBlock x:Name="TitleBarTextBlock"
Style="{StaticResource CaptionTextBlockStyle}"
Grid.Column="4"
VerticalAlignment="Center" />
Expand Down
13 changes: 11 additions & 2 deletions AppControl Manager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ public MainWindow()
m_AppWindow = this.AppWindow;

// Some event handlers
Activated += MainWindow_Activated;
AppTitleBar.SizeChanged += AppTitleBar_SizeChanged;
AppTitleBar.Loaded += AppTitleBar_Loaded;

Expand Down Expand Up @@ -440,13 +439,20 @@ private static RectInt32 GetRect(Rect bounds, double scale)
}



/*

This will make keep the title bar text white even on light theme, making it unreadable
It's not even necessary to change the text based on Window being in focus or not

/// <summary>
/// Ensures the TitleBar follows the app's appearance when the window is in and out of focus
/// Ensures the TitleBar's text follows the app's appearance when the window is in and out of focus
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
{

if (args.WindowActivationState == WindowActivationState.Deactivated)
{
TitleBarTextBlock.Foreground =
Expand All @@ -457,8 +463,11 @@ private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
TitleBarTextBlock.Foreground =
(SolidColorBrush)Application.Current.Resources["WindowCaptionForeground"];
}

}

*/


/// <summary>
/// Main Window close event
Expand Down
19 changes: 16 additions & 3 deletions AppControl Manager/Pages/CreatePolicy.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,35 @@ Style="{StaticResource AccentButtonStyle}" Click="SignedAndReputableCreateAndDep
Header="Create Microsoft Recommended Driver Block Rules"
HeaderIcon="{ui:FontIcon Glyph=&#xE71D;}">

<controls:SettingsExpander.ItemsHeader>
<InfoBar x:Name="RecommendedDriverBlockRulesInfoBar"
BorderThickness="0"
CornerRadius="0"
IsIconVisible="True"
IsOpen="False"
IsClosable="False"
Severity="Informational">
</InfoBar>
</controls:SettingsExpander.ItemsHeader>

<controls:WrapPanel Orientation="Horizontal" HorizontalSpacing="6" VerticalSpacing="10">

<Button x:Name="RecommendedDriverBlockRulesCreate" Content="Create"
<Button x:Name="RecommendedDriverBlockRulesCreate" Content="Create" ToolTipService.ToolTip="Creates the Microsoft Recommended Drivers Block List XML file"
Style="{StaticResource AccentButtonStyle}" Margin="0,0,15,0" Click="RecommendedDriverBlockRulesCreate_Click" />

<Button x:Name="RecommendedDriverBlockRulesCreateAndDeploy" Content="Create And Deploy"
<Button x:Name="RecommendedDriverBlockRulesCreateAndDeploy" Content="Create And Deploy" ToolTipService.ToolTip="Creates and Deploys the Microsoft Recommended Drivers Block List XML file"
Style="{StaticResource AccentButtonStyle}" Click="RecommendedDriverBlockRulesCreateAndDeploy_Click" Margin="0,0,15,0" />

<Button x:Name="RecommendedDriverBlockRulesScheduledAutoUpdate" Content="Auto Update" ToolTipService.ToolTip="Configures the Microsoft Recommended Drivers Block List to be automatically updated using a scheduled task"
Style="{StaticResource AccentButtonStyle}" Click="RecommendedDriverBlockRulesScheduledAutoUpdate_Click" Margin="0,0,15,0" />

</controls:WrapPanel>


<controls:SettingsExpander.Items>

<controls:SettingsCard Description="Information about the latest Microsoft Recommended Drivers Block Rules"
Header="Info">

</controls:SettingsCard>


Expand Down
Loading
Loading