MsiSetTargetPathA function

The MsiSetTargetPath function sets the full target path for a folder in the Directory table.

Syntax

UINT MsiSetTargetPathA(
  MSIHANDLE hInstall,
  LPCSTR    szFolder,
  LPCSTR    szFolderPath
);

Parameters

hInstall

Handle to the installation provided to a DLL custom action or obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.

szFolder

Specifies the folder identifier. This is a primary key in the Directory table.

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.

Requirements

   
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

See Also

Installer Location Functions