( stdout: string, valueName = 'Settings', )
| 206 | * Settings REG_SZ {"json":"value"} |
| 207 | */ |
| 208 | export function parseRegQueryStdout( |
| 209 | stdout: string, |
| 210 | valueName = 'Settings', |
| 211 | ): string | null { |
| 212 | const lines = stdout.split(/\r?\n/) |
| 213 | const escaped = valueName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') |
| 214 | const re = new RegExp(`^\\s+${escaped}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`, 'i') |
| 215 | for (const line of lines) { |
| 216 | const match = line.match(re) |
| 217 | if (match && match[1]) { |
| 218 | return match[1].trimEnd() |
| 219 | } |
| 220 | } |
| 221 | return null |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Convert raw subprocess output into parsed MDM and HKCU results, |
no outgoing calls
no test coverage detected