WindowsIntegrityPolicy Klasse

Definition

Stellt Informationen zum aktuellen Windows 10 sicheren Modus (10 S-Modus) und ein Ereignis bereit, das ausgelöst wird, wenn sich der Modus ändert.

public ref class WindowsIntegrityPolicy abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 458752)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WindowsIntegrityPolicy final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 458752)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class WindowsIntegrityPolicy
Public Class WindowsIntegrityPolicy
Vererbung
Object Platform::Object IInspectable WindowsIntegrityPolicy
Attribute

Windows-Anforderungen

Gerätefamilie
Windows 10, version 1809 (eingeführt in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v7.0)

Beispiele

public class WindowsLockdownExample
{
    public WindowsLockdownExample()
    {
        Windows.System.Profile.WindowsIntegrityPolicy.PolicyChanged += this.WindowsIntegrityPolicy_PolicyChanged;
    }

    ~WindowsLockdownExample()
    {
        Windows.System.Profile.WindowsIntegrityPolicy.PolicyChanged -= this.WindowsIntegrityPolicy_PolicyChanged;
    }

    private void WindowsIntegrityPolicy_PolicyChanged(object sender, object e)
    {
        // Windows secure mode (10 S mode) has changed.

        this.ProcessWindowsIntegrityPolicy();

        if (!Windows.System.Profile.WindowsIntegrityPolicy.IsEnabled)
        {
            // There are certain things that you may want to do when Windows secure mode
            // (10 S mode) has changed from the enabled to the disabled state. For example,
            // a security application might want to offer anti-virus software on this 
            // device.
        }
    }

    public void ProcessWindowsIntegrityPolicy()
    {
        // Check Windows secure mode (10 S mode) status.

        if (Windows.System.Profile.WindowsIntegrityPolicy.IsEnabled)
        {
            // Windows secure mode (10 S mode) is enabled.

            if (Windows.System.Profile.WindowsIntegrityPolicy.IsEnabledForTrial)
            {
                // Furthermore, it has been enabled for trial purposes. Respond accordingly.
                // For example, logging/tagging this device for the organization to 
                // monitor devices that are under trial mode.
            }
            else
            {
                // It has been enabled for normal scenarios. Respond accordingly.
                // For example, don’t try to invoke any process that will be blocked
                // by the policy, or change your UI or error message. For example, 
                // security software could show a different error message about the process
                // being blocked when Windows secure mode (10 S mode) is enabled.
            }
        }

        // Check whether Windows secure mode (10 S mode) can be disabled, and whether disabling is supported.

        if (Windows.System.Profile.WindowsIntegrityPolicy.CanDisable)
        {
            if (Windows.System.Profile.WindowsIntegrityPolicy.IsDisableSupported)
            {
                // Windows secure mode (10 S mode) can be disabled, and disabling is supported.
                // Respond accordingly. For example, report this information back to any cloud-based
                // solution, in case it need to push any policy disabling package to the right devices.
            }
            else
            {
                // Windows secure mode (10 S mode) can be disabled, but disabling is not supported.
                // So, Windows secure mode (10 S mode) can never be changed. Work around this situation.
                // For example, show the appropriate error message when you fail to disable Windows
                // secure mode (10 S mode).
            }
        }
    }
}

Hinweise

Windows bietet 10 S (auch als Windows-Lockdown bezeichnet) als Modus. Wenn Sich Windows im 10 S-Modus befindet, können nur Microsoft-Komponenten und Universelle Windows-Plattform-Apps (UWP) ausgeführt werden. Bestimmte spezifische Komponenten wie regedit.exe und cmd.exesind ebenfalls nicht zulässig. UWP-Apps, insbesondere Sicherheits- und Firewall-Apps, müssen den aktuellen 10-S-Modus kennen, um sich ordnungsgemäß zu verhalten. Solche Apps müssen auch benachrichtigt werden, wenn der 10 S-Modus von aktiviert in deaktiviert wechselt.

Eigenschaften

CanDisable

Ruft einen Wert ab, der angibt, ob Windows 10 sicheren Modus (10 S-Modus) auf beliebige Weise deaktiviert werden kann – zur Laufzeit und/oder offline, vom Originalgerätehersteller (OEM) oder von einem Drittanbieter.

IsDisableSupported

Ruft einen Wert ab, der angibt (siehe Hinweise zu anderen erforderlichen Bedingungen), ob es eine veröffentlichte Methode oder API gibt, mit der Drittanbieter Windows 10 sicheren Modus (10 S-Modus) zur Laufzeit deaktivieren können.

IsEnabled

Ruft einen Wert ab, der angibt, ob Windows 10 sichere Modus (10 S-Modus) aktiviert ist (Windows-Sperrmodus).

IsEnabledForTrial

Ruft einen Wert ab, der angibt, ob Windows 10 sicherer Modus (10 S-Modus) für Testzwecke aktiviert ist (Windows-Sperrmodus).

Ereignisse

PolicyChanged

Wird ausgelöst, wenn sich der aktuelle Windows 10 sicherer Modus (10 S-Modus) ändert.

Gilt für: