InstallShield 2018
Project • This information applies to the following project types:
• | Basic MSI with InstallScript custom actions |
• | InstallScript MSI with InstallScript custom actions |
• | Merge Module with InstallScript custom actions |
When Windows Installer executes an InstallScript custom action, InstallShield calls the function that you specified when you created the custom action. Every InstallScript custom action must have an exported, user-defined function as an entry point into the script.
Prototyping and Defining Functions
An entry-point function is prototyped and defined like any other function, except that it has the following requirements:
• | Its prototype must include the keyword export to declare it as an exported function. |
• | The function can accept only one argument, which must be a handle to the .msi database. |
• | It should return a value meaningful to Windows Installer, if your custom action is designed to wait for a return value. These custom action return values are defined in IsMsiQuery.h and available to you if you include IsMsiQuery.h or Iswi.h in your script. |
The following example script declares an entry-point function, which returns success if it succeeded:
// Include Isrt.h for built-in InstallScript function prototypes.
#include "isrt.h"
// Include Iswi.h for Windows Installer API function prototypes and constants.
#include "iswi.h"
export prototype MyFunction(HWND);
function MyFunction(hMSI)
STRING szKey, svValue, svPath;
NUMBER nvType, nvSize, nReturn;
begin
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\isdev.exe";
nReturn = RegDBGetKeyValueEx (szKey, "Path", nvType, svValue, nvSize);
// The App Paths key contains the folder where InstallShield was
// installed, followed by a semicolon.
StrSub (svPath, svValue, 0, StrFind(svValue, ";"));
if nReturn = 0 then
MessageBox ("InstallShield is installed to " + svPath, INFORMATION);
return ERROR_SUCCESS;
else
MessageBox ("Cannot determine where InstallShield is installed.", SEVERE);
return ERROR_INSTALL_FAILURE;
endif;
end;
Multiple Entry Points
Your script can have multiple entry-point functions in it to serve multiple custom actions. However, InstallShield calls only the single entry-point function specified for each InstallScript custom action.
InstallShield 2018 Help LibraryJanuary 2018 |
Copyright Information | Flexera |