MsiSetComponentState function

The MsiSetComponentState function sets a component to the requested state.

Syntax


UINT MsiSetComponentState(
  _In_ MSIHANDLE    hInstall,
  _In_ LPCTSTR      szComponent,
  _In_ INSTALLSTATE iState
);

Parameters

hInstall [in]

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

szComponent [in]

Specifies the name of the component.

iState [in]

Specifies the state to set. This parameter can be one of the following values.

ValueMeaning
INSTALLSTATE_ABSENT

The component was uninstalled.

INSTALLSTATE_LOCAL

The component was installed on the local drive.

INSTALLSTATE_SOURCE

The component will run from source, CD, or network.

 

Return value

The MsiSetComponentState function returns the following values:

ERROR_FUNCTION_FAILED

The function failed.

ERROR_INSTALL_USEREXIT

The user exited the installation.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_SUCCESS

The function succeeded.

ERROR_UNKNOWN_COMPONENT

An unknown component was requested.

Remarks

The MsiSetComponentState function requests a change in the Action state of a record in the Component table.

For more information, see Calling Database Functions From Programs.

If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.

Requirements

Version

Windows Installer 5.0 on Windows Server 2012, Windows 8, 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 or Windows XP

Header

Msiquery.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiSetComponentStateW (Unicode) and MsiSetComponentStateA (ANSI)

See also

Installer Selection Functions

 

 

Show: