|
| 1 | +using Microsoft.Win32; |
| 2 | +using System; |
| 3 | + |
| 4 | +namespace WTG_Utility.Functions |
| 5 | +{ |
| 6 | + |
| 7 | + internal class GetSettings |
| 8 | + { |
| 9 | + internal static void CurrentInfo() |
| 10 | + { |
| 11 | + Console.WriteLine("Current Info:"); |
| 12 | + } |
| 13 | + |
| 14 | + internal static void GetBootDriverFlags() |
| 15 | + { |
| 16 | + RegistryKey getBDF = Registry.LocalMachine.OpenSubKey("SYSTEM\\HardwareConfig\\Current"); |
| 17 | + int statusBDF = (int)getBDF.GetValue("BootDriverFlags"); |
| 18 | + getBDF.Close(); |
| 19 | + |
| 20 | + if (statusBDF == 20) //BootDriverFlags Check |
| 21 | + { |
| 22 | + Console.WriteLine(" Boot from USB Devices: Supported"); |
| 23 | + } |
| 24 | + else if (statusBDF == 28) |
| 25 | + { |
| 26 | + Console.WriteLine(" Boot from USB Devices: Supported"); |
| 27 | + } |
| 28 | + else if (statusBDF == 0) |
| 29 | + { |
| 30 | + Console.WriteLine(" Boot from USB Devices: Unsupported"); |
| 31 | + } |
| 32 | + else |
| 33 | + { |
| 34 | + Console.WriteLine(" Boot from USB Devices: Status unknown"); |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + internal static void GetPortableOSFeature() |
| 39 | + { |
| 40 | + RegistryKey getPOS = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control"); |
| 41 | + int statusPOS = (int)getPOS.GetValue("PortableOperatingSystem"); |
| 42 | + getPOS.Close(); |
| 43 | + |
| 44 | + if (statusPOS == 1) //PortableOS Check |
| 45 | + { |
| 46 | + Console.WriteLine(" PortableOS Feature: Enabled"); |
| 47 | + } |
| 48 | + else if (statusPOS == 0) |
| 49 | + { |
| 50 | + Console.WriteLine(" PortableOS Feature: Disabled"); |
| 51 | + } |
| 52 | + else |
| 53 | + { |
| 54 | + Console.WriteLine(" PortableOS Feature: Status unknown"); |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + internal static void GetPartmgrSettings() |
| 59 | + { |
| 60 | + RegistryKey getPMGR = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\partmgr\\Parameters"); |
| 61 | + int statusPMGR = (int)getPMGR.GetValue("SanPolicy"); |
| 62 | + getPMGR.Close(); |
| 63 | + |
| 64 | + if (statusPMGR == 4) //Partmgr Check |
| 65 | + { |
| 66 | + Console.WriteLine(" Hide Local Disks: True"); |
| 67 | + } |
| 68 | + else |
| 69 | + { |
| 70 | + Console.WriteLine(" Hide Local Disks: False"); |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + internal class ModifySettings |
| 76 | + { |
| 77 | + internal static void SetBootDriverFlags(int value) |
| 78 | + { |
| 79 | + RegistryKey setBDF = Registry.LocalMachine.CreateSubKey("SYSTEM\\HardwareConfig\\Current"); |
| 80 | + setBDF.SetValue("BootDriverFlags", value, RegistryValueKind.DWord); |
| 81 | + setBDF.Close(); |
| 82 | + } |
| 83 | + |
| 84 | + internal static void SetPortableOSFeature(int value) |
| 85 | + { |
| 86 | + RegistryKey setPOS = Registry.LocalMachine.CreateSubKey("SYSTEM\\CurrentControlSet\\Control"); |
| 87 | + setPOS.SetValue("PortableOperatingSystem", value, RegistryValueKind.DWord); |
| 88 | + setPOS.Close(); |
| 89 | + } |
| 90 | + |
| 91 | + internal static void SetPartmgrSettings(int value) |
| 92 | + { |
| 93 | + RegistryKey setPMGR = Registry.LocalMachine.CreateSubKey("SYSTEM\\CurrentControlSet\\Services\\partmgr\\Parameters"); |
| 94 | + setPMGR.SetValue("SanPolicy", value, RegistryValueKind.DWord); |
| 95 | + setPMGR.Close(); |
| 96 | + } |
| 97 | + } |
| 98 | +} |
0 commit comments