The MsiGetComponentPath function returns the full path to an installed component. If the key path for the component is a registry key then the registry key is returned.
INSTALLSTATE MsiGetComponentPathA( LPCSTR szProduct, LPCSTR szComponent, LPSTR lpPathBuf, LPDWORD pcchBuf );
Specifies the product code for the client product.
Specifies the component ID of the component to be located.
Pointer to a variable that receives the path to the component. This parameter can be null. If the component is a registry key, the registry roots are represented numerically. If this is a registry subkey path, there is a backslash at the end of the Key Path. If this is a registry value key path, there is no backslash at the end. For example, a registry path on a 32-bit operating system of HKEY_CURRENT_USER<b>SOFTWARE<b>Microsoft is returned as "01:\SOFTWARE\Microsoft". The registry roots returned on 32-bit operating systems are defined as shown in the following table.
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. If the buffer passed in is too small, the count returned does not include the terminating null character.
If lpPathBuf is null, pcchBuf can be null.
The MsiGetComponentPath function returns the following values.
||The component being requested is disabled on the computer.|
||The component is not installed.|
||One of the function parameters is invalid.|
||The component is installed locally.|
||The component is installed to run from source.|
||The component source is inaccessible.|
||The product code or component ID is unknown.|
Upon success of the MsiGetComponentPath function, the pcchBuf parameter contains the length of the string in lpPathBuf.
The MsiGetComponentPath function might return INSTALLSTATE_ABSENT or INSTALL_STATE_UNKNOWN, for the following reasons:
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.
|Minimum supported client||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.|