sync msi_winetest with wine 1.1.14

svn path=/trunk/; revision=39235
This commit is contained in:
Christoph von Wittich 2009-01-31 14:17:07 +00:00
parent d89de67fd6
commit fe9f224169
5 changed files with 220 additions and 94 deletions

View file

@ -5153,7 +5153,7 @@ static void test_viewmodify_delete_temporary(void)
DeleteFileA(msifile);
}
static void test_deleterow()
static void test_deleterow(void)
{
MSIHANDLE hdb, hview, hrec;
const char *query;

View file

@ -1365,6 +1365,7 @@ static void get_user_sid(LPSTR *usersid)
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
CloseHandle(token);
}
static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
@ -2394,6 +2395,41 @@ static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD lin
ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
}
static void check_reg_dword2(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD line)
{
DWORD val, size, type;
LONG res;
size = sizeof(DWORD);
res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
if (res != ERROR_SUCCESS || type != REG_DWORD)
{
ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
return;
}
ok_(__FILE__, line)(val == expected1 || val == expected2, "Expected %d or %d, got %d\n", expected1, expected2, val);
}
static void check_reg_dword3(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD line)
{
DWORD val, size, type;
LONG res;
size = sizeof(DWORD);
res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
if (res != ERROR_SUCCESS || type != REG_DWORD)
{
ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
return;
}
ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3,
"Expected %d, %d or %d, got %d\n", expected1, expected2, expected3, val);
}
#define CHECK_REG_STR(prodkey, name, expected) \
check_reg_str(prodkey, name, expected, TRUE, __LINE__);
@ -2415,6 +2451,20 @@ static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD lin
check_reg_dword(prodkey, name, expected, __LINE__); \
RegDeleteValueA(prodkey, name);
#define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
#define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
RegDeleteValueA(prodkey, name);
#define CHECK_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__);
#define CHECK_DEL_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__); \
RegDeleteValueA(prodkey, name);
static void get_date_str(LPSTR date)
{
SYSTEMTIME systime;
@ -2497,7 +2547,7 @@ static void test_publish_registerproduct(void)
CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
}
RegDeleteKeyA(hkey, "");
@ -2535,7 +2585,7 @@ static void test_publish_registerproduct(void)
CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
todo_wine
{
CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
}
RegDeleteKeyA(props, "");
@ -2596,7 +2646,7 @@ static void test_publish_registerproduct(void)
CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
}
RegDeleteKeyA(hkey, "");
@ -2634,7 +2684,7 @@ static void test_publish_registerproduct(void)
CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
todo_wine
{
CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
}
RegDeleteKeyA(props, "");
@ -3359,7 +3409,7 @@ static void test_publish(void)
CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
}
RegCloseKey(prodkey);
@ -3433,7 +3483,7 @@ static void test_publish(void)
CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
}
RegCloseKey(prodkey);
@ -3511,7 +3561,7 @@ static void test_publish(void)
CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
}
RegCloseKey(prodkey);
@ -3563,7 +3613,7 @@ static void test_publish(void)
CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
}
RegCloseKey(prodkey);
@ -3615,7 +3665,7 @@ static void test_publish(void)
CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -20);
}
RegCloseKey(prodkey);
@ -3693,7 +3743,7 @@ static void test_publish(void)
CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
todo_wine
{
CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
}
RegCloseKey(prodkey);
@ -3760,17 +3810,21 @@ static void test_publishsourcelist(void)
ok(pf_exists("msitest"), "File not installed\n");
/* nothing published */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -3778,17 +3832,21 @@ static void test_publishsourcelist(void)
ok(pf_exists("msitest"), "File not installed\n");
/* after RegisterProduct */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -3796,17 +3854,21 @@ static void test_publishsourcelist(void)
ok(pf_exists("msitest"), "File not installed\n");
/* after ProcessComponents */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -3814,17 +3876,21 @@ static void test_publishsourcelist(void)
ok(pf_exists("msitest"), "File not installed\n");
/* after PublishFeatures */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);

View file

@ -525,6 +525,7 @@ static void get_user_sid(LPSTR *usersid)
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
CloseHandle(token);
}
static void test_MsiQueryProductState(void)
@ -1274,7 +1275,14 @@ static void test_MsiQueryComponentState(void)
state = MAGIC_ERROR;
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
ok(state == INSTALLSTATE_NOTUSED || state == INSTALLSTATE_LOCAL,
"Expected INSTALLSTATE_NOTUSED or INSTALLSTATE_LOCAL, got %d\n", state);
/* NULL component, product exists */
state = MAGIC_ERROR;
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, NULL, &state);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(state == MAGIC_ERROR, "Expected state not changed, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -1389,7 +1397,8 @@ static void test_MsiQueryComponentState(void)
state = MAGIC_ERROR;
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
ok(state == INSTALLSTATE_NOTUSED || state == INSTALLSTATE_LOCAL,
"Expected INSTALLSTATE_NOTUSED or INSTALLSTATE_LOCAL, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -4022,7 +4031,6 @@ static void test_MsiGetProductInfoEx(void)
INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
ok(r == ERROR_MORE_DATA,
"Expected ERROR_MORE_DATA, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 10, "Expected 10, got %d\n", sz);
/* szValue is NULL, pcchValue is exactly 5 */
@ -7778,9 +7786,10 @@ static void test_MsiEnumPatchesEx(void)
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
patch_squashed[lstrlenA(patch_squashed) + 1] = '\0';
res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ,
(const BYTE *)patch_squashed,
lstrlenA(patch_squashed) + 1);
lstrlenA(patch_squashed) + 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches value exists */
@ -8779,9 +8788,10 @@ static void test_MsiEnumPatchesEx(void)
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
patch_squashed[lstrlenA(patch_squashed) + 1] = '\0';
res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ,
(const BYTE *)patch_squashed,
lstrlenA(patch_squashed) + 1);
lstrlenA(patch_squashed) + 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches value exists */
@ -9256,9 +9266,10 @@ static void test_MsiEnumPatches(void)
"Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
patch_squashed[lstrlenA(patch_squashed) + 1] = '\0';
res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ,
(const BYTE *)patch_squashed,
lstrlenA(patch_squashed) + 1);
lstrlenA(patch_squashed) + 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches value exists */
@ -9444,9 +9455,10 @@ static void test_MsiEnumPatches(void)
"Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
patch_squashed[lstrlenA(patch_squashed) + 1] = '\0';
res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ,
(const BYTE *)patch_squashed,
lstrlenA(patch_squashed) + 1);
lstrlenA(patch_squashed) + 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches value exists */
@ -9588,9 +9600,10 @@ static void test_MsiEnumPatches(void)
"Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
patch_squashed[lstrlenA(patch_squashed) + 1] = '\0';
res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ,
(const BYTE *)patch_squashed,
lstrlenA(patch_squashed) + 1);
lstrlenA(patch_squashed) + 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches value exists */

View file

@ -51,6 +51,7 @@ static void get_user_sid(LPSTR *usersid)
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
CloseHandle(token);
}
/* RegDeleteTreeW from dlls/advapi32/registry.c */

View file

@ -139,6 +139,7 @@ static int get_user_sid(LPSTR *usersid)
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
CloseHandle(token);
return 1;
}
@ -277,7 +278,8 @@ static void test_MsiSourceListGetInfo(void)
size = MAX_PATH;
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(r == ERROR_UNKNOWN_PRODUCT || ERROR_INVALID_PARAMETER,
"Expected ERROR_UNKNOWN_PRODUCT or ERROR_INVALID_PARAMETER, got %d\n", r);
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
@ -287,19 +289,23 @@ static void test_MsiSourceListGetInfo(void)
/* user product key exists */
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
res = RegCreateKeyA(userkey, "SourceList", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(size == 0, "Expected 0, got %d\n", size);
ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
data = "msitest.msi";
res = RegSetValueExA(hkey, "PackageName", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1);
@ -309,10 +315,12 @@ static void test_MsiSourceListGetInfo(void)
size = 0xdeadbeef;
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(size == 11, "Expected 11, got %d\n", size);
ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
"Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
ok(size == 11 || r != ERROR_SUCCESS, "Expected 11, got %d\n", size);
/* read the value, don't change size */
size = 11;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
@ -329,34 +337,40 @@ static void test_MsiSourceListGetInfo(void)
ok(size == 11, "Expected 11, got %d\n", size);
/* empty property now that product key exists */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, "", NULL, &size);
MSICODE_PRODUCT, "", value, &size);
ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
/* nonexistent property now that product key exists */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, "nonexistent", NULL, &size);
MSICODE_PRODUCT, "nonexistent", value, &size);
ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
data = "tester";
res = RegSetValueExA(hkey, "nonexistent", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* nonexistent property now that nonexistent value exists */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, "nonexistent", NULL, &size);
MSICODE_PRODUCT, "nonexistent", value, &size);
ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
/* invalid option now that product key exists */
size = 0xdeadbeef;
size = MAX_PATH;
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
4, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
4, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(size == 11, "Expected 11, got %d\n", size);
@ -568,11 +582,13 @@ static void test_MsiSourceListGetInfo(void)
RegCloseKey(userkey);
/* try a patch */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Patches\\");
lstrcatA(keypath, prod_squashed);
@ -583,20 +599,24 @@ static void test_MsiSourceListGetInfo(void)
/* patch key exists
* NOTE: using prodcode guid, but it really doesn't matter
*/
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, value, &size);
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
res = RegCreateKeyA(userkey, "SourceList", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
size = 0xdeadbeef;
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, value, &size);
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);
RegDeleteKeyA(hkey, "");
@ -2482,10 +2502,14 @@ static void test_MsiSourceListEnumMediaDisks(void)
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 1, &id, NULL, &labelsz,
NULL, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 2, "Expected 2, got %d\n", id);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
"Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
if (r == ERROR_SUCCESS)
{
ok(id == 2, "Expected 2, got %d\n", id);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
}
/* now fill in the values */
id = 0xbeef;
@ -2496,13 +2520,24 @@ static void test_MsiSourceListEnumMediaDisks(void)
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 1, &id, label, &labelsz,
prompt, &promptsz);
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(id == 0xbeef, "Expected 0xbeef, got %d\n", id);
ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %d\n", promptsz);
ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
"Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
if (r == ERROR_SUCCESS)
{
ok(id == 2, "Expected 2, got %d\n", id);
ok(!lstrcmpA(label, "one"), "Expected \"one\", got \"%s\"\n", label);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "two"), "Expected \"two\", got \"%s\"\n", prompt);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
}
else if (r == ERROR_INVALID_PARAMETER)
{
ok(id == 0xbeef, "Expected 0xbeef, got %d\n", id);
ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %d\n", promptsz);
}
res = RegSetValueExA(media, "4", 0, REG_SZ, (LPBYTE)"three;four", 11);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2674,11 +2709,15 @@ static void test_MsiSourceListEnumMediaDisks(void)
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 0, &id, NULL, &labelsz,
prompt, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id);
ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
"Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
if (r == ERROR_SUCCESS)
{
ok(id == 1, "Expected 1, got %d\n", id);
ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
}
/* szVolumeLabel and pcchVolumeLabel are NULL */
id = 0;
@ -2700,11 +2739,15 @@ static void test_MsiSourceListEnumMediaDisks(void)
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 0, &id, label, NULL,
prompt, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id);
ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER,
"Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r);
if (r == ERROR_SUCCESS)
{
ok(id == 1, "Expected 1, got %d\n", id);
ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label);
ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt);
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
}
/* szDiskPrompt is NULL */
id = 0;
@ -2714,11 +2757,14 @@ static void test_MsiSourceListEnumMediaDisks(void)
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, 0, &id, label, &labelsz,
NULL, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id);
ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label);
ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS, got %d\n", r);
if (r == ERROR_SUCCESS)
{
ok(id == 1, "Expected 1, got %d\n", id);
ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label);
ok(labelsz == 5, "Expected 5, got %d\n", labelsz);
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
}
/* szDiskPrompt and pcchDiskPrompt are NULL */
id = 0;