[izpack-devel] Writing a TopLevel Registry Key...

Bartz, Klaus Klaus.Bartz at coi.de
Tue Nov 28 16:13:51 CET 2006

Hi Markus,
in fact the registry stuff is an example for the custom action stuff. A more complicated and more
functional as the simple one. It is a more or less fast port of the stuff I have written for our installations
(about that the changed package path).
I have blocked root changes because there are some roots where nobody have to write (e.g. HKLM).
You know that HKCR is a merked view of HKLM/Software/Clases and HKCU/Software/Clases. A
HKCU key crossfade the HKLM one. Therefore you can set the needed keys.
I remember that I have read elsewhere that a setting at toplevel should not be performed. But in the
moment I do not know where and whether it should be so only in old OS versions or not.
Therefore I have no pricipiell problem to change it, I have only less time.
The native part will be not a big problem because I have written it.

-----Original Message-----
From: izpack-devel-bounces at lists.berlios.de [mailto:izpack-devel-bounces at lists.berlios.de]On Behalf Of Markus Schlegel
Sent: Tuesday, November 28, 2006 12:09 PM
To: izpack-devel at lists.berlios.de
Subject: [izpack-devel] Writing a TopLevel Registry Key...

Our Application requires wirting Toplevel keys to the Windows Registry for File-ending and URL-Protocol Registration.
For Example we have to write a Key "HKCR\.xte". While this should be a very common task for an Installer operation in Windows, this is not supported with the current release of IzPack (3.9.0).
First of all, when defining such an entry in the RegistrySpec.xml file, it just stops writing to the registry with an error, but no Error-Text, because the Native Exception is wrapped by a "WrappedNativeException" which has no Message anymore. Thus its very annoying to track down the reason of this failure. 
I have fixed this (give the message to the WrappedNativeExcpetion). 
I then took a look into the implementation (RegistryImpl.java) and found out, that there is no good reason why setting a toplevel RegistryKey should be "forbidden". So I enhanced the code in RegistryImpl to accept TopLevel Registry Keys.
The remaining problem is now, that it seems not possible to remove such Toplevel Keys from the registry at uninstallation. Without a modification of "RegistryImpl.deleteKeyIfEmpty()", I get the following Exception on uninstallation:
(from native Method "RegistryImpl.deleteKeyN()")
...WrappedNativeException: Der Registry-Schlüssel HKCR\.xte konnte nicht gelöscht werden.
Fehlernummer des Betriebssystems: 2
Fehlertext des Betriebssystems: Das System kann die angegebene Datei nicht finden.
I now made a temporary solution for this by not trying to delete toplevel keys at all. But I think this could be solved inside the native code. Maybe someone of you who knows the native code could fix this?
Markus Schlegel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/izpack-devel/attachments/20061128/14cbfa8b/attachment.html 

More information about the izpack-devel mailing list