Install/Remove Does Not Execute

Got a problem you cannot solve? Try here.
Post Reply
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Install/Remove Does Not Execute

Post by dziebarth »

Hi:

It seems that the code:
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)

Does not run the uninstaller in the same way that the following does:
Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into OLDINSTALLER
Run Program $OLDINSTALLER$ REMOVE=TRUE MODIFY=FALSE REPAIR=FALSE (WAIT, get result into variable OLDINSTALLRESULT)

The problem is that under Vista and later the registry entry is not available so I need to use the (Un)Install MSI Package MSI code.

What is behind the question is that we have a installer/uninstaller helper DLL which gets called (using rundll32) to remove printer instances as a part of removing / upgradeing the package, but for some reason the uninstall does not execute the code. When I manually launch the uninstall it works fine - the problem is only when I launch the uninstall from MSI code.

Is there something I am missing about how the IA script is executed when launched from a script versus manually or through "Run Program"?

Thanks!
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Install/Remove Does Not Execute

Post by giaviv »

Hi,

It should definitely be the same. Note that the (Un)Install MSI Setup will run the uninstaller silently, so messagebox and so forth won't be displayed.
How are you determining that your DLL doesn't run?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

I know that the code is not being run because I have debug trace output coming from the helper DLL (DbgView is used to catch them). I also put 30 second delays in the helper DLL code so that I could attach a debugger, but the uninstall obviously is not calling the DLL because the uninstall takes about 2 seconds to execute (based on the log file generated during the uninstall). Also the printer instances remain.

I set a breakpoint in IA code right after the (Un)Install MSI Setup and look at the printer instances and ARP. The ARP shows that the old package was removed so that makes sense.

Is there any way to turn off the silent part of the uninstall when launching it from "(Un)Install MSI Setup"? (i.e. some sort of "verbose" mode as occurs when it is launched through the "Run Program" code?) Is there another registry entry that can be used to find the uninstall exe in Vista and later OSes?

Here is the code in the Uninstall section:
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
MessageBox: Uninstalling, About to call UninstallOEMEx.
Comment: TO-DO: Insert any additional uninstall commands here
Run Program $WINSYSDIR$\RunDLL32.exe "$WINSYSDIR$\Fgfinst.dll" ,UninstallOEMEx $strDriverName$,#strCompany# (WAIT)
Read Registry Key HKLM\$RootKey$\Drivers\$TITLE$\ErrorCode into retResult
MessageBox: Uninstalling, UninstallOEMEx returned $retResult$
if Variable retResult Equals 0
Apply Uninstall (get result into variable SUCCESS)
MessageBox: Uninstalling, Done with Uninstall.
Set Variable REBOOTCOMPUTER to FALSE
Set Variable PROGRESS to 100
else
MessageBox: Driver Remove Failure, Driver Removal Failure, retResult=$retResult$$NEWLINE$Reboot and retry uninstallation.
Terminate Installation
end
else
<<Code Folding Region>>
[DEFINE REGION: Perform First Time or Maintenance Installation]

(...)


Thanks for your help!
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Install/Remove Does Not Execute

Post by giaviv »

Hey,

Your best bet would be to write the value of the variable UNINSTALLSTRING, which holds the uninstaller location regardless of OS, in a registry path of your choice. Do this in the beginning of your installer, and read it later when necessary.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

OK, that works for this version and forward but it does not address upgrading from my old version to the new version I am currently creating.

Is there any registry in Vista and later from which I can get the uninstall string? Under XP it can be taken from the entry I listed in the original post, but I have not been able to find an entry under Vista and later which has the equivalent string.

Thanks!
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Install/Remove Does Not Execute

Post by giaviv »

That registry value exists in ALL versions of Windows.
What could be is that you are using a 64 Bit machine, and hence the value will be in:
HKLM\SOFTWARE\Wow6432\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCTCODE$\UninstallString
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

OK, that entry *is* out there on my 64 bit machine. So the following hopefully will work:

Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into OLDINSTALLER
if Variable OLDINSTALLER not Contains (Ignore Case) setup.exe
Read Registry Key HKLM\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into OLDINSTALLER
end
Run Program $OLDINSTALLER$ REMOVE=TRUE MODIFY=FALSE REPAIR=FALSE (WAIT, get result into variable OLDINSTALLRESULT)


Thanks for the help!
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

For some reason the registry entry is not read - it always comes back as empty even though I can see using regedit that the entry is indeed there.

Read Registry Key HKLM\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into OLDINSTALLER

The installer is in 64 bit mode at that point.

Is there something special I need to do to read the entry?
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

One clarification is that the entry was not read correctly from Vista-64, but was read correctly from Win7-64.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Install/Remove Does Not Execute

Post by giaviv »

That shouldn't be the case; could you please conduct a registry search with regedit and see if the registry values are placed in different locations on your machines?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

Hi:

I did in fact look for additional entrys. For some reason the Wow6432Node entry could not be read on Vista-64. I think what we will do is just is the following:

Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into OLDINSTALLER
if Variable OLDINSTALLER not Contains (Ignore Case) .exe
Read Registry Key HKLM\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into OLDINSTALLER
if Variable OLDINSTALLER not Contains (Ignore Case) .exe
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel "Add-Remove Programs" or "Programs and Features" before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
end
Run Program $OLDINSTALLER$ REMOVE=TRUE MODIFY=FALSE REPAIR=FALSE (WAIT, get result into variable OLDINSTALLRESULT)


I hate to give up on it but at this point it looks like this is the best we can do.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Install/Remove Does Not Execute

Post by giaviv »

Are you able to read the Wow6432 node in regedit? Is the entry there?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
dziebarth
Posts: 13
Joined: Thu Aug 03, 2006 3:08 pm

Re: Install/Remove Does Not Execute

Post by dziebarth »

Yes, I can see that the registry in Wow6432Node is there when I view it from Regedit. On Win7-64 the entry is read fine, on Vista-64 it is returned as an empty string.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Install/Remove Does Not Execute

Post by giaviv »

Interesting. Could it have to do with permissions somehow?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply