MsiGetComponentPathExA function (msi.h)
The MsiGetComponentPathEx function returns the full path to an installed component. If the key path for the component is a registry key then the function returns the registry key.
This function extends the existing MsiGetComponentPath function to enable searches for components across user accounts and installation contexts.
INSTALLSTATE MsiGetComponentPathExA( [in] LPCSTR szProductCode, [in] LPCSTR szComponentCode, [in, optional] LPCSTR szUserSid, [in, optional] MSIINSTALLCONTEXT dwContext, [out, optional] LPSTR lpOutPathBuffer, [in, out, optional] LPDWORD pcchOutPathBuffer );
A null-terminated string value that specifies an application's product code GUID. The function gets the path of installed components used by this application.
A null-terminated string value that specifies a component code GUID. The function gets the path of an installed component having this component code.
[in, optional] szUserSid
A null-terminated string value that specifies the security identifier (SID) for a user in the system. The function gets the paths of installed components of applications installed under the user accounts identified by this SID. The special SID string s-1-1-0 (Everyone) specifies all users in the system. If this parameter is NULL, the function gets the path of an installed component for the currently logged-on user only.
||Specifies the currently logged-on user.|
||Specifies a particular user in the system. An example of an user SID is "S-1-3-64-2415071341-1358098788-3127455600-2561".|
||Specifies all users in the system.|
[in, optional] dwContext
A flag that specifies the installation context. The function gets the paths of installed components of applications installed in the specified installation context. This parameter can be a combination of the following values.
[out, optional] lpOutPathBuffer
A string value 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\SOFTWARE\Microsoft is returned as "01:\SOFTWARE\Microsoft". The registry roots returned on 32-bit operating systems are defined as shown in the following table.
[in, out, optional] pcchOutPathBuffer
Pointer to a location that receives the size of the buffer, in TCHAR, pointed to by the szPathBuf parameter. The value in this location should be set to the count of TCHAR in the string including the terminating null character. If the size of the buffer is too small, this parameter receives the length of the string value without including the terminating null character in the count.
The MsiGetComponentPathEx function returns the following values.
||The component being requested is disabled on the computer.|
||Configuration data is corrupt.|
||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.|
||The component is corrupt or partially missing in some way and requires repair.|
The MsiGetComponentPathEx 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.
The msi.h header defines MsiGetComponentPathEx 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.
|Minimum supported client||Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.|