michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * This script is intended to be run using xpcshell michael@0: */ michael@0: michael@0: const nsIWindowsRegKey = Components.interfaces.nsIWindowsRegKey; michael@0: const BASE_PATH = "SOFTWARE\\Mozilla\\Firefox"; michael@0: michael@0: function idump(indent, str) michael@0: { michael@0: for (var j = 0; j < indent; ++j) michael@0: dump(" "); michael@0: dump(str); michael@0: } michael@0: michael@0: function list_values(indent, key) { michael@0: idump(indent, "{\n"); michael@0: var count = key.valueCount; michael@0: for (var i = 0; i < count; ++i) { michael@0: var vn = key.getValueName(i); michael@0: var val = ""; michael@0: if (key.getValueType(vn) == nsIWindowsRegKey.TYPE_STRING) { michael@0: val = key.readStringValue(vn); michael@0: } michael@0: if (vn == "") michael@0: idump(indent + 1, "(Default): \"" + val + "\"\n"); michael@0: else michael@0: idump(indent + 1, vn + ": \"" + val + "\"\n"); michael@0: } michael@0: idump(indent, "}\n"); michael@0: } michael@0: michael@0: function list_children(indent, key) { michael@0: list_values(indent, key); michael@0: michael@0: var count = key.childCount; michael@0: for (var i = 0; i < count; ++i) { michael@0: var cn = key.getChildName(i); michael@0: idump(indent, "[" + cn + "]\n"); michael@0: list_children(indent + 1, key.openChild(cn, nsIWindowsRegKey.ACCESS_READ)); michael@0: } michael@0: } michael@0: michael@0: // enumerate everything under BASE_PATH michael@0: var key = Components.classes["@mozilla.org/windows-registry-key;1"]. michael@0: createInstance(nsIWindowsRegKey); michael@0: key.open(nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, BASE_PATH, michael@0: nsIWindowsRegKey.ACCESS_READ); michael@0: list_children(1, key); michael@0: michael@0: key.close(); michael@0: key.open(nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, BASE_PATH, michael@0: nsIWindowsRegKey.ACCESS_READ); michael@0: list_children(1, key);