MsiSourceListSetInfoA function (msi.h)

The MsiSourceListSetInfo function sets information about the source list for a product or patch in a specific context.


UINT MsiSourceListSetInfoA(
  [in]           LPCSTR            szProductCodeOrPatchCode,
  [in, optional] LPCSTR            szUserSid,
  [in]           MSIINSTALLCONTEXT dwContext,
  [in]           DWORD             dwOptions,
  [in]           LPCSTR            szProperty,
  [in]           LPCSTR            szValue


[in] szProductCodeOrPatchCode

The ProductCode or patch GUID of the product or patch. Use a null-terminated string. If the string is longer than 39 characters, the function fails and returns ERROR_INVALID_PARAMETER. This parameter cannot be NULL.

[in, optional] szUserSid

This parameter can be a string SID that specifies the user account that contains the product or patch. The SID is not validated or resolved. An incorrect SID can return ERROR_UNKNOWN_PRODUCT or ERROR_UNKNOWN_PATCH. When referencing a machine context, szUserSID must be NULL and dwContext must be MSIINSTALLCONTEXT_MACHINE.

Type of SID Meaning
NULL denotes the currently logged on user. When referencing the current user account, szUserSID can be NULL and dwContext can be MSIINSTALLCONTEXT_USERMANAGED or MSIINSTALLCONTEXT_USERUNMANAGED.
User SID
Specifies enumeration for a particular user in the system. An example of a user SID is "S-1-3-64-2415071341-1358098788-3127455600-2561".
Note  The special SID string "S-1-5-18" (system) cannot be used to enumerate products or patches installed as per-machine. Setting the SID value to "S-1-5-18" returns "ERROR_INVALID_PARAMETER".
Note  The special SID string "S-1-1-0" (everyone) should not be used. Setting the SID value to "S-1-1-0" fails and returns ERROR_INVALID_PARAM.

[in] dwContext

This parameter specifies the context of the product or patch instance. This parameter can contain one of the following values.

Type of context Meaning
The product or patch instance exists in the per-user-managed context.
The product or patch instance exists in the per-user-unmanaged context.
The product or patch instance exists in the per-machine context.

[in] dwOptions

The dwOptions value specifies the meaning of szProductCodeOrPatchCode.

If the property being set is "LastUsedSource", this parameter also specifies the type of source as network or URL. In this case, the dwOptions parameter must be a combination of one of the following MSISOURCETYPE_ constants and one of the following MSICODE_ constants.

Flag Meaning
The source is a network type.
The source is a URL type.
szProductCodeOrPatchCode is a product code GUID.
szProductCodeOrPatchCode is a patch code GUID.

[in] szProperty

The parameter szProperty indicates the property value to set. Not all properties that can be retrieved through MsiSourceListGetInfo can be set via a call to MsiSourceListSetInfo. The szProperty value can be one of the following values.

Name Meaning
The path relative to the root of the installation media.
The prompt template used when prompting the user for installation media.
The most recently used source location for the product. If the source is not registered, the function calls MsiSourceListAddSourceEx to register it. On successful registration, the function sets the source as the LastUsedSource.
The name of the Windows Installer package or patch package on the source.

[in] szValue

The new value of the property. No validation of the new value is performed. This value cannot be NULL. It can be an empty string.

Return value

The MsiSourceListSetInfo function returns the following values.

Value Meaning
The user does not have the ability to set the source list for the specified product.
The configuration data is corrupt.
The Windows Installer service could not be accessed.
An invalid parameter was passed to the function.
The property was set.
The patch was not found.
The product was not found.
The source property was not found.
Unexpected internal failure.


Administrators can modify the installation of a product or patch instance that exists under the machine context or under their own per-user context (managed or unmanaged.) They can modify the installation of a product or patch instance that exists under any user's per-user-managed context. Administrators cannot modify another user's installation of a product or patch instance that exists under that other user's per-user-unmanaged context.

Non-administrators cannot modify the installation of a product or patch instance that exists under another user's per-user context (managed or unmanaged.) They can modify the installation of a product or patch instance that exists under their own per-user-unmanaged context. They can modify the installation of a product or patch instance under the machine context or their own per-user-managed context only if they are enabled to browse for a product or patch source. Users can be enabled to browse for sources by setting policy. For more information, see the DisableBrowse, AllowLockdownBrowse, and AlwaysInstallElevated policies.

An exception to the above rule is setting "LastUsedSource" to one of the registered sources. If the source is already registered, a non-administrator can set "LastUsedSource" to their own installations (managed or non-managed) and per-machine installations, irrespective of policies.


The msi.h header defines MsiSourceListSetInfo 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. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.
Target Platform Windows
Header msi.h
Library Msi.lib
DLL Msi.dll

See also

Installation Context


Not Supported in Windows Installer 2.0 and earlier