MsiSetTargetPathA function (msiquery.h)
The MsiSetTargetPath function sets the full target path for a folder in the Directory table.
Syntax
UINT MsiSetTargetPathA(
[in] MSIHANDLE hInstall,
[in] LPCSTR szFolder,
[in] LPCSTR szFolderPath
);
Parameters
[in] hInstall
Handle to the installation provided to a DLL custom action or obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.
[in] szFolder
Specifies the folder identifier. This is a primary key in the Directory table.
[in] szFolderPath
Specifies the full path for the folder, ending in a directory separator.
Return value
The MsiSetTargetPath function returns the following values:
Remarks
The MsiSetTargetPath function changes the path specification for the target directory named in the in-memory Directory table. Also, the path specifications of all other path objects in the table that are either subordinate or equivalent to the changed path are updated to reflect the change. The properties for each affected path are also updated.
MsiSetTargetPath fails if the selected directory is read only.
If an error occurs in this function, all updated paths and properties revert to their previous values. Therefore, it is safe to treat errors returned by this function as nonfatal.
Do not attempt to configure the target path if the components using those paths are already installed for the current user or for a different user. Check the ProductState property before calling MsiSetTargetPath to determine if the product containing this component is installed.
See Calling Database Functions From Programs.
If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.
Note
The msiquery.h header defines MsiSetTargetPath as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
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 |
Target Platform | Windows |
Header | msiquery.h |
Library | Msi.lib |
DLL | Msi.dll |