msi: Convert REG_DWORD properties to strings in MsiGetProductInfo.

This commit is contained in:
James Hawkins 2008-02-16 23:39:16 -06:00 committed by Alexandre Julliard
parent 8412a1363b
commit bbdf79bc8c
2 changed files with 451 additions and 8 deletions

View File

@ -561,6 +561,28 @@ done:
return rc; return rc;
} }
static LPWSTR msi_reg_get_value(HKEY hkey, LPCWSTR name, DWORD *type)
{
DWORD dval;
LONG res;
WCHAR temp[20];
static const WCHAR format[] = {'%','d',0};
res = RegQueryValueExW(hkey, name, NULL, type, NULL, NULL);
if (res != ERROR_SUCCESS)
return NULL;
if (*type == REG_SZ)
return msi_reg_get_val_str(hkey, name);
if (!msi_reg_get_val_dword(hkey, name, &dval))
return NULL;
sprintfW(temp, format, dval);
return strdupW(temp);
}
static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
awstring *szValue, LPDWORD pcchValueBuf) awstring *szValue, LPDWORD pcchValueBuf)
{ {
@ -572,7 +594,7 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
BOOL classes = FALSE; BOOL classes = FALSE;
BOOL badconfig = FALSE; BOOL badconfig = FALSE;
LONG res; LONG res;
DWORD save; DWORD save, type;
static WCHAR empty[] = {0}; static WCHAR empty[] = {0};
static const WCHAR sourcelist[] = { static const WCHAR sourcelist[] = {
@ -641,7 +663,7 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONSTRINGW)) else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONSTRINGW))
szAttribute = display_version; szAttribute = display_version;
val = msi_reg_get_val_str(userdata, szAttribute); val = msi_reg_get_value(userdata, szAttribute, &type);
if (!val) if (!val)
val = empty; val = empty;
} }
@ -669,18 +691,19 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
{ {
res = RegOpenKeyW(prodkey, sourcelist, &source); res = RegOpenKeyW(prodkey, sourcelist, &source);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
val = msi_reg_get_val_str(source, szAttribute); val = msi_reg_get_value(source, szAttribute, &type);
RegCloseKey(source); RegCloseKey(source);
} }
else else
{ {
val = msi_reg_get_val_str(prodkey, szAttribute); val = msi_reg_get_value(prodkey, szAttribute, &type);
if (!val) if (!val)
val = empty; val = empty;
} }
if (val != empty && !lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGECODEW)) if (val != empty && type != REG_DWORD &&
!lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGECODEW))
{ {
if (lstrlenW(val) != SQUISH_GUID_SIZE - 1) if (lstrlenW(val) != SQUISH_GUID_SIZE - 1)
badconfig = TRUE; badconfig = TRUE;

View File

@ -2055,7 +2055,7 @@ static void test_MsiGetProductInfo(void)
CHAR buf[MAX_PATH]; CHAR buf[MAX_PATH];
CHAR keypath[MAX_PATH]; CHAR keypath[MAX_PATH];
LPSTR usersid; LPSTR usersid;
DWORD sz; DWORD sz, val = 42;
create_test_guid(prodcode, prod_squashed); create_test_guid(prodcode, prod_squashed);
create_test_guid(packcode, pack_squashed); create_test_guid(packcode, pack_squashed);
@ -2429,6 +2429,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "HelpLink", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* HelpLink type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5); res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2440,6 +2452,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "DisplayName", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* DisplayName type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"1.1.1", 6); res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"1.1.1", 6);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2451,6 +2475,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf);
ok(sz == 5, "Expected 5, got %d\n", sz); ok(sz == 5, "Expected 5, got %d\n", sz);
res = RegSetValueExA(propkey, "DisplayVersion", 0,
REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* DisplayVersion type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"tele", 5); res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"tele", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2462,6 +2498,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "tele"), "Expected \"tele\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "tele"), "Expected \"tele\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* HelpTelephone type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4); res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2473,6 +2521,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
ok(sz == 3, "Expected 3, got %d\n", sz); ok(sz == 3, "Expected 3, got %d\n", sz);
res = RegSetValueExA(propkey, "InstallLocation", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallLocation type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7); res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2484,6 +2544,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
ok(sz == 6, "Expected 6, got %d\n", sz); ok(sz == 6, "Expected 6, got %d\n", sz);
res = RegSetValueExA(propkey, "InstallSource", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallSource type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5); res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2495,6 +2567,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "InstallDate", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallDate type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4); res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2506,6 +2590,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
ok(sz == 3, "Expected 3, got %d\n", sz); ok(sz == 3, "Expected 3, got %d\n", sz);
res = RegSetValueExA(propkey, "Publisher", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Publisher type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"pack", 5); res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"pack", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2517,6 +2613,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "pack"), "Expected \"pack\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "pack"), "Expected \"pack\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "LocalPackage", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* LocalPackage type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6); res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2528,6 +2636,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
ok(sz == 5, "Expected 5, got %d\n", sz); ok(sz == 5, "Expected 5, got %d\n", sz);
res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UrlInfoAbout type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_SZ, (LPBYTE)"info", 5); res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_SZ, (LPBYTE)"info", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2539,6 +2659,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "info"), "Expected \"info\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "info"), "Expected \"info\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UrlUpdateInfo type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"1", 2); res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"1", 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2550,6 +2682,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
ok(sz == 1, "Expected 1, got %d\n", sz); ok(sz == 1, "Expected 1, got %d\n", sz);
res = RegSetValueExA(propkey, "VersionMinor", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* VersionMinor type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"1", 2); res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"1", 2);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2561,6 +2705,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
ok(sz == 1, "Expected 1, got %d\n", sz); ok(sz == 1, "Expected 1, got %d\n", sz);
res = RegSetValueExA(propkey, "VersionMajor", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* VersionMajor type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3); res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2572,6 +2728,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz); ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "ProductID", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* ProductID type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5); res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2583,6 +2751,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(propkey, "RegCompany", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* RegCompany type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"own", 4); res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"own", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2594,6 +2774,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "own"), "Expected \"own\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "own"), "Expected \"own\", got \"%s\"\n", buf);
ok(sz == 3, "Expected 3, got %d\n", sz); ok(sz == 3, "Expected 3, got %d\n", sz);
res = RegSetValueExA(propkey, "RegOwner", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* RegOwner type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5); res = RegSetValueExA(propkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2605,6 +2797,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "InstanceType", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstanceType type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5); res = RegSetValueExA(prodkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2616,6 +2820,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "type"), "Expected \"type\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "type"), "Expected \"type\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(prodkey, "InstanceType", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstanceType type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7); res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2627,6 +2843,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "Transforms", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Transforms type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7); res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2638,6 +2866,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf);
ok(sz == 6, "Expected 6, got %d\n", sz); ok(sz == 6, "Expected 6, got %d\n", sz);
res = RegSetValueExA(prodkey, "Transforms", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Transforms type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5); res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2649,6 +2889,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "Language", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Language type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5); res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2660,6 +2912,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(prodkey, "Language", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Language type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5); res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2671,6 +2935,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "ProductName", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* ProductName type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5); res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2682,10 +2958,34 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(prodkey, "ProductName", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* ProductName type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3); res = RegSetValueExA(propkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* AssignmentType value exists */ /* Assignment value exists */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "Assignment", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Assignment type is REG_DWORD */
sz = MAX_PATH; sz = MAX_PATH;
lstrcpyA(buf, "apple"); lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz); r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
@ -2696,7 +2996,7 @@ static void test_MsiGetProductInfo(void)
res = RegSetValueExA(prodkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3); res = RegSetValueExA(prodkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* AssignmentType value exists */ /* Assignment value exists */
sz = MAX_PATH; sz = MAX_PATH;
lstrcpyA(buf, "apple"); lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz); r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
@ -2704,6 +3004,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "at"), "Expected \"at\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "at"), "Expected \"at\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz); ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(prodkey, "Assignment", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Assignment type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5); res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2715,6 +3027,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "PackageCode", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* PackageCode type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5); res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2727,6 +3051,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "code"), "Expected \"code\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "code"), "Expected \"code\", got \"%s\"\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz); ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegSetValueExA(prodkey, "PackageCode", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* PackageCode type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)pack_squashed, 33); res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)pack_squashed, 33);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2749,6 +3085,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "Version", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Version type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4); res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2760,6 +3108,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
ok(sz == 3, "Expected 3, got %d\n", sz); ok(sz == 3, "Expected 3, got %d\n", sz);
res = RegSetValueExA(prodkey, "Version", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Version type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4); res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2771,6 +3131,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "ProductIcon", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* ProductIcon type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4); res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2782,6 +3154,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "ico"), "Expected \"ico\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "ico"), "Expected \"ico\", got \"%s\"\n", buf);
ok(sz == 3, "Expected 3, got %d\n", sz); ok(sz == 3, "Expected 3, got %d\n", sz);
res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* ProductIcon type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegCreateKeyA(prodkey, "SourceList", &source); res = RegCreateKeyA(prodkey, "SourceList", &source);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2795,6 +3179,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "packname"), "Expected \"packname\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "packname"), "Expected \"packname\", got \"%s\"\n", buf);
ok(sz == 8, "Expected 8, got %d\n", sz); ok(sz == 8, "Expected 8, got %d\n", sz);
res = RegSetValueExA(source, "PackageName", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* PackageName type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5); res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2806,6 +3202,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz); ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* AuthorizedLUAApp type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5); res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2817,6 +3225,18 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
ok(sz == 4, "Expected 4, got %d\n", sz); ok(sz == 4, "Expected 4, got %d\n", sz);
res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_DWORD,
(const BYTE *)&val, sizeof(DWORD));
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* AuthorizedLUAApp type is REG_DWORD */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
ok(sz == 2, "Expected 2, got %d\n", sz);
RegDeleteValueA(propkey, "HelpLink"); RegDeleteValueA(propkey, "HelpLink");
RegDeleteValueA(propkey, "DisplayName"); RegDeleteValueA(propkey, "DisplayName");
RegDeleteValueA(propkey, "DisplayVersion"); RegDeleteValueA(propkey, "DisplayVersion");