Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 2

Custom Action script fails without executing

I have created a CA called CheckCertFileExists which is triggered on 'Next' from a filename entry/browse dialog. The script function called (ExFn_ValidateCertFile) is here:
[FONT=Lucida Console][SIZE=1]
export prototype ExFn_ValidateCertFile();
export prototype ExFn_CopyCertFile();
export prototype ExFn_SetCADataProps();
prototype string GetCADataProp(byref string, string);

function ExFn_ValidateCertFile()
string szFile[512];
string szDir;
number nSize;
number nResult;
BOOL tFileExists;
SprintfMsiLog("First working statement...!");
nSize = 512;
MsiGetProperty(ISMSI_HANDLE, "USERCERTPATH", szFile, nSize);
MessageBox("ExFn_ValidateCertFile " + szFile, INFORMATION);
tFileExists = Is(FILE_EXISTS, szFile);
if (tFileExists = TRUE) then
MsiSetProperty(ISMSI_HANDLE, "CERTFILEOK", "Yes");
MessageBox("File " + szFile + " does not exist.", SEVERE);
ParsePath(szFile, szDir, PATH);
return 0;

Everything compiles and builds ok. However, it fails at runtime without executing a line. Here is the MSI log extract:

[FONT=Lucida Console][SIZE=1]
MSI (c) (68:F4) [10:42:51:955]: Doing action: FileBrowse
Action 10:42:51: FileBrowse.
Action start 10:42:51: FileBrowse.
MSI (c) (68:50) [10:42:51:971]: Invoking remote custom action. DLL: C:\Users\ADMINI~1\AppData\Local\Temp\1\MSIC0B6.tmp, Entrypoint: FileBrowse
MSI (c) (68:28) [10:42:51:971]: Cloaking enabled.
MSI (c) (68:28) [10:42:51:971]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (68:28) [10:42:51:971]: Connected to service for CA interface.
MSI (c) (68!B4) [10:42:52:561]: PROPERTY CHANGE: Modifying IS_BROWSE_FILEBROWSED property. Its current value is 'C:\'. Its new value: 'C:\Development\installer\win\LiqSecEKM\Source_Packages\PO.crt'.
Action ended 10:42:52: FileBrowse. Return value 1.
MSI (c) (68:F4) [14:16:04:603]: PROPERTY CHANGE: Modifying USERCERTPATH property. Its current value is 'C:\Users\Administrator\Documents\'. Its new value: 'C:\Development\installer\win\LiqSecEKM\Source_Packages\PO.crt'.
MSI (c) (68:F4) [14:16:04:603]: Doing action: CheckCertFileExists
Action 14:16:04: CheckCertFileExists.
Action start 14:16:04: CheckCertFileExists.
MSI (c) (68:18) [14:16:04:621]: Invoking remote custom action. DLL: C:\Users\ADMINI~1\AppData\Local\Temp\1\MSIF582.tmp, Entrypoint: f3
Action ended 14:16:06: CheckCertFileExists. Return value 3.
Info 2896. Executing action CheckCertFileExists failed.
Action ended 14:16:06: InstallWelcome. Return value 3.
MSI (c) (68:E8) [14:16:06:438]: Doing action: SetupCompleteError
I have found that the CA in question, and another one I have written to do an explicit file copy operation, have wacky MSI Type Numbers:

They imply a msidbCustomActionXXXX constant at 0x10000, but I can't find one.

Has anyone an explanation for what causes a script to fail with a 3 in this way, or what those MSI numbers mean?

Labels (1)
0 Kudos
(1) Reply
Level 10

In a Basic MSI project, an InstallScript Custom Action can only accept a single parameter--a handle to the MSI. You'll need to change the prototype and functions statements to be

export prototype ExFn_ValidateCertFile(HWND);


function ExFn_ValidateCertFile(hMSI)

Then use hMSI in all of the places that you currently use ISMSI_HANDLE.

If you do a search on ISMSI_HANDLE in the InstallShield Help, you'll see

ISMSI_HANDLE is not supported in Basic MSI projects, and is not supported in InstallScript custom actions.

It is only used in InstallScript MSI projects.
0 Kudos