cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tnand53
Level 5

CustomActionData to Access a Property

I tried the below code written in example

To access SUPPORTDIR through a deferred InstallScript custom action

In the Custom Actions and Sequences view, create a set-a-property custom action (type 51) called GetSUPPORTDIR . Configure the Property Name, Property Value, and Install Exec Sequence settings for the custom action as follows, and leave all of the other settings blank.
Property Name: DisplaySupportDir
Property Value: [SUPPORTDIR]
Install Exec Sequence: After InstallInitialize
In the InstallScript view, create a new function called DisplaySupportDir.
Add the following code to display a message box containing the value of SUPPORTDIR:
function DisplaySupportDir(hMSI)

STRING supportDirPath;

NUMBER supportDirPathBuffer;

begin

supportDirPathBuffer = MAX_PATH;

if(MsiGetProperty(hMSI, "CustomActionData", supportDirPath, supportDirPathBuffer) == ERROR_SUCCESS) then

SprintfBox(INFORMATION,"Deferred Execution","The value of SUPPORTDIR is %s",supportDirPath);

SprintfBox(INFORMATION,"Deferred Execution","The value of InstallScript's SUPPORTDIR is %s",SUPPORTDIR);

endif;

end;

In the Custom Actions and Sequences view, create an InstallScript custom action called DisplaySupportDir. Configure the Function Name, In-Script Execution, and Install Exec Sequence settings for the custom action as follows, and leave all of the other settings blank.
Function Name: DisplaySupportDir
In-Script Execution: Deferred Execution in System Context
Install Exec Sequence: After GetSUPPORTDIR



When I execute the installer the first SprintfBox (supportDirPath variable) gives blank and second SprintfBox gives correct supportdir value. Is that the required behaviour.
When I am printing SUPPORTDIR directly , it is giving me the correct path.

Is this correct behaviour?
Labels (1)
0 Kudos
(1) Reply
Christopher_Pai
Level 16

You might want to check out the sample @

http://www.installsite.org/pages/en/msi/ca.htm

(first sample)
0 Kudos