Skip to content

Latest commit

 

History

History
236 lines (168 loc) · 7.24 KB

nf-msi-msisourcelistaddsourcew.md

File metadata and controls

236 lines (168 loc) · 7.24 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:msi.MsiSourceListAddSourceW
MsiSourceListAddSourceW function (msi.h)
Adds to the list of valid network sources that contain the specified type of sources for a product or patch in a specified user context. (Unicode)
MsiSourceListAddSource
MsiSourceListAddSource function
MsiSourceListAddSourceW
_msi_msisourcelistaddsource
msi/MsiSourceListAddSource
msi/MsiSourceListAddSourceW
setup.msisourcelistaddsource
setup\msisourcelistaddsource.htm
setup
5f01a49a-38ae-4a53-967a-38aad1aa01f4
12/05/2018
MsiSourceListAddSource, MsiSourceListAddSource function, MsiSourceListAddSourceA, MsiSourceListAddSourceW, _msi_msisourcelistaddsource, msi/MsiSourceListAddSource, msi/MsiSourceListAddSourceA, msi/MsiSourceListAddSourceW, setup.msisourcelistaddsource
msi.h
Windows
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.
MsiSourceListAddSourceW (Unicode) and MsiSourceListAddSourceA (ANSI)
Msi.lib
Msi.dll
Windows
19H1
MsiSourceListAddSourceW
msi/MsiSourceListAddSourceW
c++
APIRef
kbSyntax
DllExport
Msi.dll
MsiSourceListAddSource
MsiSourceListAddSourceA
MsiSourceListAddSourceW

MsiSourceListAddSourceW function

-description

The MsiSourceListAddSource function adds to the list of valid network sources that contain the specified type of sources for a product or patch in a specified user context.

The number of sources in the SOURCELIST property is unlimited.

-parameters

-param szProduct [in]

The ProductCode of the product to modify.

-param szUserName [in]

The user name for a per-user installation. On Windows 2000 or Windows XP, the user name should always be in the format of DOMAIN\USERNAME (or MACHINENAME\USERNAME for a local user).

An empty string or NULL for a per-machine installation.

-param dwReserved [in]

Reserved for future use. This value must be set to 0.

-param szSource [in]

Pointer to the string specifying the source.

-returns

Return code Description
ERROR_ACCESS_DENIED
The user does not have the ability to add a source.
ERROR_BAD_CONFIGURATION
The configuration data is corrupt.
ERROR_BAD_USERNAME
Could not resolve the user name.
ERROR_FUNCTION_FAILED
The function did not succeed.
ERROR_INSTALL_SERVICE_FAILURE
Could not access installer service.
ERROR_INVALID_PARAMETER
An invalid parameter was passed to the function.
ERROR_SUCCESS
The source was added.
ERROR_UNKNOWN_PRODUCT
The specified product is unknown.

-remarks

An administrator can modify per-machine installations, their own per-user non-managed installations, and the per-user managed installations for any user. A non-administrator can only modify per-machine installations and their own (managed or non-managed)per-user installations. Users can be enabled to browse for sources by setting policy. For more information, see the DisableBrowse, AllowLockdownBrowse, and AlwaysInstallElevated policies.

Note that this function merely adds the new source to the list of valid sources. If another source was used to install the product, the new source is not used until the current source is unavailable.

It is the responsibility of the caller to ensure that the provided source is a valid source image for the product.

If the user name is an empty string or NULL, the function operates on the per-machine installation of the product. In this case, if the product is installed only in the per-user state, the function returns ERROR_UNKNOWN_PRODUCT.

If the user name is not an empty string or NULL, it specifies the name of the user whose product installation is modified. If the user name is the current user name, the function first attempts to modify a non-managed installation of the product. If no non-managed installation of the product can be found, the function then tries to modify a managed per-user installation of the product. If no managed or unmanaged per-user installations of the product can be found, the function returns ERROR_UNKNOWN_PRODUCT, even if the product is installed per-machine.

This function can not modify a non-managed installation for any user besides the current user. If the user name is not an empty string or NULL, but is not the current user, the function only checks for a managed per-user installation of the product for the specified user. If the product is not installed as managed per-user for the specified user, the function returns ERROR_UNKNOWN_PRODUCT, even if the product is installed per-machine.

Note

The msi.h header defines MsiSourceListAddSource 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.

-see-also

AllowLockdownBrowse

AlwaysInstallElevated

DisableBrowse

Installation Context

LookupAccountName

ProductCode

SOURCELIST

Source Resiliency