Commit 280af526 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Mask off modifiers before setting the UILevel property.

Spotted by Aric Stewart.
parent 9b2b760e
...@@ -1154,9 +1154,9 @@ void msi_adjust_privilege_properties( MSIPACKAGE *package ) ...@@ -1154,9 +1154,9 @@ void msi_adjust_privilege_properties( MSIPACKAGE *package )
MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
{ {
static const WCHAR szpi[] = {'%','i',0}; static const WCHAR fmtW[] = {'%','u',0};
MSIPACKAGE *package; MSIPACKAGE *package;
WCHAR uilevel[10]; WCHAR uilevel[11];
UINT r; UINT r;
TRACE("%p\n", db); TRACE("%p\n", db);
...@@ -1181,7 +1181,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) ...@@ -1181,7 +1181,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
set_installed_prop( package ); set_installed_prop( package );
set_installer_properties( package ); set_installer_properties( package );
sprintfW(uilevel,szpi,gUILevel); sprintfW( uilevel, fmtW, gUILevel & INSTALLUILEVEL_MASK );
msi_set_property(package->db, szUILevel, uilevel); msi_set_property(package->db, szUILevel, uilevel);
r = msi_load_summary_properties( package ); r = msi_load_summary_properties( package );
......
...@@ -10031,6 +10031,7 @@ static void test_installprops(void) ...@@ -10031,6 +10031,7 @@ static void test_installprops(void)
UINT r; UINT r;
REGSAM access = KEY_ALL_ACCESS; REGSAM access = KEY_ALL_ACCESS;
SYSTEM_INFO si; SYSTEM_INFO si;
INSTALLUILEVEL uilevel;
if (is_wow64) if (is_wow64)
access |= KEY_WOW64_64KEY; access |= KEY_WOW64_64KEY;
...@@ -10039,6 +10040,8 @@ static void test_installprops(void) ...@@ -10039,6 +10040,8 @@ static void test_installprops(void)
lstrcat(path, "\\"); lstrcat(path, "\\");
lstrcat(path, msifile); lstrcat(path, msifile);
uilevel = MsiSetInternalUI(INSTALLUILEVEL_BASIC|INSTALLUILEVEL_SOURCERESONLY, NULL);
hdb = create_package_db(); hdb = create_package_db();
ok( hdb, "failed to create database\n"); ok( hdb, "failed to create database\n");
...@@ -10046,6 +10049,7 @@ static void test_installprops(void) ...@@ -10046,6 +10049,7 @@ static void test_installprops(void)
if (r == ERROR_INSTALL_PACKAGE_REJECTED) if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{ {
skip("Not enough rights to perform tests\n"); skip("Not enough rights to perform tests\n");
MsiSetInternalUI(uilevel, NULL);
DeleteFile(msifile); DeleteFile(msifile);
return; return;
} }
...@@ -10053,6 +10057,21 @@ static void test_installprops(void) ...@@ -10053,6 +10057,21 @@ static void test_installprops(void)
MsiCloseHandle(hdb); MsiCloseHandle(hdb);
buf[0] = 0;
size = MAX_PATH;
r = MsiGetProperty(hpkg, "UILevel", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
buf[0] = 0;
size = MAX_PATH;
r = MsiGetProperty(hpkg, "UILevel", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "DATABASE", buf, &size); r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
...@@ -10071,6 +10090,7 @@ static void test_installprops(void) ...@@ -10071,6 +10090,7 @@ static void test_installprops(void)
RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size); RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
} }
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "USERNAME", buf, &size); r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
...@@ -10088,37 +10108,44 @@ static void test_installprops(void) ...@@ -10088,37 +10108,44 @@ static void test_installprops(void)
if (*path) if (*path)
{ {
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size); r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf); ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
} }
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size); r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("VersionDatabase = %s\n", buf); trace("VersionDatabase = %s\n", buf);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "VersionMsi", buf, &size); r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("VersionMsi = %s\n", buf); trace("VersionMsi = %s\n", buf);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "Date", buf, &size); r = MsiGetProperty(hpkg, "Date", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("Date = %s\n", buf); trace("Date = %s\n", buf);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "Time", buf, &size); r = MsiGetProperty(hpkg, "Time", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("Time = %s\n", buf); trace("Time = %s\n", buf);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "PackageCode", buf, &size); r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r); ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("PackageCode = %s\n", buf); trace("PackageCode = %s\n", buf);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "ComputerName", buf, &size); r = MsiGetProperty(hpkg, "ComputerName", buf, &size);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
...@@ -10127,18 +10154,21 @@ static void test_installprops(void) ...@@ -10127,18 +10154,21 @@ static void test_installprops(void)
langid = GetUserDefaultLangID(); langid = GetUserDefaultLangID();
sprintf(path, "%d", langid); sprintf(path, "%d", langid);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size); r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf); ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
res = GetSystemMetrics(SM_CXSCREEN); res = GetSystemMetrics(SM_CXSCREEN);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "ScreenX", buf, &size); r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf)); ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
res = GetSystemMetrics(SM_CYSCREEN); res = GetSystemMetrics(SM_CYSCREEN);
buf[0] = 0;
size = MAX_PATH; size = MAX_PATH;
r = MsiGetProperty(hpkg, "ScreenY", buf, &size); r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
...@@ -10350,6 +10380,7 @@ static void test_installprops(void) ...@@ -10350,6 +10380,7 @@ static void test_installprops(void)
CloseHandle(hkey2); CloseHandle(hkey2);
MsiCloseHandle(hpkg); MsiCloseHandle(hpkg);
DeleteFile(msifile); DeleteFile(msifile);
MsiSetInternalUI(uilevel, NULL);
} }
static void test_launchconditions(void) static void test_launchconditions(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment