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

How to use public properties (like CERTPATH) in LaunchAppAndWait or LaunchApp?

Jump to solution

Hello,

I need to implement java keystore validation during UI sequence... I'm using InstallScript MSI project type.

To check certificate I'm using keytool from Java. I need to launch keytool  by LaunchAppAndWait with parameters that user set in UI. I use public properties to catch these inputs and I need to transmit them to LaunchAppAndWait...

Code:

########################################################

szParm1 = ""+"-list"+" "+"-keystore";
szParm2 = "+"CERTPATH"";
szParm3 = ""+"-storepass"+" "+"CERTPASS";

szCmdLine = "\"" + szParm1 + szParm2 + szParm3 + "\"";

LongPathToQuote( szApplicationPath, TRUE );
nResult = (LaunchAppAndWait (PROGRAM, szCmdLine, nOptions));

########################################################

In this case public properties are not working

Another option:

########################################

szParm1 = ""+"-list"+" "+"-keystore";
szParm2 = "+"CERTPATH;
szParm3 = ""+"-storepass"+" "+"CERTPASS";

########################################

In this case compilator give me error that error C8012: 'CERTPATH' : semicolon expected

Can anyone help me?

 

Labels (1)
0 Kudos
(1) Solution

Here code what works:

nOptions = LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN;

szApplicationPath = "C:\\Program Files\\Java\\jre1.8.0_211\\bin\\keytool.exe";

nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPATH", szParm1, nvSize);
nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPASS", szParm2, nvSize);

szParm3 = "-list -keystore \"CERTPATH\" -storepass \"CERTPASS\"";
StrReplace ( szParm3, "CERTPATH", szParm1, 0 );
StrReplace ( szParm3, "CERTPASS", szParm2, 0 );

LongPathToQuote( szApplicationPath, TRUE );
nResult = (LaunchAppAndWait (PROGRAM, szParm3, nOptions) );

View solution in original post

0 Kudos
(5) Replies
banna_k
Revenera
Revenera

Hi @gbublic ,

 

If you want to pass the public property value to another process as command line parameter, you have to get the property value and then pass the value:

Below link provides information on how to get the property value in Installscript using "MsiGetProperty", and need to provide the "ISMSI_HANDLE" as msi handle for installscript msi.

https://helpnet.flexerasoftware.com/installshield25helplib/helplibrary/IHelpIScriptWIProperty.htm#customizinginstallbehavior_2047521563_1022849

 

you can modify the example code like below to use the MsiGetProperty, and ensure to test and verify all the use cases and scenarios

nvSize = 256;
szParm1 = ""+"-list"+" "+"-keystore";
MsiGetProperty (ISMSI_HANDLE, "CERTPATH", szParm2, nvSize);
nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPASS", szParm3, nvSize);
szCmdLine = "\"" + szParm1 + " " + szParm2 + " " +"-storepass"+" "+ szParm3 + "\"";

0 Kudos

Thank you @banna_k for quick reply, but unfortunately something is still going wrong...

I try your code:

nvSize = 256;
szParm1 = ""+"-list"+" "+"-keystore";
MsiGetProperty (ISMSI_HANDLE, "CERTPATH", szParm2, nvSize);
nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPASS", szParm3, nvSize);
szCmdLine = "\"" + szParm1 + " " + szParm2 + " " +"-storepass"+" "+ szParm3 + "\"";

The output is:

Screenshot_3.jpg

0 Kudos

Also I have tried this code, but parameters szParm2 and  szParm2 are not transmitted...

nvSize = 256;
szParm1 = ""+"-list"+" "+"-keystore";
MsiGetProperty (ISMSI_HANDLE, "CERTPATH", szParm2, nvSize);
nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPASS", szParm3, nvSize);

LongPathToQuote( szApplicationPath, TRUE );
nResult = (LaunchAppAndWait (PROGRAM, "-list"+" "+"-keystore"+" "+"szParm2"+" "+"-storepass"+" "+""szParm3"", nOptions));

Output:

Screenshot_4.jpg

0 Kudos

Hi @gbublic ,

 

 You can debug your installscript code, and see why the values are not getting reflected while calling the MsiGetProperty.

0 Kudos

Here code what works:

nOptions = LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN;

szApplicationPath = "C:\\Program Files\\Java\\jre1.8.0_211\\bin\\keytool.exe";

nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPATH", szParm1, nvSize);
nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "CERTPASS", szParm2, nvSize);

szParm3 = "-list -keystore \"CERTPATH\" -storepass \"CERTPASS\"";
StrReplace ( szParm3, "CERTPATH", szParm1, 0 );
StrReplace ( szParm3, "CERTPASS", szParm2, 0 );

LongPathToQuote( szApplicationPath, TRUE );
nResult = (LaunchAppAndWait (PROGRAM, szParm3, nOptions) );

0 Kudos