msi: Add tests for enumerating the source list after publishing.

This commit is contained in:
James Hawkins 2008-02-17 23:14:20 -06:00 committed by Alexandre Julliard
parent 40aa7df344
commit f177dc9f90
2 changed files with 127 additions and 6 deletions

View File

@ -2898,6 +2898,7 @@ static void test_publishsourcelist(void)
UINT r;
DWORD size;
CHAR value[MAX_PATH];
CHAR path[MAX_PATH];
CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
CreateDirectoryA("msitest", NULL);
@ -2915,10 +2916,19 @@ static void test_publishsourcelist(void)
/* nothing published */
size = 0xdeadbeef;
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
size = 0xdeadbeef;
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
todo_wine
{
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
}
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(pf_exists("msitest\\maximus"), "File not installed\n");
@ -2927,10 +2937,19 @@ static void test_publishsourcelist(void)
/* after RegisterProduct */
size = 0xdeadbeef;
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
size = 0xdeadbeef;
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
todo_wine
{
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
}
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(pf_exists("msitest\\maximus"), "File not installed\n");
@ -2939,10 +2958,19 @@ static void test_publishsourcelist(void)
/* after ProcessComponents */
size = 0xdeadbeef;
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
size = 0xdeadbeef;
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
todo_wine
{
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
}
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(pf_exists("msitest\\maximus"), "File not installed\n");
@ -2951,10 +2979,19 @@ static void test_publishsourcelist(void)
/* after PublishFeatures */
size = 0xdeadbeef;
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
size = 0xdeadbeef;
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
todo_wine
{
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
}
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(pf_exists("msitest\\maximus"), "File not installed\n");
@ -2964,7 +3001,7 @@ static void test_publishsourcelist(void)
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -2972,6 +3009,86 @@ static void test_publishsourcelist(void)
ok(size == 11, "Expected 11, got %d\n", size);
}
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
ok(size == 0, "Expected 0, got %d\n", size);
}
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
ok(size == 0, "Expected 0, got %d\n", size);
}
lstrcpyA(path, CURR_DIR);
lstrcatA(path, "\\");
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
}
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
ok(size == 1, "Expected 1, got %d\n", size);
}
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
todo_wine
{
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
}
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
}
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
todo_wine
{
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
}
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
/* complete uninstall */
r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);

View File

@ -348,7 +348,7 @@ static const WCHAR INSTALLPROPERTY_MOREINFOURLW[] = {'M','o','r','e','I','n','f'
/* Source List Info */
#define INSTALLPROPERTY_LASTUSEDSOURCEA "LastUsedSource"
static const WCHAR INSTALLPROPERTY_LASTUSEDSOURCEW[] = {'L','a','s','t','U','s','e','d','S','o','u','r','c','e',0};
#define INSTALLPROPERTY_LASTUSEDSOURCE WINELIB_NAME_AW(INSTALLPROPERTY_LASTUSEDSOURCEW)
#define INSTALLPROPERTY_LASTUSEDSOURCE WINELIB_NAME_AW(INSTALLPROPERTY_LASTUSEDSOURCE)
#define INSTALLPROPERTY_LASTUSEDTYPEA "LastUsedType"
static const WCHAR INSTALLPROPERTY_LASTUSEDTYPEW[] = {'L','a','s','t','U','s','e','d','T','y','p','e',0};
@ -537,6 +537,10 @@ UINT WINAPI MsiSourceListAddSourceA(LPCSTR, LPCSTR, DWORD, LPCSTR);
UINT WINAPI MsiSourceListAddSourceW(LPCWSTR, LPCWSTR, DWORD, LPCWSTR);
#define MsiSourceListAddSource WINELIB_NAME_AW(MsiSourceListAddSource)
UINT WINAPI MsiSourceListEnumSourcesA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPWSTR, LPDWORD);
#define MsiSourceListEnumSources WINELIB_NAME_AW(MsiSourceListEnumSources)
UINT WINAPI MsiSourceListClearAllA(LPCSTR, LPCSTR, DWORD);
UINT WINAPI MsiSourceListClearAllW(LPCWSTR, LPCWSTR, DWORD);
#define MsiSourceListClearAll WINELIB_NAME_AW(MsiSourceListClearAll)