我只知道引用using Microsoft.Win32;我不知道如何读取键值.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\
名称NtfsDisableEncryption值为0x00000001(1)我想做个判断如何如何获取这个值为0x00000001(1)不知道如何读取,那位告诉告诉我一下.

解决方案 »

  1.   

    RegistryKey hkml = Registry.LocalMachine;读取根节点
    然后每一步都可以一直打开子节点RegistryKey node = hkml.OpenSubKey("SYSTEM");
    OpenSubKey()方法传递的参数是节点名,用SetValue方法可以改变该键的值
      

  2.   


    //我直接这样
    RegistryKey reg = Registry.LocalMachine.OpenSubKey("\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\
    ")
    然后不知道怎么拿到
    名称NtfsDisableEncryption值为0x00000001(1)
      

  3.   

    string reg = Registry.LocalMachine.OpenSubKey("SYSTEM", true).OpenSubKey("CurrentControlSet", true).OpenSubKey("Control", true).OpenSubKey("FileSystem", true).GetValue("NtfsDisableEncryption").ToString();reg 值为 "1"你直接判断是否等于1就成了
      

  4.   

    using (RegistryKey key = Registry.LocalMachine.OpenSubKey(regKeyName, false))
      {
      object value = null;
      if (key != null)
      {
      value = key.GetValue(regValueName);
      }
    }