MsiSourceListAddSourceEx function
The MsiSourceListAddSourceEx function adds or reorders the set of sources of a patch or product in a specified context. It can also create a source list for a patch that does not exist in the specified context.
Syntax
UINT MsiSourceListAddSourceEx( _In_ LPCTSTR szProductCodeOrPatchCode, _In_opt_ LPCTSTR szUserSid, _In_ MSIINSTALLCONTEXT dwContext, _In_ DWORD dwOptions, _In_ LPCTSTR szSource, _In_opt_ DWORD dwIndex );
Parameters
- szProductCodeOrPatchCode [in]
-
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.
- szUserSid [in, optional]
-
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.
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 .
- dwContext [in]
-
This parameter specifies the context of the product or patch instance. This parameter can contain one of the following values.
- dwOptions [in]
-
The dwOptions value determines the interpretation of the szProductCodeOrPatchCode value and the type of sources to clear. This parameter must be a combination of one of the following MSISOURCETYPE_* constants and one of the following MSICODE_* constants.
- szSource [in]
-
Source to add or move. This parameter is expected to contain only the path without the filename. The filename is already registered as "PackageName" and can be manipulated through MsiSourceListSetInfo. This argument is required.
- dwIndex [in, optional]
-
This parameter provides the new index for the source. All sources are indexed in the source list from 1 to N, where N is the count of sources in the list. Every source in the list has a unique index.
If MsiSourceListAddSourceEx is called with a new source and dwIndex set to 0 (zero), the new source is appended to the existing list. If dwIndex is set to 0 and the source already exists in the list, no update is done on the list.
If MsiSourceListAddSourceEx is called with a new source and dwIndex set to a non-zero value less than count (N), the new source is placed at the specified index and the other sources are re-indexed. If the source already exists, it is moved to the specified index and the other sources are re-indexed.
If MsiSourceListAddSourceEx is called with a new source and dwIndex set to a non-zero value greater than the count of sources (N), the new source is appended to the existing list. If the source already exists, it is moved to the end of the list and the other sources are re-indexed.
Return value
The MsiSourceListAddSourceEx function returns the following values.
| Value | Meaning |
|---|---|
|
The user does not have the ability to add or move a source. Does not indicate whether the product or patch was found. |
|
The configuration data is corrupt. |
|
Could not access the Windows Installer service. |
|
The source was inserted or updated. |
|
The specified product is unknown. |
|
The specified patch is unknown. |
|
Unexpected internal failure. |
Remarks
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.
Requirements
|
Version | 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 3.0 or later 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. |
|---|---|
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | MsiSourceListAddSourceExW (Unicode) and MsiSourceListAddSourceExA (ANSI) |
See also
- AllowLockdownBrowse
- AlwaysInstallElevated
- DisableBrowse
- ProductCode
- Source Resiliency
- MsiSourceListSetInfo
- Not Supported in Windows Installer 2.0 and earlier
Build date: 11/30/2012