MsiLocateComponent

[This is preliminary documentation and subject to change.]

The MsiLocateComponent function returns the full path to an installed component without a product code. This function attempts to determine the product using MsiGetProductCode, but is not guaranteed to find the correct product for the caller. MsiGetComponentPath should always be called when possible.

INSTALLSTATE MsiLocateComponent(
  LPCTSTR szComponent,  // component Id, string GUID
  LPTSTR lpPathBuf,     // returned path
  DWORD *pcchBuf        // in/out buffer character count
);
 

Parameters

szComponent
Specifies the component ID of the component to be located.
lpPathBuf
Pointer to a variable that receives the path to the component. This parameter can be NULL.
pcchBuf
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter.

If lpPathBuf is NULL, pcchBuf can be NULL.

Return Values

ERROR_INSTALL_NOTUSED
The component being requested is disabled on the computer.
INSTALLSTATE_ABSENT
The component is not installed.
INSTALLSTATE_BAD_CONFIGURATION
The configuration data is corrupt.
INSTALLSTATE_INVALIDARG
One of the function parameters is invalid.
INSTALLSTATE_LOCAL
The component is installed locally.
INSTALLSTATE_SOURCE
The component is installed to run from source.
INSTALLSTATE_SOURCEABSENT
The component source is inaccessible.
INSTALLSTATE_UNKNOWN
The product code or component ID is unknown.

Remarks

Upon success of the MsiLocateComponent function, the pcchBuf parameter contains the length of the string in lpPathBuf.

The MsiLocateComponent function might return INSTALLSTATE_ABSENT or INSTALL_STATE_UNKNOWN, for the following reasons:

QuickInfo

  Windows NT: Requires version 4.0 or later. Available as a redistributable for Windows NT 4.0.
  Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in msi.h.
  Import Library: Use msi.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Component-Specific Functions