forked from Mirrors/wine-wine
msi: Allow enumerating the sources without querying the source name.
parent
3de0014750
commit
6c7339eea1
|
@ -189,12 +189,13 @@ UINT WINAPI MsiSourceListEnumSourcesA(LPCSTR szProductCodeOrPatch, LPCSTR szUser
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
|
len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
|
||||||
if (*pcchSource >= len)
|
if (pcchSource && *pcchSource >= len)
|
||||||
WideCharToMultiByte(CP_ACP, 0, source, -1, szSource, len, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, source, -1, szSource, len, NULL, NULL);
|
||||||
else if (szSource)
|
else if (szSource)
|
||||||
r = ERROR_MORE_DATA;
|
r = ERROR_MORE_DATA;
|
||||||
|
|
||||||
*pcchSource = len - 1;
|
if (pcchSource)
|
||||||
|
*pcchSource = len - 1;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
msi_free(product);
|
msi_free(product);
|
||||||
|
@ -203,7 +204,7 @@ done:
|
||||||
|
|
||||||
if (r == ERROR_SUCCESS)
|
if (r == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (szSource) index++;
|
if (szSource || !pcchSource) index++;
|
||||||
}
|
}
|
||||||
else if (dwIndex > index)
|
else if (dwIndex > index)
|
||||||
index = 0;
|
index = 0;
|
||||||
|
@ -281,7 +282,7 @@ done:
|
||||||
|
|
||||||
if (r == ERROR_SUCCESS)
|
if (r == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (szSource) index++;
|
if (szSource || !pcchSource) index++;
|
||||||
}
|
}
|
||||||
else if (dwIndex > index)
|
else if (dwIndex > index)
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
|
@ -883,6 +883,18 @@ static void test_MsiSourceListEnumSources(void)
|
||||||
ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value);
|
ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value);
|
||||||
ok(size == 5, "Expected 5, got %d\n", size);
|
ok(size == 5, "Expected 5, got %d\n", size);
|
||||||
|
|
||||||
|
/* both szSource and pcchSource are NULL, index 0 */
|
||||||
|
r = MsiSourceListEnumSourcesA(prodcode, usersid,
|
||||||
|
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||||
|
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, NULL);
|
||||||
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||||
|
|
||||||
|
/* both szSource and pcchSource are NULL, index 1 */
|
||||||
|
r = MsiSourceListEnumSourcesA(prodcode, usersid,
|
||||||
|
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||||
|
MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, NULL, NULL);
|
||||||
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||||
|
|
||||||
/* size is exactly 5 */
|
/* size is exactly 5 */
|
||||||
size = 5;
|
size = 5;
|
||||||
lstrcpyA(value, "aaa");
|
lstrcpyA(value, "aaa");
|
||||||
|
|
Loading…
Reference in New Issue