Shop

InstallShield
Advanced Installer
AdminStudio
more / weitere

InstallShield und AdminStudio Schulungen

weitere Infos

InstallShield InstallScript: Registry and INI Files

Note regarding InstallScript versions: The samples on this page have been developed with various versions of InstallShield. Some of them require a minimum InstallShield version or may only work in the one version they have been created for. Often it will be possible to make them compatible with other InstallShield versions.

Handle Multiline Registry Entries

For InstallShield 6:

These functions read or write multiline registry entries from/to registry. The lines are passed in a string list.

prototype RegDBSetMultiSZ(NUMBER,STRING,STRING,LIST);
prototype RegDBGetMultiSZ(NUMBER,STRING,STRING,LIST);

ZIP RegMultiSZ.zip   Written by Ingo Jache
File size: 1.269 bytes   Last update: 2000-05-26

For InstallShield 5:

Here is a function to add a value into a multi-line registry value on NT.

prototype RegAddMulti(STRING, STRING, STRING, STRING, NUMBER);

ZIP RegAddMulti.zip   Written by Elihu Rozen, enhanced by Joe Goeke
File size: 1.297 bytes

Copy an INI Section

This function copies an INI section from one file to another.

prototype CopyINISection (STRING, STRING, STRING, STRING);

Fix: Missing parameter added, and obsolete subroutine call removed.

ZIP copyini.zip   Written by Alan Frank
File size: 816 bytes   Last update: 05/31/1999

Copy a Registry Key

Here's a function that copies all the subkeys and values under a key into another key. To rename a key, call RegDBCopyKey on it, and then delete the original.
Note: InstallShield Professional 7 has a built in RegDBCopyKeys function.

prototype RegDBCopyKey(STRING, STRING, NUMBER);

ZIP copykey.zip   Written by Robert M. Dickau, InstallShield Software Corporation
File size: 1.976 bytes   Last update: 03/26/1999

Get the ClassID of a Control from Registry

This function provides the ability to specify a ControlName.Interface for any control and get the ClassId (GUID) of the control from the registry.

Use this function after the control(s) has been registered.

prototype GetCLSIDByName( NUMBER, STRING );

ZIP GetCLSIDByName.zip  Written by Paul Cronk, SoftWin Consulting, Inc.
File size: 3.004 bytes   Last update: 07/29/1999

Import Registry File

Import at run time

This function imports a .reg file and creates the specified entries with the InstallShield registry functions. The advantage of this method is, that the entries will be removed upon uninstall. If you merge the .reg file by starting RegEdit with LaunchAppAndWait, the entries will not be logged for uninstall.

Update: now handles all types of registry entries

prototype ProcessREGFile(STRING);

ZIP processregfile.zip    Written by David Somers based on a sample from an InstallShield Training Course, last modified by Dominick Moré
File size: 4.770 bytes   Last update: 2002-06-14

Import to .rul file at design time

Here is a tool (written in InstallScript) that will read a .reg file and generate a .rul file with RegDBSetKeyValueEx function calls. It handles most registry value types, including STRING_MULTI and STRING_EXPAND. However currently it doesn't handle BINARY properly.

ZIP ProcessRegFile2.zip    Written by Carl Bennett and Graham Pye
File size: 14.539 bytes   Last update: 2001-06-29

Import to .rge file at design time

This is a variant of the ProcessRegFile2 tool, but instead of a .rul file it creates a registry set .rge file. It takes in .reg files, and asks you for a .rge file to output to. It creates a new registry set and puts all your entries there. It does not do any text substitution.

ZIP ProcessRegFile3.zip    Written by Carl Bennett
File size: 13.812 bytes   Last update: 2001-06-29

Load a User Hive Under the HKEY_USERS Key

Typically only the HKEY_USERS hive for the currently logged on user is loaded and available for modification. If you want to add registry entries for other (or all) users of an NT box, you can use this DLL to load their hives into the registry.

Included in the ZIP is the DLL, a sample .rul file, a test program, and the Visual C++ source codes. The DLL does not require MFC.

ZIP UserHive.zip    Written by Radboud Platvoet
File size: 86.272 bytes   Last update: 2000-04-26

See also: Handle Files and Registry Entries in User Profiles

Mark Controls as Safe for Scripting and Safe for Initialization

This function provides the ability to specify a ControlName.Interface for any control(s) and using the ControlName.Interface to set Safe for Scripting and Safe for Initialization on the control in the registry.

A text file in the form of a Windows Profile file is used (Scripting.txt) for example which is read by ComponentSafety. The code reads the file using GetProfileString, parses out the Control.Interface value and gets the ClassId (GUID) for it from the registry. It then sets Safe for Scripting and Safe for Initialization on the ClassIdbased using the flags in the text file.

Use this function after the control(s) has been registered.

New version: You only have to specify the name; the GUID is retrieved automatically.

prototype ComponentSafety( NUMBER, NUMBER );

ZIP ComponentSafety.zip  Written by Paul Cronk, SoftWin Consulting, Inc.
File size: 4.847 bytes   Last update: 07/29/1999

RunOnceEx and RunEx Registry Keys

This is summary describes the functionality of the RunOnceEx and RunEx registry keys in Windows 98. It does not apply to other Windows versions.

Currently, the "Run" and "RunOnce" registry keys in Windows 98 execute commands when the shell starts. Several features have been added to make this more robust. The replacements are RunEx for Run and RunOnceEx for RunOnce. The main features for RunEx and RunOnceEx are described in the following list:

Status - A dialog box is displayed while the items contained in the registry key are being processed. The entries to be processed are grouped into sections and the dialog box highlights the current section being processed. You can disable the status dialog box feature.

Performance - The majority of the commands contained in the Run and RunOnce registry keys create separate processes, which is very inefficient. The RunEx and RunOnceEx registry keys do not create separate processes. The RunEx and RunOnceEx registry keys also support a dependency list of DLLs that remain loaded while either all the sections or some of the sections are being processed.

Error Handling - If an exception occurs while calling a function in a DLL, the exception is caught and an error dialog box is displayed to the user. You can suppress this error dialog box using a flag in the RunOnceEx registry key. You can also set a flag to enable log errors and execution of the RunOnceEx or RunEx registry keys.

Deterministic - The RunOnceEx and RunEx registry keys sort the entries and sections alphabetically to force a deterministic order. The RunOnce and Run registry keys do not wait until one entry is finished before starting the next entry, except for the items in the RunOnce registry key contained in the HKEY_LOCAL_MACHINE registry key.

The above information is based on article Q232487 in the Microsoft knowledge base.

Test if a Section Exists in an INI File

Look for a section in an INI file.

prototype stdmiscExistsSectionInInifile (STRING, STRING);

ZIP stdmiscexistssectionininifile.zip (1.048 Bytes)   Provided by Richard Lippmann

Update Environment in NT Registry

This function broadcasts a notification message that informs all applications about a change in the environment settings, e.g. addtions to the PATH.
This function only works on Windows NT 4.

Article Q100090 in the InstallShield Knowledge Base has also information about this topic.

prototype RefreshEnvironment()

ZIP RefreshEnvironment.zip (552 Bytes)    Provided by Paul Becker

 

 

 

English News Discussions Windows Installer Related Tools More Help InstallScript About InstallSite Shop Site Search
deutsch Neuigkeiten Diskussionsgruppen Windows Installer MSI FAQ Artikel     Shop Suche

Copyright © by InstallSite Stefan Krueger. All rights reserved. Legal information.
Impressum/Imprint Datenschutzerklärung/Privacy Policy
By using this site you agree to the license agreement. Webmaster contact