Modifying the system registry
Previous Top Next


OPTIONAL_KEYFLAGS

By default, registry keys listed in .threg files remain virtual (no modifications are made to the system registry). Optional key flags allow you to modify the system registry for applications that need to interact with other applications in the manner - for example, interaction with Windows Explorer. To create an installation that modifies the system registry the following steps should be followed:

1. Create a text file using notepad or any text editor, the format of the text file is discussed here.
2. For keys that you wish to have effect the system registry, append one or more of the flags below to the end of the key name. See below for an example.
3. Save the text file on your hard drive with the filename extension of ".threg". The filename can be anything you want.
4. Add the .threg file to your Thinstall project as a file.
5. During build, Thinstall will convert the .threg file into virtual registry files and the .threg will not be an actual virtual file.

Optional virtual registry key defined


Optional flag name
Effect of Flag


create_on_install

Thinstall will create the registry key (and all subkeys) in the real system registry when the program installer is run. If Thinstall's installer is disabled, this flag will have no effect. If the registry key cannot be created for any reason, the operation will silently fail. If the registry key already exists, any previous values will be overwritten with values specified in this file.



create_on_start

Thinstall will create the registry key (and all subkeys) in the real system registry every time the program is run. If the registry key cannot be created for any reason, the operation will silently fail. If the registry key already exist, any previous values will be overwritten with values specified in this file.




remove_on_uninstall

Thinstall will add the registry key to the uninstall_log file, for removal from the real system registry when the application is uninstalled. If the registry key was not created by Thinstall (it was pre-existing), the registry key will not be added to the uninstall_log file. Only newly created Registry keys by Thinstall will be marked for uninstall removal. During uninstall, all registry keys in the uninstall_log file will be removed. If any key fails to be removed, the operation will silently fail.




remove_on_end

Thinstall will remove the registry key when the application exits. If the registry key was not created by Thinstall (it was pre-existing), the registry key will not be removed on exit. Only newly created Registry keys by Thinstall will be marked for removal when the program exits. If the program crashes or is prematurely terminated, the registry key will not be deleted. If any key fails to be removed, the operation will silently fail.




Examples:

The following .threg file adds the installation path to the real system registry during install, and removes the key on uninstall. Thinstall's installer must be enabled before the registry key will be created.


HKEY_LOCAL_MACHINE\Software\mycompany\mysoftware create_on_install remove_on_uninstall
{
value "InstallationPath" 01 "%InstallPath%"
}



The following .threg file makes the same registry key available to your application, but the system registry is not modified.


HKEY_LOCAL_MACHINE\Software\mycompany\mysoftware
{
value "InstallationPath" 01 "%InstallPath%"
}



Notes:

· %InstallPath% is a macro which is expanded by Thinstall. Click here for a list of macros available in .threg files.

· Registry Key names that have spaces in them need to be surrounded by quotes like this:

"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\App Paths\My application" create_on_install remove_on_uninstall
{
value "InstallationPath" 01 "%InstallPath%"
}



See Also
How to install file type icons.