Archive: Removing MSI installation (Suggestion)


Removing MSI installation (Suggestion)
Hello.

Just one thing to discuss:

I read this article on how to remove a MSI based setup. This is okay, but I worked a bit with MSI before I came to NSIS and I use another way to remove. I call MSI related functions. It's not that hard it sounds. IMHO it's the better choice because you will not see the message "do you really want to remove ... bla bla". You can show your own message or work silently (just with that MSI progress dialog).

First of all you have to check that the MSI product is installed. This requires the ProductID (the so called "ProductCode", s. the article):

System::Call "msi::MsiQueryProductStateA(t '{48E5A72D-whatever-xxxx}') i.r0"
StrCmp $0 "5" 0 NotInstalled

"5" stands for INSTALLSTATE_DEFAULT and means the product is installed. Then you can remove it by calling another MSI function
System::Call "msi::MsiConfigureProductA(t '{48E5A72D-whatever-xxxx}', \
i 0xFFFF, i 2) i.r0"
StrCmp $0 "0" +3

MessageBox MB_OK|MB_ICONEXCLAMATION \
"Oh boy, there was a problem removing that MSI thing"
Abort

"0xFFFF" means INSTALLLEVEL_MAXIMUM (= all components of the MSI product), and the "2" (s. 3rd parameter) stands for INSTALLSTATE_ABSENT (= removes the product). The result "0" is ERROR_SUCCESS (= everything went fine). (As short as possible. :) If you want to know more about, you should refer Microsoft's PSDK or MSDN.)

That's all. When my human translator fixed my spelling problems :D, I will make another suggestion on how to block these old MSI setups.

Hm ... I'm not sure. Is something like this for the archive only or is it okay that I write here?

Mathias.

Re: Removing MSI installation (Suggestion)

Originally posted by MathiasSimmack
Hm ... I'm not sure. Is something like this for the archive only or is it okay that I write here?
It's OK that you write it here, but if you put it in the Archive too it would be much easier to find.

Understood, & done.
Thanks. :)