Declare the service :
let service = Cc["@shacknet.nu/winregistry;1"]
.getService(Ci.nsIWindowsRegistryService);
Oldest way :
let key = service.getKey(
Ci.nsIWindowsRegistryService.ROOT_KEY_LOCAL_MACHINE,
"Software\\Mozilla\\Firefox\\Crash Reporter\\EmailMe");
let answer = key.getValue();
key.close();
Older way :
let key = service.getKey(
"Software\\Mozilla\\Firefox\\Crash Reporter",
"EmailMe");
let answer = key.getValue();
key.close();
New and simplier :
let answer = service.getKey(
"Software\\Mozilla\\Firefox\\Crash Reporter",
"EmailMe");
I figure, this will work for 100% of the use cases right now. I was gonna get complicated with making another, more complete, interface for getting attributes of keys (ie. what was the root, path, and key name). But this early in the process, especially without requirements, I don't care about it :)
No comments:
Post a Comment