SmartAppControlPolicy Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Smart App Control policy interface and runtime class.
public ref class SmartAppControlPolicy abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 983040)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SmartAppControlPolicy final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 983040)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class SmartAppControlPolicy
Public Class SmartAppControlPolicy
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 11 Insider Preview (introduced in 10.0.23504.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v15.0)
|
Examples
The following example shows how apps can register for the SmartAppControlPolicy.Changed event and handle the event when it's raised.
using Windows.System.Profile;
public class SmartAppControlPolicySample: IDisposable
{
public SmartAppControlPolicySample()
{
SmartAppControlPolicy.Changed += OnSmartAppControlPolicyChanged;
OnSmartAppControlPolicyChanged();
}
~SmartAppControlPolicySample()
{
SmartAppControlPolicy.Changed -= OnSmartAppControlPolicyChanged;
}
public void HandleSmartAppControlPolicyChange()
{
//
// Change related UI Elements
//
ChangeUIForSmartAppControl(SmartAppControlPolicy.IsEnabled);
}
void OnSmartAppControlPolicyChanged(object args)
{
//
// Smart App Control Policy state changed.
//
HandleSmartAppControlPolicyChange();
//
// Manage detection settings.
//
if (!SmartAppControlPolicy.IsEnabled)
{
//
// Set AV in full scanning mode.
//
SetMalwareDetectionBehavior(MalwareDetectionBehavior.FullDetectionMode);
}
else
{
//
// Set AV in light weight scanning mode.
//
SetMalwareDetectionBehavior(MalwareDetectionBehavior.LightweightDetectionMode);
}
}
}
Remarks
Smart App Control is a new security feature in Windows 11, which improves consumer PC security by blocking apps that are malicious or untrusted. It's implemented as a Microsoft Defender Application Control (MDAC) policy, similar to Windows in S mode.
Apps and services may want to query the Smart App Control mode on a given system or register for a notification when the state changes. This can be accomplished with the SmartAppControlPolicy APIs.
Properties
IsEnabled |
Indicates whether Smart App Control is enabled. |
Events
Changed |
This event is invoked when the Smart App Control state changes. |