This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Could not get the INSTALLDIR value using the Deferred custom action.
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2012
06:18 AM
Could not get the INSTALLDIR value using the Deferred custom action.
Hi,
- I wanted to delete all the application created files in the installed path after uninstallation.
- To acheive this i was trying to get the INSTALLDIR value through deferred custom action as per the below link.
http://helpnet.flexerasoftware.com/installshield18helplib/AccessingProps-DeferredCAs.htm
- My Configurations:
1. Create a set-a-property custom action (type 51) called GetINSTALLDIR
Property Name: DisplayINSTALLDIR
Property Value: [INSTALLDIR]
Install Exec Sequence: After InstallInitialize
2. In the InstallScript view, create a new function called DisplayINSTALLDIR with the below code.
export prototype DisplayINSTALLDIR(HWND);
function DisplayINSTALLDIR(hISWI)
STRING szInstDir;
NUMBER nvCount;
begin
nvCount = MAX_PATH;
if (MsiGetProperty(hISWI,"CustomActionData",szInstDir,nvCount) = ERROR_SUCCESS) then
SprintfBox(INFORMATION,"Deferred Execution","The value of INSTALLDIR is %s",szInstDir);
SprintfBox(INFORMATION,"Deferred Execution","The value of InstallScript's INSTALLDIR is %s",INSTALLDIR);
endif;
end;
3. In the Custom Actions and Sequences view, created an InstallScript custom action called DisplayINSTALLDIR.
Function Name: DisplayINSTALLDIR
In-Script Execution: Deferred Execution in System Context
Install Exec Sequence: After GetINSTALLDIR
My Output:
The values of szInstDir & INSTALLDIR in the above 2 message boxes are blank.
Other Observation:
When tried the same as instructed in the link (http://helpnet.flexerasoftware.com/installshield18helplib/AccessingProps-DeferredCAs.htm) i am getting a blank message for the first messagebox & a code for the 2nd message box.
Could you please guide me.
- I wanted to delete all the application created files in the installed path after uninstallation.
- To acheive this i was trying to get the INSTALLDIR value through deferred custom action as per the below link.
http://helpnet.flexerasoftware.com/installshield18helplib/AccessingProps-DeferredCAs.htm
- My Configurations:
1. Create a set-a-property custom action (type 51) called GetINSTALLDIR
Property Name: DisplayINSTALLDIR
Property Value: [INSTALLDIR]
Install Exec Sequence: After InstallInitialize
2. In the InstallScript view, create a new function called DisplayINSTALLDIR with the below code.
export prototype DisplayINSTALLDIR(HWND);
function DisplayINSTALLDIR(hISWI)
STRING szInstDir;
NUMBER nvCount;
begin
nvCount = MAX_PATH;
if (MsiGetProperty(hISWI,"CustomActionData",szInstDir,nvCount) = ERROR_SUCCESS) then
SprintfBox(INFORMATION,"Deferred Execution","The value of INSTALLDIR is %s",szInstDir);
SprintfBox(INFORMATION,"Deferred Execution","The value of InstallScript's INSTALLDIR is %s",INSTALLDIR);
endif;
end;
3. In the Custom Actions and Sequences view, created an InstallScript custom action called DisplayINSTALLDIR.
Function Name: DisplayINSTALLDIR
In-Script Execution: Deferred Execution in System Context
Install Exec Sequence: After GetINSTALLDIR
My Output:
The values of szInstDir & INSTALLDIR in the above 2 message boxes are blank.
Other Observation:
When tried the same as instructed in the link (http://helpnet.flexerasoftware.com/installshield18helplib/AccessingProps-DeferredCAs.htm) i am getting a blank message for the first messagebox & a code for the 2nd message box.
Could you please guide me.
(8) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 16, 2012
03:02 PM
The steps here should work to get the value of INSTALLDIR in a deferred action. I've attached a sample project with script that follows the same steps in your post and the value of INSTALLDIR is displayed by the deferred custom action.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 18, 2012
12:39 PM
I am having the same problem. I have upgraded a project from InstallShield 2010 where this was working fine. Now in InstallShield 2012 it does not work - MsiGetProperty() fails.
I cannot open your sample in InstallShield 2012. Can you please provide an example that works in InstallShield 2012?
I cannot open your sample in InstallShield 2012. Can you please provide an example that works in InstallShield 2012?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 18, 2012
03:58 PM
Thanks. Your sample works, but my project upgraded from InstallShield 2010 still fails on MsiGetProperty. Do you have any idea why this might be?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 18, 2012
04:40 PM
Are you setting the buffer size passed to MsiGetProperty (nvCount is the buffer size variable in the sample code, initialized to MAX_PATH)?
If the buffer size is not the issue, you may want to try creating a verbose log of the installation to see if any custom action data is passed to the custom action that needs it. For example, running the attached sample yields the following log entry when the deferred action is run:
Notice the CustomActionData value is displayed in the log for the action that was scheduled to run. This would allow for verifying the custom action data is being set up correctly by the earlier set property action.
If the buffer size is not the issue, you may want to try creating a verbose log of the installation to see if any custom action data is passed to the custom action that needs it. For example, running the attached sample yields the following log entry when the deferred action is run:
MSI (s) (F8:9C) [16:39:29:802]: Executing op: CustomActionSchedule(Action=DisplayINSTALLDIR,ActionType=3073,Source=BinaryData,Target=f1,CustomActionData=C:\Program Files (x86)\My InstallDir\)
Notice the CustomActionData value is displayed in the log for the action that was scheduled to run. This would allow for verifying the custom action data is being set up correctly by the earlier set property action.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 19, 2012
09:24 AM
Setting the buffer size fixed it. Thank you!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 19, 2013
06:40 AM
Hi,
I am new to installshield, I do have a similar issue where in the install script which was migrated from 10.5 to 12 is not able to get the value for INSTALLDIR(I did add a few debug prints and found that this value isn't coming through in IS 2012). This script works perfectly fine when built on installshield 10.5 but when the same was ported to installshield 12, the value for INSTALLDIR doesn't seem to be populated. Any idea what would be missing.....
Thanks in Advance....
Arun J
I am new to installshield, I do have a similar issue where in the install script which was migrated from 10.5 to 12 is not able to get the value for INSTALLDIR(I did add a few debug prints and found that this value isn't coming through in IS 2012). This script works perfectly fine when built on installshield 10.5 but when the same was ported to installshield 12, the value for INSTALLDIR doesn't seem to be populated. Any idea what would be missing.....
Thanks in Advance....
Arun J