繁体   English   中英

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

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

我如何知道 UWF 是启用还是禁用? 我正在使用 C# 制作应用程序,因此我需要了解该语言。

谢谢

在考虑 UWF 是启用还是禁用时,有几件事需要牢记:

  1. 启用 UWF 时未启用保护,您需要使用UWF_Volume类中的 Protect 方法明确打开它。
  2. 启用或禁用 UWF 后需要重新启动系统才能应用更改。 UWF_Filter类提供启用/禁用和执行系统重启/关闭的方法。

下面的 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;
    }

注意/请求:请求具有1500 声望的人创建并链接以下标签,以便像我这样的人更容易在 stackoverflow 上请求解决方案/回答问题。

  1. UWF
  2. UWFMGR

暂无
暂无

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

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