Bagikan melalui


WindowsIntegrityPolicy Kelas

Definisi

Menyediakan informasi tentang mode aman Windows 10 saat ini (mode 10 S), dan peristiwa yang dinaikkan saat mode berubah.

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
Warisan
Object Platform::Object IInspectable WindowsIntegrityPolicy
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10, version 1809 (diperkenalkan dalam 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v7.0)

Contoh

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).
            }
        }
    }
}

Keterangan

Windows menyediakan 10 S (juga dikenal sebagai Windows Lockdown) sebagai mode. Saat Windows dalam mode 10 S, hanya komponen Microsoft dan aplikasi Platform Windows Universal (UWP) yang dapat berjalan. Komponen tertentu tertentu, seperti regedit.exe dan cmd.exe, juga tidak diizinkan. Aplikasi UWP, terutama aplikasi keamanan dan firewall, perlu menyadari mode 10 S saat ini agar berperilaku dengan benar. Aplikasi tersebut juga perlu diberi tahu ketika mode 10 S beralih dari diaktifkan ke dinonaktifkan.

Properti

CanDisable

Mendapatkan nilai yang menunjukkan apakah mode aman Windows 10 (mode 10 S) dapat dinonaktifkan dengan cara apa pun—pada durasi dan/atau offline; oleh produsen peralatan asli (OEM), atau oleh pihak ketiga.

IsDisableSupported

Mendapatkan nilai yang menunjukkan (lihat Keterangan untuk kondisi lain yang diperlukan) apakah ada cara yang diterbitkan atau tidak, atau API, bagi vendor pihak ketiga untuk menonaktifkan mode aman Windows 10 (mode 10 S) pada durasi.

IsEnabled

Mendapatkan nilai yang menunjukkan apakah mode aman Windows 10 (mode 10 S) diaktifkan atau tidak (mode Penguncian Windows).

IsEnabledForTrial

Mendapatkan nilai yang menunjukkan apakah mode aman Windows 10 (mode 10 S) diaktifkan atau tidak (mode Penguncian Windows) untuk tujuan uji coba.

Acara

PolicyChanged

Muncul ketika mode aman Windows 10 saat ini (mode 10 S) berubah.

Berlaku untuk