src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java
branchJDK-8200758-branch
changeset 57067 9c17d779808e
parent 57039 98d3963b0b7b
child 57106 ea870b9ce89a
equal deleted inserted replaced
57066:2fd0529702cd 57067:9c17d779808e
    34 import java.util.ArrayList;
    34 import java.util.ArrayList;
    35 import java.util.List;
    35 import java.util.List;
    36 
    36 
    37 import static jdk.jpackage.internal.IOUtils.exec;
    37 import static jdk.jpackage.internal.IOUtils.exec;
    38 
    38 
    39 public final class WindowsRegistry {
    39 final class WindowsRegistry {
    40 
    40 
    41     private WindowsRegistry() {}
    41     private WindowsRegistry() {}
    42 
    42 
    43     /**
    43     /**
    44      * Reads the registry value for DisableRealtimeMonitoring.
    44      * Reads the registry value for DisableRealtimeMonitoring.
    45      * @return true if DisableRealtimeMonitoring is set to 0x1,
    45      * @return true if DisableRealtimeMonitoring is set to 0x1,
    46      *         false otherwise.
    46      *         false otherwise.
    47      */
    47      */
    48     public static final boolean readDisableRealtimeMonitoring() {
    48     static final boolean readDisableRealtimeMonitoring() {
    49         boolean result = false;
    49         boolean result = false;
    50         final String key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\"
    50         final String key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\"
    51                   + "Windows Defender\\Real-Time Protection";
    51                   + "Windows Defender\\Real-Time Protection";
    52         final String subkey = "DisableRealtimeMonitoring";
    52         final String subkey = "DisableRealtimeMonitoring";
    53         String value = readRegistry(key, subkey);
    53         String value = readRegistry(key, subkey);
    73         }
    73         }
    74 
    74 
    75         return result;
    75         return result;
    76     }
    76     }
    77 
    77 
    78     public static final List<String> readExclusionsPaths() {
    78     static final List<String> readExclusionsPaths() {
    79         List<String> result = new ArrayList<String>();
    79         List<String> result = new ArrayList<String>();
    80         final String key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\"
    80         final String key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\"
    81                 + "Windows Defender\\Exclusions\\Paths";
    81                 + "Windows Defender\\Exclusions\\Paths";
    82         String value = readRegistry(key, "");
    82         String value = readRegistry(key, "");
    83 
    83 
   110     /**
   110     /**
   111      * @param key in the registry
   111      * @param key in the registry
   112      * @param subkey in the registry key
   112      * @param subkey in the registry key
   113      * @return registry value or null if not found
   113      * @return registry value or null if not found
   114      */
   114      */
   115     public static final String readRegistry(String key, String subkey){
   115     static final String readRegistry(String key, String subkey){
   116         String result = "";
   116         String result = "";
   117 
   117 
   118         try {
   118         try {
   119             List<String> buildOptions = new ArrayList<>();
   119             List<String> buildOptions = new ArrayList<>();
   120             buildOptions.add("reg");
   120             buildOptions.add("reg");