Project • This information applies to the following project types:
Windows Installer properties can contain useful information about the product, the setup, the operating system, and the user. By calling MsiGetProperty and MsiSetProperty, you can directly interact with these properties in your immediate InstallScript custom action.
Note • Note that the MsiGetProperty and MsiSetProperty properties cannot be used for deferred InstallScript custom actions, which do not have access to the active .msi database and do not recognize any Windows Installer properties. They can access only the information that has been written into the execution script.
The following example retrieves the user name from the Windows Installer setup package, confirms the value, gives the user the opportunity to change it, and then writes the new value back into the database.
Note • It may be necessary to specify a proper buffer size if the property value exceeds 1024 characters. For an example of how to write code for this scenario, refer to Changes in Behavior for Some MSI APIs That Are Called in InstallScript Custom Actions in the “Upgrading Projects from InstallShield 2011 or Earlier” topic.
// Include header file for built-in functions
// Include header file for MSI API functions and constants
export prototype Func1(HWND);
NUMBER nvSize, nResponse;
// Retrieve the user's name from the MSI database
nvSize = 256;
MsiGetProperty (hMSI, "USERNAME", svName, nvSize);
nResponse = AskYesNo ("Your name will be registered as " +
svName + ". Is this correct?", YES);
if nResponse = NO then
AskText ("Enter the name that will be registered for " +
"this product.", svName, svName);
MsiSetProperty(hMSI, "USERNAME", svName);
MsiGetProperty (Windows Installer Help Library
MsiSetProperty (Windows Installer Help Library
InstallShield 2019 Help Library
|Copyright Information | Flexera|
Open topic with navigation