提交 e99ff903 authored 作者: yangli's avatar yangli

.

上级 818fb72c
...@@ -29,8 +29,12 @@ public class InstalledProgramCache { ...@@ -29,8 +29,12 @@ public class InstalledProgramCache {
@Scheduled(fixedDelay = 3000) @Scheduled(fixedDelay = 3000)
protected void loadProgramListJob() throws IOException { protected void loadProgramListJob() throws IOException {
List<Map<String, String>> programs = new ArrayList<>(); List<Map<String, String>> programs = new ArrayList<>();
Process process = Runtime.getRuntime() String[] regPaths = {
.exec("cmd /c reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"); "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
};
for (String regPath : regPaths) {
Process process = Runtime.getRuntime().exec("cmd /c reg query " + regPath);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"))) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"))) {
String key; String key;
while ((key = reader.readLine()) != null) { while ((key = reader.readLine()) != null) {
...@@ -39,6 +43,7 @@ public class InstalledProgramCache { ...@@ -39,6 +43,7 @@ public class InstalledProgramCache {
} }
process.destroy(); process.destroy();
} }
}
programList = programs; programList = programs;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论