Hi All,
As I may have mentioned earlier, we are moving away from Wise and back to InstallShield (2010 at the moment). I'm currently looking at re-writing some of our Custom Action in InstallScript. I did use InstallScript for this purpose many, many years ago so I've forgotten or a lot may have changed with that script itself.
Anyway, I want to write to the HKLM {ProductCode}\Uninstall\DisplayVersion during the install. I know this must occur after RegisterProduct or any changes would be overwritten with the ProductVersion property value. I need to do this because our Support dept. likes to see our actual application version written there instead of the install package version, which is usually different.
Currently we have a WiseScript action to Grab ProductCode and OURVERSION property values then it writes the value in the required registry location. It is sequenced in the Deferred sequence after RegisterProduct and everything seems OK.
Also, with InstallScript, can I handle the 64 bit registry hive as well as I'm not sure where the ARP info/Uninstall key is written based on architecture? In othere words I don't know if I would need to write a second CA to handle 64 bit registry or not.
I read that you cannot use InstallScript to grab property values in the deferred sequence...
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.
InstallScript Custom Action Questions...
Started by
Superfreak3
, Sep 16 2010 15:39
3 replies to this topic
Posted 16 September 2010 - 15:39
QUOTE |
Note: Note that the MsiGetProperty and MsiSetProperty properties cannot be used for deferred InstallScript custom actions, which do not have access to the active .msi database and do not recognize any Windows Installer properties. They can access only the information that has been written into the execution script. |
Does this mean I can write the action and schedule it in the Immediate Sequence after Register Product?
Any guidance, sample InstallScripts, direction would be greatly appreciated!
Thanks much.
Posted 16 September 2010 - 19:33
Here's what I did and here's the problem....
I've only tested this on 32 bit, but here's the InstallScript code that did up date the Uninstall\DisplayVersion registry value...
I've only tested this on 32 bit, but here's the InstallScript code that did up date the Uninstall\DisplayVersion registry value...
CODE |
function ARPDisplayVersion(hMSI) // To Do: Declare local variables. STRING strProdCode, strOurVersion; NUMBER numSize; begin // To Do: Write script that will be executed when MyFunction is called. numSize = 256; // OURVERSION property passed to Execute sequence via CustomActionData MsiGetProperty (hMSI, "CustomActionData", strOurVersion, numSize); MsiGetProperty (hMSI, "ProductCode", strProdCode, numSize); RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); // Write the values to the registry. Root set above since HKCR is the default of following function... RegDBSetKeyValueEx ("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + strProdCode, "DisplayVersion", REGDB_STRING, strOurVersion, -1); end; |
Like I said this does update the value I need, however there is an issue. It is left behind on uninstall. Does IScript set a ref count or something? Is there another IScript registry function to only update the value, maybe?
I guess I could add another function to the script to remove and call via Custom Action on uninstall, but I don't know that that would be the best way to do things.
I would simply like to update the value to display a different version and have it uninstall normally as if no edit was made (if that's possible).
Any thoughts, guidance, hints appreciated!
Thanks much in advance!!
Posted 16 September 2010 - 19:40
Here's another part of the puzzle and I guess this just shows how much I don't know about using InstallScript for Custom Actions.
Just for kicks, I went ahead and added a function to the same Setup.rul file that contains the registry set function. Now, when I run the full install, it seems that even though the Custom Action that calls the key delete function is conditioned as REMOVE~="ALL", it still runs and actually deletes the key on install.
Do I need two separate script files for the tasks to update a key value then delete that key on uninstall? I'm just wondering why the delete function is being called when the Custom Action that calls that function should only run on uninstall.
I also have two export prototype statements to mark my functions as entry points. Is this incorrect?
Any help appreciated!!
Just for kicks, I went ahead and added a function to the same Setup.rul file that contains the registry set function. Now, when I run the full install, it seems that even though the Custom Action that calls the key delete function is conditioned as REMOVE~="ALL", it still runs and actually deletes the key on install.
Do I need two separate script files for the tasks to update a key value then delete that key on uninstall? I'm just wondering why the delete function is being called when the Custom Action that calls that function should only run on uninstall.
I also have two export prototype statements to mark my functions as entry points. Is this incorrect?
Any help appreciated!!
Edited by Superfreak3, 16 September 2010 - 19:50.
Posted 17 September 2010 - 13:29
Looks like something strange is going on. Did you generate a log file to verify the condition on that custom action? Are you testing on a clean machine/image?
Stefan Krüger
InstallSite.org twitter facebook