Write Registry

Got a problem you cannot solve? Try here.
paulga
Posts: 17
Joined: Thu Aug 10, 2006 6:50 am
Location: England

Write Registry

Postby paulga » Thu Aug 10, 2006 7:26 am

Hi,

During installation I need to be able to check to see if a certain registry value under a key exists 'thevalue' , if it doesn't I will create it, if it does I will create another value 'thevaluetokeep' and give it the data copied from 'thevalue', I will then put new data in 'thevalue', this all works fine.

However I want to reverse this process on an uninstall to put things back as they were. I have tried to do a Write Registry under the Perform Uninstallation region after the Apply Uninstall command which doesn't seem to work.

Is it possible to write to the registry from this region? As I know the syntax is correct.

Thanks

Paul

Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Postby Gizm0 » Thu Aug 10, 2006 8:04 am

You have to put it BEFORE the Apply Uninstall command.
Then it will work fine..
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation

paulga
Posts: 17
Joined: Thu Aug 10, 2006 6:50 am
Location: England

Postby paulga » Thu Aug 10, 2006 9:21 am

thanks for the reply,

I tried moving it before Apply uninstall but it still won't write to the registry. I can delete a value from the same point but not write a value.

Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Postby Gizm0 » Thu Aug 10, 2006 4:17 pm

Can you post your script here?
Panagiotis Kefalidis

Software Design Team Lead

\"In order to succeed, your desire for success should be greater than your fear of failure\"

InstallAware Software Corporation

paulga
Posts: 17
Joined: Thu Aug 10, 2006 6:50 am
Location: England

Postby paulga » Fri Aug 11, 2006 3:17 am

Hi,

here is some of the script which I've tried to prune down:

[DEFINE REGION: Perform Uninstallation]
Comment: Uninstall product
Comment: TO-DO: Insert any additional uninstall commands here

Set Variable checkoldxvalue to
Check Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\oldx into checkoldxvalue

if Variable checkoldxvalue not Equals NO$VALUE
Comment: Value detected, better get it
Set Variable oldxval to

Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\oldx into oldxval

Write Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\val, $oldxkval$ (permanent)

Comment: now delete oldx
Delete Registry VALUE HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\oldx
end


Apply Uninstall (get result into variable SUCCESS)

Set Variable PROGRESS to 100


else
<<Code Folding Region>>


I have stepped through the code and it appears to be doing the correct things but without the results.

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Fri Aug 11, 2006 5:46 am

Please read the help file section titled "Setup Commands Preceding Apply Uninstall". This answers your exact question.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

paulga
Posts: 17
Joined: Thu Aug 10, 2006 6:50 am
Location: England

Postby paulga » Fri Aug 11, 2006 6:28 am

I've just read that and that was one of the reasons I originally placed commands after the Apply Uninstall command. Does this explain why things that I try and write to the registry never appear?

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Fri Aug 11, 2006 4:31 pm

If you want to write to the registry, you will need to do so before the Apply Install command, and make sure Apply Install executes. And any time your setup is being uninstalled, i.e. when Apply Uninstall is called, these changes will be removed.

I'm afraid there isn't a way to restore the former registry keys at uninstall time within the confines of Windows Installer. What you can do is use the Call DLL Function command to call a pre-existing DLL you may already have, which would restore those keys. You could call Run Program if you have an EXE that would restore these keys. Alternately, you could write an InstallAware plug-in to save and restore those keys. Whichever way you find easiest...
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

paulga
Posts: 17
Joined: Thu Aug 10, 2006 6:50 am
Location: England

Postby paulga » Mon Aug 14, 2006 2:18 am

ok thanks Michael.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 50 guests