Skip to content

Commit

Permalink
Merge pull request #382 from HotCakeX/AppControl-Manager-1.2.0.0-and-…
Browse files Browse the repository at this point in the history
…WDACConfig-0.4.8

AppControl Manager 1.2.0.0 and WDACConfig 0.4.8
  • Loading branch information
HotCakeX authored Nov 2, 2024
2 parents 9f1f9cd + 2aef3c8 commit 735fb3c
Show file tree
Hide file tree
Showing 103 changed files with 2,561 additions and 1,551 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Build AppControl Manager MSIX Package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ jobs:
"Authorization" = "token ${{ secrets.GITHUB_TOKEN }}"
"Content-Type" = "application/octet-stream"
}
Write-Host -Object "Uploaded package to draft release: $Response.name"
shell: pwsh
Write-Host -Object "Uploaded package to draft release: $Response.name"
shell: pwsh

- name: Uploading the SBOM file to the Draft Release
run: |
Expand All @@ -133,5 +133,5 @@ jobs:
"Authorization" = "token ${{ secrets.GITHUB_TOKEN }}"
"Content-Type" = "application/octet-stream"
}
Write-Host -Object "Uploaded the SBOM file to the draft release: $Response.name"
Write-Host -Object "Uploaded the SBOM file to the draft release: $Response.name"
shell: pwsh
3 changes: 3 additions & 0 deletions AppControl Manager/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,6 @@ dotnet_diagnostic.CA2265.severity = error

# CA1507: Use nameof to express symbol names
dotnet_diagnostic.CA1507.severity = error

# IDE0001: Simplify name
dotnet_diagnostic.IDE0001.severity = error
13 changes: 11 additions & 2 deletions AppControl Manager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Windows.ApplicationModel;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

// Useful info regarding App Lifecycle events: https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/applifecycle/applifecycle


namespace WDACConfig
{
/// <summary>
Expand All @@ -22,6 +24,13 @@ public partial class App : Application
// Exceptions will stack up and wait in line to be shown to the user
private static readonly SemaphoreSlim _dialogSemaphore = new(1, 1);

// Get the current app's version
private static readonly PackageVersion packageVersion = Package.Current.Id.Version;

// Convert it to a normal Version object
internal static readonly Version currentAppVersion = new(packageVersion.Major, packageVersion.Minor, packageVersion.Build, packageVersion.Revision);


/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
Expand All @@ -42,7 +51,7 @@ public App()
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Closed += Window_Closed; // Assign event handler for the window closed event
Expand Down Expand Up @@ -76,7 +85,7 @@ private async void App_UnhandledException(object sender, Microsoft.UI.Xaml.Unhan
/// <summary>
/// Event handler for when the window is closed.
/// </summary>
private void Window_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs e)
private void Window_Closed(object sender, WindowEventArgs e)
{
// Clean up the staging area
if (Directory.Exists(GlobalVars.StagingArea))
Expand Down
171 changes: 99 additions & 72 deletions AppControl Manager/AppControl Manager.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- The following are the details for AppControlManager, a Self-Contained Trimmed MSIX Packaged App -->
<!-- The following are the details for AppControlManager, a Self-Contained MSIX Packaged App -->
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.26100.0</TargetPlatformMinVersion>

<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/package-validation/overview -->
<EnablePackageValidation>true</EnablePackageValidation>

<!-- https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#invariantglobalization -->
<InvariantGlobalization>true</InvariantGlobalization>

<RootNamespace>WDACConfig</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x64</Platforms>
Expand All @@ -24,44 +31,61 @@
-->
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

<!-- Publish Properties -->
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>

<!-- Disabling trimming temporarily -->
<!-- There should be absolutely no trim warnings before this can be enabled
Otherwise there is no guarantee that the app will work as expected at all times -->
<!-- https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options -->
<PublishTrimmed>false</PublishTrimmed>
<!-- <TrimMode>partial</TrimMode> -->
<!-- <SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings> -->

<SupportedOSPlatformVersion>10.0.26100.0</SupportedOSPlatformVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Description>An application that simplifies management of Application Control in Windows.</Description>
<PackageProjectUrl>https://github.com/HotCakeX/Harden-Windows-Security</PackageProjectUrl>
<RepositoryUrl>https://github.com/HotCakeX/Harden-Windows-Security</RepositoryUrl>
<PackageTags>App Control,WDAC,WDACConfig,AppControl For Business, AppControl Manager</PackageTags>
<PackageReleaseNotes>https://github.com/HotCakeX/Harden-Windows-Security/releases</PackageReleaseNotes>

<!-- Automatically created for packing -->
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampDigestAlgorithm>SHA512</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>

<!-- Defining custom directory in the root directory to be created if it doesn't exist. MSIX package after packing will be stored there -->
<AppxPackageDir>MSIXOutput\</AppxPackageDir>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Auto</AppxBundle>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AssemblyName>AppControlManager</AssemblyName>
<PublishAot>False</PublishAot>
<ErrorReport>send</ErrorReport>
<FileVersion>1.2.0.0</FileVersion>
<AssemblyVersion>$(FileVersion)</AssemblyVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<StartupObject>WDACConfig.Program</StartupObject>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<Version>$(FileVersion)</Version>

</PropertyGroup>
<ItemGroup>
<None Remove="Pages\ConfigurePolicyRuleOptions.xaml" />
<None Remove="Pages\GetCIHashes.xaml" />
<None Remove="Pages\GetSecurePolicySettings.xaml" />
<None Remove="Pages\GitHubDocumentation.xaml" />
<None Remove="Pages\Logs.xaml" />
<None Remove="Pages\MicrosoftDocumentation.xaml" />
<None Remove="Pages\Settings.xaml" />
<None Remove="Pages\Simulation.xaml" />
<None Remove="Pages\SystemInformation\CodeIntegrityInfo.xaml" />
<None Remove="Pages\SystemInformation\SystemInformation.xaml" />
<None Remove="Pages\Update.xaml" />
<None Remove="Pages\ViewCurrentPolicies.xaml" />
<None Remove="Resources\AppControlManagerSupplementalPolicy.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
<Content Include="Resources\AppControlManagerSupplementalPolicy.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging

<!-- Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
package has not yet been restored. -->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>

<!-- Nuget packages -->
<ItemGroup>
<!-- <PackageReference Include="CommunityToolkit.Labs.WinUI.Controls.DataTable" Version="0.1.241015-build.1760" /> -->
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.1.240916" />
Expand All @@ -78,6 +102,7 @@
<PackageReference Include="System.Management.Automation" Version="7.4.6" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.0-rc.2.24473.5" />
</ItemGroup>

<ItemGroup>
<Page Update="Pages\MicrosoftDocumentation.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -106,62 +131,64 @@
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>

<!-- <PublishTrimmed Condition="'$(Configuration)' == 'Debug'">True</PublishTrimmed> -->
<!-- <PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed> -->
<!-- Disabling trimming temporarily -->
<!--
There should be absolutely no trim warnings before this can be enabled
Otherwise there is no guarantee that the app will work as expected at all times
-->
<PublishTrimmed>false</PublishTrimmed>

<SupportedOSPlatformVersion>10.0.26100.0</SupportedOSPlatformVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Description>An application that simplifies management of Application Control in Windows.</Description>
<PackageProjectUrl>https://github.com/HotCakeX/Harden-Windows-Security</PackageProjectUrl>
<RepositoryUrl>https://github.com/HotCakeX/Harden-Windows-Security</RepositoryUrl>
<PackageTags>App Control,WDAC,WDACConfig,AppControl For Business, AppControl Manager</PackageTags>
<PackageReleaseNotes>https://github.com/HotCakeX/Harden-Windows-Security/releases</PackageReleaseNotes>

<!-- Automatically created for packing -->
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampDigestAlgorithm>SHA512</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<!-- Defining custom directory in the root directory to be created if it doesn't exist. MSIX package after packing will be stored there -->
<AppxPackageDir>MSIXOutput\</AppxPackageDir>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Auto</AppxBundle>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AssemblyName>AppControlManager</AssemblyName>
<PublishAot>False</PublishAot>

</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>

<ItemGroup>
<None Remove="Pages\ConfigurePolicyRuleOptions.xaml" />
<None Remove="Pages\GetCIHashes.xaml" />
<None Remove="Pages\GetSecurePolicySettings.xaml" />
<None Remove="Pages\GitHubDocumentation.xaml" />
<None Remove="Pages\Logs.xaml" />
<None Remove="Pages\MicrosoftDocumentation.xaml" />
<None Remove="Pages\Settings.xaml" />
<None Remove="Pages\Simulation.xaml" />
<None Remove="Pages\SystemInformation\CodeIntegrityInfo.xaml" />
<None Remove="Pages\SystemInformation\SystemInformation.xaml" />
<None Remove="Pages\Update.xaml" />
<None Remove="Pages\ViewCurrentPolicies.xaml" />
<None Remove="Resources\AppControlManagerSupplementalPolicy.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
<Content Include="Resources\AppControlManagerSupplementalPolicy.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

<!-- Exclude the following files and folders from compilation, build, search, solution explorer etc. -->
<ItemGroup>
<Compile Remove="version.txt" />
<Content Remove="version.txt" />
<None Remove="version.txt" />

<Compile Remove="DownloadURL.txt" />
<Content Remove="DownloadURL.txt" />
<None Remove="DownloadURL.txt" />

<Compile Remove="MSIXOutput\**" />
<Content Remove="MSIXOutput\**" />
<None Remove="MSIXOutput\**" />
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<Page Update="Pages\Update.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down
14 changes: 13 additions & 1 deletion AppControl Manager/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<MicaBackdrop Kind="BaseAlt"/>
</Window.SystemBackdrop>

<Grid>
<Grid x:Name="RootGrid">

<!-- When using this, we shouldn't set PaneDisplayMode="" property on the navigation element itself, otherwise these dynamic triggers won't work on it -->
<!-- Also apparently there are hardcoded minimum width that do not allow for smaller MinWindowWidth to be set for the triggers below and they are overriden when it happens -->
Expand Down Expand Up @@ -114,10 +114,22 @@
</NavigationView.MenuItems>

<NavigationView.FooterMenuItems>

<NavigationViewItem Content="Update" ToolTipService.ToolTip="Check for updates" Tag="Update">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xEB52;" />
</NavigationViewItem.Icon>

<NavigationViewItem.InfoBadge>
<InfoBadge x:Name="AvailableUpdateInfoBadge"
Opacity="{x:Bind ViewModel.InfoBadgeOpacity, Mode=OneWay}"
Style="{ThemeResource AttentionIconInfoBadgeStyle}">
<InfoBadge.IconSource>
<FontIconSource Glyph="&#xEA6A;"/>
</InfoBadge.IconSource>
</InfoBadge>
</NavigationViewItem.InfoBadge>

</NavigationViewItem>

</NavigationView.FooterMenuItems>
Expand Down
44 changes: 44 additions & 0 deletions AppControl Manager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Linq;
using System.Threading.Tasks;

namespace WDACConfig
{
public sealed partial class MainWindow : Window
{
public MainWindowViewModel ViewModel { get; }

public MainWindow()
{
this.InitializeComponent();
Expand All @@ -14,6 +17,47 @@ public MainWindow()
// Make title bar Mica
ExtendsContentIntoTitleBar = true;

#region

// Use the singleton instance of AppUpdate class
AppUpdate updateService = AppUpdate.Instance;

// Pass the AppUpdate class instance to MainWindowViewModel
ViewModel = new MainWindowViewModel(updateService);

// Set the DataContext of the Grid to enable bindings in XAML
RootGrid.DataContext = ViewModel;

_ = Task.Run(() =>
{

// If AutoUpdateCheck is enabled in the user configurations, checks for updates on startup and displays a dot on the Update page in the navigation
// If a new version is available.
if (UserConfiguration.Get().AutoUpdateCheck == true)
{

Logger.Write("Checking for update on startup because AutoUpdateCheck is enabled");

// Start the update check
UpdateCheckResponse updateCheckResponse = updateService.Check();

// If a new version is available
if (updateCheckResponse.IsNewVersionAvailable)
{
// Set the text for the button in the update page
GlobalVars.updateButtonTextOnTheUpdatePage = $"Install version {updateCheckResponse.OnlineVersion}";
}
else
{
Logger.Write("No new version of the AppControl Manager is available.");
}
}

});

#endregion


// Navigate to the CreatePolicy page when the window is loaded
_ = ContentFrame.Navigate(typeof(Pages.CreatePolicy));

Expand Down
2 changes: 1 addition & 1 deletion AppControl Manager/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="AppControlManager"
Publisher="CN=SelfSignedCertForAppControlManager"
Version="1.1.0.0" />
Version="1.2.0.0" />

<mp:PhoneIdentity PhoneProductId="199a23ec-7cb6-4ab5-ab50-8baca348bc79" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
Loading

0 comments on commit 735fb3c

Please sign in to comment.