This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Creating a REG_MULTI_SZ key in registry during installation
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Sep 07, 2008
04:11 AM
Creating a REG_MULTI_SZ key in registry during installation
Hi,
During installations I need to create a couple of keys in the registry.
Installanywhere can handle STRING,DWORD and BINARY values, but I need a REG_MULTI_SZ value.
Does any one have any idea how to do it?
10x
Alon
During installations I need to create a couple of keys in the registry.
Installanywhere can handle STRING,DWORD and BINARY values, but I need a REG_MULTI_SZ value.
Does any one have any idea how to do it?
10x
Alon
(7) Replies
‎Sep 08, 2008
12:13 PM
If the multi-string data are constant, perhaps you could export a .reg file from regedit on your system, and then from the installer run the command regedit.exe /s filename.reg. There might need to be another action to remove the data during uninstall.
If the data are dynamic, perhaps you could use the Win32RegistryService methods in a custom code action.
If the data are dynamic, perhaps you could use the Win32RegistryService methods in a custom code action.
‎Sep 08, 2008
12:46 PM
The data is dynamic so the first option in not good.
Java doesn't support adding this type of data(REG_MULTI_SZ)to the registry for that you need to use the jni and I'm trying to avoid it.
Any other solution?
Java doesn't support adding this type of data(REG_MULTI_SZ)to the registry for that you need to use the jni and I'm trying to avoid it.
Any other solution?
‎Sep 08, 2008
12:50 PM
Actually, the Win32RegistryService interface (please see the javadoc API documentation) should take care of the JNI part, so you can write the code using just Java...
‎Sep 08, 2008
12:53 PM
I'm really just an amateur when it's gets to Java. and what I said its what I understood from google 😮 . can you please explain what you mean?
don't I need to write a code in lets say c++ and than call it from Java- isn't that what jni means?
don't I need to write a code in lets say c++ and than call it from Java- isn't that what jni means?
‎Sep 08, 2008
01:05 PM
That is correct about JNI in general, but much of the InstallAnywhere API is implemented such that you need to deal with only the Java interface in your custom code actions; the JNI for the IA API is invisibly called in the background...
‎Sep 08, 2008
01:32 PM
Code for an action using the service might look like this:
[code]import com.zerog.ia.api.pub.*;
import com.installshield.wizard.service.*;
import com.installshield.wizard.platform.win32.*;
public class TestWin32Registry extends CustomCodeAction
{
public void install(InstallerProxy ip) throws InstallException
{
// get an instance of the service
Win32RegistryService winregsvc =
(Win32RegistryService)ip.getService(Win32RegistryService.class);
try {
// create the key first...
winregsvc.createKey(
Win32RegistryService.HKEY_CLASSES_ROOT,
"", "...MyKeyName");
// ...then create values inside it
winregsvc.setMultiStringValue(
Win32RegistryService.HKEY_CLASSES_ROOT,
"...MyKeyName", "MyValueName",
new String[] { "aaa", "bbb", "ccc", "ddd", "eee" });
} catch (ServiceException drat) { drat.printStackTrace( ); }
}
public void uninstall(UninstallerProxy up) throws InstallException
{
// TO DO: handle uninstallation...
}
public String getInstallStatusMessage( ) { return "Writing registry values..."; }
public String getUninstallStatusMessage( ) { return "Nothing..."; }
}[/code]
You'll need IAClasses.zip, resource\services\services.jar, and resource\services\ppk\windowsppk.jar on the compiler build path.
In the project, you'll also need to select Project > Java > Add service support for custom code.
After that, you should be able to add the packaged custom class to your project, and the JNI code behind Win32RegistryService should create the data for you...
[code]import com.zerog.ia.api.pub.*;
import com.installshield.wizard.service.*;
import com.installshield.wizard.platform.win32.*;
public class TestWin32Registry extends CustomCodeAction
{
public void install(InstallerProxy ip) throws InstallException
{
// get an instance of the service
Win32RegistryService winregsvc =
(Win32RegistryService)ip.getService(Win32RegistryService.class);
try {
// create the key first...
winregsvc.createKey(
Win32RegistryService.HKEY_CLASSES_ROOT,
"", "...MyKeyName");
// ...then create values inside it
winregsvc.setMultiStringValue(
Win32RegistryService.HKEY_CLASSES_ROOT,
"...MyKeyName", "MyValueName",
new String[] { "aaa", "bbb", "ccc", "ddd", "eee" });
} catch (ServiceException drat) { drat.printStackTrace( ); }
}
public void uninstall(UninstallerProxy up) throws InstallException
{
// TO DO: handle uninstallation...
}
public String getInstallStatusMessage( ) { return "Writing registry values..."; }
public String getUninstallStatusMessage( ) { return "Nothing..."; }
}[/code]
You'll need IAClasses.zip, resource\services\services.jar, and resource\services\ppk\windowsppk.jar on the compiler build path.
In the project, you'll also need to select Project > Java > Add service support for custom code.
After that, you should be able to add the packaged custom class to your project, and the JNI code behind Win32RegistryService should create the data for you...