MsiDoAction Function

Windows Installer

MsiDoAction Function

The MsiDoAction function executes a built-in action, custom action, or user-interface wizard action.

Syntax

C++UINT MsiDoAction(
  __in  MSIHANDLE hInstall,
  __in  LPCTSTR szAction
);

Parameters

hInstall [in]

Handle to the installation provided to a DLL custom action or obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.

szAction [in]

Specifies the action to execute.

Return Value

ERROR_FUNCTION_FAILED

The function failed.

ERROR_FUNCTION_NOT_CALLED

The action was not found.

ERROR_INSTALL_FAILURE

The action failed.

ERROR_INSTALL_SUSPEND

The user suspended the installation.

ERROR_INSTALL_USEREXIT

The user canceled the action.

ERROR_INVALID_DATA

A failure occurred while calling the custom action.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_INVALID_HANDLE_STATE

The handle state was invalid.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function.

ERROR_MORE_DATA

The action indicates that the remaining actions should be skipped.

ERROR_SUCCESS

The function succeeded.

Remarks

The MsiDoAction function executes the action that corresponds to the name supplied. If the name is not recognized by the installer as a built-in action or as a custom action in the CustomAction table, the name is passed to the user-interface handler object, which can invoke a function or a dialog box. If a null action name is supplied, the installer uses the upper-case value of the ACTION property as the action to perform. If no property value is defined, the default action is performed, defined as "INSTALL".

Actions that update the system, such as the InstallFiles and WriteRegistryValues actions, cannot be run by calling MsiDoAction. The exception to this rule is if MsiDoAction is called from a custom action that is scheduled in the InstallExecuteSequence table between the InstallInitialize and InstallFinalize actions. Actions that do not update the system, such as AppSearch or CostInitialize, can be called.

Requirements

VersionWindows Installer 5.0 on Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003, Windows XP, and Windows 2000
HeaderMsiquery.h
LibraryMsi.lib
DLLMsi.dll
Unicode and ANSI namesMsiDoActionW (Unicode) and MsiDoActionA (ANSI)

See Also

Installer Action Functions

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.