Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Allow uninstall ONLY if...


2 replies to this topic

dtieuf

dtieuf
  • Full Members
  • 31 posts

Posted 03 May 2005 - 22:45

Hi all,

Supposing I am installing A.msi and B.msi in this order through a custom bootstrapper...
A and B have distinct package/product/upgrade codes.

I would like the uninstall process to be in a specific order as well, meaning:
if users launch A's uninstall, detect B, if B is still installed, don't uninstall A.

I have tried using RegLocator with B's upgrade code but that table doesn't work with registry keys (only values).

I have tried an entry in A's upgrade table with msidbUpgradeAttributesOnlyDetect and a CA type 19 after FindRelatedProducts, it's still being able to uninstall.

Any thoughts ?

Thank you,

Sophie

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 04 May 2005 - 00:12

You should be able to find B's upgrade code in the registry, or some other unique key for B in the registry, and set this to a property.

You can then add this to A's logic and pop up an error when this property is set.



_nick_

_nick_
  • Members
  • 34 posts

Posted 04 May 2005 - 14:00

You want to call MsiQueryProductState with the the product code of B in A's uninstall.

http://msdn.microsof...roductstate.asp

Make it an uninstall action and check for a return of INSTALLSTATE_DEFAULT.

CODE

INSTALLSTATE    eState;

eState = MsiQueryProductState( szProductCode );

switch(eState) {
  case INSTALLSTATE_ABSENT:
  case INSTALLSTATE_ADVERTISED:
  case INSTALLSTATE_UNKNOWN:
     // Product is advertised or not installed, proceed
    return S_OK;

  case INSTALLSTATE_DEFAULT:
     // Product is still installed
     return E_FAIL;

  case INSTALLSTATE_INVALIDARG:
     // malformed product code
     ASSERT(FALSE);
     return E_FAIL;
}