[Bug 12] New: The registry "exists" check failes on keys, only works for values

bugzilla-daemon at wpkg.org bugzilla-daemon at wpkg.org
Thu Dec 1 10:01:42 CET 2005


Please reply using this URL only: http://bugs.wpkg.org/show_bug.cgi?id=12

           Summary: The registry "exists" check failes on keys, only works
                    for values
           Product: WPKG
           Version: 0.9.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: wpkg.js
        AssignedTo: mangoo at mch.one.pl
        ReportedBy: kristofer.kiik at gmail.com


I needed to check an existance of a KEY, that has no values in it. Currently
wpkg.js registry "exists" check tries to lookup a key's VALUE and thus failes.

In order to accomplish this, i fixed getRegistryValue function:

=====
function getRegistryValue(keyName) {
    var WshShell = new ActiveXObject("WScript.Shell");
    var val;
    try {
        val = WshShell.RegRead(keyName);
    } catch (e) {
        val = null;
    }
	if (val == null)
	{
    try {
        val = WshShell.RegRead(keyName + "\\");
    } catch (e) {
        val = "";
    }

	}

    return val;
}
=====

Now, it returns:
* the value of a key, if there is one
* a NULL value if the specified key or value does not exist
* an empty value if you try to check for a key

I'm not a programmer, but it works for me. YMMV

-- 
Configure bugmail: http://bugs.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wpkg-users mailing list