Skip to content

Commit 9ceec23

Browse files
committed
Merged PR 20903: New APIs for SmartAppControlPolicy and IPropertyValue
New and updated APIs for SmartAppControlPolicy and IPropertyValue. GetDateTimeArray removed the api with a DateTimeOffset array param and added one with a DateTime array.
1 parent d606e89 commit 9ceec23

4 files changed

Lines changed: 136 additions & 5 deletions

File tree

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
---
2-
-api-id: M:Windows.Foundation.IPropertyValue.GetDateTimeArray(Windows.Foundation.DateTimeOffset[]@)
2+
-api-id: M:Windows.Foundation.IPropertyValue.GetDateTimeArray(Windows.Foundation.DateTime[]@)
33
-api-type: winrt method
44
---
55

66
<!-- Method syntax
7-
public void GetDateTimeArray(Windows.Foundation.DateTimeOffset[] value)
7+
public void GetDateTimeArray (out Windows.Foundation.DateTime[] value);
88
-->
99

10-
# Windows.Foundation.IPropertyValue.GetDateTimeArray
10+
# Windows.Foundation.IPropertyValue.GetDateTimeArray(Windows.Foundation.DateTime[]@)
1111

1212
## -description
13+
1314
Returns the array of date and time values stored as a property value.
1415

1516
## -parameters
17+
1618
### -param value
19+
1720
The array of values.
1821

1922
## -remarks
2023

21-
## -examples
22-
2324
## -see-also
25+
26+
[IPropertyValue](ipropertyvalue.md), [DateTime](datetime.md)
27+
28+
## -examples
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
-api-id: T:Windows.System.Profile.SmartAppControlPolicy
3+
-api-type: winrt class
4+
---
5+
6+
# Windows.System.Profile.SmartAppControlPolicy
7+
8+
<!--
9+
public static class SmartAppControlPolicy
10+
-->
11+
12+
## -description
13+
14+
The **Smart App Control** policy interface and runtime class.
15+
16+
## -remarks
17+
18+
**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 is implemented as a Microsoft Defender Application Control (MDAC) policy, similar to [Windows in S mode](https://support.microsoft.com/windows/windows-10-and-windows-11-in-s-mode-faq-851057d6-1ee9-b9e5-c30b-93baebeebc85).
19+
20+
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 done with the **SmartAppControlPolicy** APIs.
21+
22+
## -see-also
23+
24+
[What is Smart App Control?](https://support.microsoft.com/topic/what-is-smart-app-control-285ea03d-fa88-4d56-882e-6698afdb7003)
25+
26+
## -examples
27+
28+
The following example shows how to register for the [SmartAppControlPolicy.Changed](smartappcontrolpolicy_changed.md) event and handle the event when it's raised.
29+
30+
```csharp
31+
using Windows.System.Profile;
32+
33+
public class SmartAppControlPolicySample: IDisposable
34+
{
35+
public SmartAppControlPolicySample()
36+
{
37+
SmartAppControlPolicy.Changed += OnSmartAppControlPolicyChanged;
38+
OnSmartAppControlPolicyChanged();
39+
}
40+
41+
~SmartAppControlPolicySample()
42+
{
43+
SmartAppControlPolicy.Changed -= OnSmartAppControlPolicyChanged;
44+
}
45+
46+
public void HandleSmartAppControlPolicyChange()
47+
{
48+
//
49+
// Change related UI Elements
50+
//
51+
ChangeUIForSmartAppControl(SmartAppControlPolicy.IsEnabled);
52+
}
53+
54+
void OnSmartAppControlPolicyChanged(object args)
55+
{
56+
//
57+
// Smart App Control Policy state changed.
58+
//
59+
HandleSmartAppControlPolicyChange();
60+
61+
//
62+
// Manage detection settings.
63+
//
64+
if (!SmartAppControlPolicy.IsEnabled)
65+
{
66+
//
67+
// Set AV in full scanning mode.
68+
//
69+
SetMalwareDetectionBehavior(MalwareDetectionBehavior.FullDetectionMode);
70+
}
71+
else
72+
{
73+
//
74+
// Set AV in light weight scanning mode.
75+
//
76+
SetMalwareDetectionBehavior(MalwareDetectionBehavior.LightweightDetectionMode);
77+
}
78+
}
79+
}
80+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
-api-id: E:Windows.System.Profile.SmartAppControlPolicy.Changed
3+
-api-type: winrt event
4+
---
5+
6+
# Windows.System.Profile.SmartAppControlPolicy.Changed
7+
8+
<!--
9+
public static event System.EventHandler<object> Changed;
10+
-->
11+
12+
## -description
13+
14+
This event is invoked when the **Smart App Control** state has changed.
15+
16+
## -remarks
17+
18+
## -see-also
19+
20+
[IsEnabled](smartappcontrolpolicy_isenabled.md)
21+
22+
## -examples
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
-api-id: P:Windows.System.Profile.SmartAppControlPolicy.IsEnabled
3+
-api-type: winrt property
4+
---
5+
6+
# Windows.System.Profile.SmartAppControlPolicy.IsEnabled
7+
8+
<!--
9+
public static bool IsEnabled { get; }
10+
-->
11+
12+
## -description
13+
14+
Indicates whether **Smart App Control** is enabled.
15+
16+
## -property-value
17+
18+
## -remarks
19+
20+
## -see-also
21+
22+
[Changed](smartappcontrolpolicy_changed.md)
23+
24+
## -examples

0 commit comments

Comments
 (0)