The MsiSourceListEnumSources function enumerates the sources in the source list of a specified patch or product.
Syntax
C++UINT MsiSourceListEnumSources(
__in LPCTSTR szProductCodeOrPatchCode,
__in_opt LPCTSTR szUserSid,
__in MSIINSTALLCONTEXT dwContext,
__in DWORD dwOptions,
__in DWORD dwIndex,
__in_opt LPTSTR szSource,
__inout_opt LPDWORD pcchSource
);
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]
-
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
A NULL indicates the current user who is logged on. When referencing the current user account, szUserSID can be NULL and dwContext can be MSIINSTALLCONTEXT_USERMANAGED or MSIINSTALLCONTEXT_USERUNMANAGED.
- User SID
An enumeration for a specific user in the system. An example of a user SID is "S-1-3-64-2415071341-1358098788-3127455600-2561".
- s-1-1-0
The special SID string s-1-1-0 (everyone) specifies enumeration across all users in the system.
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.
- dwContext [in]
-
The context of the product or patch instance. This parameter can contain one of the following values.
Type of context Meaning - MSIINSTALLCONTEXT_USERMANAGED
The product or patch instance exists in the per-user-managed context.
- MSIINSTALLCONTEXT_USERUNMANAGED
The product or patch instance exists in the per-user-unmanaged context.
- MSIINSTALLCONTEXT_MACHINE
The product or patch instance exists in the per-machine context.
- 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.
Flag Meaning - MSISOURCETYPE_NETWORK
The source is a network type.
- MSISOURCETYPE_URL
The source is a URL type.
- MSICODE_PRODUCT
szProductCodeOrPatchCode is a product code.
- MSICODE_PATCH
szProductCodeOrPatchCode is a patch code.
- dwIndex [in]
-
The index of the source to retrieve. This parameter must be 0 (zero) for the first call to the MsiSourceListEnumSources function, and then incremented for subsequent calls until the function returns ERROR_NO_MORE_ITEMS. The index should be incremented only if the previous call returned ERROR_SUCCESS.
- szSource [in, optional]
-
A pointer to a buffer that receives the path to the source that is being enumerated. This buffer should be large enough to contain the received value. If the buffer is too small, the function returns ERROR_MORE_DATA and sets *pcchSource to the number of TCHAR in the value, not including the terminating NULL character.
If szSource is set to NULL and pcchSource is set to a valid pointer, the function returns ERROR_SUCCESS and sets *pcchSource to the number of TCHAR in the value, not including the terminating NULL character. The function can then be called again to retrieve the value, with szSource buffer large enough to contain *pcchSource + 1 characters.
If szSource and pcchSource are both set to NULL, the function returns ERROR_SUCCESS if the value exists, without retrieving the value.
- pcchSource [in, out, optional]
-
A pointer to a variable that specifies the number of TCHAR in the szSource buffer. When the function returns, this parameter is set to the size of the requested value whether or not the function copies the value into the specified buffer. The size is returned as the number of TCHAR in the requested value, not including the terminating null character.
This parameter can be set to NULL only if szSource is also NULL, otherwise the function returns ERROR_INVALID_PARAMETER.
Return Value
The MsiSourceListEnumSources function returns the following values.
Value | Meaning |
---|---|
|
The user does not have the ability to read the specified source list. This does not indicate whether a product or patch is found. |
|
The configuration data is corrupt. |
|
An invalid parameter is passed to the function. |
|
The provided buffer is not sufficient to contain the requested data. |
|
There are no more sources in the specified list to enumerate. |
|
A source is enumerated successfully. |
|
The patch specified is not installed on the computer in the specified contexts. |
|
The product specified is not installed on the computer in the specified contexts. |
|
Unexpected internal failure. |
Remarks
When making multiple calls to MsiSourceListEnumSources to enumerate all sources for a single product instance, each call must be made from the same thread.
An administrator can enumerate per-user unmanaged and managed installations for themselves, per-machine installations, and per-user managed installations for any user. An administrator cannot enumerate per-user unmanaged installations for other users. Non-administrators can only enumerate their own per-user unmanaged and managed installations and per-machine installations.
Windows Installer 2.0: Not supported. The MsiSourceListEnumSources function is available beginning with Windows Installer 3.0.
Requirements
Version | Windows Installer 5.0 on 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, Windows XP, and Windows 2000. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
---|---|
Header | Msi.h |
Library | Msi.lib |
DLL | Msi.dll |
Unicode and ANSI names | MsiSourceListEnumSourcesW (Unicode) and MsiSourceListEnumSourcesA (ANSI) |
See Also
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.