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

MSIRUNMODE_SCHEDULED


7 replies to this topic

dcleous

dcleous
  • Members
  • 38 posts

Posted 30 April 2004 - 18:45

I have a question...regarding the MSIGetMode()

If I'm calling a particular function say "foo()" from various CA's some being deferred and some immediete,is it possible for me to know in the function foo() that the call is being made from the Deferred CA?

Like this is what I'm trying to do..
I'm calling the MSIGetMode() and assuming if it returns MSIRUNMODE_SCHEDULED then it is Deferred...is that correct way of doing.

Please discuss the pros and cons and suggest.

Thanks a lot,
L

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 04 May 2004 - 08:08

After reading the Windows Installer SDK, that looks like the correct and recommended way to detect the mode.

Read the following:
For example, to have a custom action that calls a C/C++ dynamic link library (DLL) (Custom Action Type 1) both when the mode is MSIRUNMODE_SCHEDULED and MSIRUNMODE_ROLLBACK put two entries in the CustomAction table that call the same DLL but that have different numeric types. Include code that calls MsiGetMode to determine when to run which custom action.


Have you tested this? does it work?

dcleous

dcleous
  • Members
  • 38 posts

Posted 04 May 2004 - 21:51

MsiGetMode returns "MSIRUNMODE_SCHEDULED " for both the CAs Deferred as well as the immediete.

So...I'm using MsiGetMode(MSIRUNMODE_SCHEDULED)
&&
MSIGetProperty(hInstall,"versionNT") which always fails in Deferred CA.


luke_s

luke_s
  • Full Members
  • 532 posts

Posted 05 May 2004 - 01:17

hmmm thats interesting....

Another idea i had was to run an msi query on the custom action table and check the attributes of the custom action.

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 05 May 2004 - 08:35

That wouldn't work either, since msi database access is not possible in deferred CAs (although that tells you more either...)

One solution that doesn't force errors would be reading the property "CustomActionData" - assuming you set a property with the CA name beforehand (assuming your CA is called "MyDeferredAction, do MsiSetProperty("MyDeferredAction", "some data"))

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 05 May 2004 - 08:59

Have a look at the following link, after reading it, it still looks like me the MsiGetMode is the right method to use.

http://msdn.microsof...tom_actions.asp

dcleous

dcleous
  • Members
  • 38 posts

Posted 06 May 2004 - 01:43

So I don't have to do all these...
MsiGetMode(MSIRUNMODE_SCHEDULED)
&&
MSIGetProperty(hInstall,"versionNT")


but just MSIGEtMode()....my extra intelligence is of no good..smile.gif


luke_s

luke_s
  • Full Members
  • 532 posts

Posted 06 May 2004 - 03:02

Welll after reading that document that is my understanding, but you would need to test this though. Maybe somone else can clarify??