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

Destination Folder dependent on registry


6 replies to this topic

kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 09 October 2006 - 11:52

[BASIC MSI]
guess it's a newbie question...

I defined my destination folder as a "registry dependent" folder:

MyAppDestFolder\XXXX

[MYAPPDESTFOLDER] should get the value read in the registry of another software, and it should be set before the "Destination Folder" dialog.

Hence I created a deferred InstallScript CA, called just after exec "CostFinalize".
The script read the registry in HKLM and attempt to set the destination folder.

I tried to set the [MYAPPDESTFOLDER] with MsiSetProperty, FeatureSetTarget or MsiSetTargetPath but I can't make it work, the Setup set the INSTALLDIR to C:\MyAppDestFolder\XXXX and ends with this error:
Error 2762. Cannot write script record. Transaction not started.

What is the best way to do this kind of CA?



Attached Images

  • dest_folder01.JPG


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 09 October 2006 - 13:04

This is one of the cases where the custom action needs to be an immediate rather than deferred custom action. Change it to a set property custom action and run it right after CostFinalize but before InstallInitialize.
Regards
-Stein Åsmul

kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 09 October 2006 - 13:57

Right! No more error message. Thx biggrin.gif

Hence I solved my issue with the following:

1. The CA must be an immediate action, just after CostFinalize (Install UI sequence)
2. I must use MsiSetTargetPath instead of MsiSetProperty in my script to set the value of "MYAPPDESTFOLDER" otherwise the INSTALLDIR will not be changed.

For (2), do you have any idea why it didn't work with MsiSetProperty?


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 09 October 2006 - 14:37

You are probably not using a Basic MSI are you?
Regards
-Stein Åsmul

kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 09 October 2006 - 14:51

This is a Basic MSI.



Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 09 October 2006 - 15:16

This is probably because you are dealing with a directory table entry. From the SDK it looks like MsiSetTargetPath will cascade changes done to related directory table entries. A word of caution in there too:

"Do not attempt to configure the target path if the components using those paths are already installed for the current user or for a different user. Check the ProductState property before calling MsiSetTargetPath to determine if the product containing this component is installed."
Regards
-Stein Åsmul

kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 09 October 2006 - 15:43

This is exactly what I observe in the log files. With MsiSetTargetPath, the change of the property is propagated to INSTALLDIR, not with MsiSetProperty.

MsiSetProperty(hMSI, "MYAPPDESTFOLDER", szDestPath);
=====================================
InstallShield: Invoking script function ExFn_SetDestinationPath
MSI © (E4!04) [16:40:22:312]: PROPERTY CHANGE: Modifying MYAPPDESTFOLDER property. Its current value is 'C:\MyAppDestFolder\'. Its new value: 'C:\ThdParty\'.

MsiSetTargetPath(hMSI, "MYAPPDESTFOLDER", szDestPath);
=======================================
InstallShield: Invoking script function ExFn_SetDestinationPath
MSI © (1C!F8) [16:46:19:638]: PROPERTY CHANGE: Modifying MYAPPDESTFOLDER property. Its current value is 'C:\MyAppDestFolder\'. Its new value: 'C:\ThdParty\'.
MSI © (1C!F8) [16:46:19:638]: PROPERTY CHANGE: Modifying NEW_DIRECTORY1 property. Its current value is 'C:\MyAppDestFolder\XXXX\'. Its new value: 'C:\ThdParty\XXXX\'.
MSI © (1C!F8) [16:46:19:638]: PROPERTY CHANGE: Modifying INSTALLDIR property. Its current value is 'C:\MyAppDestFolder\XXXX\'. Its new value: 'C:\ThdParty\XXXX\'.