Skip to content

Latest commit

 

History

History
211 lines (171 loc) · 5.89 KB

nf-msi-msilocatecomponenta.md

File metadata and controls

211 lines (171 loc) · 5.89 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:msi.MsiLocateComponentA
MsiLocateComponentA function (msi.h)
The MsiLocateComponent function returns the full path to an installed component without a product code. (ANSI)
MsiLocateComponentA
msi/MsiLocateComponentA
setup\msilocatecomponent.htm
setup
5b6235c5-9a64-4b4e-9f2c-42ed73400cbe
12/05/2018
MsiLocateComponent, MsiLocateComponent function, MsiLocateComponentA, MsiLocateComponentW, _msi_msilocatecomponent, msi/MsiLocateComponent, msi/MsiLocateComponentA, msi/MsiLocateComponentW, setup.msilocatecomponent
msi.h
Windows
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. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.
MsiLocateComponentW (Unicode) and MsiLocateComponentA (ANSI)
Msi.lib
Msi.dll
Windows
19H1
MsiLocateComponentA
msi/MsiLocateComponentA
c++
APIRef
kbSyntax
DllExport
Msi.dll
MsiLocateComponent
MsiLocateComponentA
MsiLocateComponentW

MsiLocateComponentA function

-description

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.

-parameters

-param szComponent [in]

Specifies the component ID of the component to be located.

-param lpPathBuf [out]

Pointer to a variable that receives the path to the component. The variable includes the terminating null character.

-param pcchBuf [in, out]

Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. Upon success of the MsiLocateComponent function, the variable pointed to by pcchBuf contains the count of characters not including the terminating null character. If the size of the buffer passed in is too small, the function returns INSTALLSTATE_MOREDATA.

If lpPathBuf is null, pcchBuf can be null.

-returns

Value Meaning
INSTALLSTATE_NOTUSED
The component being requested is disabled on the computer.
INSTALLSTATE_ABSENT
The component is not installed. See Remarks.
INSTALLSTATE_INVALIDARG
One of the function parameters is invalid.
INSTALLSTATE_LOCAL
The component is installed locally.
INSTALLSTATE_MOREDATA
The buffer provided was too small.
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. See Remarks.

-remarks

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

  • INSTALLSTATE_ABSENT

    The application did not properly ensure that the feature was installed by calling MsiUseFeature and, if necessary, MsiConfigureFeature.

  • INSTALLSTATE_UNKNOWN

    The feature is not published. The application should have determined this earlier by calling MsiQueryFeatureState or MsiEnumFeatures. The application makes these calls while it initializes. An application should only use features that are known to be published. Since INSTALLSTATE_UNKNOWN should have been returned by MsiUseFeature as well, either MsiUseFeature was not called, or its return value was not properly checked.

Note

The msi.h header defines MsiLocateComponent as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

Component-Specific Functions