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

difference between deffered and immediate executio


2 replies to this topic

asrinivas

asrinivas
  • Full Members
  • 36 posts

Posted 03 October 2007 - 13:36

Hi,

I am bit confused with differed and immediate execution.What is the difference between these two.and how we select in which face the CA has to execute.
in which face , we use differed execution and immediate execution.

Regards,
A.Srinivas

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 04 October 2007 - 02:27

There is a lot to this, but basically immediate mode actions are run whenever they are encountered in the sequence they are in (since the same sequence is generally run twice, the actions may appear to run twice unless flagged to run only once). They always run with user permissions and should generally not change the system. A good examle of a use for immediate mode actions would be to perform input validation in the user interface sequence to make sure the user inputs valid entires. A common error is to insert immediate mode custom actions after InstallFinalize - this is always wrong!

Deferred mode actions do not run immediately, but are written into the execution script and will hence "appear" to run towards the end of the install process (when the InstallFinalize standard action starts). These actions can run with elevated rights (LocalSystem) and hence have access to make administrator-level changes to the system. The actions will not have access to read content from the MSI database, so values you want to use in deferred context must be written into the execution script using a special property called CustomActionData - this is somewhat complicated, but documented in the SDK (search for CustomActionData).

More so than explaining the technical details, if you give a description of what you want to do it is generally easier to say what type of action to use and then to explain why.

Edited by Glytzhkof, 04 October 2007 - 02:27.

Regards
-Stein Åsmul

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 04 October 2007 - 02:33

Some rules of thumb:

* If you need to run custom actions in the user interface, use immediate mode custom actions. Don't make changes to the system from the user interface sequence though! Just validate user input etc...

* If you need to run a custom actions that will post process or access files installed by your setup you need to use a deferred mode custom action (DON'T use an immediate mode custom action after InstallFinalize - this is wrong wrong wrong for many reasons).

* Don't use custom actions at all for things MSI can do out of the box such as updating ini files, duplicating files, removing registry entries and files, etc...

* Remember that script custom actions are sometimes blocked by anti-virus. Compiled custom actions are generally preferred, though scripts are more transparent. If you use a compiled custom action DLL remember to document in your custom action comments field what the custom action is doing (for corporate deployment customization and logo compliance).

Regards
-Stein Åsmul