简体   繁体   English

如何知道 UWF 是启用还是禁用

[英]How to know if UWF is enabled or disabled

How do I know if the UWF is enabled or disabled?我如何知道 UWF 是启用还是禁用? I'm making an application with C # so I need to know for that language.我正在使用 C# 制作应用程序,因此我需要了解该语言。

Thank you谢谢

There are few things to keep in mind when considering whether UWF is enabled or disabled:在考虑 UWF 是启用还是禁用时,有几件事需要牢记:

  1. Protection is not enabled when UWF is enabled, you need to exlicitly turn it ON by making use of Protect method in UWF_Volume class.启用 UWF 时未启用保护,您需要使用UWF_Volume类中的 Protect 方法明确打开它。
  2. A system reboot is required after enabling or disabling of UWF in order to apply the changes.启用或禁用 UWF 后需要重新启动系统才能应用更改。 UWF_Filter class provides methods for enable/disable and for performing reboot/shutdown of the system. UWF_Filter类提供启用/禁用和执行系统重启/关闭的方法。

The C# code below demonstrates the use of CurrentEnabled property of UWF_Filter class:下面的 C# 代码演示了 UWF_Filter 类的CurrentEnabled属性的使用:

public static bool IsEnabled()
    {
        try
        {
            //root\standardcimv2\embedded
            ManagementScope scope = new ManagementScope(@"root\standardcimv2\embedded");
            using (ManagementClass mc = new ManagementClass(scope.Path.Path, "UWF_Filter",
            null))
            {
                ManagementObjectCollection moc = mc.GetInstances();

                foreach (ManagementObject mo in moc)
                {
                    // Please make use of NextEnabled property in case you have enabled the UWF_Filter in the current session. 
                    //The value in CurrentEnabled is populated only when the UWF_Filter was enabled on system boot.
                    return (bool)mo.GetPropertyValue("CurrentEnabled");
                }
            }


        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        return false;
    }

Note/Request : Request someone with 1500 reputation to create and link following tags so that it becomes easier for people like me to request solutions/answer questions on stackoverflow.注意/请求:请求具有1500 声望的人创建并链接以下标签,以便像我这样的人更容易在 stackoverflow 上请求解决方案/回答问题。

  1. UWF UWF
  2. UWFMGR UWFMGR

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM