Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,26 @@ private static String queryRegistryValue(String keyPath, String valueName) {
}

String value = status.assertExitCodeIsZero().getOutput().stream().skip(2).findFirst().orElseThrow();
// Extract the last field from the following line:
// Common Desktop REG_SZ C:\Users\Public\Desktop
value = value.split(" REG_SZ ")[1];
// Extract the last field from the following lines:
// (Default) REG_SZ test1
// string_val REG_SZ test2
// string_val_empty REG_SZ
// bin_val REG_BINARY 4242
// bin_val_empty REG_BINARY
// dword_val REG_DWORD 0x2a
// qword_val REG_QWORD 0x2a
// multi_string_val REG_MULTI_SZ test3\0test4
// multi_string_val_empty REG_MULTI_SZ
// expand_string_val REG_EXPAND_SZ test5
// expand_string_val_empty REG_EXPAND_SZ
String[] parts = value.split(" {4}REG_[A-Z_]+ {4}");
if (parts.length == 1) {
value = "";
} else if (parts.length == 2) {
value = parts[1];
} else {
throw new RuntimeException(String.format("Failed to extract registry value from string [%s]", value));
}

TKit.trace(String.format("Registry value [%s] at [%s] path is [%s]",
valueName, keyPath, value));
Expand Down