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
- :
- InstallShield
- :
- InstallShield Forum
- :
- Run script (or something) on uninstall??
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 07, 2008
09:52 AM
Run script (or something) on uninstall??
My install package modifies a registry key that needs to be set back to a certain value on uninstall. However, uninstalling deletes the key entirely. How can I write a default value back to the key instead of deleting it during an uninstall?
(15) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 10, 2008
10:38 AM
Nothing?? Do the macrovision employees not even peruse this forum??
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 10, 2008
02:21 PM
Are you using InstallScript or MSI?
ME
ME
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 10, 2008
03:37 PM
MarkEarle wrote:
Are you using InstallScript or MSI?
ME
Thanks for the response...
Im trying to create an MSI for a deployment.... "Basic MSI Project" if that answers your question.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 10, 2008
03:55 PM
Okay,
Here we go. I am going to assume you defined this registry key and associated it to a Component. Navigate to the Component => Registry Data and find the key you want to have as permanent. Create a dummy value as this will allow the key to get created or modified but not removed during uninstallation. To make the key permanent you create a dummy value named with the plus + sign and do not enter any value data. That's it.
Hope this helps you. 🙂
Cheers,
ME
Here we go. I am going to assume you defined this registry key and associated it to a Component. Navigate to the Component => Registry Data and find the key you want to have as permanent. Create a dummy value as this will allow the key to get created or modified but not removed during uninstallation. To make the key permanent you create a dummy value named with the plus + sign and do not enter any value data. That's it.
Hope this helps you. 🙂
Cheers,
ME
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 10, 2008
04:14 PM
MarkEarle wrote:
Okay,
Here we go. I am going to assume you defined this registry key and associated it to a Component. Navigate to the Component => Registry Data and find the key you want to have as permanent. Create a dummy value as this will allow the key to get created or modified but not removed during uninstallation. To make the key permanent you create a dummy value named with the plus + sign and do not enter any value data. That's it.
Hope this helps you. 🙂
Cheers,
ME
Im sorry, you lost me there. The value I need to set back is a value that existed before the install. Make sense? The key specifically is the Userinit key that origionally runs "userinit.exe". My install simply replaces that value, but upon uninstall the entire key is removed. Which obviously prevents the GUI (explorer.exe) from loading at all.
Im looking in component view at the ISRegistryComponent and I see where my value is defined in there but Im not sure I understand where/how I should be creating a "dummy" value.
I very much appreciate your help by the way!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 10, 2008
04:54 PM
I see the option to set is as permenant, which looks like it will prevent it from being deleted. However, I still dont see how to set it back to its original value.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 11, 2008
07:20 AM
ZenDragon,
I am more familiar with InstallScript so I can give you a very simple way of doing this with a couple InstallScript functions that can be called in a custom action.
Instead of adding the registry key to the Component make your changes in the script.
These are really basic functions with minimal error checking so you should tweak them if you use them at all. Then you have to add the custom actions in you MSI project. I have quoted the instructions from Macrovision below:
And there you go. When you use Disable( LOGGING )/Enable( LOGGING ) the installation doesn't know anything about the actions you took so it is up to you to ensure you fix whatever you changed. In this case if you make or change a registry value it doesn't get removed or reset.
I know it was long winded but I hope it helps.
Cheers,
ME
I am more familiar with InstallScript so I can give you a very simple way of doing this with a couple InstallScript functions that can be called in a custom action.
Instead of adding the registry key to the Component make your changes in the script.
export prototype _UpdateRegValue( HWND );
export prototype _ResetRegValue( HWND );
function _UpdateRegValue( hMSI )
NUMBER nResult, nvType, nvSize;
STRING szKey, szName, svValue;
begin
Disable( LOGGING );
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
nResult = RegDBGetKeyValueEx( szKey, szName, nvType, svValue, nvSize );
if( nResult = 0 ) then
// Save the value of the key somewhere. The value is returned in svValue...
// Set your value now...
svValue =;
nResult = RegDBSetKeyValueEx( szKey, szName, nvType, svValue, nvSize );
if( nResult = 0 ) then
SprintfBox( INFORMATION, "", "Successfully inserted %s registry information", szName );
else
SprintfBox( WARNING, "Insertion of registry information for %s failed(%lu)", szName, nResult );
endif;
else
// Failure path...
endif;
Enable( LOGGING );
end;
function _ResetRegValue( hMSI )
NUMBER nResult, nvType, nvSize;
STRING szKey, szName, svValue;
begin
Disable( LOGGING );
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
// Reset your value now from where you saved it...
svValue =;
nResult = RegDBSetKeyValueEx( szKey, szName, nvType, svValue, nvSize );
if( nResult = 0 ) then
SprintfBox( INFORMATION, "", "Successfully reset %s registry information", szName );
else
SprintfBox( WARNING, "Reset of registry information for %s failed(%lu)", szName, nResult );
endif;
Enable( LOGGING );
end;
These are really basic functions with minimal error checking so you should tweak them if you use them at all. Then you have to add the custom actions in you MSI project. I have quoted the instructions from Macrovision below:
To Do: Create a custom action for this entry-point function:
1. Right-click on "Custom Actions" in the Sequences/Actions view.
2. Select "Custom Action Wizard" from the context menu.
3. Proceed through the wizard and give the custom action a unique name.
4. Select "Run InstallScript code" for the custom action type, and in
the next panel select "MyFunction" (or the new name of the entry-
point function) for the source.
5. Click Next, accepting the default selections until the wizard
creates the custom action.
Once you have made a custom action, you must execute it in your setup by
inserting it into a sequence or making it the result of a dialog's
control event.
And there you go. When you use Disable( LOGGING )/Enable( LOGGING ) the installation doesn't know anything about the actions you took so it is up to you to ensure you fix whatever you changed. In this case if you make or change a registry value it doesn't get removed or reset.
I know it was long winded but I hope it helps.
Cheers,
ME
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 11, 2008
11:25 AM
Pardon my ignorance... but I still dont see how it is running that on "uninstall". All I need to do is set the reg value back to "userinit.exe" when the user uninstalls the package. The actual setting of the registry value works fine.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 11, 2008
11:48 AM
Please see this newsletter tip for information on conditions that identify installation and uninstallation (PDF warning): http://www.macrovision.com/webdocuments/PDF/msiconditions.pdf.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 11, 2008
11:55 AM
What you have to do is call the custom action you created just before InstallFinalize. The InstallFinalize action is the last transacted action taken by the installation package. If you look up InstallFinalize in the help files it will give you more information. So the steps are:
[LIST=1]
Add a script file to your project and craft your exported functions.
Create a custom action as per the instructions from my last post that calls the functions.
Move that action to just before InstallFinalize so it is the second last thing your package does. Make sure you have figured out if you are installing/uninstalling or you may get bad results.
Cheers,
ME
[LIST=1]
Cheers,
ME
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 11, 2008
01:16 PM
I must be doing something wrong here... I went to install sscript and created a new script with the aformentioned code. I then went through the custom action process and created an action. However when I try to build the msi I get an error message "Error compiling Setup.rul. Setup.rul is required to be included in the project..."
I dont mind doing it this why but I dont understand why this has to be so complicated. Im fairly new with this poduct in general, and I know NOTHING about InstallScript, I was hoping all of this could be done through the gui. I dont want to overcomplicate this and not be able to troubleshoot when something goes wrong.
Anyhow, again I very much appreciate your assistance.
UPDATE: I worked through that issue. Just had to rename my rul file back to setup.rul which I guess is what its expecting. Anyhow if I try to compile the rul file or build another msi I get the following errors fromt he script:
C:\Files\Setup\FMI Login Banner\script files\setup.rul(8) : error C8025: 'Disable' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(9) : error C8025: 'RegDBSetDefaultRoot' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(10) : error C8025: 'RegDBGetKeyValueEx' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(10) : error C8041: '(' : function type required
C:\Files\Setup\FMI Login Banner\script files\setup.rul(16) : error C8025: 'RegDBSetKeyValueEx' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(16) : error C8041: '(' : function type required
C:\Files\Setup\FMI Login Banner\script files\setup.rul(18) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(20) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(25) : error C8025: 'Enable' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(32) : error C8025: 'Disable' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(33) : error C8025: 'RegDBSetDefaultRoot' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(37) : error C8025: 'RegDBSetKeyValueEx' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(37) : error C8041: '(' : function type required
C:\Files\Setup\FMI Login Banner\script files\setup.rul(39) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(41) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(43) : error C8025: 'Enable' : undefined identifier
I dont mind doing it this why but I dont understand why this has to be so complicated. Im fairly new with this poduct in general, and I know NOTHING about InstallScript, I was hoping all of this could be done through the gui. I dont want to overcomplicate this and not be able to troubleshoot when something goes wrong.
Anyhow, again I very much appreciate your assistance.
UPDATE: I worked through that issue. Just had to rename my rul file back to setup.rul which I guess is what its expecting. Anyhow if I try to compile the rul file or build another msi I get the following errors fromt he script:
C:\Files\Setup\FMI Login Banner\script files\setup.rul(8) : error C8025: 'Disable' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(9) : error C8025: 'RegDBSetDefaultRoot' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(10) : error C8025: 'RegDBGetKeyValueEx' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(10) : error C8041: '(' : function type required
C:\Files\Setup\FMI Login Banner\script files\setup.rul(16) : error C8025: 'RegDBSetKeyValueEx' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(16) : error C8041: '(' : function type required
C:\Files\Setup\FMI Login Banner\script files\setup.rul(18) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(20) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(25) : error C8025: 'Enable' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(32) : error C8025: 'Disable' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(33) : error C8025: 'RegDBSetDefaultRoot' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(37) : error C8025: 'RegDBSetKeyValueEx' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(37) : error C8041: '(' : function type required
C:\Files\Setup\FMI Login Banner\script files\setup.rul(39) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(41) : error C8025: 'SprintfBox' : undefined identifier
C:\Files\Setup\FMI Login Banner\script files\setup.rul(43) : error C8025: 'Enable' : undefined identifier
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 12, 2008
03:13 PM
Anyone there?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 12, 2008
03:42 PM
Please verify that this line is at the top of your script:
#include "ifx.h"
The header file ifx.h contains prototypes for a large set of built-in InstallScript functions.
#include "ifx.h"
The header file ifx.h contains prototypes for a large set of built-in InstallScript functions.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 13, 2008
03:17 PM
RobertDickau wrote:
Please verify that this line is at the top of your script:
#include "ifx.h"
The header file ifx.h contains prototypes for a large set of built-in InstallScript functions.
That was it 🙂 Thanks, glad it was something simple.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 17, 2008
11:29 AM
ZenDragon,
Is it fixed? I was away for March Break so I couldn't reply? You got the IS master when Robert answered. Anyway hope the help worked.
Cheers,
ME
Is it fixed? I was away for March Break so I couldn't reply? You got the IS master when Robert answered. Anyway hope the help worked.
Cheers,
ME
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)