diff --git a/lib/registry.js b/lib/registry.js index 6319ae3..5edd7d7 100644 --- a/lib/registry.js +++ b/lib/registry.js @@ -41,7 +41,7 @@ var util = require('util') , PATH_PATTERN = /^(HKEY_LOCAL_MACHINE|HKEY_CURRENT_USER|HKEY_CLASSES_ROOT|HKEY_USERS|HKEY_CURRENT_CONFIG)(.*)$/ /* registry item pattern */ -, ITEM_PATTERN = /^(.*)\s(REG_SZ|REG_MULTI_SZ|REG_EXPAND_SZ|REG_DWORD|REG_QWORD|REG_BINARY|REG_NONE)\s+([^\s].*)$/ +, ITEM_PATTERN = /^\s{4}(.+)\s{4}(REG_SZ|REG_MULTI_SZ|REG_EXPAND_SZ|REG_DWORD|REG_QWORD|REG_BINARY|REG_NONE)\s{4}(.+)\s$/ /** * Creates an Error object that contains the exit code of the REG.EXE process. @@ -643,8 +643,8 @@ Registry.prototype.get = function get (name, cb) { , lineNumber = 0 for (var i = 0, l = lines.length; i < l; i++) { - var line = lines[i].trim(); - if (line.length > 0) { + var line = lines[i]; + if (line.trim().length > 0) { log(line); if (lineNumber != 0) { items.push(line); @@ -654,15 +654,15 @@ Registry.prototype.get = function get (name, cb) { } //Get last item - so it works in XP where REG QUERY returns with a header - var item = items[items.length-1] || '' + var item = items.at(-1) || '' , match = ITEM_PATTERN.exec(item) , name , type , value if (match) { - name = match[1].trim(); - type = match[2].trim(); + name = match[1]; + type = match[2]; value = match[3]; result = new RegistryItem(self.host, self.hive, self.key, name, type, value, self.arch); }