- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: How to use public properties (like CERTPATH) in LaunchAppAndWait or LaunchApp?
- 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
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?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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) );
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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.
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 + "\"";
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @gbublic ,
You can debug your installscript code, and see why the values are not getting reflected while calling the MsiGetProperty.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
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) );