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





------- Additional Comments From [EMAIL PROTECTED]  2006-09-02 10:17 -------
(In reply to comment #5)
> Hi, I tried it and it doesn't work for me :)
> 
> I have the following packages.xml entry, which launches notepad:
> 
> <package id="notepad" name="notepad">
>   <check type="registry" condition="exists"
> path="HKLM\HARDWARE\DESCRIPTION\System" />
>   <install cmd='notepad' />
> </package>
> 
> As you can see on the screenshot, it exists:
> 
> http://wpkg.org/regedit.png
> 
> However:
> 
> Checking presence of notepad; registry check condition failed !
> Installing notepad...
> 
> Of course, if I change it to the "full key"
> ("HKLM\HARDWARE\DESCRIPTION\System\Identifier"), it's recognized properly.
> 
> 
> Other option is I don't understand the idea of it :)
> 
> (well, I currently run WPKG in Wine on Linux, so it may not work as on Windows
> natively, too).

You're specifying a key without a value assigned to it.  If you open regedit 
and look at any key (not value) that key will have an entry called (Default).  
This entry determines whether there is a value associated with the key or not.  
If the (Default) says (value not set) it means there's no corresponding default 
value for the key itself.

Here's a VB function that was posted by one of the MS MVP guys on USENET that 
checks for the existence of a key:

Function RegKeyExists(ByVal sRegKey)
    ' Returns True or False based on the existence of a registry key.

    Dim sDescription, oShell
    Set oShell = CreateObject("WScript.Shell")

    RegKeyExists = True
    sRegKey = Trim (sRegKey)
    If Not Right(sRegKey, 1) = "\" Then
      sRegKey = sRegKey & "\"
    End If

    On Error Resume Next
    oShell.RegRead "HKEYNotAKey\"
    sDescription = Replace(Err.Description, "HKEYNotAKey\", "")

    Err.Clear
    oShell.RegRead sRegKey
    RegKeyExists = sDescription <> Replace(Err.Description, sRegKey, "")
    On Error Goto 0
End Function

Since I'm not much of a VB scripter myself, although I've been writing Windows 
apps since the 1.x days of Windows, I can't completely verify that it works.  
Based on my crude understanding of VB, though, it does a test failure, strips 
the key from the error description, tests the key you're looking for, strips 
the key from that error description, then compares the two error descriptions.  
Seems a bit like overkill to me (since in the Win32 API you just call 
RegQueryKey() and then test for failure) but it looks like it works.


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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
wpkg-users mailing list
wpkg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wpkg-users

Reply via email to