cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JaiShankar
Level 3

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.
Labels (1)
0 Kudos
(8) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

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.
0 Kudos
GlenMiller
Level 3

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?
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Please see the attached project which should open in IS 2012.
0 Kudos
GlenMiller
Level 3

Thanks. Your sample works, but my project upgraded from InstallShield 2010 still fails on MsiGetProperty. Do you have any idea why this might be?
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

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:

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.
0 Kudos
GlenMiller
Level 3

Setting the buffer size fixed it. Thank you!
0 Kudos
arunjaganath
Level 2

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
0 Kudos