Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Installer
Installer Database
Database Functions
 MsiSetComponentState Function
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.

Value Meaning

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 Requires Windows Installer 4.0 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003, Windows XP, and Windows 2000.
Header

Declared in Msiquery.h.

Library

Use Msi.lib.

DLL

Requires Msi.dll.

Unicode/ANSI

Implemented as MsiSetComponentStateW (Unicode) and MsiSetComponentStateA (ANSI).

See Also

Installer Selection Functions


Send comments about this topic to Microsoft

Build date: 6/5/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker