[izpack-user] Unable to write in Windows Registry (under HKLM/SOFTWARE)

750 views
Skip to first unread message

Federico Bortolomiol

unread,
Nov 6, 2013, 7:26:23 AM11/6/13
to us...@izpack.codehaus.org
I'm facing some troubles with Windows Registry. I'm not able to write any key under HKLM/SOFTWARE, despite Uninstall key is placed properly under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.
I'm using izPack 5.0.0 RC1 in Windows 64bit machine.
Please give me some suggestion to solve this issue.
Here is required code i put in install.xml:

<listeners>
    <listener classname="RegistryInstallerListener" stage="install">
       <os family="windows"/>
     </listener>
     <listener classname="RegistryUninstallerListener" stage="uninstall">
       <os family="windows"/>
     </listener>
</listeners>


<natives>
     <native type="izpack" name="ShellLink.dll"/>
     <native type="izpack" name="ShellLink_x64.dll"/>
     <native type="3rdparty" name="COIOSHelper_x64.dll" stage="both">
        <os family="windows"/>
     </native>
</natives>



<resources>
    ...
   <res src="res/RegistrySpec.xml" id="RegistrySpec.xml"/>
</resources>


RegistrySpec.xml is attached.

--

Ing. Federico Bortolomiol

System Engineer

M B M Italia S.r.l.

Via Pellizzo 14/A - 35128 Padova

Email f.bort...@mbm.it

Phone   +39.049.9080741    Fax   +39.049.2106668
WEB     www.mbm.it
RegistrySpec_cut.xml

Paul Bors

unread,
Nov 6, 2013, 9:31:17 AM11/6/13
to us...@izpack.codehaus.org

I think is just your registry specs encoding…

 

I have the following natives:

<!-- The native libraries to add -->

    <natives>

        <native type="izpack"   name="ShellLink.dll"/>

        <native type="izpack"   name="ShellLink_x64.dll"/>

        <native type="izpack"   name="WinSetupAPI.dll"/>

        <native type="izpack"   name="WinSetupAPI_x64.dll"/>

        <native type="3rdparty" name="COIOSHelper.dll"          stage="both">

            <os family="windows"/>

        </native>

        <native type="3rdparty" name="COIOSHelper_x64.dll"      stage="both">

            <os family="windows"/>

        </native>

    </natives>

 

With the attached registry specs that works fine on Windows x86 and x64 (do notice the encoding of it set for UTF-8):

 

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!--

    ATTENTION!!! do not edit with an editor which do not handle UTF-8 in a right manner!!

    Storing with a wrong editor can crash this file!

    Registry definition file for IzPack Installation.

    $Id$

-->

 

<izpack:registry version="5.0"

                 xmlns:izpack="http://izpack.org/schema/registry"

                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                 xsi:schemaLocation="http://izpack.org/schema/registry http://izpack.org/schema/5.0/izpack-registry-5.0.xsd">

                

    <pack name="UninstallStuff">

        <!-- Special "pack", if not defined an uninstall key will be generated automatically -->

        <!-- The variable $UNINSTALL_NAME can be only used if CheckedHelloPanel will be used

               because there the variable will be declared. With that variabel it is possible

               to install more as one instances of the product on one machine each with an

               unique uninstall key. -->

        <value name="DisplayName"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="$APP_NAME" />

        <value name="DisplayVersion"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="$APP_VER (r${buildNumber})" />

        <value name="UninstallString"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="&quot;$JAVA_HOME\bin\javaw.exe&quot; -jar &quot;$INSTALL_PATH\uninstaller\uninstaller.jar&quot; -f -x" />

        <value name="DisplayIcon"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="$INSTALL_PATH\Uninstaller\uninstaller.ico" />

        <value name="HelpLink"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="$APP_URL" />

        <value name="ServiceName"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="${console.serviceName}" />

        <value name="InstallPath"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="$INSTALL_PATH" />

        <value name="Publisher"

            keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$APP_NAME $APP_VER"

            root="HKLM"

            string="My Comp Software Inc." />

    </pack>

</izpack:registry>

Federico Bortolomiol

unread,
Nov 6, 2013, 11:00:59 AM11/6/13
to us...@izpack.codehaus.org
Thank you for quick reply but it not helps me.
I have used your RegistrySpec.xml code but if i add a pack like the following one the keys are not placed in the registry.
<pack name="OtherStuff">
        <value name="Name"
           keypath="SOFTWARE\XXX\yyy"
           root="HKLM"
           string="$UNINSTALL_NAME" />
        <value name="Version"
            keypath="SOFTWARE\XXX\yyy"
            root="HKLM"
            string="$APP_VER" />
    </pack>



I remember you that i want ot write under HKLM/SOFTWARE as izpack made creating the key HKEY_LOCAL_MACHINE\SOFTWARE\IzForge\IzPack\IzPack 5.0.0-rc1
I checked that the format was "UTF-8 w/o BOM" in every file.
I'm using izPack 5.0.0 RC1, have you try with that version?


2013/11/6 Paul Bors <pa...@bors.ws>

Paul Bors

unread,
Nov 6, 2013, 2:40:49 PM11/6/13
to us...@izpack.codehaus.org

I’m still on izPack 5.0.0-beta11 but my use-case is different from yours. I do not use a second pack.

 

Most likely your pack name must match a defined package inside your intall.xml instead of OtherStuff.

 

ie:

<packs>

        <pack name="GlassFish Server" required="yes" preselected="yes" hidden="true">

            <description>

                GlassFish Server is the world's first implementation of the Java

                Platform, Enterprise Edition (Java EE) 6 specification which delivers

                a flexible, lightweight, and production-ready Java EE 6 application

                server.

               

                For more details please see

                https://GlassFish.Java.net

            </description>

            <fileset dir="" targetdir="$INSTALL_PATH">

                <include name="glassfish/**" />

                <include name="drivers/*.jar" />

                <include name="Uninstaller/*.ico" />

            </fileset>

        </pack>

       …

</packs>

 

Then I would expect your RegistrySpecs.xml to have something like:

    <pack name="GlassFish Server">


        <value name="Name"
           keypath="SOFTWARE\XXX\yyy"
           root="HKLM"
           string="$UNINSTALL_NAME" />
        <value name="Version"
            keypath="SOFTWARE\XXX\yyy"
            root="HKLM"
            string="$APP_VER" />
    </pack>

 

Again, this is just my guess as I haven’t looked over izPack’s code nor have I tried this. I deducted this from the older outdated documentation at:

http://izpack.org/documentation/custom-actions.html#extended-uninstall-key

Which states that UninstallerStuff is a build in package (the generated uninstaller).

 

See also the newer documentation at:

http://docs.codehaus.org/pages/viewpage.action?pageId=142803064#id-(CustomActions)-CustomActionTypes

 

I suggest you look over izPack’s code and post back with your solution.

 

~ Thank you,

    Paul Bors

Federico Bortolomiol

unread,
Nov 7, 2013, 3:47:32 AM11/7/13
to us...@izpack.codehaus.org
It works!!!! It's necessary that attribute name in pack tag is matched in install.xml.
Thank you so much Paul!

Bye

Bartz, Klaus

unread,
Nov 7, 2013, 7:15:01 AM11/7/13
to us...@izpack.codehaus.org

Hi Federico,

this was made because only the registry entries for installed packs should by set. An exception is the virtual pack “UninstallStuff” which will be always assumed as defined and installed.

 

Cheers

 

Klaus

Reply all
Reply to author
Forward
0 new messages