Wine-Devel
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 4 participants
- 84544 discussions
Oct. 28, 2020
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/package.c | 526 +++++++++++++++------------------------------
1 file changed, 179 insertions(+), 347 deletions(-)
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 7b64362b10d..2483d99e2b5 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -359,20 +359,11 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg)
static UINT create_temp_property_table(MSIPACKAGE *package)
{
- static const WCHAR query[] = {
- 'C','R','E','A','T','E',' ','T','A','B','L','E',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ','(',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ',
- 'C','H','A','R','(','5','6',')',' ','N','O','T',' ','N','U','L','L',' ',
- 'T','E','M','P','O','R','A','R','Y',',',' ',
- '`','V','a','l','u','e','`',' ','C','H','A','R','(','9','8',')',' ',
- 'N','O','T',' ','N','U','L','L',' ','T','E','M','P','O','R','A','R','Y',
- ' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ',
- '`','_','P','r','o','p','e','r','t','y','`',')',' ','H','O','L','D',0};
MSIQUERY *view;
UINT rc;
- rc = MSI_DatabaseOpenViewW(package->db, query, &view);
+ rc = MSI_DatabaseOpenViewW(package->db, L"CREATE TABLE `_Property` ( `_Property` CHAR(56) NOT NULL TEMPORARY, "
+ L"`Value` CHAR(98) NOT NULL TEMPORARY PRIMARY KEY `_Property`) HOLD", &view);
if (rc != ERROR_SUCCESS)
return rc;
@@ -384,22 +375,10 @@ static UINT create_temp_property_table(MSIPACKAGE *package)
UINT msi_clone_properties( MSIDATABASE *db )
{
- static const WCHAR query_select[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','P','r','o','p','e','r','t','y','`',0};
- static const WCHAR query_insert[] = {
- 'I','N','S','E','R','T',' ','I','N','T','O',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ',
- '(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ',
- 'V','A','L','U','E','S',' ','(','?',',','?',')',0};
- static const WCHAR query_update[] = {
- 'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ',
- 'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ',
- 'W','H','E','R','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','?',0};
MSIQUERY *view_select;
UINT rc;
- rc = MSI_DatabaseOpenViewW( db, query_select, &view_select );
+ rc = MSI_DatabaseOpenViewW( db, L"SELECT * FROM `Property`", &view_select );
if (rc != ERROR_SUCCESS)
return rc;
@@ -420,7 +399,7 @@ UINT msi_clone_properties( MSIDATABASE *db )
if (rc != ERROR_SUCCESS)
break;
- rc = MSI_DatabaseOpenViewW( db, query_insert, &view_insert );
+ rc = MSI_DatabaseOpenViewW( db, L"INSERT INTO `_Property` (`_Property`,`Value`) VALUES (?,?)", &view_insert );
if (rc != ERROR_SUCCESS)
{
msiobj_release( &rec_select->hdr );
@@ -436,7 +415,7 @@ UINT msi_clone_properties( MSIDATABASE *db )
TRACE("insert failed, trying update\n");
- rc = MSI_DatabaseOpenViewW( db, query_update, &view_update );
+ rc = MSI_DatabaseOpenViewW( db, L"UPDATE `_Property` SET `Value` = ? WHERE `_Property` = ?", &view_update );
if (rc != ERROR_SUCCESS)
{
WARN("open view failed %u\n", rc);
@@ -481,7 +460,7 @@ static UINT set_installed_prop( MSIPACKAGE *package )
if (r == ERROR_SUCCESS)
{
RegCloseKey( hkey );
- msi_set_property( package->db, szInstalled, szOne, -1 );
+ msi_set_property( package->db, L"Installed", L"1", -1 );
}
return r;
}
@@ -523,7 +502,7 @@ static UINT set_user_sid_prop( MSIPACKAGE *package )
if (!ConvertSidToStringSidW( psid, &sid_str ))
goto done;
- r = msi_set_property( package->db, szUserSID, sid_str, -1 );
+ r = msi_set_property( package->db, L"UserSID", sid_str, -1 );
done:
LocalFree( sid_str );
@@ -536,39 +515,27 @@ done:
static LPWSTR get_fusion_filename(MSIPACKAGE *package)
{
- static const WCHAR fusion[] =
- {'f','u','s','i','o','n','.','d','l','l',0};
- static const WCHAR subkey[] =
- {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
- 'N','E','T',' ','F','r','a','m','e','w','o','r','k',' ','S','e','t','u','p','\\','N','D','P',0};
- static const WCHAR subdir[] =
- {'M','i','c','r','o','s','o','f','t','.','N','E','T','\\','F','r','a','m','e','w','o','r','k','\\',0};
- static const WCHAR v2050727[] =
- {'v','2','.','0','.','5','0','7','2','7',0};
- static const WCHAR v4client[] =
- {'v','4','\\','C','l','i','e','n','t',0};
- static const WCHAR installpath[] =
- {'I','n','s','t','a','l','l','P','a','t','h',0};
HKEY netsetup, hkey;
LONG res;
DWORD size, len, type;
WCHAR windir[MAX_PATH], path[MAX_PATH], *filename = NULL;
- res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, subkey, 0, KEY_CREATE_SUB_KEY, &netsetup);
+ res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\NET Framework Setup\\NDP", 0, KEY_CREATE_SUB_KEY,
+ &netsetup);
if (res != ERROR_SUCCESS)
return NULL;
- if (!RegCreateKeyExW(netsetup, v4client, 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
+ if (!RegCreateKeyExW(netsetup, L"v4\\Client", 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
{
size = ARRAY_SIZE(path);
- if (!RegQueryValueExW(hkey, installpath, NULL, &type, (BYTE *)path, &size))
+ if (!RegQueryValueExW(hkey, L"InstallPath", NULL, &type, (BYTE *)path, &size))
{
- len = lstrlenW(path) + lstrlenW(fusion) + 2;
+ len = lstrlenW(path) + lstrlenW(L"fusion.dll") + 2;
if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
lstrcpyW(filename, path);
- lstrcatW(filename, szBackSlash);
- lstrcatW(filename, fusion);
+ lstrcpyW(filename, L"\\");
+ lstrcatW(filename, L"fusion.dll");
if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES)
{
TRACE( "found %s\n", debugstr_w(filename) );
@@ -580,19 +547,20 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package)
RegCloseKey(hkey);
}
- if (!RegCreateKeyExW(netsetup, v2050727, 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
+ if (!RegCreateKeyExW(netsetup, L"v2.0.50727", 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
{
RegCloseKey(hkey);
GetWindowsDirectoryW(windir, MAX_PATH);
- len = lstrlenW(windir) + lstrlenW(subdir) + lstrlenW(v2050727) + lstrlenW(fusion) + 3;
+ len = lstrlenW(windir) + lstrlenW(L"Microsoft.NET\\Framework\\") + lstrlenW(L"v2.0.50727") +
+ lstrlenW(L"fusion.dll") + 3;
if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
lstrcpyW(filename, windir);
- lstrcatW(filename, szBackSlash);
- lstrcatW(filename, subdir);
- lstrcatW(filename, v2050727);
- lstrcatW(filename, szBackSlash);
- lstrcatW(filename, fusion);
+ lstrcatW(filename, L"\\");
+ lstrcatW(filename, L"Microsoft.NET\\Framework\\");
+ lstrcatW(filename, L"v2.0.50727");
+ lstrcatW(filename, L"\\");
+ lstrcatW(filename, L"fusion.dll");
if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES)
{
TRACE( "found %s\n", debugstr_w(filename) );
@@ -620,19 +588,6 @@ static void set_msi_assembly_prop(MSIPACKAGE *package)
LPWSTR fusion, verstr;
LANGANDCODEPAGE *translate;
- static const WCHAR netasm[] = {
- 'M','s','i','N','e','t','A','s','s','e','m','b','l','y','S','u','p','p','o','r','t',0
- };
- static const WCHAR translation[] = {
- '\\','V','a','r','F','i','l','e','I','n','f','o',
- '\\','T','r','a','n','s','l','a','t','i','o','n',0
- };
- static const WCHAR verfmt[] = {
- '\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o',
- '\\','%','0','4','x','%','0','4','x',
- '\\','P','r','o','d','u','c','t','V','e','r','s','i','o','n',0
- };
-
fusion = get_fusion_filename(package);
if (!fusion)
return;
@@ -648,10 +603,11 @@ static void set_msi_assembly_prop(MSIPACKAGE *package)
if (!GetFileVersionInfoW(fusion, handle, size, version))
goto done;
- if (!VerQueryValueW(version, translation, (LPVOID *)&translate, &val_len))
+ if (!VerQueryValueW(version, L"\\VarFileInfo\\Translation", (LPVOID *)&translate, &val_len))
goto done;
- swprintf(buf, ARRAY_SIZE(buf), verfmt, translate[0].wLanguage, translate[0].wCodePage);
+ swprintf(buf, ARRAY_SIZE(buf), L"\\StringFileInfo\\%04x%04x\\ProductVersion", translate[0].wLanguage,
+ translate[0].wCodePage);
if (!VerQueryValueW(version, buf, (LPVOID *)&verstr, &val_len))
goto done;
@@ -659,7 +615,7 @@ static void set_msi_assembly_prop(MSIPACKAGE *package)
if (!val_len || !verstr)
goto done;
- msi_set_property( package->db, netasm, verstr, -1 );
+ msi_set_property( package->db, L"MsiNetAssemblySupport", verstr, -1 );
done:
msi_free(fusion);
@@ -679,84 +635,6 @@ static VOID set_installer_properties(MSIPACKAGE *package)
SYSTEM_INFO sys_info;
LANGID langid;
- static const WCHAR szCommonFilesFolder[] = {'C','o','m','m','o','n','F','i','l','e','s','F','o','l','d','e','r',0};
- static const WCHAR szProgramFilesFolder[] = {'P','r','o','g','r','a','m','F','i','l','e','s','F','o','l','d','e','r',0};
- static const WCHAR szCommonAppDataFolder[] = {'C','o','m','m','o','n','A','p','p','D','a','t','a','F','o','l','d','e','r',0};
- static const WCHAR szFavoritesFolder[] = {'F','a','v','o','r','i','t','e','s','F','o','l','d','e','r',0};
- static const WCHAR szFontsFolder[] = {'F','o','n','t','s','F','o','l','d','e','r',0};
- static const WCHAR szSendToFolder[] = {'S','e','n','d','T','o','F','o','l','d','e','r',0};
- static const WCHAR szStartMenuFolder[] = {'S','t','a','r','t','M','e','n','u','F','o','l','d','e','r',0};
- static const WCHAR szStartupFolder[] = {'S','t','a','r','t','u','p','F','o','l','d','e','r',0};
- static const WCHAR szTemplateFolder[] = {'T','e','m','p','l','a','t','e','F','o','l','d','e','r',0};
- static const WCHAR szDesktopFolder[] = {'D','e','s','k','t','o','p','F','o','l','d','e','r',0};
- static const WCHAR szProgramMenuFolder[] = {'P','r','o','g','r','a','m','M','e','n','u','F','o','l','d','e','r',0};
- static const WCHAR szAdminToolsFolder[] = {'A','d','m','i','n','T','o','o','l','s','F','o','l','d','e','r',0};
- static const WCHAR szSystemFolder[] = {'S','y','s','t','e','m','F','o','l','d','e','r',0};
- static const WCHAR szSystem16Folder[] = {'S','y','s','t','e','m','1','6','F','o','l','d','e','r',0};
- static const WCHAR szLocalAppDataFolder[] = {'L','o','c','a','l','A','p','p','D','a','t','a','F','o','l','d','e','r',0};
- static const WCHAR szMyPicturesFolder[] = {'M','y','P','i','c','t','u','r','e','s','F','o','l','d','e','r',0};
- static const WCHAR szPersonalFolder[] = {'P','e','r','s','o','n','a','l','F','o','l','d','e','r',0};
- static const WCHAR szWindowsVolume[] = {'W','i','n','d','o','w','s','V','o','l','u','m','e',0};
- static const WCHAR szPrivileged[] = {'P','r','i','v','i','l','e','g','e','d',0};
- static const WCHAR szVersion9x[] = {'V','e','r','s','i','o','n','9','X',0};
- static const WCHAR szVersionNT[] = {'V','e','r','s','i','o','n','N','T',0};
- static const WCHAR szMsiNTProductType[] = {'M','s','i','N','T','P','r','o','d','u','c','t','T','y','p','e',0};
- static const WCHAR szFormat[] = {'%','u',0};
- static const WCHAR szFormat2[] = {'%','u','.','%','u',0};
- static const WCHAR szWindowsBuild[] = {'W','i','n','d','o','w','s','B','u','i','l','d',0};
- static const WCHAR szServicePackLevel[] = {'S','e','r','v','i','c','e','P','a','c','k','L','e','v','e','l',0};
- static const WCHAR szVersionMsi[] = { 'V','e','r','s','i','o','n','M','s','i',0 };
- static const WCHAR szVersionDatabase[] = { 'V','e','r','s','i','o','n','D','a','t','a','b','a','s','e',0 };
- static const WCHAR szPhysicalMemory[] = { 'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0 };
- static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0};
- static const WCHAR szScreenY[] = {'S','c','r','e','e','n','Y',0};
- static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0};
- static const WCHAR szIntFormat[] = {'%','d',0};
- static const WCHAR szMsiAMD64[] = { 'M','s','i','A','M','D','6','4',0 };
- static const WCHAR szMsix64[] = { 'M','s','i','x','6','4',0 };
- static const WCHAR szSystem64Folder[] = { 'S','y','s','t','e','m','6','4','F','o','l','d','e','r',0 };
- static const WCHAR szCommonFiles64Folder[] = { 'C','o','m','m','o','n','F','i','l','e','s','6','4','F','o','l','d','e','r',0 };
- static const WCHAR szProgramFiles64Folder[] = { 'P','r','o','g','r','a','m','F','i','l','e','s','6','4','F','o','l','d','e','r',0 };
- static const WCHAR szProgramFilesDir[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',0};
- static const WCHAR szProgramFilesDirx86[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
- static const WCHAR szCommonFilesDir[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',0};
- static const WCHAR szCommonFilesDirx86[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
- static const WCHAR szVersionNT64[] = { 'V','e','r','s','i','o','n','N','T','6','4',0 };
- static const WCHAR szUserInfo[] = {
- 'S','O','F','T','W','A','R','E','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'M','S',' ','S','e','t','u','p',' ','(','A','C','M','E',')','\\',
- 'U','s','e','r',' ','I','n','f','o',0
- };
- static const WCHAR szDefName[] = { 'D','e','f','N','a','m','e',0 };
- static const WCHAR szDefCompany[] = { 'D','e','f','C','o','m','p','a','n','y',0 };
- static const WCHAR szCurrentVersion[] = {
- 'S','O','F','T','W','A','R','E','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0
- };
- static const WCHAR szCurrentVersionNT[] = {
- 'S','O','F','T','W','A','R','E','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0
- };
- static const WCHAR szRegisteredOwner[] = {'R','e','g','i','s','t','e','r','e','d','O','w','n','e','r',0};
- static const WCHAR szRegisteredOrganization[] = {
- 'R','e','g','i','s','t','e','r','e','d','O','r','g','a','n','i','z','a','t','i','o','n',0
- };
- static const WCHAR szUSERNAME[] = {'U','S','E','R','N','A','M','E',0};
- static const WCHAR szCOMPANYNAME[] = {'C','O','M','P','A','N','Y','N','A','M','E',0};
- static const WCHAR szUserLanguageID[] = {'U','s','e','r','L','a','n','g','u','a','g','e','I','D',0};
- static const WCHAR szSystemLangID[] = {'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0};
- static const WCHAR szProductState[] = {'P','r','o','d','u','c','t','S','t','a','t','e',0};
- static const WCHAR szLogonUser[] = {'L','o','g','o','n','U','s','e','r',0};
- static const WCHAR szNetHoodFolder[] = {'N','e','t','H','o','o','d','F','o','l','d','e','r',0};
- static const WCHAR szPrintHoodFolder[] = {'P','r','i','n','t','H','o','o','d','F','o','l','d','e','r',0};
- static const WCHAR szRecentFolder[] = {'R','e','c','e','n','t','F','o','l','d','e','r',0};
- static const WCHAR szComputerName[] = {'C','o','m','p','u','t','e','r','N','a','m','e',0};
-
/*
* Other things that probably should be set:
*
@@ -765,100 +643,100 @@ static VOID set_installer_properties(MSIPACKAGE *package)
*/
SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szCommonAppDataFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"CommonAppDataFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_FAVORITES, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szFavoritesFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"FavoritesFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szFontsFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"FontsFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_SENDTO, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szSendToFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"SendToFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szStartMenuFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"StartMenuFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szStartupFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"StartupFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_TEMPLATES, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szTemplateFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"TemplateFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_DESKTOP, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szDesktopFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"DesktopFolder", pth, -1 );
/* FIXME: set to AllUsers profile path if ALLUSERS is set */
SHGetFolderPathW(NULL, CSIDL_PROGRAMS, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szProgramMenuFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"ProgramMenuFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_ADMINTOOLS, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szAdminToolsFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"AdminToolsFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szAppDataFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"AppDataFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_SYSTEM, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szSystemFolder, pth, -1 );
- msi_set_property( package->db, szSystem16Folder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"SystemFolder", pth, -1 );
+ msi_set_property( package->db, L"System16Folder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szLocalAppDataFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"LocalAppDataFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_MYPICTURES, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szMyPicturesFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"MyPicturesFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szPersonalFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"PersonalFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szWindowsFolder, pth, -1 );
-
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"WindowsFolder", pth, -1 );
+
SHGetFolderPathW(NULL, CSIDL_PRINTHOOD, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szPrintHoodFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"PrintHoodFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_NETHOOD, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szNetHoodFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"NetHoodFolder", pth, -1 );
SHGetFolderPathW(NULL, CSIDL_RECENT, NULL, 0, pth);
- lstrcatW(pth, szBackSlash);
- msi_set_property( package->db, szRecentFolder, pth, -1 );
+ lstrcatW(pth, L"\\");
+ msi_set_property( package->db, L"RecentFolder", pth, -1 );
/* Physical Memory is specified in MB. Using total amount. */
msex.dwLength = sizeof(msex);
GlobalMemoryStatusEx( &msex );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, (int)(msex.ullTotalPhys / 1024 / 1024) );
- msi_set_property( package->db, szPhysicalMemory, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", (int)(msex.ullTotalPhys / 1024 / 1024) );
+ msi_set_property( package->db, L"PhysicalMemory", bufstr, len );
SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, pth);
ptr = wcschr(pth,'\\');
if (ptr) *(ptr + 1) = 0;
- msi_set_property( package->db, szWindowsVolume, pth, -1 );
-
+ msi_set_property( package->db, L"WindowsVolume", pth, -1 );
+
len = GetTempPathW(MAX_PATH, pth);
- msi_set_property( package->db, szTempFolder, pth, len );
+ msi_set_property( package->db, L"TempFolder", pth, len );
/* in a wine environment the user is always admin and privileged */
- msi_set_property( package->db, szAdminUser, szOne, -1 );
- msi_set_property( package->db, szPrivileged, szOne, -1 );
+ msi_set_property( package->db, L"AdminUser", L"1", -1 );
+ msi_set_property( package->db, L"Privileged", L"1", -1 );
/* set the os things */
OSVersion.dwOSVersionInfoSize = sizeof(OSVersion);
@@ -869,122 +747,122 @@ static VOID set_installer_properties(MSIPACKAGE *package)
verval = 603;
OSVersion.dwBuildNumber = 9600;
}
- len = swprintf( verstr, ARRAY_SIZE(verstr), szFormat, verval );
+ len = swprintf( verstr, ARRAY_SIZE(verstr), L"%u", verval );
switch (OSVersion.dwPlatformId)
{
- case VER_PLATFORM_WIN32_WINDOWS:
- msi_set_property( package->db, szVersion9x, verstr, len );
+ case VER_PLATFORM_WIN32_WINDOWS:
+ msi_set_property( package->db, L"Version9X", verstr, len );
break;
case VER_PLATFORM_WIN32_NT:
- msi_set_property( package->db, szVersionNT, verstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat,OSVersion.wProductType );
- msi_set_property( package->db, szMsiNTProductType, bufstr, len );
+ msi_set_property( package->db, L"VersionNT", verstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.wProductType );
+ msi_set_property( package->db, L"MsiNTProductType", bufstr, len );
break;
}
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, OSVersion.dwBuildNumber );
- msi_set_property( package->db, szWindowsBuild, bufstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, OSVersion.wServicePackMajor );
- msi_set_property( package->db, szServicePackLevel, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.dwBuildNumber );
+ msi_set_property( package->db, L"WindowsBuild", bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.wServicePackMajor );
+ msi_set_property( package->db, L"ServicePackLevel", bufstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat2, MSI_MAJORVERSION, MSI_MINORVERSION );
- msi_set_property( package->db, szVersionMsi, bufstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, MSI_MAJORVERSION * 100 );
- msi_set_property( package->db, szVersionDatabase, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u.%u", MSI_MAJORVERSION, MSI_MINORVERSION );
+ msi_set_property( package->db, L"VersionMsi", bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", MSI_MAJORVERSION * 100 );
+ msi_set_property( package->db, L"VersionDatabase", bufstr, len );
- RegOpenKeyExW(HKEY_LOCAL_MACHINE, szCurrentVersion, 0,
+ RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0,
KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey);
GetNativeSystemInfo( &sys_info );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, sys_info.wProcessorLevel );
- msi_set_property( package->db, szIntel, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", sys_info.wProcessorLevel );
+ msi_set_property( package->db, L"Intel", bufstr, len );
if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{
GetSystemDirectoryW( pth, MAX_PATH );
PathAddBackslashW( pth );
- msi_set_property( package->db, szSystemFolder, pth, -1 );
+ msi_set_property( package->db, L"SystemFolder", pth, -1 );
len = MAX_PATH;
- RegQueryValueExW(hkey, szProgramFilesDir, 0, &type, (BYTE *)pth, &len);
+ RegQueryValueExW(hkey, L"ProgramFilesDir", 0, &type, (BYTE *)pth, &len);
PathAddBackslashW( pth );
- msi_set_property( package->db, szProgramFilesFolder, pth, -1 );
+ msi_set_property( package->db, L"ProgramFilesFolder", pth, -1 );
len = MAX_PATH;
- RegQueryValueExW(hkey, szCommonFilesDir, 0, &type, (BYTE *)pth, &len);
+ RegQueryValueExW(hkey, L"CommonFilesDir", 0, &type, (BYTE *)pth, &len);
PathAddBackslashW( pth );
- msi_set_property( package->db, szCommonFilesFolder, pth, -1 );
+ msi_set_property( package->db, L"CommonFilesFolder", pth, -1 );
}
else if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{
- msi_set_property( package->db, szMsiAMD64, bufstr, -1 );
- msi_set_property( package->db, szMsix64, bufstr, -1 );
- msi_set_property( package->db, szVersionNT64, verstr, -1 );
+ msi_set_property( package->db, L"MsiAMD64", bufstr, -1 );
+ msi_set_property( package->db, L"Msix64", bufstr, -1 );
+ msi_set_property( package->db, L"VersionNT64", verstr, -1 );
GetSystemDirectoryW( pth, MAX_PATH );
PathAddBackslashW( pth );
- msi_set_property( package->db, szSystem64Folder, pth, -1 );
+ msi_set_property( package->db, L"System64Folder", pth, -1 );
GetSystemWow64DirectoryW( pth, MAX_PATH );
PathAddBackslashW( pth );
- msi_set_property( package->db, szSystemFolder, pth, -1 );
+ msi_set_property( package->db, L"SystemFolder", pth, -1 );
len = MAX_PATH;
- RegQueryValueExW(hkey, szProgramFilesDir, 0, &type, (BYTE *)pth, &len);
+ RegQueryValueExW(hkey, L"ProgramFilesDir", 0, &type, (BYTE *)pth, &len);
PathAddBackslashW( pth );
- msi_set_property( package->db, szProgramFiles64Folder, pth, -1 );
+ msi_set_property( package->db, L"ProgramFiles64Folder", pth, -1 );
len = MAX_PATH;
- RegQueryValueExW(hkey, szProgramFilesDirx86, 0, &type, (BYTE *)pth, &len);
+ RegQueryValueExW(hkey, L"ProgramFilesDir (x86)", 0, &type, (BYTE *)pth, &len);
PathAddBackslashW( pth );
- msi_set_property( package->db, szProgramFilesFolder, pth, -1 );
+ msi_set_property( package->db, L"ProgramFilesFolder", pth, -1 );
len = MAX_PATH;
- RegQueryValueExW(hkey, szCommonFilesDir, 0, &type, (BYTE *)pth, &len);
+ RegQueryValueExW(hkey, L"CommonFilesDir", 0, &type, (BYTE *)pth, &len);
PathAddBackslashW( pth );
- msi_set_property( package->db, szCommonFiles64Folder, pth, -1 );
+ msi_set_property( package->db, L"CommonFiles64Folder", pth, -1 );
len = MAX_PATH;
- RegQueryValueExW(hkey, szCommonFilesDirx86, 0, &type, (BYTE *)pth, &len);
+ RegQueryValueExW(hkey, L"CommonFilesDir (x86)", 0, &type, (BYTE *)pth, &len);
PathAddBackslashW( pth );
- msi_set_property( package->db, szCommonFilesFolder, pth, -1 );
+ msi_set_property( package->db, L"CommonFilesFolder", pth, -1 );
}
RegCloseKey(hkey);
/* Screen properties. */
dc = GetDC(0);
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, HORZRES) );
- msi_set_property( package->db, szScreenX, bufstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, VERTRES) );
- msi_set_property( package->db, szScreenY, bufstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, BITSPIXEL) );
- msi_set_property( package->db, szColorBits, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, HORZRES) );
+ msi_set_property( package->db, L"ScreenX", bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, VERTRES) );
+ msi_set_property( package->db, L"ScreenY", bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, BITSPIXEL) );
+ msi_set_property( package->db, L"ColorBits", bufstr, len );
ReleaseDC(0, dc);
/* USERNAME and COMPANYNAME */
- username = msi_dup_property( package->db, szUSERNAME );
- companyname = msi_dup_property( package->db, szCOMPANYNAME );
+ username = msi_dup_property( package->db, L"USERNAME" );
+ companyname = msi_dup_property( package->db, L"COMPANYNAME" );
if ((!username || !companyname) &&
- RegOpenKeyW( HKEY_CURRENT_USER, szUserInfo, &hkey ) == ERROR_SUCCESS)
+ RegOpenKeyW( HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey ) == ERROR_SUCCESS)
{
if (!username &&
- (username = msi_reg_get_val_str( hkey, szDefName )))
- msi_set_property( package->db, szUSERNAME, username, -1 );
+ (username = msi_reg_get_val_str( hkey, L"DefName" )))
+ msi_set_property( package->db, L"USERNAME", username, -1 );
if (!companyname &&
- (companyname = msi_reg_get_val_str( hkey, szDefCompany )))
- msi_set_property( package->db, szCOMPANYNAME, companyname, -1 );
+ (companyname = msi_reg_get_val_str( hkey, L"DefCompany" )))
+ msi_set_property( package->db, L"COMPANYNAME", companyname, -1 );
CloseHandle( hkey );
}
if ((!username || !companyname) &&
- RegOpenKeyExW( HKEY_LOCAL_MACHINE, szCurrentVersionNT, 0, KEY_QUERY_VALUE|KEY_WOW64_64KEY,
- &hkey ) == ERROR_SUCCESS)
+ RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0,
+ KEY_QUERY_VALUE|KEY_WOW64_64KEY, &hkey ) == ERROR_SUCCESS)
{
if (!username &&
- (username = msi_reg_get_val_str( hkey, szRegisteredOwner )))
- msi_set_property( package->db, szUSERNAME, username, -1 );
+ (username = msi_reg_get_val_str( hkey, L"RegisteredOwner" )))
+ msi_set_property( package->db, L"USERNAME", username, -1 );
if (!companyname &&
- (companyname = msi_reg_get_val_str( hkey, szRegisteredOrganization )))
- msi_set_property( package->db, szCOMPANYNAME, companyname, -1 );
+ (companyname = msi_reg_get_val_str( hkey, L"RegisteredOrganization" )))
+ msi_set_property( package->db, L"COMPANYNAME", companyname, -1 );
CloseHandle( hkey );
}
msi_free( username );
@@ -996,15 +874,15 @@ static VOID set_installer_properties(MSIPACKAGE *package)
set_msi_assembly_prop( package );
langid = GetUserDefaultLangID();
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, langid );
- msi_set_property( package->db, szUserLanguageID, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", langid );
+ msi_set_property( package->db, L"UserLanguageID", bufstr, len );
langid = GetSystemDefaultLangID();
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, langid );
- msi_set_property( package->db, szSystemLangID, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", langid );
+ msi_set_property( package->db, L"SystemLanguageID", bufstr, len );
- len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, MsiQueryProductStateW(package->ProductCode) );
- msi_set_property( package->db, szProductState, bufstr, len );
+ len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", MsiQueryProductStateW(package->ProductCode) );
+ msi_set_property( package->db, L"ProductState", bufstr, len );
len = 0;
if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
@@ -1013,7 +891,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
if ((username = msi_alloc( len * sizeof(WCHAR) )))
{
if (GetUserNameW( username, &len ))
- msi_set_property( package->db, szLogonUser, username, len - 1 );
+ msi_set_property( package->db, L"LogonUser", username, len - 1 );
msi_free( username );
}
}
@@ -1024,7 +902,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
if ((computername = msi_alloc( len * sizeof(WCHAR) )))
{
if (GetComputerNameW( computername, &len ))
- msi_set_property( package->db, szComputerName, computername, len );
+ msi_set_property( package->db, L"ComputerName", computername, len );
msi_free( computername );
}
}
@@ -1066,9 +944,7 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package)
BYTE *data;
UINT r, sz;
- static const WCHAR stmname[] = {'A','d','m','i','n','P','r','o','p','e','r','t','i','e','s',0};
-
- r = read_stream_data(package->db->storage, stmname, FALSE, &data, &sz);
+ r = read_stream_data(package->db->storage, L"AdminProperties", FALSE, &data, &sz);
if (r != ERROR_SUCCESS)
return r;
@@ -1081,17 +957,16 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package)
void msi_adjust_privilege_properties( MSIPACKAGE *package )
{
/* FIXME: this should depend on the user's privileges */
- if (msi_get_property_int( package->db, szAllUsers, 0 ) == 2)
+ if (msi_get_property_int( package->db, L"ALLUSERS", 0 ) == 2)
{
TRACE("resetting ALLUSERS property from 2 to 1\n");
- msi_set_property( package->db, szAllUsers, szOne, -1 );
+ msi_set_property( package->db, L"ALLUSERS", L"1", -1 );
}
- msi_set_property( package->db, szAdminUser, szOne, -1 );
+ msi_set_property( package->db, L"AdminUser", L"1", -1 );
}
MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
{
- static const WCHAR fmtW[] = {'%','u',0};
MSIPACKAGE *package;
WCHAR uilevel[11];
int len;
@@ -1115,13 +990,13 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
msi_clone_properties( package->db );
msi_adjust_privilege_properties( package );
- package->ProductCode = msi_dup_property( package->db, szProductCode );
+ package->ProductCode = msi_dup_property( package->db, L"ProductCode" );
set_installer_properties( package );
package->ui_level = gUILevel;
- len = swprintf( uilevel, ARRAY_SIZE(uilevel), fmtW, gUILevel & INSTALLUILEVEL_MASK );
- msi_set_property( package->db, szUILevel, uilevel, len );
+ len = swprintf( uilevel, ARRAY_SIZE(uilevel), L"%u", gUILevel & INSTALLUILEVEL_MASK );
+ msi_set_property( package->db, L"UILevel", uilevel, len );
r = msi_load_suminfo_properties( package );
if (r != ERROR_SUCCESS)
@@ -1177,21 +1052,18 @@ UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename )
UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix )
{
- static const WCHAR szInstaller[] = {
- '\\','I','n','s','t','a','l','l','e','r','\\',0};
- static const WCHAR fmt[] = {'%','x',0};
DWORD time, len, i, offset;
HANDLE handle;
time = GetTickCount();
GetWindowsDirectoryW( path, MAX_PATH );
- lstrcatW( path, szInstaller );
+ lstrcatW( path, L"\\Installer\\" );
CreateDirectoryW( path, NULL );
len = lstrlenW(path);
for (i = 0; i < 0x10000; i++)
{
- offset = swprintf( path + len, MAX_PATH - len, fmt, (time + i) & 0xffff );
+ offset = swprintf( path + len, MAX_PATH - len, L"%x", (time + i) & 0xffff );
memcpy( path + len + offset, suffix, (lstrlenW( suffix ) + 1) * sizeof(WCHAR) );
handle = CreateFileW( path, GENERIC_WRITE, 0, NULL,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 );
@@ -1210,11 +1082,11 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix )
static enum platform parse_platform( const WCHAR *str )
{
- if (!str[0] || !wcscmp( str, szIntel )) return PLATFORM_INTEL;
- else if (!wcscmp( str, szIntel64 )) return PLATFORM_INTEL64;
- else if (!wcscmp( str, szX64 ) || !wcscmp( str, szAMD64 )) return PLATFORM_X64;
- else if (!wcscmp( str, szARM )) return PLATFORM_ARM;
- else if (!wcscmp( str, szARM64 )) return PLATFORM_ARM64;
+ if (!str[0] || !wcscmp( str, L"Intel" )) return PLATFORM_INTEL;
+ else if (!wcscmp( str, L"Intel64" )) return PLATFORM_INTEL64;
+ else if (!wcscmp( str, L"x64" ) || !wcscmp( str, L"AMD64" )) return PLATFORM_X64;
+ else if (!wcscmp( str, L"Arm" )) return PLATFORM_ARM;
+ else if (!wcscmp( str, L"Arm64" )) return PLATFORM_ARM64;
return PLATFORM_UNRECOGNIZED;
}
@@ -1332,17 +1204,12 @@ static UINT validate_package( MSIPACKAGE *package )
static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop )
{
- static const WCHAR select_query[] = {
- 'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ',
- 'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',' ',
- 'W','H','E','R','E',' ','`','P','r','o','p','e','r','t','y','`','=',
- '\'','%','s','\'',0};
WCHAR query[MAX_PATH];
MSIQUERY *view;
MSIRECORD *rec;
WCHAR *ret = NULL;
- swprintf(query, ARRAY_SIZE(query), select_query, prop);
+ swprintf(query, ARRAY_SIZE(query), L"SELECT `Value` FROM `Property` WHERE `Property`='%s'", prop);
if (MSI_DatabaseOpenViewW( db, query, &view ) != ERROR_SUCCESS)
{
return NULL;
@@ -1365,12 +1232,12 @@ static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop )
static WCHAR *get_product_code( MSIDATABASE *db )
{
- return get_property( db, szProductCode );
+ return get_property( db, L"ProductCode" );
}
static WCHAR *get_product_version( MSIDATABASE *db )
{
- return get_property( db, szProductVersion );
+ return get_property( db, L"ProductVersion" );
}
static UINT get_registered_local_package( const WCHAR *product, WCHAR *localfile )
@@ -1436,9 +1303,9 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package )
UINT r;
if (UrlIsW( package, URLIS_URL ))
- r = msi_set_property( db, szOriginalDatabase, package, -1 );
+ r = msi_set_property( db, L"OriginalDatabase", package, -1 );
else if (package[0] == '#')
- r = msi_set_property( db, szOriginalDatabase, db->path, -1 );
+ r = msi_set_property( db, L"OriginalDatabase", db->path, -1 );
else
{
DWORD len;
@@ -1447,7 +1314,7 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package )
if (!(len = GetFullPathNameW( package, 0, NULL, NULL ))) return GetLastError();
if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
len = GetFullPathNameW( package, len, path, NULL );
- r = msi_set_property( db, szOriginalDatabase, path, len );
+ r = msi_set_property( db, L"OriginalDatabase", path, len );
msi_free( path );
}
return r;
@@ -1455,7 +1322,6 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package )
UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
{
- static const WCHAR dotmsi[] = {'.','m','s','i',0};
MSIDATABASE *db;
MSIPACKAGE *package;
MSIHANDLE handle;
@@ -1502,7 +1368,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
r = get_local_package( db, localfile );
if (r != ERROR_SUCCESS || GetFileAttributesW( localfile ) == INVALID_FILE_ATTRIBUTES)
{
- r = msi_create_empty_local_file( localfile, dotmsi );
+ r = msi_create_empty_local_file( localfile, L".msi" );
if (r != ERROR_SUCCESS)
{
msiobj_release( &db->hdr );
@@ -1583,7 +1449,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
msiobj_release( &package->hdr );
return r;
}
- msi_set_property( package->db, szDatabase, db->path, -1 );
+ msi_set_property( package->db, L"DATABASE", db->path, -1 );
set_installed_prop( package );
msi_set_context( package );
@@ -1591,7 +1457,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
if (msi_locate_product( product_code, &context ) == ERROR_SUCCESS)
{
TRACE("product already registered\n");
- msi_set_property( package->db, szProductToBeRegistered, szOne, -1 );
+ msi_set_property( package->db, L"ProductToBeRegistered", L"1", -1 );
}
msi_free(product_code);
@@ -1765,12 +1631,6 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *record, LPCWSTR message)
{
- static const WCHAR szActionData[] = {'A','c','t','i','o','n','D','a','t','a',0};
- static const WCHAR szActionText[] = {'A','c','t','i','o','n','T','e','x','t',0};
- static const WCHAR szSetProgress[] = {'S','e','t','P','r','o','g','r','e','s','s',0};
- static const WCHAR szWindows_Installer[] =
- {'W','i','n','d','o','w','s',' ','I','n','s','t','a','l','l','e','r',0};
-
if (!package || (package->ui_level & INSTALLUILEVEL_MASK) == INSTALLUILEVEL_NONE)
return 0;
@@ -1784,17 +1644,17 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0;
if (!(eMessageType & MB_ICONMASK))
eMessageType |= MB_ICONEXCLAMATION;
- return MessageBoxW(gUIhwnd, message, szWindows_Installer, eMessageType & 0x00ffffff);
+ return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff);
case INSTALLMESSAGE_WARNING:
if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0;
if (!(eMessageType & MB_ICONMASK))
eMessageType |= MB_ICONASTERISK;
- return MessageBoxW(gUIhwnd, message, szWindows_Installer, eMessageType & 0x00ffffff);
+ return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff);
case INSTALLMESSAGE_USER:
if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0;
if (!(eMessageType & MB_ICONMASK))
eMessageType |= MB_USERICON;
- return MessageBoxW(gUIhwnd, message, szWindows_Installer, eMessageType & 0x00ffffff);
+ return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff);
case INSTALLMESSAGE_INFO:
case INSTALLMESSAGE_INITIALIZE:
case INSTALLMESSAGE_TERMINATE:
@@ -1815,7 +1675,7 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
if (!uirow) return -1;
deformat_string(package, MSI_RecordGetString(record, 2), &deformatted);
MSI_RecordSetStringW(uirow, 1, deformatted);
- msi_event_fire(package, szActionText, uirow);
+ msi_event_fire(package, L"ActionText", uirow);
msi_free(deformatted);
msiobj_release(&uirow->hdr);
@@ -1826,7 +1686,7 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
MSIRECORD *uirow = MSI_CreateRecord(1);
if (!uirow) return -1;
MSI_RecordSetStringW(uirow, 1, message);
- msi_event_fire(package, szActionData, uirow);
+ msi_event_fire(package, L"ActionData", uirow);
msiobj_release(&uirow->hdr);
if (package->action_progress_increment)
@@ -1835,13 +1695,13 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
if (!uirow) return -1;
MSI_RecordSetInteger(uirow, 1, 2);
MSI_RecordSetInteger(uirow, 2, package->action_progress_increment);
- msi_event_fire(package, szSetProgress, uirow);
+ msi_event_fire(package, L"SetProgress", uirow);
msiobj_release(&uirow->hdr);
}
return 1;
}
case INSTALLMESSAGE_PROGRESS:
- msi_event_fire(package, szSetProgress, record);
+ msi_event_fire(package, L"SetProgress", record);
return 1;
case INSTALLMESSAGE_COMMONDATA:
switch (MSI_RecordGetInteger(record, 1))
@@ -1860,8 +1720,6 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
}
}
-static const WCHAR szActionNotFound[] = {'D','E','B','U','G',':',' ','E','r','r','o','r',' ','[','1',']',':',' ',' ','A','c','t','i','o','n',' ','n','o','t',' ','f','o','u','n','d',':',' ','[','2',']',0};
-
static const struct
{
int id;
@@ -1869,7 +1727,7 @@ static const struct
}
internal_errors[] =
{
- {2726, szActionNotFound},
+ {2726, L"DEBUG: Error [1]: Action not found: [2]"},
{0}
};
@@ -1891,14 +1749,10 @@ static LPCWSTR get_internal_error_message(int error)
/* Returned string must be freed */
LPWSTR msi_get_error_message(MSIDATABASE *db, int error)
{
- static const WCHAR query[] =
- {'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ',
- 'F','R','O','M',' ','`','E','r','r','o','r','`',' ','W','H','E','R','E',' ',
- '`','E','r','r','o','r','`',' ','=',' ','%','i',0};
MSIRECORD *record;
LPWSTR ret = NULL;
- if ((record = MSI_QueryGetRecord(db, query, error)))
+ if ((record = MSI_QueryGetRecord(db, L"SELECT `Message` FROM `Error` WHERE `Error` = %d", error)))
{
ret = msi_dup_record_field(record, 1);
msiobj_release(&record->hdr);
@@ -2028,7 +1882,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
template_rec = msi_dup_record_field(record, 0);
template_prefix = msi_get_error_message(package->db, eMessageType >> 24);
- if (!template_prefix) template_prefix = strdupW(szEmpty);
+ if (!template_prefix) template_prefix = strdupW(L"");
if (!template_rec)
{
@@ -2060,19 +1914,17 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
msi_free(package->LastAction);
msi_free(package->LastActionTemplate);
package->LastAction = msi_dup_record_field(record, 1);
- if (!package->LastAction) package->LastAction = strdupW(szEmpty);
+ if (!package->LastAction) package->LastAction = strdupW(L"");
package->LastActionTemplate = msi_dup_record_field(record, 3);
break;
}
case INSTALLMESSAGE_ACTIONDATA:
if (package->LastAction && package->LastActionTemplate)
{
- static const WCHAR template_s[] =
- {'{','{','%','s',':',' ','}','}','%','s',0};
size_t len = lstrlenW(package->LastAction) + lstrlenW(package->LastActionTemplate) + 7;
WCHAR *template = msi_alloc(len * sizeof(WCHAR));
if (!template) return ERROR_OUTOFMEMORY;
- swprintf(template, len, template_s, package->LastAction, package->LastActionTemplate);
+ swprintf(template, len, L"{{%s: }}%s", package->LastAction, package->LastActionTemplate);
MSI_RecordSetStringW(record, 0, template);
msi_free(template);
}
@@ -2174,19 +2026,6 @@ void msi_reset_source_folders( MSIPACKAGE *package )
UINT msi_set_property( MSIDATABASE *db, const WCHAR *name, const WCHAR *value, int len )
{
- static const WCHAR insert_query[] = {
- 'I','N','S','E','R','T',' ','I','N','T','O',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ',
- '(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ',
- 'V','A','L','U','E','S',' ','(','?',',','?',')',0};
- static const WCHAR update_query[] = {
- 'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ',
- 'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ','W','H','E','R','E',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
- static const WCHAR delete_query[] = {
- 'D','E','L','E','T','E',' ','F','R','O','M',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ',
- '`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
MSIQUERY *view;
MSIRECORD *row = NULL;
DWORD sz = 0;
@@ -2207,17 +2046,17 @@ UINT msi_set_property( MSIDATABASE *db, const WCHAR *name, const WCHAR *value, i
rc = msi_get_property( db, name, 0, &sz );
if (!value || (!*value && !len))
{
- swprintf( query, ARRAY_SIZE(query), delete_query, name );
+ swprintf( query, ARRAY_SIZE(query), L"DELETE FROM `_Property` WHERE `_Property` = '%s'", name );
}
else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS)
{
- swprintf( query, ARRAY_SIZE(query), update_query, name );
+ swprintf( query, ARRAY_SIZE(query), L"UPDATE `_Property` SET `Value` = ? WHERE `_Property` = '%s'", name );
row = MSI_CreateRecord(1);
msi_record_set_string( row, 1, value, len );
}
else
{
- lstrcpyW( query, insert_query );
+ lstrcpyW( query, L"INSERT INTO `_Property` (`_Property`,`Value`) VALUES (?,?)" );
row = MSI_CreateRecord(2);
msi_record_set_string( row, 1, name, -1 );
msi_record_set_string( row, 2, value, len );
@@ -2261,7 +2100,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
}
ret = msi_set_property( package->db, szName, szValue, -1 );
- if (ret == ERROR_SUCCESS && !wcscmp( szName, szSourceDir ))
+ if (ret == ERROR_SUCCESS && !wcscmp( szName, L"SourceDir" ))
msi_reset_source_folders( package );
msiobj_release( &package->hdr );
@@ -2270,23 +2109,16 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
{
- static const WCHAR query[]= {
- 'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ',
- 'F','R','O','M',' ' ,'`','_','P','r','o','p','e','r','t','y','`',' ',
- 'W','H','E','R','E',' ' ,'`','_','P','r','o','p','e','r','t','y','`','=','?',0};
MSIRECORD *rec, *row = NULL;
MSIQUERY *view;
UINT r;
-
- static const WCHAR szDate[] = {'D','a','t','e',0};
- static const WCHAR szTime[] = {'T','i','m','e',0};
WCHAR *buffer;
int length;
if (!name || !*name)
return NULL;
- if (!wcscmp(name, szDate))
+ if (!wcscmp(name, L"Date"))
{
length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0);
if (!length)
@@ -2304,7 +2136,7 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
msi_free(buffer);
return row;
}
- else if (!wcscmp(name, szTime))
+ else if (!wcscmp(name, L"Time"))
{
length = GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOTIMEMARKER, NULL, NULL, NULL, 0);
if (!length)
@@ -2329,7 +2161,7 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
MSI_RecordSetStringW(rec, 1, name);
- r = MSI_DatabaseOpenViewW(db, query, &view);
+ r = MSI_DatabaseOpenViewW(db, L"SELECT `Value` FROM `_Property` WHERE `_Property`=?", &view);
if (r == ERROR_SUCCESS)
{
MSI_ViewExecute(view, rec);
@@ -2408,7 +2240,7 @@ int msi_get_property_int( MSIDATABASE *db, LPCWSTR prop, int def )
UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD *sz)
{
- const WCHAR *value = szEmpty;
+ const WCHAR *value = L"";
MSIPACKAGE *package;
MSIRECORD *row;
WCHAR *nameW;
@@ -2480,7 +2312,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWORD *sz)
{
- const WCHAR *value = szEmpty;
+ const WCHAR *value = L"";
MSIPACKAGE *package;
MSIRECORD *row;
int len = 0;
--
2.28.0
1
0
Oct. 28, 2020
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/msi.c | 182 +++++++++++++++++--------------------------------
1 file changed, 64 insertions(+), 118 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 6387b0a9372..71de13a8ffc 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -53,8 +53,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
BOOL is_wow64;
-static const WCHAR installerW[] = {'\\','I','n','s','t','a','l','l','e','r',0};
-
UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
{
HKEY hkey = NULL;
@@ -109,10 +107,6 @@ static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package)
LPWSTR path;
MSIINSTALLCONTEXT context;
- static const WCHAR managed[] = {
- 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0};
- static const WCHAR local[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
-
TRACE("%s %p\n", debugstr_w(szProduct), package);
r = msi_locate_product(szProduct, &context);
@@ -124,9 +118,9 @@ static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package)
return ERROR_UNKNOWN_PRODUCT;
if (context == MSIINSTALLCONTEXT_USERMANAGED)
- path = msi_reg_get_val_str(props, managed);
+ path = msi_reg_get_val_str(props, L"ManagedLocalPackage");
else
- path = msi_reg_get_val_str(props, local);
+ path = msi_reg_get_val_str(props, L"LocalPackage");
r = ERROR_UNKNOWN_PRODUCT;
@@ -250,7 +244,7 @@ UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
if (!*szPackagePath)
return ERROR_PATH_NOT_FOUND;
- reinstallmode = msi_get_command_line_option(szCommandLine, szReinstallMode, &len);
+ reinstallmode = msi_get_command_line_option(szCommandLine, L"REINSTALLMODE", &len);
if (reinstallmode)
{
while (len > 0)
@@ -292,7 +286,7 @@ UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode)
{
TRACE("%s %08x\n", debugstr_w(szProduct), dwReinstallMode);
- return MsiReinstallFeatureW(szProduct, szAll, dwReinstallMode);
+ return MsiReinstallFeatureW(szProduct, L"ALL", dwReinstallMode);
}
UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage,
@@ -376,9 +370,6 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
LPWSTR cmd, *codes = NULL;
BOOL succeeded = FALSE;
- static const WCHAR fmt[] = {'%','s',' ','P','A','T','C','H','=','"','%','s','"',0};
- static const WCHAR empty[] = {0};
-
if (!szPatchPackage || !szPatchPackage[0])
return ERROR_INVALID_PARAMETER;
@@ -386,16 +377,16 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
return r;
if (!szCommandLine)
- cmd_ptr = empty;
+ cmd_ptr = L"";
- size = lstrlenW(cmd_ptr) + lstrlenW(fmt) + lstrlenW(szPatchPackage) + 1;
+ size = lstrlenW(cmd_ptr) + lstrlenW(L"%s PATCH=\"%s\"") + lstrlenW(szPatchPackage) + 1;
cmd = msi_alloc(size * sizeof(WCHAR));
if (!cmd)
{
msi_free(codes);
return ERROR_OUTOFMEMORY;
}
- swprintf(cmd, size, fmt, cmd_ptr, szPatchPackage);
+ swprintf(cmd, size, L"%s PATCH=\"%s\"", cmd_ptr, szPatchPackage);
if (szProductCode)
r = MsiConfigureProductExW(szProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
@@ -603,9 +594,6 @@ static UINT MSI_ApplicablePatchW( MSIPACKAGE *package, LPCWSTR patch )
/* IXMLDOMDocument should be set to XPath mode already */
static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc )
{
- static const WCHAR queryW[] = {'M','s','i','P','a','t','c','h','/',
- 'T','a','r','g','e','t','P','r','o','d','u','c','t','/',
- 'T','a','r','g','e','t','P','r','o','d','u','c','t','C','o','d','e',0};
UINT r = ERROR_FUNCTION_FAILED;
IXMLDOMNodeList *list;
LPWSTR product_code;
@@ -613,7 +601,7 @@ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc )
HRESULT hr;
BSTR s;
- product_code = msi_dup_property( package->db, szProductCode );
+ product_code = msi_dup_property( package->db, L"ProductCode" );
if (!product_code)
{
/* FIXME: the property ProductCode should be written into the DB somewhere */
@@ -621,7 +609,7 @@ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc )
return ERROR_SUCCESS;
}
- s = SysAllocString(queryW);
+ s = SysAllocString( L"MsiPatch/TargetProduct/TargetProductCode" );
hr = IXMLDOMDocument_selectNodes( desc, s, &list );
SysFreeString(s);
if (hr != S_OK)
@@ -808,7 +796,7 @@ static UINT open_package( const WCHAR *product, const WCHAR *usersid,
r = MSIREG_OpenInstallProps( product, context, usersid, &props, FALSE );
if (r != ERROR_SUCCESS) return ERROR_BAD_CONFIGURATION;
- if ((localpath = msi_reg_get_val_str( props, szLocalPackage )))
+ if ((localpath = msi_reg_get_val_str( props, L"LocalPackage" )))
{
lstrcpyW( sourcepath, localpath );
msi_free( localpath );
@@ -858,15 +846,6 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
WCHAR sourcepath[MAX_PATH], filename[MAX_PATH];
LPWSTR commandline;
- static const WCHAR szInstalled[] = {
- ' ','I','n','s','t','a','l','l','e','d','=','1',0};
- static const WCHAR szMaxInstallLevel[] = {
- ' ','I','N','S','T','A','L','L','L','E','V','E','L','=','3','2','7','6','7',0};
- static const WCHAR szRemoveAll[] = {
- ' ','R','E','M','O','V','E','=','A','L','L',0};
- static const WCHAR szMachine[] = {
- ' ','A','L','L','U','S','E','R','S','=','1',0};
-
TRACE("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState,
debugstr_w(szCommandLine));
@@ -888,19 +867,19 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
if (r != ERROR_SUCCESS)
return r;
- sz = lstrlenW(szInstalled) + 1;
+ sz = lstrlenW(L" Installed=1") + 1;
if (szCommandLine)
sz += lstrlenW(szCommandLine);
if (eInstallState != INSTALLSTATE_DEFAULT)
- sz += lstrlenW(szMaxInstallLevel);
+ sz += lstrlenW(L" INSTALLLEVEL=32767");
if (eInstallState == INSTALLSTATE_ABSENT)
- sz += lstrlenW(szRemoveAll);
+ sz += lstrlenW(L" REMOVE=ALL");
if (context == MSIINSTALLCONTEXT_MACHINE)
- sz += lstrlenW(szMachine);
+ sz += lstrlenW(L" ALLUSERS=1");
commandline = msi_alloc(sz * sizeof(WCHAR));
if (!commandline)
@@ -911,16 +890,16 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
commandline[0] = 0;
if (szCommandLine)
- lstrcpyW(commandline,szCommandLine);
+ lstrcpyW(commandline, szCommandLine);
if (eInstallState != INSTALLSTATE_DEFAULT)
- lstrcatW(commandline, szMaxInstallLevel);
+ lstrcatW(commandline, L" INSTALLLEVEL=32767");
if (eInstallState == INSTALLSTATE_ABSENT)
- lstrcatW(commandline, szRemoveAll);
+ lstrcatW(commandline, L" REMOVE=ALL");
if (context == MSIINSTALLCONTEXT_MACHINE)
- lstrcatW(commandline, szMachine);
+ lstrcatW(commandline, L" ALLUSERS=1");
sz = sizeof(sourcepath);
MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT,
@@ -1041,7 +1020,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
return ERROR_INVALID_PARAMETER;
if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS &&
- MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &compkey, FALSE) != ERROR_SUCCESS)
+ MSIREG_OpenUserDataComponentKey(szComponent, L"S-1-5-18", &compkey, FALSE) != ERROR_SUCCESS)
{
return ERROR_UNKNOWN_COMPONENT;
}
@@ -1102,12 +1081,11 @@ static WCHAR *reg_get_value( HKEY hkey, const WCHAR *name, DWORD *type )
if (*type == REG_SZ) return msi_reg_get_val_str( hkey, name );
if (*type == REG_DWORD)
{
- static const WCHAR fmt[] = {'%','u',0};
WCHAR temp[11];
DWORD val;
if (!msi_reg_get_val_dword( hkey, name, &val )) return NULL;
- swprintf( temp, ARRAY_SIZE(temp), fmt, val );
+ swprintf( temp, ARRAY_SIZE(temp), L"%u", val );
return strdupW( temp );
}
@@ -1119,10 +1097,6 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
awstring *szValue, LPDWORD pcchValueBuf)
{
static WCHAR empty[] = {0};
- static const WCHAR sourcelist[] = {'S','o','u','r','c','e','L','i','s','t',0};
- static const WCHAR display_name[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
- static const WCHAR display_version[] = {'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
- static const WCHAR assignment[] = {'A','s','s','i','g','n','m','e','n','t',0};
MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED;
UINT r = ERROR_UNKNOWN_PROPERTY;
HKEY prodkey, userdata, source;
@@ -1182,9 +1156,9 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
}
if (!wcscmp( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ))
- szAttribute = display_name;
+ szAttribute = L"DisplayName";
else if (!wcscmp( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW ))
- szAttribute = display_version;
+ szAttribute = L"DisplayVersion";
val = reg_get_value(userdata, szAttribute, &type);
if (!val)
@@ -1209,11 +1183,11 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
}
if (!wcscmp( szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW ))
- szAttribute = assignment;
+ szAttribute = L"Assignment";
if (!wcscmp( szAttribute, INSTALLPROPERTY_PACKAGENAMEW ))
{
- res = RegOpenKeyW(prodkey, sourcelist, &source);
+ res = RegOpenKeyW(prodkey, L"SourceList", &source);
if (res != ERROR_SUCCESS)
{
r = ERROR_UNKNOWN_PRODUCT;
@@ -1426,14 +1400,6 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty,
LPWSTR szValue, LPDWORD pcchValue)
{
- static const WCHAR five[] = {'5',0};
- static const WCHAR displayname[] = {
- 'D','i','s','p','l','a','y','N','a','m','e',0};
- static const WCHAR displayversion[] = {
- 'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
- static const WCHAR managed_local_package[] = {
- 'M','a','n','a','g','e','d','L','o','c','a','l',
- 'P','a','c','k','a','g','e',0};
WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE];
LPCWSTR package = NULL;
HKEY props = NULL, prod, classes = NULL, managed, hkey = NULL;
@@ -1478,7 +1444,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
}
else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
{
- package = managed_local_package;
+ package = L"ManagedLocalPackage";
if (!props && !managed)
goto done;
@@ -1522,13 +1488,13 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
msi_free(val);
if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ))
- szProperty = displayname;
+ szProperty = L"DisplayName";
else if (!wcscmp( szProperty, INSTALLPROPERTY_VERSIONSTRINGW ))
- szProperty = displayversion;
+ szProperty = L"DisplayVersion";
val = reg_get_value(props, szProperty, &type);
if (!val)
- val = strdupW(szEmpty);
+ val = strdupW(L"");
r = msi_copy_outval(val, szValue, pcchValue);
}
@@ -1553,7 +1519,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
val = reg_get_value(hkey, szProperty, &type);
if (!val)
- val = strdupW(szEmpty);
+ val = strdupW(L"");
r = msi_copy_outval(val, szValue, pcchValue);
}
@@ -1568,10 +1534,10 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
goto done;
msi_free(val);
- val = strdupW(five);
+ val = strdupW(L"5");
}
else
- val = strdupW(szOne);
+ val = strdupW(L"1");
r = msi_copy_outval(val, szValue, pcchValue);
goto done;
@@ -1579,13 +1545,13 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
else if (props && (val = reg_get_value(props, package, &type)))
{
msi_free(val);
- val = strdupW(five);
+ val = strdupW(L"5");
r = msi_copy_outval(val, szValue, pcchValue);
goto done;
}
if (prod || managed)
- val = strdupW(szOne);
+ val = strdupW(L"1");
else
goto done;
@@ -1597,7 +1563,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
goto done;
/* FIXME */
- val = strdupW(szEmpty);
+ val = strdupW(L"");
r = msi_copy_outval(val, szValue, pcchValue);
}
else
@@ -1700,8 +1666,6 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue)
{
- static const WCHAR szManagedPackage[] =
- {'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0};
WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_patch[SQUASHED_GUID_SIZE];
HKEY udprod = 0, prod = 0, props = 0;
HKEY patch = 0, patches = 0;
@@ -1735,7 +1699,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
return ERROR_INVALID_PARAMETER;
- if (szUserSid && !wcscmp( szUserSid, szLocalSid ))
+ if (szUserSid && !wcscmp( szUserSid, L"S-1-5-18" ))
return ERROR_INVALID_PARAMETER;
if (MSIREG_OpenUserDataProductKey(szProductCode, dwContext, NULL,
@@ -1748,7 +1712,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
r = ERROR_UNKNOWN_PATCH;
- res = RegOpenKeyExW(udprod, szPatches, 0, KEY_READ, &patches);
+ res = RegOpenKeyExW(udprod, L"Patches", 0, KEY_READ, &patches);
if (res != ERROR_SUCCESS)
goto done;
@@ -1762,7 +1726,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
&prod, FALSE) != ERROR_SUCCESS)
goto done;
- res = RegOpenKeyExW(prod, szPatches, 0, KEY_ALL_ACCESS, &prodpatches);
+ res = RegOpenKeyExW(prod, L"Patches", 0, KEY_ALL_ACCESS, &prodpatches);
if (res != ERROR_SUCCESS)
goto done;
@@ -1778,13 +1742,13 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
if (!wcscmp( szProperty, INSTALLPROPERTY_LOCALPACKAGEW ))
{
if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
- szProperty = szManagedPackage;
+ szProperty = L"ManagedLocalPackage";
datakey = udpatch;
}
else if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLDATEW ))
{
datakey = patch;
- szProperty = szInstalled;
+ szProperty = L"Installed";
}
else if (!wcscmp( szProperty, INSTALLPROPERTY_UNINSTALLABLEW ) ||
!wcscmp( szProperty, INSTALLPROPERTY_PATCHSTATEW ) ||
@@ -1802,7 +1766,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
val = reg_get_value(datakey, szProperty, &type);
if (!val)
- val = strdupW(szEmpty);
+ val = strdupW(L"");
r = ERROR_SUCCESS;
@@ -2048,7 +2012,7 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i
return r;
}
- if (!msi_get_property_int( package->db, szCostingComplete, 0 ))
+ if (!msi_get_property_int( package->db, L"CostingComplete", 0 ))
{
msiobj_release( &package->hdr );
return ERROR_FUNCTION_NOT_CALLED;
@@ -2145,19 +2109,14 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
LONG res;
UINT r;
- static const WCHAR local_package[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
- static const WCHAR managed_local_package[] = {
- 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0
- };
-
r = MSIREG_OpenInstallProps(prodcode, context, NULL, &hkey, FALSE);
if (r != ERROR_SUCCESS)
return FALSE;
if (context == MSIINSTALLCONTEXT_USERMANAGED)
- package = managed_local_package;
+ package = L"ManagedLocalPackage";
else
- package = local_package;
+ package = L"LocalPackage";
sz = 0;
res = RegQueryValueExW(hkey, package, NULL, NULL, NULL, &sz);
@@ -2175,7 +2134,7 @@ static UINT msi_comp_find_prodcode(WCHAR *squashed_pc,
UINT r;
if (context == MSIINSTALLCONTEXT_MACHINE)
- r = MSIREG_OpenUserDataComponentKey(comp, szLocalSid, &hkey, FALSE);
+ r = MSIREG_OpenUserDataComponentKey(comp, L"S-1-5-18", &hkey, FALSE);
else
r = MSIREG_OpenUserDataComponentKey(comp, NULL, &hkey, FALSE);
@@ -2308,7 +2267,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
if (r != ERROR_SUCCESS)
goto done;
- if (!msi_reg_get_val_dword(userdata, szWindowsInstaller, &val))
+ if (!msi_reg_get_val_dword(userdata, L"WindowsInstaller", &val))
goto done;
if (val)
@@ -2724,11 +2683,6 @@ UINT WINAPI MsiGetProductPropertyW(MSIHANDLE hProduct, LPCWSTR szProperty,
LPCWSTR val;
UINT r;
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ',
- '`','P','r','o','p','e','r','t','y','`','=','\'','%','s','\'',0};
-
TRACE("(%d, %s, %p, %p)\n", hProduct, debugstr_w(szProperty),
szValue, pccbValue);
@@ -2742,7 +2696,7 @@ UINT WINAPI MsiGetProductPropertyW(MSIHANDLE hProduct, LPCWSTR szProperty,
if (!package)
return ERROR_INVALID_HANDLE;
- r = MSI_OpenQuery(package->db, &view, query, szProperty);
+ r = MSI_OpenQuery(package->db, &view, L"SELECT * FROM `Property` WHERE `Property` = '%s'", szProperty);
if (r != ERROR_SUCCESS)
goto done;
@@ -2829,11 +2783,11 @@ static BOOL open_userdata_comp_key( const WCHAR *comp, const WCHAR *usersid, MSI
{
if (ctx & MSIINSTALLCONTEXT_MACHINE)
{
- if (!MSIREG_OpenUserDataComponentKey( comp, szLocalSid, hkey, FALSE )) return TRUE;
+ if (!MSIREG_OpenUserDataComponentKey( comp, L"S-1-5-18", hkey, FALSE )) return TRUE;
}
if (ctx & (MSIINSTALLCONTEXT_USERMANAGED|MSIINSTALLCONTEXT_USERUNMANAGED))
{
- if (usersid && !wcsicmp( usersid, szAllSid ))
+ if (usersid && !wcsicmp( usersid, L"S-1-1-0" ))
{
FIXME( "only looking at the current user\n" );
usersid = NULL;
@@ -2847,8 +2801,6 @@ static INSTALLSTATE MSI_GetComponentPath( const WCHAR *szProduct, const WCHAR *s
const WCHAR *szUserSid, MSIINSTALLCONTEXT ctx,
awstring *lpPathBuf, DWORD *pcchBuf )
{
- static const WCHAR wininstaller[] =
- {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
WCHAR *path = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_comp[SQUASHED_GUID_SIZE];
HKEY hkey;
INSTALLSTATE state;
@@ -2877,7 +2829,7 @@ static INSTALLSTATE MSI_GetComponentPath( const WCHAR *szProduct, const WCHAR *s
if ((!MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE, NULL, &hkey, FALSE) ||
!MSIREG_OpenUserDataProductKey(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED, NULL, &hkey, FALSE)) &&
- msi_reg_get_val_dword(hkey, wininstaller, &version) &&
+ msi_reg_get_val_dword(hkey, L"WindowsInstaller", &version) &&
GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES)
{
RegCloseKey(hkey);
@@ -2966,7 +2918,7 @@ end:
*/
INSTALLSTATE WINAPI MsiGetComponentPathW( LPCWSTR product, LPCWSTR comp, LPWSTR buf, LPDWORD buflen )
{
- return MsiGetComponentPathExW( product, comp, szAllSid, MSIINSTALLCONTEXT_ALL, buf, buflen );
+ return MsiGetComponentPathExW( product, comp, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, buf, buflen );
}
/******************************************************************
@@ -3028,7 +2980,7 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co
}
StringFromGUID2( &guid, comp, GUID_SIZE );
if (ctx == MSIINSTALLCONTEXT_MACHINE)
- r = MSIREG_OpenUserDataComponentKey( comp, szLocalSid, &hkey, FALSE );
+ r = MSIREG_OpenUserDataComponentKey( comp, L"S-1-5-18", &hkey, FALSE );
else
r = MSIREG_OpenUserDataComponentKey( comp, usersid, &hkey, FALSE );
@@ -3214,9 +3166,6 @@ end:
static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen,
WCHAR *langbuf, DWORD *langlen )
{
- static const WCHAR szVersionResource[] = {'\\',0};
- static const WCHAR szVersionFormat[] = {'%','d','.','%','d','.','%','d','.','%','d',0};
- static const WCHAR szLangFormat[] = {'%','d',0};
UINT ret = ERROR_MORE_DATA;
DWORD len, error;
LPVOID version;
@@ -3244,9 +3193,9 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen,
}
if (verlen)
{
- if (VerQueryValueW( version, szVersionResource, (LPVOID *)&ffi, &len ) && len > 0)
+ if (VerQueryValueW( version, L"\\", (LPVOID *)&ffi, &len ) && len > 0)
{
- swprintf( tmp, ARRAY_SIZE(tmp), szVersionFormat,
+ swprintf( tmp, ARRAY_SIZE(tmp), L"%d.%d.%d.%d",
HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS) );
if (verbuf) lstrcpynW( verbuf, tmp, *verlen );
@@ -3262,9 +3211,9 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen,
}
if (langlen)
{
- if (VerQueryValueW( version, szLangResource, (LPVOID *)&lang, &len ) && len > 0)
+ if (VerQueryValueW( version, L"\\VarFileInfo\\Translation", (LPVOID *)&lang, &len ) && len > 0)
{
- swprintf( tmp, ARRAY_SIZE(tmp), szLangFormat, *lang );
+ swprintf( tmp, ARRAY_SIZE(tmp), L"%d", *lang );
if (langbuf) lstrcpynW( langbuf, tmp, *langlen );
len = lstrlenW( tmp );
if (*langlen > len) ret = ERROR_SUCCESS;
@@ -3496,7 +3445,7 @@ static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent,
StringFromGUID2( &guid, comp, ARRAY_SIZE( comp ));
}
- state = MSI_GetComponentPath( szProduct, comp, szAllSid, MSIINSTALLCONTEXT_ALL, lpPathBuf, pcchPathBuf );
+ state = MSI_GetComponentPath( szProduct, comp, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, lpPathBuf, pcchPathBuf );
if (state == INSTALLSTATE_MOREDATA) return ERROR_MORE_DATA;
if (state != INSTALLSTATE_LOCAL) return ERROR_FILE_NOT_FOUND;
@@ -3658,7 +3607,7 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
if (pcchOrgNameBuf)
{
orgptr = org;
- if (!orgptr) orgptr = szEmpty;
+ if (!orgptr) orgptr = L"";
r = msi_strcpy_to_awstring(orgptr, -1, lpOrgNameBuf, pcchOrgNameBuf);
if (r == ERROR_MORE_DATA)
@@ -3755,7 +3704,6 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
MSIHANDLE handle;
UINT rc;
MSIPACKAGE *package;
- static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
TRACE("(%s)\n",debugstr_w(szProduct));
@@ -3768,7 +3716,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
if (!package)
return ERROR_CALL_NOT_IMPLEMENTED;
- rc = ACTION_PerformAction(package, szFirstRun);
+ rc = ACTION_PerformAction(package, L"FirstRun");
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
@@ -3781,7 +3729,6 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
MSIHANDLE handle;
UINT rc;
MSIPACKAGE *package;
- static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
TRACE("(%s)\n",debugstr_a(szProduct));
@@ -3794,7 +3741,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
if (!package)
return ERROR_CALL_NOT_IMPLEMENTED;
- rc = ACTION_PerformAction(package, szFirstRun);
+ rc = ACTION_PerformAction(package, L"FirstRun");
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
@@ -3875,7 +3822,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
- r = ACTION_PerformAction(package, szCostInitialize);
+ r = ACTION_PerformAction(package, L"CostInitialize");
if (r != ERROR_SUCCESS)
goto end;
@@ -3911,7 +3858,7 @@ UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved)
if (!GetWindowsDirectoryW(path, MAX_PATH))
return ERROR_FUNCTION_FAILED;
- lstrcatW(path, installerW);
+ lstrcatW(path, L"\\Installer");
if (!CreateDirectoryW(path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
return ERROR_FUNCTION_FAILED;
@@ -4006,7 +3953,6 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dwReinstallMode )
{
- static const WCHAR fmtW[] = {'%','s','=','%','s',' ','%','s','=','%','s',0};
MSIPACKAGE *package;
MSIINSTALLCONTEXT context;
UINT r;
@@ -4060,14 +4006,14 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dw
if (r != ERROR_SUCCESS)
return r;
- sz = (lstrlenW( fmtW ) + lstrlenW( szReinstallMode ) + lstrlenW( reinstallmode )) * sizeof(WCHAR);
- sz += (lstrlenW( szReinstall ) + lstrlenW( szFeature )) * sizeof(WCHAR);
+ sz = (lstrlenW( L"%s=%s %s=%s" ) + lstrlenW( L"REINSTALLMODE" ) + lstrlenW( reinstallmode )) * sizeof(WCHAR);
+ sz += (lstrlenW( L"REINSTALL" ) + lstrlenW( szFeature )) * sizeof(WCHAR);
if (!(cmdline = msi_alloc( sz )))
{
msiobj_release( &package->hdr );
return ERROR_OUTOFMEMORY;
}
- swprintf( cmdline, sz / sizeof(WCHAR), fmtW, szReinstallMode, reinstallmode, szReinstall, szFeature );
+ swprintf( cmdline, sz / sizeof(WCHAR), L"%s=%s %s=%s", L"REINSTALLMODE", reinstallmode, L"REINSTALL", szFeature );
r = MSI_InstallPackage( package, sourcepath, cmdline );
msiobj_release( &package->hdr );
--
2.28.0
1
0
Oct. 28, 2020
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/dialog.c | 500 ++++++++++++++++------------------------------
1 file changed, 174 insertions(+), 326 deletions(-)
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 81b0d3dba02..f2bfbf1d913 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -117,7 +117,7 @@ struct subscriber
};
typedef UINT (*msi_dialog_control_func)( msi_dialog *dialog, MSIRECORD *rec );
-struct control_handler
+struct control_handler
{
LPCWSTR control_type;
msi_dialog_control_func func;
@@ -130,38 +130,6 @@ typedef struct
LPWSTR propval;
} radio_button_group_descr;
-static const WCHAR szMsiDialogClass[] = { 'M','s','i','D','i','a','l','o','g','C','l','o','s','e','C','l','a','s','s',0 };
-static const WCHAR szMsiHiddenWindow[] = { 'M','s','i','H','i','d','d','e','n','W','i','n','d','o','w',0 };
-static const WCHAR szStatic[] = { 'S','t','a','t','i','c',0 };
-static const WCHAR szButton[] = { 'B','U','T','T','O','N', 0 };
-static const WCHAR szButtonData[] = { 'M','S','I','D','A','T','A',0 };
-static const WCHAR szProgress[] = { 'P','r','o','g','r','e','s','s',0 };
-static const WCHAR szText[] = { 'T','e','x','t',0 };
-static const WCHAR szPushButton[] = { 'P','u','s','h','B','u','t','t','o','n',0 };
-static const WCHAR szLine[] = { 'L','i','n','e',0 };
-static const WCHAR szBitmap[] = { 'B','i','t','m','a','p',0 };
-static const WCHAR szCheckBox[] = { 'C','h','e','c','k','B','o','x',0 };
-static const WCHAR szScrollableText[] = { 'S','c','r','o','l','l','a','b','l','e','T','e','x','t',0 };
-static const WCHAR szComboBox[] = { 'C','o','m','b','o','B','o','x',0 };
-static const WCHAR szEdit[] = { 'E','d','i','t',0 };
-static const WCHAR szMaskedEdit[] = { 'M','a','s','k','e','d','E','d','i','t',0 };
-static const WCHAR szPathEdit[] = { 'P','a','t','h','E','d','i','t',0 };
-static const WCHAR szProgressBar[] = { 'P','r','o','g','r','e','s','s','B','a','r',0 };
-static const WCHAR szSetProgress[] = { 'S','e','t','P','r','o','g','r','e','s','s',0 };
-static const WCHAR szRadioButtonGroup[] = { 'R','a','d','i','o','B','u','t','t','o','n','G','r','o','u','p',0 };
-static const WCHAR szIcon[] = { 'I','c','o','n',0 };
-static const WCHAR szSelectionTree[] = { 'S','e','l','e','c','t','i','o','n','T','r','e','e',0 };
-static const WCHAR szGroupBox[] = { 'G','r','o','u','p','B','o','x',0 };
-static const WCHAR szListBox[] = { 'L','i','s','t','B','o','x',0 };
-static const WCHAR szDirectoryCombo[] = { 'D','i','r','e','c','t','o','r','y','C','o','m','b','o',0 };
-static const WCHAR szDirectoryList[] = { 'D','i','r','e','c','t','o','r','y','L','i','s','t',0 };
-static const WCHAR szVolumeCostList[] = { 'V','o','l','u','m','e','C','o','s','t','L','i','s','t',0 };
-static const WCHAR szVolumeSelectCombo[] = { 'V','o','l','u','m','e','S','e','l','e','c','t','C','o','m','b','o',0 };
-static const WCHAR szSelectionDescription[] = {'S','e','l','e','c','t','i','o','n','D','e','s','c','r','i','p','t','i','o','n',0};
-static const WCHAR szSelectionPath[] = {'S','e','l','e','c','t','i','o','n','P','a','t','h',0};
-static const WCHAR szHyperLink[] = {'H','y','p','e','r','L','i','n','k',0};
-static const WCHAR szListView[] = {'L','i','s','t','V','i','e','w',0};
-
/* dialog sequencing */
#define WM_MSI_DIALOG_CREATE (WM_USER+0x100)
@@ -376,15 +344,12 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name )
static UINT msi_dialog_build_font_list( msi_dialog *dialog )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','T','e','x','t','S','t','y','l','e','`',0};
MSIQUERY *view;
UINT r;
TRACE("dialog %p\n", dialog );
- r = MSI_OpenQuery( dialog->package->db, &view, query );
+ r = MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `TextStyle`" );
if( r != ERROR_SUCCESS )
return r;
@@ -479,31 +444,13 @@ static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key )
MSIRECORD *rec;
LPWSTR text;
- static const WCHAR query[] = {
- 's','e','l','e','c','t',' ','*',' ',
- 'f','r','o','m',' ','`','U','I','T','e','x','t','`',' ',
- 'w','h','e','r','e',' ','`','K','e','y','`',' ','=',' ','\'','%','s','\'',0
- };
-
- rec = MSI_QueryGetRecord( dialog->package->db, query, key );
+ rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `UIText` WHERE `Key` = '%s'", key );
if (!rec) return NULL;
text = strdupW( MSI_RecordGetString( rec, 2 ) );
msiobj_release( &rec->hdr );
return text;
}
-static MSIRECORD *msi_get_binary_record( MSIDATABASE *db, LPCWSTR name )
-{
- static const WCHAR query[] = {
- 's','e','l','e','c','t',' ','*',' ',
- 'f','r','o','m',' ','B','i','n','a','r','y',' ',
- 'w','h','e','r','e',' ',
- '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0
- };
-
- return MSI_QueryGetRecord( db, query, name );
-}
-
static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type,
UINT cx, UINT cy, UINT flags )
{
@@ -516,7 +463,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type,
if (!(tmp = msi_create_temp_file( db ))) return NULL;
- rec = msi_get_binary_record( db, name );
+ rec = MSI_QueryGetRecord( db, L"SELCT * FROM `Binary` WHERE `Name` = '%s'", name );
if( rec )
{
r = MSI_RecordStreamToFile( rec, 2, tmp );
@@ -580,7 +527,7 @@ static void msi_dialog_update_all_controls( msi_dialog *dialog )
static void msi_dialog_set_property( MSIPACKAGE *package, LPCWSTR property, LPCWSTR value )
{
UINT r = msi_set_property( package->db, property, value, -1 );
- if (r == ERROR_SUCCESS && !wcscmp( property, szSourceDir ))
+ if (r == ERROR_SUCCESS && !wcscmp( property, L"SourceDir" ))
msi_reset_source_folders( package );
}
@@ -606,7 +553,7 @@ struct msi_selection_tree_info
static MSIFEATURE *msi_seltree_get_selected_feature( msi_control *control )
{
- struct msi_selection_tree_info *info = GetPropW( control->hwnd, szButtonData );
+ struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" );
return msi_seltree_feature_from_item( control->hwnd, info->selected );
}
@@ -618,7 +565,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
ctrl = msi_dialog_find_control( dialog, control );
if (!ctrl)
return;
- if( !wcscmp( attribute, szText ) )
+ if( !wcscmp( attribute, L"Text" ) )
{
const WCHAR *font_text, *text = NULL;
WCHAR *font, *text_fmt = NULL;
@@ -627,7 +574,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
font = msi_dialog_get_style( font_text, &text );
deformat_string( dialog->package, text, &text_fmt );
if (text_fmt) text = text_fmt;
- else text = szEmpty;
+ else text = L"";
SetWindowTextW( ctrl->hwnd, text );
@@ -635,7 +582,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
msi_free( text_fmt );
msi_dialog_check_messages( NULL );
}
- else if( !wcscmp( attribute, szProgress ) )
+ else if( !wcscmp( attribute, L"Progress" ) )
{
DWORD func, val1, val2, units;
@@ -690,12 +637,12 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
break;
}
}
- else if ( !wcscmp( attribute, szProperty ) )
+ else if ( !wcscmp( attribute, L"Property" ) )
{
MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl );
if (feature) msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory );
}
- else if ( !wcscmp( attribute, szSelectionPath ) )
+ else if ( !wcscmp( attribute, L"SelectionPath" ) )
{
BOOL indirect = ctrl->attributes & msidbControlAttributesIndirect;
LPWSTR path = msi_dialog_dup_property( dialog, ctrl->property, indirect );
@@ -754,11 +701,6 @@ static UINT map_event( MSIRECORD *row, void *param )
static void dialog_map_events( msi_dialog *dialog, const WCHAR *control )
{
- static const WCHAR queryW[] =
- {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','E','v','e','n','t','M','a','p','p','i','n','g','`',' ',
- 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ',
- 'A','N','D',' ','`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0};
MSIQUERY *view;
struct dialog_control dialog_control =
{
@@ -766,7 +708,9 @@ static void dialog_map_events( msi_dialog *dialog, const WCHAR *control )
control
};
- if (!MSI_OpenQuery( dialog->package->db, &view, queryW, dialog->name, control ))
+ if (!MSI_OpenQuery( dialog->package->db, &view,
+ L"SELECT * FROM `EventMapping` WHERE `Dialog_` = '%s' AND `Control_` = '%s'",
+ dialog->name, control ))
{
MSI_IterateRecords( view, NULL, map_event, &dialog_control );
msiobj_release( &view->hdr );
@@ -784,7 +728,7 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog,
name = MSI_RecordGetString( rec, 2 );
control_type = MSI_RecordGetString( rec, 3 );
attributes = MSI_RecordGetInteger( rec, 8 );
- if (wcscmp( control_type, szScrollableText )) text = MSI_RecordGetString( rec, 10 );
+ if (wcscmp( control_type, L"ScrollableText" )) text = MSI_RecordGetString( rec, 10 );
TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name),
attributes, debugstr_w(text), style);
@@ -831,7 +775,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
- info = GetPropW(hWnd, szButtonData);
+ info = GetPropW(hWnd, L"MSIDATA");
if( msg == WM_CTLCOLORSTATIC &&
( info->attributes & msidbControlAttributesTransparent ) )
@@ -851,7 +795,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_NCDESTROY:
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
break;
}
@@ -867,7 +811,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
TRACE("%p %p\n", dialog, rec);
- control = msi_dialog_add_control( dialog, rec, szStatic, SS_LEFT | WS_GROUP );
+ control = msi_dialog_add_control( dialog, rec, L"Static", SS_LEFT | WS_GROUP );
if( !control )
return ERROR_FUNCTION_FAILED;
@@ -891,9 +835,9 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIText_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
- event_subscribe( dialog, szSelectionPath, control_name, szSelectionPath );
+ event_subscribe( dialog, L"SelectionPath", control_name, L"SelectionPath" );
return ERROR_SUCCESS;
}
@@ -920,7 +864,6 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec )
static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg )
{
- static const WCHAR szNullArg[] = {'{','}',0};
LPWSTR p, prop, arg_fmt = NULL;
UINT len;
@@ -931,8 +874,7 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP
if (p && (p[1] == 0 || p[1] == ' '))
{
*p = 0;
- if (wcscmp( szNullArg, arg ))
- deformat_string( dialog->package, arg, &arg_fmt );
+ if (wcscmp( L"{}", arg )) deformat_string( dialog->package, arg, &arg_fmt );
msi_dialog_set_property( dialog->package, prop, arg_fmt );
msi_dialog_update_controls( dialog, prop );
msi_free( arg_fmt );
@@ -981,19 +923,15 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param )
static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- 'C','o','n','t','r','o','l','E','v','e','n','t',' ','W','H','E','R','E',' ',
- '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ','A','N','D',' ',
- '`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ',
- 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0};
MSIQUERY *view;
UINT r;
if (HIWORD(param) != BN_CLICKED)
return ERROR_SUCCESS;
- r = MSI_OpenQuery( dialog->package->db, &view, query, dialog->name, control->name );
+ r = MSI_OpenQuery( dialog->package->db, &view,
+ L"SELECT * FROM `ControlEvent` WHERE `Dialog_` = '%s' AND `Control_` = '%s' ORDER BY `Ordering`",
+ dialog->name, control->name );
if (r != ERROR_SUCCESS)
{
ERR("query failed\n");
@@ -1024,7 +962,7 @@ static HBITMAP msi_load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT
BITMAP bm;
UINT r;
- rec = msi_get_binary_record( db, name );
+ rec = MSI_QueryGetRecord( db, L"SELCT * FROM `Binary` WHERE `Name` = '%s'", name );
if (!rec)
goto end;
@@ -1100,7 +1038,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
}
}
- control = msi_dialog_add_control( dialog, rec, szButton, style );
+ control = msi_dialog_add_control( dialog, rec, L"BUTTON", style );
if (!control)
return ERROR_FUNCTION_FAILED;
@@ -1133,18 +1071,11 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ',
- 'F','R','O','M',' ','`','C','h','e','c','k','B','o','x','`',' ',
- 'W','H','E','R','E',' ',
- '`','P','r','o','p','e','r','t','y','`',' ','=',' ',
- '\'','%','s','\'',0
- };
MSIRECORD *rec = NULL;
LPWSTR ret = NULL;
/* find if there is a value associated with the checkbox */
- rec = MSI_QueryGetRecord( dialog->package->db, query, prop );
+ rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `CheckBox` WHERE `Property` = '%s'", prop );
if (!rec)
return ret;
@@ -1179,7 +1110,6 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *cont
static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *control, UINT state )
{
- static const WCHAR szState[] = {'1',0};
LPCWSTR val;
/* if uncheck then the property is set to NULL */
@@ -1193,7 +1123,7 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *cont
if (control->value && control->value[0])
val = control->value;
else
- val = szState;
+ val = L"1";
msi_dialog_set_property( dialog->package, control->property, val );
}
@@ -1228,7 +1158,7 @@ static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec )
TRACE("%p %p\n", dialog, rec);
- control = msi_dialog_add_control( dialog, rec, szButton, BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP );
+ control = msi_dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP );
control->handler = msi_dialog_checkbox_handler;
control->update = msi_dialog_checkbox_sync_state;
prop = MSI_RecordGetString( rec, 9 );
@@ -1293,7 +1223,7 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
width = msi_dialog_scale_unit( dialog, width );
height = 2; /* line is exactly 2 units in height */
- control->hwnd = CreateWindowExW( exstyle, szStatic, NULL, style,
+ control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style,
x, y, width, height, dialog->hwnd, NULL, NULL, NULL );
TRACE("Dialog %s control %s hwnd %p\n",
@@ -1319,7 +1249,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
- info = GetPropW( hWnd, szButtonData );
+ info = GetPropW( hWnd, L"MSIDATA" );
r = CallWindowProcW( info->oldproc, hWnd, msg, wParam, lParam );
@@ -1329,7 +1259,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return DLGC_WANTARROWS;
case WM_NCDESTROY:
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
break;
case WM_PAINT:
/* native MSI sets a wait cursor here */
@@ -1382,7 +1312,6 @@ static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text )
static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
{
- static const WCHAR szRichEdit20W[] = {'R','i','c','h','E','d','i','t','2','0','W',0};
struct msi_scrolltext_info *info;
msi_control *control;
HMODULE hRichedit;
@@ -1397,7 +1326,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
style = WS_BORDER | ES_MULTILINE | WS_VSCROLL |
ES_READONLY | ES_AUTOVSCROLL | WS_TABSTOP;
- control = msi_dialog_add_control( dialog, rec, szRichEdit20W, style );
+ control = msi_dialog_add_control( dialog, rec, L"RichEdit20W", style );
if (!control)
{
FreeLibrary( hRichedit );
@@ -1413,7 +1342,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
/* subclass the static control */
info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIScrollText_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
/* add the text into the richedit */
text = MSI_RecordGetString( rec, 10 );
@@ -1440,7 +1369,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
style |= SS_CENTERIMAGE;
}
- control = msi_dialog_add_control( dialog, rec, szStatic, style );
+ control = msi_dialog_add_control( dialog, rec, L"Static", style );
cx = MSI_RecordGetInteger( rec, 6 );
cy = MSI_RecordGetInteger( rec, 7 );
cx = msi_dialog_scale_unit( dialog, cx );
@@ -1455,7 +1384,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
ERR("Failed to load bitmap %s\n", debugstr_w(name));
msi_free( name );
-
+
return ERROR_SUCCESS;
}
@@ -1467,9 +1396,9 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
TRACE("\n");
- control = msi_dialog_add_control( dialog, rec, szStatic,
+ control = msi_dialog_add_control( dialog, rec, L"Static",
SS_ICON | SS_CENTERIMAGE | WS_GROUP );
-
+
attributes = MSI_RecordGetInteger( rec, 8 );
name = msi_get_binary_name( dialog->package, rec );
control->hIcon = msi_load_icon( dialog->package->db, name, attributes );
@@ -1501,7 +1430,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
- info = GetPropW( hWnd, szButtonData );
+ info = GetPropW( hWnd, L"MSIDATA" );
if (!info)
return 0;
@@ -1514,7 +1443,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
msi_free( info->items[j] );
msi_free( info->items );
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
break;
}
@@ -1541,16 +1470,12 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param )
static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR property )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','C','o','m','b','o','B','o','x','`',' ','W','H','E','R','E',' ',
- '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ',
- 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0};
MSIQUERY *view;
DWORD count;
UINT r;
- r = MSI_OpenQuery( info->dialog->package->db, &view, query, property );
+ r = MSI_OpenQuery( info->dialog->package->db, &view,
+ L"SELECT * FROM `ComboBox` WHERE `Property` = '%s' ORDER BY `Order`", property );
if (r != ERROR_SUCCESS)
return r;
@@ -1572,11 +1497,6 @@ static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR prop
static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param )
{
- static const WCHAR szHide[] = {'H','i','d','e',0};
- static const WCHAR szShow[] = {'S','h','o','w',0};
- static const WCHAR szDisable[] = {'D','i','s','a','b','l','e',0};
- static const WCHAR szEnable[] = {'E','n','a','b','l','e',0};
- static const WCHAR szDefault[] = {'D','e','f','a','u','l','t',0};
msi_dialog *dialog = param;
msi_control *control;
LPCWSTR name, action, condition;
@@ -1592,15 +1512,15 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param )
TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name));
/* FIXME: case sensitive? */
- if (!wcscmp( action, szHide ))
+ if (!wcscmp( action, L"Hide" ))
ShowWindow(control->hwnd, SW_HIDE);
- else if (!wcscmp( action, szShow ))
+ else if (!wcscmp( action, L"Show" ))
ShowWindow(control->hwnd, SW_SHOW);
- else if (!wcscmp( action, szDisable ))
+ else if (!wcscmp( action, L"Disable" ))
EnableWindow(control->hwnd, FALSE);
- else if (!wcscmp( action, szEnable ))
+ else if (!wcscmp( action, L"Enable" ))
EnableWindow(control->hwnd, TRUE);
- else if (!wcscmp( action, szDefault ))
+ else if (!wcscmp( action, L"Default" ))
SetFocus(control->hwnd);
else
FIXME("Unhandled action %s\n", debugstr_w(action));
@@ -1610,10 +1530,6 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param )
static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- 'C','o','n','t','r','o','l','C','o','n','d','i','t','i','o','n',' ',
- 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
UINT r;
MSIQUERY *view;
MSIPACKAGE *package = dialog->package;
@@ -1621,7 +1537,7 @@ static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog )
TRACE("%p %s\n", dialog, debugstr_w(dialog->name));
/* query the Control table for all the elements of the control */
- r = MSI_OpenQuery( package->db, &view, query, dialog->name );
+ r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `ControlCondition` WHERE `Dialog_` = '%s'", dialog->name );
if (r != ERROR_SUCCESS)
return ERROR_SUCCESS;
@@ -1639,7 +1555,7 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro
if (HIWORD(param) != CBN_SELCHANGE && HIWORD(param) != CBN_EDITCHANGE)
return ERROR_SUCCESS;
- info = GetPropW( control->hwnd, szButtonData );
+ info = GetPropW( control->hwnd, L"MSIDATA" );
index = SendMessageW( control->hwnd, CB_GETCURSEL, 0, 0 );
if (index == CB_ERR)
value = msi_get_window_text( control->hwnd );
@@ -1661,7 +1577,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control
LPWSTR value, tmp;
DWORD j;
- info = GetPropW( control->hwnd, szButtonData );
+ info = GetPropW( control->hwnd, L"MSIDATA" );
value = msi_dup_property( dialog->package->db, control->property );
if (!value)
@@ -1730,7 +1646,7 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec )
info->addpos_items = 0;
info->oldproc = (WNDPROC)SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIComboBox_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
if (control->property)
msi_combobox_add_items( info, control->property );
@@ -1767,7 +1683,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec )
WCHAR num[MAX_NUM_DIGITS];
DWORD limit;
- control = msi_dialog_add_control( dialog, rec, szEdit,
+ control = msi_dialog_add_control( dialog, rec, L"Edit",
WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL );
control->handler = msi_dialog_edit_handler;
@@ -1914,7 +1830,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
- info = GetPropW(hWnd, szButtonData);
+ info = GetPropW(hWnd, L"MSIDATA");
r = CallWindowProcW(info->oldproc, hWnd, msg, wParam, lParam);
@@ -1930,7 +1846,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCDESTROY:
msi_free( info->prop );
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
break;
}
@@ -2053,7 +1969,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font )
wx = 0;
ww = width;
}
- hwnd = CreateWindowW( szEdit, NULL, style, wx, 0, ww, height,
+ hwnd = CreateWindowW( L"Edit", NULL, style, wx, 0, ww, height,
info->hwnd, NULL, NULL, NULL );
if( !hwnd )
{
@@ -2101,7 +2017,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
info->dialog = dialog;
- control = msi_dialog_add_control( dialog, rec, szStatic,
+ control = msi_dialog_add_control( dialog, rec, L"Static",
SS_OWNERDRAW | WS_GROUP | WS_VISIBLE );
if( !control )
{
@@ -2116,7 +2032,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
/* subclass the static control */
info->oldproc = (WNDPROC) SetWindowLongPtrW( info->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIMaskedEdit_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
prop = MSI_RecordGetString( rec, 9 );
if( prop )
@@ -2158,7 +2074,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec )
if( !control )
return ERROR_FUNCTION_FAILED;
- event_subscribe( dialog, szSetProgress, control->name, szProgress );
+ event_subscribe( dialog, L"SetProgress", control->name, L"Progress" );
return ERROR_SUCCESS;
}
@@ -2185,7 +2101,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control
{
WCHAR *path;
- if (!control && !(control = msi_dialog_find_control_by_type( dialog, szPathEdit )))
+ if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"PathEdit" )))
return;
if (!(path = get_path_property( dialog, control ))) return;
@@ -2244,7 +2160,7 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control )
static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct msi_pathedit_info *info = GetPropW(hWnd, szButtonData);
+ struct msi_pathedit_info *info = GetPropW(hWnd, L"MSIDATA");
LRESULT r = 0;
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
@@ -2261,7 +2177,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if ( msg == WM_NCDESTROY )
{
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
}
return r;
@@ -2277,7 +2193,7 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec )
if (!info)
return ERROR_FUNCTION_FAILED;
- control = msi_dialog_add_control( dialog, rec, szEdit,
+ control = msi_dialog_add_control( dialog, rec, L"Edit",
WS_BORDER | WS_TABSTOP );
control->attributes = MSI_RecordGetInteger( rec, 8 );
prop = MSI_RecordGetString( rec, 9 );
@@ -2288,7 +2204,7 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec )
info->control = control;
info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIPathEdit_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
msi_dialog_update_pathedit( dialog, control );
@@ -2319,7 +2235,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
name = MSI_RecordGetString( rec, 3 );
text = MSI_RecordGetString( rec, 8 );
- control = dialog_create_window( dialog, rec, 0, szButton, name, text, style,
+ control = dialog_create_window( dialog, rec, 0, L"BUTTON", name, text, style,
group->parent->hwnd );
if (!control)
return ERROR_FUNCTION_FAILED;
@@ -2343,7 +2259,7 @@ static BOOL CALLBACK msi_radioground_child_enum( HWND hWnd, LPARAM lParam )
static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
- WNDPROC oldproc = (WNDPROC)GetPropW( hWnd, szButtonData );
+ WNDPROC oldproc = (WNDPROC)GetPropW( hWnd, L"MSIDATA" );
LRESULT r;
TRACE("hWnd %p msg %04x wParam 0x%08lx lParam 0x%08lx\n", hWnd, msg, wParam, lParam);
@@ -2362,10 +2278,6 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam,
static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- 'R','a','d','i','o','B','u','t','t','o','n',' ','W','H','E','R','E',' ',
- '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
UINT r;
LPCWSTR prop;
msi_control *control;
@@ -2390,23 +2302,23 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
style |= BS_OWNERDRAW;
/* Create parent group box to hold radio buttons */
- control = msi_dialog_add_control( dialog, rec, szButton, style );
+ control = msi_dialog_add_control( dialog, rec, L"BUTTON", style );
if( !control )
return ERROR_FUNCTION_FAILED;
oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIRadioGroup_WndProc );
- SetPropW(control->hwnd, szButtonData, oldproc);
+ SetPropW(control->hwnd, L"MSIDATA", oldproc);
SetWindowLongPtrW( control->hwnd, GWL_EXSTYLE, WS_EX_CONTROLPARENT );
if( prop )
control->property = strdupW( prop );
/* query the Radio Button table for all control in this group */
- r = MSI_OpenQuery( package->db, &view, query, prop );
+ r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `RadioButton` WHERE `Property` = '%s'", prop );
if( r != ERROR_SUCCESS )
{
- ERR("query failed for dialog %s radio group %s\n",
+ ERR("query failed for dialog %s radio group %s\n",
debugstr_w(dialog->name), debugstr_w(prop));
return ERROR_INVALID_PARAMETER;
}
@@ -2505,7 +2417,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
} u;
UINT r;
- info = GetPropW(hwnd, szButtonData);
+ info = GetPropW(hwnd, L"MSIDATA");
package = info->dialog->package;
feature = msi_seltree_feature_from_item( hwnd, hItem );
@@ -2553,7 +2465,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
- info = GetPropW(hWnd, szButtonData);
+ info = GetPropW(hWnd, L"MSIDATA");
switch( msg )
{
@@ -2573,7 +2485,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_NCDESTROY:
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
break;
}
return r;
@@ -2583,7 +2495,7 @@ static void
msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd,
LPCWSTR parent, HTREEITEM hParent )
{
- struct msi_selection_tree_info *info = GetPropW( hwnd, szButtonData );
+ struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" );
MSIFEATURE *feature;
TVINSERTSTRUCTW tvis;
HTREEITEM hitem, hfirst = NULL;
@@ -2671,7 +2583,7 @@ static void msi_seltree_create_imagelist( HWND hwnd )
static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
msi_control *control, WPARAM param )
{
- struct msi_selection_tree_info *info = GetPropW( control->hwnd, szButtonData );
+ struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" );
LPNMTREEVIEWW tv = (LPNMTREEVIEWW)param;
MSIRECORD *row, *rec;
MSIFOLDER *folder;
@@ -2679,12 +2591,6 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
LPCWSTR dir, title = NULL;
UINT r = ERROR_SUCCESS;
- static const WCHAR select[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ',
- '`','T','i','t','l','e','`',' ','=',' ','\'','%','s','\'',0
- };
-
if (tv->hdr.code != TVN_SELCHANGINGW)
return ERROR_SUCCESS;
@@ -2699,14 +2605,14 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
else
title = tv->itemNew.pszText;
- row = MSI_QueryGetRecord( dialog->package->db, select, title );
+ row = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `Feature` WHERE `Title` = '%s'", title );
if (!row)
return ERROR_FUNCTION_FAILED;
rec = MSI_CreateRecord( 1 );
MSI_RecordSetStringW( rec, 1, MSI_RecordGetString( row, 4 ) );
- msi_event_fire( dialog->package, szSelectionDescription, rec );
+ msi_event_fire( dialog->package, L"SelectionDescription", rec );
dir = MSI_RecordGetString( row, 7 );
if (dir)
@@ -2722,7 +2628,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
else
MSI_RecordSetStringW( rec, 1, NULL );
- msi_event_fire( dialog->package, szSelectionPath, rec );
+ msi_event_fire( dialog->package, L"SelectionPath", rec );
done:
msiobj_release(&row->hdr);
@@ -2764,9 +2670,9 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec )
info->hwnd = control->hwnd;
info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSISelectionTree_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
- event_subscribe( dialog, szSelectionPath, control_name, szProperty );
+ event_subscribe( dialog, L"SelectionPath", control_name, L"Property" );
/* initialize it */
msi_seltree_create_imagelist( control->hwnd );
@@ -2810,7 +2716,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA
TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam);
- info = GetPropW( hWnd, szButtonData );
+ info = GetPropW( hWnd, L"MSIDATA" );
if (!info)
return 0;
@@ -2823,7 +2729,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA
msi_free( info->items[j] );
msi_free( info->items );
msi_free( info );
- RemovePropW( hWnd, szButtonData );
+ RemovePropW( hWnd, L"MSIDATA" );
break;
}
@@ -2849,16 +2755,12 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param )
static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR property )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','L','i','s','t','B','o','x','`',' ','W','H','E','R','E',' ',
- '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ',
- 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0};
MSIQUERY *view;
DWORD count;
UINT r;
- r = MSI_OpenQuery( info->dialog->package->db, &view, query, property );
+ r = MSI_OpenQuery( info->dialog->package->db, &view,
+ L"SELECT * FROM `ListBox` WHERE `Property` = '%s' ORDER BY `Order`", property );
if ( r != ERROR_SUCCESS )
return r;
@@ -2888,7 +2790,7 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog,
if( HIWORD(param) != LBN_SELCHANGE )
return ERROR_SUCCESS;
- info = GetPropW( control->hwnd, szButtonData );
+ info = GetPropW( control->hwnd, L"MSIDATA" );
index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 );
value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 );
@@ -2933,7 +2835,7 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec )
info->addpos_items = 0;
info->oldproc = (WNDPROC)SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC,
(LONG_PTR)MSIListBox_WndProc );
- SetPropW( control->hwnd, szButtonData, info );
+ SetPropW( control->hwnd, L"MSIDATA", info );
if ( control->property )
msi_listbox_add_items( info, control->property );
@@ -2947,7 +2849,7 @@ static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control *
{
WCHAR *path;
- if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryCombo )))
+ if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryCombo" )))
return;
if (!(path = get_path_property( dialog, control ))) return;
@@ -2986,13 +2888,12 @@ static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec )
static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *control )
{
- static const WCHAR asterisk[] = {'*',0};
WCHAR dir_spec[MAX_PATH], *path;
WIN32_FIND_DATAW wfd;
LVITEMW item;
HANDLE file;
- if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryList )))
+ if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" )))
return;
/* clear the list-view */
@@ -3000,7 +2901,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c
if (!(path = get_path_property( dialog, control ))) return;
lstrcpyW( dir_spec, path );
- lstrcatW( dir_spec, asterisk );
+ lstrcatW( dir_spec, L"*" );
file = FindFirstFileW( dir_spec, &wfd );
if (file == INVALID_HANDLE_VALUE)
@@ -3014,7 +2915,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c
if ( wfd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
continue;
- if ( !wcscmp( wfd.cFileName, szDot ) || !wcscmp( wfd.cFileName, szDotDot ) )
+ if ( !wcscmp( wfd.cFileName, L"." ) || !wcscmp( wfd.cFileName, L".." ) )
continue;
item.mask = LVIF_TEXT;
@@ -3036,7 +2937,7 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog )
LPWSTR prop, path, ptr;
BOOL indirect;
- control = msi_dialog_find_control_by_type( dialog, szDirectoryList );
+ control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" );
indirect = control->attributes & msidbControlAttributesIndirect;
prop = msi_dialog_dup_property( dialog, control->property, indirect );
path = msi_dialog_dup_property( dialog, prop, TRUE );
@@ -3060,7 +2961,6 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog )
static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len )
{
- static const WCHAR fmtW[] = {'%','s','%','s',' ','%','u',0};
WCHAR newfolder[MAX_PATH], *path, *ptr;
int len, count = 2;
@@ -3078,7 +2978,7 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len )
msi_free( path );
return NULL;
}
- swprintf( path, len + 4, fmtW, root, newfolder, count++ );
+ swprintf( path, len + 4, L"%s%s %u", root, newfolder, count++ );
}
ptr = wcsrchr( path, '\\' ) + 1;
@@ -3094,7 +2994,7 @@ static UINT msi_dialog_directorylist_new( msi_dialog *dialog )
LVITEMW item;
int index;
- control = msi_dialog_find_control_by_type( dialog, szDirectoryList );
+ control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" );
if (!(path = get_path_property( dialog, control ))) return ERROR_OUTOFMEMORY;
@@ -3162,7 +3062,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control
lstrcpyW( new_path, path );
lstrcatW( new_path, text );
if (nmhdr->code == LVN_ENDLABELEDITW) CreateDirectoryW( new_path, NULL );
- lstrcatW( new_path, szBackSlash );
+ lstrcatW( new_path, L"\\" );
msi_dialog_set_property( dialog->package, prop, new_path );
@@ -3219,11 +3119,11 @@ static BOOL str_is_number( LPCWSTR str )
static const WCHAR column_keys[][80] =
{
- {'V','o','l','u','m','e','C','o','s','t','V','o','l','u','m','e',0},
- {'V','o','l','u','m','e','C','o','s','t','S','i','z','e',0},
- {'V','o','l','u','m','e','C','o','s','t','A','v','a','i','l','a','b','l','e',0},
- {'V','o','l','u','m','e','C','o','s','t','R','e','q','u','i','r','e','d',0},
- {'V','o','l','u','m','e','C','o','s','t','D','i','f','f','e','r','e','n','c','e',0}
+ L"VolumeCostVolume",
+ L"VolumeCostSize",
+ L"VolumeCostAvailable",
+ L"VolumeCostRequired",
+ L"VolumeCostDifference",
};
static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control, MSIRECORD *rec )
@@ -3234,8 +3134,6 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
LVCOLUMNW lvc;
DWORD count = 0;
- static const WCHAR negative[] = {'-',0};
-
if (!text) return;
while ((begin = wcschr( begin, '{' )) && count < 5)
@@ -3250,8 +3148,8 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
lstrcpynW( num, begin + 1, end - begin );
begin += end - begin + 1;
- /* empty braces or '0' hides the column */
- if ( !num[0] || !wcscmp( num, szZero ) )
+ /* empty braces or '0' hides the column */
+ if ( !num[0] || !wcscmp( num, L"0" ) )
{
count++;
msi_free( num );
@@ -3261,7 +3159,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
/* the width must be a positive number
* if a width is invalid, all remaining columns are hidden
*/
- if ( !wcsncmp( num, negative, 1 ) || !str_is_number( num ) ) {
+ if ( !wcsncmp( num, L"-", 1 ) || !str_is_number( num ) ) {
msi_free( num );
return;
}
@@ -3471,9 +3369,7 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec )
static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
{
- static const WCHAR hrefW[] = {'h','r','e','f'};
- static const WCHAR openW[] = {'o','p','e','n',0};
- int len, len_href = ARRAY_SIZE( hrefW );
+ int len, len_href = ARRAY_SIZE( L"href" ) - 1;
const WCHAR *p, *q;
WCHAR quote = 0;
LITEM item;
@@ -3491,7 +3387,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr
while (*p && iswspace( *p )) p++;
len = lstrlenW( p );
- if (len > len_href && !wcsnicmp( p, hrefW, len_href ))
+ if (len > len_href && !wcsnicmp( p, L"href", len_href ))
{
p += len_href;
while (*p && iswspace( *p )) p++;
@@ -3511,7 +3407,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr
if (!*q) return ERROR_SUCCESS;
}
item.szUrl[q - item.szUrl] = 0;
- ShellExecuteW( NULL, openW, p, NULL, NULL, SW_SHOWNORMAL );
+ ShellExecuteW( NULL, L"open", p, NULL, NULL, SW_SHOWNORMAL );
}
return ERROR_SUCCESS;
}
@@ -3587,15 +3483,11 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param )
static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','L','i','s','t','V','i','e','w','`',' ','W','H','E','R','E',' ',
- '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ',
- 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0};
MSIQUERY *view;
struct listview_param lv_param = { dialog, control };
- if (MSI_OpenQuery( dialog->package->db, &view, query, control->property ) == ERROR_SUCCESS)
+ if (MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `ListView` WHERE `Property` = '%s' ORDER BY `Order`",
+ control->property ) == ERROR_SUCCESS)
{
MSI_IterateRecords( view, NULL, msi_listview_add_item, &lv_param );
msiobj_release( &view->hdr );
@@ -3646,28 +3538,28 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec )
static const struct control_handler msi_dialog_handler[] =
{
- { szText, msi_dialog_text_control },
- { szPushButton, msi_dialog_button_control },
- { szLine, msi_dialog_line_control },
- { szBitmap, msi_dialog_bitmap_control },
- { szCheckBox, msi_dialog_checkbox_control },
- { szScrollableText, msi_dialog_scrolltext_control },
- { szComboBox, msi_dialog_combo_control },
- { szEdit, msi_dialog_edit_control },
- { szMaskedEdit, msi_dialog_maskedit_control },
- { szPathEdit, msi_dialog_pathedit_control },
- { szProgressBar, msi_dialog_progress_bar },
- { szRadioButtonGroup, msi_dialog_radiogroup_control },
- { szIcon, msi_dialog_icon_control },
- { szSelectionTree, msi_dialog_selection_tree },
- { szGroupBox, msi_dialog_group_box },
- { szListBox, msi_dialog_list_box },
- { szDirectoryCombo, msi_dialog_directory_combo },
- { szDirectoryList, msi_dialog_directory_list },
- { szVolumeCostList, msi_dialog_volumecost_list },
- { szVolumeSelectCombo, msi_dialog_volumeselect_combo },
- { szHyperLink, msi_dialog_hyperlink },
- { szListView, msi_dialog_listview }
+ { L"Text", msi_dialog_text_control },
+ { L"PushButton", msi_dialog_button_control },
+ { L"Line", msi_dialog_line_control },
+ { L"Bitmap", msi_dialog_bitmap_control },
+ { L"CheckBox", msi_dialog_checkbox_control },
+ { L"ScrollableText", msi_dialog_scrolltext_control },
+ { L"ComboBox", msi_dialog_combo_control },
+ { L"Edit", msi_dialog_edit_control },
+ { L"MaskedEdit", msi_dialog_maskedit_control },
+ { L"PathEdit", msi_dialog_pathedit_control },
+ { L"ProgressBar", msi_dialog_progress_bar },
+ { L"RadioButtonGroup", msi_dialog_radiogroup_control },
+ { L"Icon", msi_dialog_icon_control },
+ { L"SelectionTree", msi_dialog_selection_tree },
+ { L"GroupBox", msi_dialog_group_box },
+ { L"ListBox", msi_dialog_list_box },
+ { L"DirectoryCombo", msi_dialog_directory_combo },
+ { L"DirectoryList", msi_dialog_directory_list },
+ { L"VolumeCostList", msi_dialog_volumecost_list },
+ { L"VolumeSelectCombo", msi_dialog_volumeselect_combo },
+ { L"HyperLink", msi_dialog_hyperlink },
+ { L"ListView", msi_dialog_listview }
};
static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param )
@@ -3691,10 +3583,6 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param )
static UINT msi_dialog_fill_controls( msi_dialog *dialog )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- 'C','o','n','t','r','o','l',' ','W','H','E','R','E',' ',
- '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
UINT r;
MSIQUERY *view;
MSIPACKAGE *package = dialog->package;
@@ -3702,7 +3590,7 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog )
TRACE("%p %s\n", dialog, debugstr_w(dialog->name) );
/* query the Control table for all the elements of the control */
- r = MSI_OpenQuery( package->db, &view, query, dialog->name );
+ r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `Control` WHERE `Dialog_` = '%s'", dialog->name );
if( r != ERROR_SUCCESS )
{
ERR("query failed for dialog %s\n", debugstr_w(dialog->name));
@@ -3723,8 +3611,6 @@ static UINT msi_dialog_reset( msi_dialog *dialog )
/* figure out the height of 10 point MS Sans Serif */
static INT msi_dialog_get_sans_serif_height( HWND hwnd )
{
- static const WCHAR szSansSerif[] = {
- 'M','S',' ','S','a','n','s',' ','S','e','r','i','f',0 };
LOGFONTW lf;
TEXTMETRICW tm;
BOOL r;
@@ -3737,7 +3623,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd )
{
memset( &lf, 0, sizeof lf );
lf.lfHeight = MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- lstrcpyW( lf.lfFaceName, szSansSerif );
+ lstrcpyW( lf.lfFaceName, L"MS Sans Serif" );
hFont = CreateFontIndirectW(&lf);
if (hFont)
{
@@ -3756,17 +3642,12 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd )
/* fetch the associated record from the Dialog table */
static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog )
{
- static const WCHAR query[] = {
- 'S','E','L','E','C','T',' ','*',' ',
- 'F','R','O','M',' ','D','i','a','l','o','g',' ',
- 'W','H','E','R','E',' ',
- '`','D','i','a','l','o','g','`',' ','=',' ','\'','%','s','\'',0};
MSIPACKAGE *package = dialog->package;
MSIRECORD *rec = NULL;
TRACE("%p %s\n", dialog, debugstr_w(dialog->name) );
- rec = MSI_QueryGetRecord( package->db, query, dialog->name );
+ rec = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Dialog` WHERE `Dialog` = '%s'", dialog->name );
if( !rec )
WARN("query failed for dialog %s\n", debugstr_w(dialog->name));
@@ -3775,9 +3656,6 @@ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog )
static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LPRECT pos )
{
- static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0};
- static const WCHAR szScreenY[] = {'S','c','r','e','e','n','Y',0};
-
UINT xres, yres;
POINT center;
SIZE sz;
@@ -3792,8 +3670,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP
sz.cx = msi_dialog_scale_unit( dialog, sz.cx );
sz.cy = msi_dialog_scale_unit( dialog, sz.cy );
- xres = msi_get_property_int( dialog->package->db, szScreenX, 0 );
- yres = msi_get_property_int( dialog->package->db, szScreenY, 0 );
+ xres = msi_get_property_int( dialog->package->db, L"ScreenX", 0 );
+ yres = msi_get_property_int( dialog->package->db, L"ScreenY", 0 );
center.x = MulDiv( center.x, xres, 100 );
center.y = MulDiv( center.y, yres, 100 );
@@ -3859,10 +3737,6 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first )
static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
{
- static const WCHAR df[] = {
- 'D','e','f','a','u','l','t','U','I','F','o','n','t',0 };
- static const WCHAR dfv[] = {
- 'M','S',' ','S','h','e','l','l',' ','D','l','g',0 };
msi_dialog *dialog = cs->lpCreateParams;
MSIRECORD *rec = NULL;
LPWSTR title = NULL;
@@ -3886,10 +3760,10 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
dialog->attributes = MSI_RecordGetInteger( rec, 6 );
- dialog->default_font = msi_dup_property( dialog->package->db, df );
+ dialog->default_font = msi_dup_property( dialog->package->db, L"DefaultUIFont" );
if (!dialog->default_font)
{
- dialog->default_font = strdupW(dfv);
+ dialog->default_font = strdupW( L"MS Shell Dlg" );
if (!dialog->default_font)
{
msiobj_release( &rec->hdr );
@@ -3928,7 +3802,7 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd
case 2: /* escape */
control = msi_dialog_find_control( dialog, dialog->control_cancel );
break;
- default:
+ default:
control = msi_dialog_find_control_by_hwnd( dialog, hwnd );
}
@@ -4043,7 +3917,7 @@ static UINT dialog_run_message_loop( msi_dialog *dialog )
if (dialog->parent == NULL && (dialog->attributes & msidbDialogAttributesMinimize))
style |= WS_MINIMIZEBOX;
- hwnd = CreateWindowW( szMsiDialogClass, dialog->name, style,
+ hwnd = CreateWindowW( L"MsiDialogCloseClass", dialog->name, style,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, NULL, dialog );
if( !hwnd )
@@ -4098,20 +3972,20 @@ static BOOL dialog_register_class( void )
cls.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
cls.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
cls.lpszMenuName = NULL;
- cls.lpszClassName = szMsiDialogClass;
+ cls.lpszClassName = L"MsiDialogCloseClass";
if( !RegisterClassW( &cls ) )
return FALSE;
cls.lpfnWndProc = MSIHiddenWindowProc;
- cls.lpszClassName = szMsiHiddenWindow;
+ cls.lpszClassName = L"MsiHiddenWindow";
if( !RegisterClassW( &cls ) )
return FALSE;
uiThreadId = GetCurrentThreadId();
- hMsiHiddenWindow = CreateWindowW( szMsiHiddenWindow, NULL, WS_OVERLAPPED,
+ hMsiHiddenWindow = CreateWindowW( L"MsiHiddenWindow", NULL, WS_OVERLAPPED,
0, 0, 100, 100, NULL, NULL, NULL, NULL );
if( !hMsiHiddenWindow )
return FALSE;
@@ -4122,8 +3996,6 @@ static BOOL dialog_register_class( void )
static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_dialog *parent,
control_event_handler event_handler )
{
- static const WCHAR szDialogCreated[] =
- {'D','i','a','l','o','g',' ','c','r','e','a','t','e','d',0};
MSIRECORD *rec = NULL;
msi_dialog *dialog;
@@ -4162,7 +4034,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di
return NULL;
}
MSI_RecordSetStringW(rec, 1, name);
- MSI_RecordSetStringW(rec, 2, szDialogCreated);
+ MSI_RecordSetStringW(rec, 2, L"Dialog created");
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, rec);
msiobj_release(&rec->hdr);
@@ -4292,8 +4164,8 @@ void msi_dialog_unregister_class( void )
{
DestroyWindow( hMsiHiddenWindow );
hMsiHiddenWindow = NULL;
- UnregisterClassW( szMsiDialogClass, NULL );
- UnregisterClassW( szMsiHiddenWindow, NULL );
+ UnregisterClassW( L"MsiDialogCloseClass", NULL );
+ UnregisterClassW( L"MsiHiddenWindow", NULL );
uiThreadId = 0;
}
@@ -4477,18 +4349,13 @@ static INT event_do_dialog( MSIPACKAGE *package, const WCHAR *name, msi_dialog *
/* end a modal dialog box */
static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument )
{
- static const WCHAR exitW[] = {'E','x','i','t',0};
- static const WCHAR retryW[] = {'R','e','t','r','y',0};
- static const WCHAR ignoreW[] = {'I','g','n','o','r','e',0};
- static const WCHAR returnW[] = {'R','e','t','u','r','n',0};
-
- if (!wcscmp( argument, exitW ))
+ if (!wcscmp( argument, L"Exit" ))
dialog->retval = IDCANCEL;
- else if (!wcscmp( argument, retryW ))
+ else if (!wcscmp( argument, L"Retry" ))
dialog->retval = IDRETRY;
- else if (!wcscmp( argument, ignoreW ))
+ else if (!wcscmp( argument, L"Ignore" ))
dialog->retval = IDOK;
- else if (!wcscmp( argument, returnW ))
+ else if (!wcscmp( argument, L"Return" ))
dialog->retval = 0;
else
{
@@ -4570,10 +4437,10 @@ static UINT event_add_local( msi_dialog *dialog, const WCHAR *argument )
LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry )
{
- if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll ))
+ if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" ))
{
if (feature->ActionRequest != INSTALLSTATE_LOCAL)
- msi_set_property( dialog->package->db, szPreselected, szOne, -1 );
+ msi_set_property( dialog->package->db, L"Preselected", L"1", -1 );
MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_LOCAL );
}
}
@@ -4586,10 +4453,10 @@ static UINT event_remove( msi_dialog *dialog, const WCHAR *argument )
LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry )
{
- if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll ))
+ if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" ))
{
if (feature->ActionRequest != INSTALLSTATE_ABSENT)
- msi_set_property( dialog->package->db, szPreselected, szOne, -1 );
+ msi_set_property( dialog->package->db, L"Preselected", L"1", -1 );
MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_ABSENT );
}
}
@@ -4602,10 +4469,10 @@ static UINT event_add_source( msi_dialog *dialog, const WCHAR *argument )
LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry )
{
- if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll ))
+ if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" ))
{
if (feature->ActionRequest != INSTALLSTATE_SOURCE)
- msi_set_property( dialog->package->db, szPreselected, szOne, -1 );
+ msi_set_property( dialog->package->db, L"Preselected", L"1", -1 );
MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_SOURCE );
}
}
@@ -4632,7 +4499,7 @@ static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument )
UINT r = ERROR_SUCCESS;
MSI_RecordSetStringW( rec, 1, path );
- msi_event_fire( dialog->package, szSelectionPath, rec );
+ msi_event_fire( dialog->package, L"SelectionPath", rec );
if (path)
{
/* failure to set the path halts the executing of control events */
@@ -4651,11 +4518,10 @@ static UINT event_reset( msi_dialog *dialog, const WCHAR *argument )
INT ACTION_ShowDialog( MSIPACKAGE *package, const WCHAR *dialog )
{
- static const WCHAR szDialog[] = {'D','i','a','l','o','g',0};
MSIRECORD *row;
INT rc;
- if (!TABLE_Exists(package->db, szDialog)) return 0;
+ if (!TABLE_Exists(package->db, L"Dialog")) return 0;
row = MSI_CreateRecord(0);
if (!row) return -1;
@@ -4722,12 +4588,12 @@ static UINT event_directory_list_new( msi_dialog *dialog, const WCHAR *argument
static UINT event_reinstall_mode( msi_dialog *dialog, const WCHAR *argument )
{
- return msi_set_property( dialog->package->db, szReinstallMode, argument, -1 );
+ return msi_set_property( dialog->package->db, L"REINSTALLMODE", argument, -1 );
}
static UINT event_reinstall( msi_dialog *dialog, const WCHAR *argument )
{
- return msi_set_property( dialog->package->db, szReinstall, argument, -1 );
+ return msi_set_property( dialog->package->db, L"REINSTALL", argument, -1 );
}
static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument )
@@ -4735,43 +4601,25 @@ static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument
return msi_validate_product_id( dialog->package );
}
-static const WCHAR end_dialogW[] = {'E','n','d','D','i','a','l','o','g',0};
-static const WCHAR new_dialogW[] = {'N','e','w','D','i','a','l','o','g',0};
-static const WCHAR spawn_dialogW[] = {'S','p','a','w','n','D','i','a','l','o','g',0};
-static const WCHAR spawn_wait_dialogW[] = {'S','p','a','w','n','W','a','i','t','D','i','a','l','o','g',0};
-static const WCHAR do_actionW[] = {'D','o','A','c','t','i','o','n',0};
-static const WCHAR add_localW[] = {'A','d','d','L','o','c','a','l',0};
-static const WCHAR removeW[] = {'R','e','m','o','v','e',0};
-static const WCHAR add_sourceW[] = {'A','d','d','S','o','u','r','c','e',0};
-static const WCHAR set_target_pathW[] = {'S','e','t','T','a','r','g','e','t','P','a','t','h',0};
-static const WCHAR resetW[] = {'R','e','s','e','t',0};
-static const WCHAR set_install_levelW[] = {'S','e','t','I','n','s','t','a','l','l','L','e','v','e','l',0};
-static const WCHAR directory_list_upW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','U','p',0};
-static const WCHAR directory_list_newW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','N','e','w',0};
-static const WCHAR selection_browseW[] = {'S','e','l','e','c','t','i','o','n','B','r','o','w','s','e',0};
-static const WCHAR reinstall_modeW[] = {'R','e','i','n','s','t','a','l','l','M','o','d','e',0};
-static const WCHAR reinstallW[] = {'R','e','i','n','s','t','a','l','l',0};
-static const WCHAR validate_product_idW[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
-
static const struct control_event control_events[] =
{
- { end_dialogW, pending_event_end_dialog },
- { new_dialogW, pending_event_new_dialog },
- { spawn_dialogW, pending_event_spawn_dialog },
- { spawn_wait_dialogW, event_spawn_wait_dialog },
- { do_actionW, event_do_action },
- { add_localW, event_add_local },
- { removeW, event_remove },
- { add_sourceW, event_add_source },
- { set_target_pathW, event_set_target_path },
- { resetW, event_reset },
- { set_install_levelW, event_set_install_level },
- { directory_list_upW, event_directory_list_up },
- { directory_list_newW, event_directory_list_new },
- { selection_browseW, event_spawn_dialog },
- { reinstall_modeW, event_reinstall_mode },
- { reinstallW, event_reinstall },
- { validate_product_idW, event_validate_product_id },
+ { L"EndDialog", pending_event_end_dialog },
+ { L"NewDialog", pending_event_new_dialog },
+ { L"SpawnDialog", pending_event_spawn_dialog },
+ { L"SpawnWaitDialog", event_spawn_wait_dialog },
+ { L"DoAction", event_do_action },
+ { L"AddLocal", event_add_local },
+ { L"Remove", event_remove },
+ { L"AddSource", event_add_source },
+ { L"SetTargetPath", event_set_target_path },
+ { L"Reset", event_reset },
+ { L"SetInstallLevel", event_set_install_level },
+ { L"DirectoryListUp", event_directory_list_up },
+ { L"DirectoryListNew", event_directory_list_new },
+ { L"SelectionBrowse", event_spawn_dialog },
+ { L"ReinstallMode", event_reinstall_mode },
+ { L"Reinstall", event_reinstall },
+ { L"ValidateProductID", event_validate_product_id },
{ NULL, NULL }
};
--
2.28.0
1
0
[PATCH 3/4] winex11.drv: Query virtual screen and primary screen rectangles from the wineserver.
by Zhiyi Zhang Oct. 28, 2020
by Zhiyi Zhang Oct. 28, 2020
Oct. 28, 2020
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winex11.drv/display.c | 39 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 23 deletions(-)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index abc4f2a07cc..b0c52fa91ef 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -47,7 +47,6 @@ DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1
/* Wine specific properties */
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_GPU_VULKAN_UUID, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5c, 2);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
-DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
static const WCHAR driver_date_dataW[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0};
@@ -146,14 +145,11 @@ void release_display_device_init_mutex(HANDLE mutex)
static BOOL update_screen_cache(void)
{
RECT virtual_rect = {0}, primary_rect = {0}, monitor_rect;
- SP_DEVINFO_DATA device_data = {sizeof(device_data)};
- HDEVINFO devinfo = INVALID_HANDLE_VALUE;
FILETIME filetime = {0};
HANDLE mutex = NULL;
+ NTSTATUS status;
DWORD i = 0;
INT result;
- DWORD type;
- BOOL ret = FALSE;
EnterCriticalSection(&screen_section);
if ((!video_key && RegOpenKeyW(HKEY_LOCAL_MACHINE, video_keyW, &video_key))
@@ -169,15 +165,21 @@ static BOOL update_screen_cache(void)
mutex = get_display_device_init_mutex();
- devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_MONITOR, displayW, NULL, DIGCF_PRESENT);
- if (devinfo == INVALID_HANDLE_VALUE)
- goto fail;
-
- while (SetupDiEnumDeviceInfo(devinfo, i++, &device_data))
+ while (TRUE)
{
- if (!SetupDiGetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, &type,
- (BYTE *)&monitor_rect, sizeof(monitor_rect), NULL, 0))
- goto fail;
+ SERVER_START_REQ(enum_monitor)
+ {
+ req->index = i++;
+ if (!(status = wine_server_call(req)))
+ {
+ SetRect(&monitor_rect, reply->monitor_rect.left, reply->monitor_rect.top,
+ reply->monitor_rect.right, reply->monitor_rect.bottom);
+ }
+ }
+ SERVER_END_REQ;
+
+ if (status)
+ break;
UnionRect(&virtual_rect, &virtual_rect, &monitor_rect);
if (i == 1)
@@ -189,13 +191,8 @@ static BOOL update_screen_cache(void)
primary_monitor_rect = primary_rect;
last_query_screen_time = filetime;
LeaveCriticalSection(&screen_section);
- ret = TRUE;
-fail:
- SetupDiDestroyDeviceInfoList(devinfo);
release_display_device_init_mutex(mutex);
- if (!ret)
- WARN("Update screen cache failed!\n");
- return ret;
+ return TRUE;
}
POINT virtual_screen_to_root(INT x, INT y)
@@ -621,10 +618,6 @@ static BOOL X11DRV_InitMonitor(HDEVINFO devinfo, const struct x11drv_monitor *mo
if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_STATEFLAGS, DEVPROP_TYPE_UINT32,
(const BYTE *)&monitor->state_flags, sizeof(monitor->state_flags), 0))
goto done;
- /* RcMonitor */
- if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, DEVPROP_TYPE_BINARY,
- (const BYTE *)&monitor->rc_monitor, sizeof(monitor->rc_monitor), 0))
- goto done;
/* Adapter name */
sprintfW(bufferW, adapter_name_fmtW, video_index + 1);
size = (strlenW(bufferW) + 1) * sizeof(WCHAR);
--
2.27.0
2
1
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
include/dbs.idl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/dbs.idl b/include/dbs.idl
index 63617c88c00..19f92b3c05f 100644
--- a/include/dbs.idl
+++ b/include/dbs.idl
@@ -500,6 +500,8 @@ cpp_quote(" EXTERN_C const GUID name DECLSPEC_HIDDEN")
cpp_quote("#endif")
cpp_quote("DEFINE_DBGUID(DB_NULLGUID, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);")
+cpp_quote("DEFINE_DBGUID(DBGUID_SQL, 0xc8b522d7, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
+cpp_quote("DEFINE_DBGUID(DBGUID_DEFAULT, 0xc8b521fb, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_SESSION, 0xc8b522f5, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_ROWSET, 0xc8b522f6, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_ROW, 0xc8b522f7, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
--
2.28.0
1
0
[PATCH 2/4] winemac.drv: Store monitor information in the wineserver for EnumDisplayMonitors().
by Zhiyi Zhang Oct. 28, 2020
by Zhiyi Zhang Oct. 28, 2020
Oct. 28, 2020
Fix Office 2016/365 having a 640x480 main window.
Office 2016/365 hooks NtOpenKeyEx() and prevents access to SetupAPI device properties.
After failed to query monitor information from SetupAPI, EnumDisplayMonitors() reports
a fallback monitor of size 640x480.
As to why store the monitor information in wineserver, it seems the EnumDisplayMonitors()
reports monitors connected to current user logon session. For instance, EnumDisplayMonitors()
always report one monitor when called by services.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winemac.drv/display.c | 65 ++++++++++++++++++++++++++++++--------
1 file changed, 51 insertions(+), 14 deletions(-)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index f6390becea7..9e7d5214e47 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -32,6 +32,7 @@
#include "setupapi.h"
#define WIN32_NO_STATUS
#include "winternl.h"
+#include "wine/server.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(display);
@@ -57,8 +58,6 @@ DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1
/* Wine specific monitor properties */
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
-DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
-DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 4);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
static const char initial_mode_key[] = "Initial Display Mode";
@@ -1628,10 +1627,11 @@ static BOOL macdrv_init_monitor(HDEVINFO devinfo, const struct macdrv_monitor *m
int video_index, const LUID *gpu_luid, UINT output_id)
{
SP_DEVINFO_DATA device_data = {sizeof(SP_DEVINFO_DATA)};
+ RECT monitor_rect, work_rect;
WCHAR nameW[MAX_PATH];
WCHAR bufferW[MAX_PATH];
+ DWORD size;
HKEY hkey;
- RECT rect;
BOOL ret = FALSE;
/* Create GUID_DEVCLASS_MONITOR instance */
@@ -1666,22 +1666,35 @@ static BOOL macdrv_init_monitor(HDEVINFO devinfo, const struct macdrv_monitor *m
if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_STATEFLAGS, DEVPROP_TYPE_UINT32,
(const BYTE *)&monitor->state_flags, sizeof(monitor->state_flags), 0))
goto done;
- /* RcMonitor */
- rect = rect_from_cgrect(monitor->rc_monitor);
- if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, DEVPROP_TYPE_BINARY,
- (const BYTE *)&rect, sizeof(rect), 0))
- goto done;
- /* RcWork */
- rect = rect_from_cgrect(monitor->rc_work);
- if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCWORK, DEVPROP_TYPE_BINARY,
- (const BYTE *)&rect, sizeof(rect), 0))
- goto done;
/* Adapter name */
sprintfW(bufferW, adapter_name_fmtW, video_index + 1);
+ size = (lstrlenW(bufferW) + 1) * sizeof(WCHAR);
if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, DEVPROP_TYPE_STRING,
- (const BYTE *)bufferW, (lstrlenW(bufferW) + 1) * sizeof(WCHAR), 0))
+ (const BYTE *)bufferW, size, 0))
goto done;
+ /* EnumDisplayMonitors() doesn't enumerate mirrored replicas and inactive monitors */
+ if (monitor_index == 0 && monitor->state_flags & DISPLAY_DEVICE_ACTIVE)
+ {
+ SERVER_START_REQ(create_monitor)
+ {
+ monitor_rect = rect_from_cgrect(monitor->rc_monitor);
+ req->monitor_rect.top = monitor_rect.top;
+ req->monitor_rect.left = monitor_rect.left;
+ req->monitor_rect.right = monitor_rect.right;
+ req->monitor_rect.bottom = monitor_rect.bottom;
+ work_rect = rect_from_cgrect(monitor->rc_work);
+ req->work_rect.top = work_rect.top;
+ req->work_rect.left = work_rect.left;
+ req->work_rect.right = work_rect.right;
+ req->work_rect.bottom = work_rect.bottom;
+ wine_server_add_data(req, bufferW, size);
+ if (wine_server_call(req))
+ goto done;
+ }
+ SERVER_END_REQ;
+ }
+
ret = TRUE;
done:
if (!ret)
@@ -1693,7 +1706,9 @@ static void prepare_devices(HKEY video_hkey)
{
static const BOOL not_present = FALSE;
SP_DEVINFO_DATA device_data = {sizeof(device_data)};
+ HMONITOR monitor = NULL;
HDEVINFO devinfo;
+ NTSTATUS status;
DWORD i = 0;
/* Remove all monitors */
@@ -1705,6 +1720,28 @@ static void prepare_devices(HKEY video_hkey)
}
SetupDiDestroyDeviceInfoList(devinfo);
+ while (TRUE)
+ {
+ SERVER_START_REQ(enum_monitor)
+ {
+ req->index = 0;
+ if (!(status = wine_server_call(req)))
+ monitor = wine_server_ptr_handle(reply->handle);
+ }
+ SERVER_END_REQ;
+
+ if (status)
+ break;
+
+ SERVER_START_REQ(destroy_monitor)
+ {
+ req->handle = wine_server_obj_handle(monitor);
+ if (wine_server_call(req))
+ ERR("Failed to remove monitor.\n");
+ }
+ SERVER_END_REQ;
+ }
+
/* Clean up old adapter keys for reinitialization */
RegDeleteTreeW(video_hkey, NULL);
--
2.27.0
2
1
[PATCH 8/8] wined3d: Restore display modes for all outputs when doing mode restoration.
by Zhiyi Zhang Oct. 28, 2020
by Zhiyi Zhang Oct. 28, 2020
Oct. 28, 2020
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/d3d8/tests/device.c | 30 ++++++-------
dlls/d3d9/tests/device.c | 30 ++++++-------
dlls/ddraw/ddraw.c | 2 +-
dlls/ddraw/tests/ddraw1.c | 10 ++---
dlls/ddraw/tests/ddraw2.c | 10 ++---
dlls/ddraw/tests/ddraw4.c | 10 ++---
dlls/ddraw/tests/ddraw7.c | 10 ++---
dlls/dxgi/tests/dxgi.c | 14 +++---
dlls/wined3d/directx.c | 93 +++++++++++++++++++++++++--------------
dlls/wined3d/swapchain.c | 55 +++++++++++++----------
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 1 +
12 files changed, 151 insertions(+), 115 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 8c7737f6601..80de1ec9dbb 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -4331,7 +4331,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
- todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
+ ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, devmode.dmPelsWidth, devmode.dmPelsHeight);
@@ -4411,7 +4411,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
@@ -4449,7 +4449,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
@@ -4535,15 +4535,15 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D8_GetAdapterDisplayMode(d3d8, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
+ ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
old_devmode.dmPelsWidth, d3ddm.Width);
- todo_wine ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
+ ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
old_devmode.dmPelsHeight, d3ddm.Height);
refcount = IDirect3DDevice8_Release(device);
@@ -4571,15 +4571,15 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D8_GetAdapterDisplayMode(d3d8, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
+ ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
old_devmode.dmPelsWidth, d3ddm.Width);
- todo_wine ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
+ ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
old_devmode.dmPelsHeight, d3ddm.Height);
ret = restore_display_modes(original_modes, display_count);
ok(ret, "Failed to restore display modes.\n");
@@ -4600,7 +4600,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -4610,7 +4610,7 @@ static void test_mode_change(void)
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
hr = IDirect3D8_GetAdapterDisplayMode(d3d8, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == devmode.dmPelsWidth && d3ddm.Height == devmode.dmPelsHeight,
+ ok(d3ddm.Width == devmode.dmPelsWidth && d3ddm.Height == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
d3ddm.Width, d3ddm.Height);
ret = restore_display_modes(original_modes, display_count);
@@ -4645,13 +4645,13 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D8_GetAdapterDisplayMode(d3d8, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
+ ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", old_devmode.dmPelsWidth,
old_devmode.dmPelsHeight, d3ddm.Width, d3ddm.Height);
@@ -4686,13 +4686,13 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D8_GetAdapterDisplayMode(d3d8, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
+ ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", old_devmode.dmPelsWidth,
old_devmode.dmPelsHeight, d3ddm.Width, d3ddm.Height);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index d7b71152b03..bc9e1d32d11 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5418,7 +5418,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
- todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
+ ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n",
registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, devmode.dmPelsWidth, devmode.dmPelsHeight);
@@ -5498,7 +5498,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
@@ -5536,7 +5536,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
@@ -5622,15 +5622,15 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D9_GetAdapterDisplayMode(d3d9, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
+ ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
old_devmode.dmPelsWidth, d3ddm.Width);
- todo_wine ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
+ ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
old_devmode.dmPelsHeight, d3ddm.Height);
refcount = IDirect3DDevice9_Release(device);
@@ -5658,15 +5658,15 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D9_GetAdapterDisplayMode(d3d9, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
+ ok(d3ddm.Width == old_devmode.dmPelsWidth, "Expected width %u, got %u.\n",
old_devmode.dmPelsWidth, d3ddm.Width);
- todo_wine ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
+ ok(d3ddm.Height == old_devmode.dmPelsHeight, "Expected height %u, got %u.\n",
old_devmode.dmPelsHeight, d3ddm.Height);
ret = restore_display_modes(original_modes, display_count);
ok(ret, "Failed to restore display modes.\n");
@@ -5687,7 +5687,7 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -5697,7 +5697,7 @@ static void test_mode_change(void)
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
hr = IDirect3D9_GetAdapterDisplayMode(d3d9, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == devmode.dmPelsWidth && d3ddm.Height == devmode.dmPelsHeight,
+ ok(d3ddm.Width == devmode.dmPelsWidth && d3ddm.Height == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
d3ddm.Width, d3ddm.Height);
ret = restore_display_modes(original_modes, display_count);
@@ -5732,13 +5732,13 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D9_GetAdapterDisplayMode(d3d9, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
+ ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", old_devmode.dmPelsWidth,
old_devmode.dmPelsHeight, d3ddm.Width, d3ddm.Height);
@@ -5773,13 +5773,13 @@ static void test_mode_change(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDirect3D9_GetAdapterDisplayMode(d3d9, 1, &d3ddm);
ok(hr == S_OK, "GetAdapterDisplayMode failed, hr %#x.\n", hr);
- todo_wine ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
+ ok(d3ddm.Width == old_devmode.dmPelsWidth && d3ddm.Height == old_devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", old_devmode.dmPelsWidth,
old_devmode.dmPelsHeight, d3ddm.Width, d3ddm.Height);
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 11a16f8d535..f78d344c085 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -698,7 +698,7 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
return DDERR_NOEXCLUSIVEMODE;
}
- if (SUCCEEDED(hr = wined3d_output_set_display_mode(ddraw->wined3d_output, NULL)))
+ if (SUCCEEDED(hr = wined3d_restore_display_modes(ddraw->wined3d)))
{
ddraw->flags &= ~DDRAW_RESTORE_MODE;
if (ddraw->cooperative_level & DDSCL_EXCLUSIVE &&
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 783c1b961a0..e1a315f291f 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -3784,7 +3784,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3805,7 +3805,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3830,7 +3830,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -3860,7 +3860,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3891,7 +3891,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 23d3e0c1f02..849d510a349 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -3944,7 +3944,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3965,7 +3965,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3990,7 +3990,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -4020,7 +4020,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -4051,7 +4051,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 12cfbc3784f..56a4777add5 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -4172,7 +4172,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -4193,7 +4193,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -4218,7 +4218,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -4248,7 +4248,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -4279,7 +4279,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index c214cbc221e..c9ba50287be 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -3819,7 +3819,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3840,7 +3840,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3865,7 +3865,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -3895,7 +3895,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
@@ -3926,7 +3926,7 @@ static void test_coop_level_mode_set_multi(void)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(compare_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 4d9677b3762..e6c8e0eb8c4 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -7097,7 +7097,7 @@ static void test_mode_change(IUnknown *device, BOOL is_d3d12)
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &devmode), "Got a different mode.\n");
@@ -7196,16 +7196,16 @@ static void test_mode_change(IUnknown *device, BOOL is_d3d12)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
+ ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
ok(equal_mode_rect(&devmode2, &old_devmode), "Got a different mode.\n");
hr = IDXGIOutput_GetDesc(second_output, &output_desc);
ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr);
- todo_wine ok(output_desc.DesktopCoordinates.right - output_desc.DesktopCoordinates.left ==
+ ok(output_desc.DesktopCoordinates.right - output_desc.DesktopCoordinates.left ==
old_devmode.dmPelsWidth, "Expected width %u, got %u.\n", old_devmode.dmPelsWidth,
output_desc.DesktopCoordinates.right - output_desc.DesktopCoordinates.left);
- todo_wine ok(output_desc.DesktopCoordinates.bottom - output_desc.DesktopCoordinates.top ==
+ ok(output_desc.DesktopCoordinates.bottom - output_desc.DesktopCoordinates.top ==
old_devmode.dmPelsHeight, "Expected height %u, got %u.\n", old_devmode.dmPelsHeight,
output_desc.DesktopCoordinates.bottom - output_desc.DesktopCoordinates.top);
@@ -7228,7 +7228,7 @@ static void test_mode_change(IUnknown *device, BOOL is_d3d12)
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_CURRENT_SETTINGS, &devmode2);
ok(ret, "EnumDisplaySettingsW failed, error %#x.\n", GetLastError());
- todo_wine ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
+ ok(devmode2.dmPelsWidth == devmode.dmPelsWidth && devmode2.dmPelsHeight == devmode.dmPelsHeight,
"Expected resolution %ux%u, got %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight,
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
ret = EnumDisplaySettingsW(second_monitor_name, ENUM_REGISTRY_SETTINGS, &devmode2);
@@ -7238,10 +7238,10 @@ static void test_mode_change(IUnknown *device, BOOL is_d3d12)
devmode2.dmPelsWidth, devmode2.dmPelsHeight);
hr = IDXGIOutput_GetDesc(second_output, &output_desc);
ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr);
- todo_wine ok(output_desc.DesktopCoordinates.right - output_desc.DesktopCoordinates.left ==
+ ok(output_desc.DesktopCoordinates.right - output_desc.DesktopCoordinates.left ==
devmode.dmPelsWidth, "Expected width %u, got %u.\n", devmode.dmPelsWidth,
output_desc.DesktopCoordinates.right - output_desc.DesktopCoordinates.left);
- todo_wine ok(output_desc.DesktopCoordinates.bottom - output_desc.DesktopCoordinates.top ==
+ ok(output_desc.DesktopCoordinates.bottom - output_desc.DesktopCoordinates.top ==
devmode.dmPelsHeight, "Expected height %u, got %u.\n", devmode.dmPelsHeight,
output_desc.DesktopCoordinates.bottom - output_desc.DesktopCoordinates.top);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index c11fa22cc38..aa257de44ee 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1320,54 +1320,79 @@ HRESULT CDECL wined3d_output_get_display_mode(const struct wined3d_output *outpu
return WINED3D_OK;
}
+HRESULT CDECL wined3d_restore_display_modes(struct wined3d *wined3d)
+{
+ unsigned int adapter_idx, output_idx;
+ struct wined3d_adapter *adapter;
+ struct wined3d_output *output;
+ DEVMODEW devmode;
+ LONG ret;
+
+ TRACE("wined3d %p.\n", wined3d);
+
+ ret = ChangeDisplaySettingsExW(NULL, NULL, NULL, 0, NULL);
+ if (ret != DISP_CHANGE_SUCCESSFUL)
+ {
+ ERR("Failed to restore all outputs to their registry display settings, error %d.\n", ret);
+ return WINED3DERR_NOTAVAILABLE;
+ }
+
+ memset(&devmode, 0, sizeof(devmode));
+ devmode.dmSize = sizeof(devmode);
+ for (adapter_idx = 0; adapter_idx < wined3d->adapter_count; ++adapter_idx)
+ {
+ adapter = wined3d->adapters[adapter_idx];
+ for (output_idx = 0; output_idx < adapter->output_count; ++output_idx)
+ {
+ output = &adapter->outputs[output_idx];
+
+ if (!EnumDisplaySettingsExW(output->device_name, ENUM_CURRENT_SETTINGS, &devmode, 0))
+ {
+ ERR("Failed to read the current display mode for %s.\n",
+ wine_dbgstr_w(output->device_name));
+ return WINED3DERR_NOTAVAILABLE;
+ }
+
+ output->screen_format = pixelformat_for_depth(devmode.dmBitsPerPel);
+ }
+ }
+
+ return WINED3D_OK;
+}
+
HRESULT CDECL wined3d_output_set_display_mode(struct wined3d_output *output,
const struct wined3d_display_mode *mode)
{
+ enum wined3d_format_id new_format_id;
+ const struct wined3d_format *format;
DEVMODEW new_mode, current_mode;
LONG ret;
- enum wined3d_format_id new_format_id;
TRACE("output %p, mode %p.\n", output, mode);
+ TRACE("mode %ux%u@%u %s %#x.\n", mode->width, mode->height, mode->refresh_rate,
+ debug_d3dformat(mode->format_id), mode->scanline_ordering);
memset(&new_mode, 0, sizeof(new_mode));
new_mode.dmSize = sizeof(new_mode);
memset(¤t_mode, 0, sizeof(current_mode));
current_mode.dmSize = sizeof(current_mode);
- if (mode)
+
+ format = wined3d_get_format(output->adapter, mode->format_id, WINED3D_BIND_RENDER_TARGET);
+
+ new_mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
+ new_mode.dmBitsPerPel = format->byte_count * CHAR_BIT;
+ new_mode.dmPelsWidth = mode->width;
+ new_mode.dmPelsHeight = mode->height;
+ new_mode.dmDisplayFrequency = mode->refresh_rate;
+ if (mode->refresh_rate)
+ new_mode.dmFields |= DM_DISPLAYFREQUENCY;
+ if (mode->scanline_ordering != WINED3D_SCANLINE_ORDERING_UNKNOWN)
{
- const struct wined3d_format *format;
-
- TRACE("mode %ux%u@%u %s %#x.\n", mode->width, mode->height, mode->refresh_rate,
- debug_d3dformat(mode->format_id), mode->scanline_ordering);
-
- format = wined3d_get_format(output->adapter, mode->format_id, WINED3D_BIND_RENDER_TARGET);
-
- new_mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
- new_mode.dmBitsPerPel = format->byte_count * CHAR_BIT;
- new_mode.dmPelsWidth = mode->width;
- new_mode.dmPelsHeight = mode->height;
-
- new_mode.dmDisplayFrequency = mode->refresh_rate;
- if (mode->refresh_rate)
- new_mode.dmFields |= DM_DISPLAYFREQUENCY;
-
- if (mode->scanline_ordering != WINED3D_SCANLINE_ORDERING_UNKNOWN)
- {
- new_mode.dmFields |= DM_DISPLAYFLAGS;
- if (mode->scanline_ordering == WINED3D_SCANLINE_ORDERING_INTERLACED)
- new_mode.u2.dmDisplayFlags |= DM_INTERLACED;
- }
- new_format_id = mode->format_id;
- }
- else
- {
- if (!EnumDisplaySettingsW(output->device_name, ENUM_REGISTRY_SETTINGS, &new_mode))
- {
- ERR("Failed to read mode from registry.\n");
- return WINED3DERR_NOTAVAILABLE;
- }
- new_format_id = pixelformat_for_depth(new_mode.dmBitsPerPel);
+ new_mode.dmFields |= DM_DISPLAYFLAGS;
+ if (mode->scanline_ordering == WINED3D_SCANLINE_ORDERING_INTERLACED)
+ new_mode.u2.dmDisplayFlags |= DM_INTERLACED;
}
+ new_format_id = mode->format_id;
/* Only change the mode if necessary. */
if (!EnumDisplaySettingsW(output->device_name, ENUM_CURRENT_SETTINGS, ¤t_mode))
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 847907c6d4c..7e46e5c6150 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -28,8 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain)
{
- struct wined3d_output *output;
- HRESULT hr = E_FAIL;
+ HRESULT hr;
UINT i;
TRACE("Destroying swapchain %p.\n", swapchain);
@@ -71,9 +70,7 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain)
{
if (swapchain->state.desc.auto_restore_display_mode)
{
- output = wined3d_swapchain_get_output(swapchain);
- if (!output || FAILED(hr = wined3d_output_set_display_mode(output,
- &swapchain->state.original_mode)))
+ if (FAILED(hr = wined3d_restore_display_modes(swapchain->device->wined3d)))
ERR("Failed to restore display mode, hr %#x.\n", hr);
if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
@@ -1543,8 +1540,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
err:
if (displaymode_set)
{
- if (FAILED(wined3d_output_set_display_mode(desc->output,
- &swapchain->state.original_mode)))
+ if (FAILED(wined3d_restore_display_modes(device->wined3d)))
ERR("Failed to restore display mode.\n");
}
@@ -1791,13 +1787,6 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
if (!(focus_messages = device->wined3d->flags & WINED3D_FOCUS_MESSAGES))
filter = wined3d_filter_messages(window, TRUE);
- output = wined3d_swapchain_get_output(swapchain);
- if (!output)
- {
- ERR("Failed to get output from swapchain %p.\n", swapchain);
- return;
- }
-
if (activate)
{
SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_active, 0);
@@ -1813,6 +1802,13 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
*
* Guild Wars 1 wants a WINDOWPOSCHANGED message on the device window to
* resume drawing after a focus loss. */
+ output = wined3d_swapchain_get_output(swapchain);
+ if (!output)
+ {
+ ERR("Failed to get output from swapchain %p.\n", swapchain);
+ return;
+ }
+
if (SUCCEEDED(hr = wined3d_output_get_desc(output, &output_desc)))
SetWindowPos(window, NULL, output_desc.desktop_rect.left,
output_desc.desktop_rect.top, swapchain->state.desc.backbuffer_width,
@@ -1823,6 +1819,13 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
if (device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE)
{
+ output = wined3d_swapchain_get_output(swapchain);
+ if (!output)
+ {
+ ERR("Failed to get output from swapchain %p.\n", swapchain);
+ return;
+ }
+
if (FAILED(hr = wined3d_output_set_display_mode(output,
&swapchain->state.d3d_mode)))
ERR("Failed to set display mode, hr %#x.\n", hr);
@@ -1839,8 +1842,8 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
device->restore_screensaver = FALSE;
}
- if (FAILED(hr = wined3d_output_set_display_mode(output, NULL)))
- ERR("Failed to set display mode, hr %#x.\n", hr);
+ if (FAILED(hr = wined3d_restore_display_modes(device->wined3d)))
+ ERR("Failed to restore display modes, hr %#x.\n", hr);
swapchain->reapply_mode = TRUE;
@@ -1974,9 +1977,9 @@ static HRESULT wined3d_swapchain_state_set_display_mode(struct wined3d_swapchain
if (output != state->desc.output)
{
- if (FAILED(hr = wined3d_output_set_display_mode(state->desc.output, &state->original_mode)))
+ if (FAILED(hr = wined3d_restore_display_modes(state->wined3d)))
{
- WARN("Failed to set display mode, hr %#x.\n", hr);
+ WARN("Failed to restore display modes, hr %#x.\n", hr);
return hr;
}
@@ -2199,6 +2202,9 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
if (mode)
{
actual_mode = *mode;
+ if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, swapchain_desc->output,
+ &actual_mode)))
+ return hr;
}
else
{
@@ -2210,16 +2216,19 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
actual_mode.format_id = adapter_format_from_backbuffer_format(swapchain_desc->output->adapter,
swapchain_desc->backbuffer_format);
actual_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
+ if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, swapchain_desc->output,
+ &actual_mode)))
+ return hr;
}
else
{
- actual_mode = state->original_mode;
+ if (FAILED(hr = wined3d_restore_display_modes(state->wined3d)))
+ {
+ WARN("Failed to restore display modes for all outputs, hr %#x.\n", hr);
+ return hr;
+ }
}
}
-
- if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, swapchain_desc->output,
- &actual_mode)))
- return hr;
}
else
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index e4ff1161bce..44008119a8d 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -15,6 +15,7 @@
@ cdecl wined3d_incref(ptr)
@ cdecl wined3d_register_software_device(ptr ptr)
@ cdecl wined3d_register_window(ptr ptr ptr long)
+@ cdecl wined3d_restore_display_modes(ptr)
@ cdecl wined3d_unregister_windows(ptr)
@ cdecl wined3d_adapter_get_identifier(ptr long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 62ea3960118..4a06b511211 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2313,6 +2313,7 @@ ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function);
BOOL __cdecl wined3d_register_window(struct wined3d *wined3d, HWND window,
struct wined3d_device *device, unsigned int flags);
+HRESULT __cdecl wined3d_restore_display_modes(struct wined3d *wined3d);
void __cdecl wined3d_unregister_windows(struct wined3d *wined3d);
HRESULT __cdecl wined3d_adapter_get_identifier(const struct wined3d_adapter *adapter,
--
2.27.0
2
1
[PATCH 1/4] winex11.drv: Store monitor information in the wineserver for EnumDisplayMonitors().
by Zhiyi Zhang Oct. 28, 2020
by Zhiyi Zhang Oct. 28, 2020
Oct. 28, 2020
Fix Office 2016/365 having a 640x480 main window.
Office 2016/365 hooks NtOpenKeyEx() and prevents access to SetupAPI device properties.
After failed to query monitor information from SetupAPI, EnumDisplayMonitors() reports
a fallback monitor of size 640x480.
As to why store the monitor information in wineserver, it seems the EnumDisplayMonitors()
reports monitors connected to current user logon session. For instance, EnumDisplayMonitors()
always report one monitor when called by services.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/user32/sysparams.c | 53 ++++++++++
dlls/winex11.drv/display.c | 54 +++++++++--
server/Makefile.in | 1 +
server/display.c | 192 +++++++++++++++++++++++++++++++++++++
server/protocol.def | 35 +++++++
server/user.h | 11 +++
6 files changed, 340 insertions(+), 6 deletions(-)
create mode 100644 server/display.c
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 1381f387e03..227d57b0e5c 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -46,6 +46,7 @@
#include "win.h"
#include "user_private.h"
#include "wine/gdi_driver.h"
+#include "wine/server.h"
#include "wine/asm.h"
#include "wine/debug.h"
@@ -3858,9 +3859,31 @@ fail:
BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info )
{
UINT index = (UINT_PTR)handle - 1;
+ WCHAR adapter_name[CCHDEVICENAME];
TRACE("(%p, %p)\n", handle, info);
+ SERVER_START_REQ( get_monitor_info )
+ {
+ req->handle = wine_server_obj_handle( handle );
+ wine_server_set_reply( req, adapter_name, sizeof(adapter_name) );
+ if (!wine_server_call( req ))
+ {
+ SetRect( &info->rcMonitor, reply->monitor_rect.left, reply->monitor_rect.top,
+ reply->monitor_rect.right, reply->monitor_rect.bottom );
+ SetRect( &info->rcWork, reply->work_rect.left, reply->work_rect.top,
+ reply->work_rect.right, reply->work_rect.bottom );
+ if (!IsRectEmpty( &info->rcMonitor ) && !info->rcMonitor.top && !info->rcMonitor.left)
+ info->dwFlags = MONITORINFOF_PRIMARY;
+ else
+ info->dwFlags = 0;
+ if (info->cbSize >= sizeof(MONITORINFOEXW))
+ lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, adapter_name );
+ return TRUE;
+ }
+ }
+ SERVER_END_REQ;
+
/* Fallback to report one monitor */
if (handle == NULLDRV_DEFAULT_HMONITOR)
{
@@ -3874,7 +3897,10 @@ BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info )
}
if (!update_monitor_cache())
+ {
+ SetLastError( ERROR_INVALID_MONITOR_HANDLE );
return FALSE;
+ }
EnterCriticalSection( &monitors_section );
if (index < monitor_count)
@@ -3995,11 +4021,38 @@ static BOOL CALLBACK enum_mon_callback( HMONITOR monitor, HDC hdc, LPRECT rect,
BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp )
{
+ HMONITOR monitor = NULL;
RECT monitor_rect;
+ NTSTATUS status;
DWORD i = 0;
TRACE("(%p, %p, %p, 0x%lx)\n", hdc, rect, proc, lp);
+ while (TRUE)
+ {
+ SERVER_START_REQ( enum_monitor )
+ {
+ req->index = i;
+ if (!(status = wine_server_call( req )))
+ {
+ SetRect( &monitor_rect, reply->monitor_rect.left, reply->monitor_rect.top,
+ reply->monitor_rect.right, reply->monitor_rect.bottom );
+ monitor = wine_server_ptr_handle( reply->handle );
+ }
+ }
+ SERVER_END_REQ;
+
+ if (status)
+ break;
+
+ ++i;
+ if (!proc( monitor, hdc, &monitor_rect, lp ))
+ return FALSE;
+ }
+
+ if (i)
+ return TRUE;
+
if (update_monitor_cache())
{
while (TRUE)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index 0f61f9f7b2e..abc4f2a07cc 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -34,6 +34,7 @@
#define WIN32_NO_STATUS
#include "winternl.h"
#include "wine/debug.h"
+#include "wine/server.h"
#include "wine/unicode.h"
#include "x11drv.h"
@@ -47,7 +48,6 @@ DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_GPU_VULKAN_UUID, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5c, 2);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
-DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 4);
DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
static const WCHAR driver_date_dataW[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0};
@@ -586,6 +586,7 @@ static BOOL X11DRV_InitMonitor(HDEVINFO devinfo, const struct x11drv_monitor *mo
{
SP_DEVINFO_DATA device_data = {sizeof(SP_DEVINFO_DATA)};
WCHAR bufferW[MAX_PATH];
+ DWORD size;
HKEY hkey;
BOOL ret = FALSE;
@@ -624,16 +625,33 @@ static BOOL X11DRV_InitMonitor(HDEVINFO devinfo, const struct x11drv_monitor *mo
if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, DEVPROP_TYPE_BINARY,
(const BYTE *)&monitor->rc_monitor, sizeof(monitor->rc_monitor), 0))
goto done;
- /* RcWork */
- if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCWORK, DEVPROP_TYPE_BINARY,
- (const BYTE *)&monitor->rc_work, sizeof(monitor->rc_work), 0))
- goto done;
/* Adapter name */
sprintfW(bufferW, adapter_name_fmtW, video_index + 1);
+ size = (strlenW(bufferW) + 1) * sizeof(WCHAR);
if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, DEVPROP_TYPE_STRING,
- (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR), 0))
+ (const BYTE *)bufferW, size, 0))
goto done;
+ /* EnumDisplayMonitors() doesn't enumerate mirrored replicas and inactive monitors */
+ if (monitor_index == 0 && monitor->state_flags & DISPLAY_DEVICE_ACTIVE)
+ {
+ SERVER_START_REQ(create_monitor)
+ {
+ req->monitor_rect.top = monitor->rc_monitor.top;
+ req->monitor_rect.left = monitor->rc_monitor.left;
+ req->monitor_rect.right = monitor->rc_monitor.right;
+ req->monitor_rect.bottom = monitor->rc_monitor.bottom;
+ req->work_rect.top = monitor->rc_work.top;
+ req->work_rect.left = monitor->rc_work.left;
+ req->work_rect.right = monitor->rc_work.right;
+ req->work_rect.bottom = monitor->rc_work.bottom;
+ wine_server_add_data(req, bufferW, size);
+ if (wine_server_call(req))
+ goto done;
+ }
+ SERVER_END_REQ;
+ }
+
ret = TRUE;
done:
if (!ret)
@@ -645,7 +663,9 @@ static void prepare_devices(HKEY video_hkey)
{
static const BOOL not_present = FALSE;
SP_DEVINFO_DATA device_data = {sizeof(device_data)};
+ HMONITOR monitor = NULL;
HDEVINFO devinfo;
+ NTSTATUS status;
DWORD i = 0;
/* Remove all monitors */
@@ -657,6 +677,28 @@ static void prepare_devices(HKEY video_hkey)
}
SetupDiDestroyDeviceInfoList(devinfo);
+ while (TRUE)
+ {
+ SERVER_START_REQ(enum_monitor)
+ {
+ req->index = 0;
+ if (!(status = wine_server_call(req)))
+ monitor = wine_server_ptr_handle(reply->handle);
+ }
+ SERVER_END_REQ;
+
+ if (status)
+ break;
+
+ SERVER_START_REQ(destroy_monitor)
+ {
+ req->handle = wine_server_obj_handle(monitor);
+ if (wine_server_call(req))
+ ERR("Failed to remove monitor.\n");
+ }
+ SERVER_END_REQ;
+ }
+
/* Clean up old adapter keys for reinitialization */
RegDeleteTreeW(video_hkey, NULL);
diff --git a/server/Makefile.in b/server/Makefile.in
index e90c5d1336c..af6cbc2b6f8 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -10,6 +10,7 @@ C_SRCS = \
console.c \
debugger.c \
device.c \
+ display.c \
directory.c \
event.c \
fd.c \
diff --git a/server/display.c b/server/display.c
new file mode 100644
index 00000000000..ebaa9925253
--- /dev/null
+++ b/server/display.c
@@ -0,0 +1,192 @@
+/*
+ * Server-side display device management
+ *
+ * Copyright (C) 2020 Zhiyi Zhang for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdio.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winternl.h"
+
+#include "object.h"
+#include "handle.h"
+#include "request.h"
+#include "unicode.h"
+#include "user.h"
+
+static struct list monitor_list = LIST_INIT(monitor_list);
+
+static void monitor_dump( struct object *obj, int verbose );
+static void monitor_destroy( struct object *obj );
+
+static const struct object_ops monitor_ops =
+{
+ sizeof(struct monitor), /* size */
+ monitor_dump, /* dump */
+ no_get_type, /* get_type */
+ no_add_queue, /* add_queue */
+ NULL, /* remove_queue */
+ NULL, /* signaled */
+ NULL, /* satisfied */
+ no_signal, /* signal */
+ no_get_fd, /* get_fd */
+ no_map_access, /* map_access */
+ default_get_sd, /* get_sd */
+ default_set_sd, /* set_sd */
+ no_get_full_name, /* get_full_name */
+ no_lookup_name, /* lookup_name */
+ no_link_name, /* link_name */
+ default_unlink_name, /* unlink_name */
+ no_open_file, /* open_file */
+ no_kernel_obj_list, /* get_kernel_obj_list */
+ no_close_handle, /* close_handle */
+ monitor_destroy /* destroy */
+};
+
+/* create a monitor */
+static struct monitor *create_monitor( const rectangle_t *monitor_rect,
+ const rectangle_t *work_rect,
+ const struct unicode_str *adapter_name )
+{
+ struct monitor *monitor;
+ obj_handle_t handle;
+
+ if ((monitor = alloc_object( &monitor_ops )))
+ {
+ if (!(monitor->adapter_name = memdup( adapter_name->str, adapter_name->len )))
+ {
+ release_object( monitor );
+ return NULL;
+ }
+ monitor->adapter_name_len = adapter_name->len;
+
+ if (!(handle = alloc_handle( current->process, monitor, 0, 0 )))
+ {
+ release_object( monitor );
+ return NULL;
+ }
+
+ if (!(monitor->handle = duplicate_handle( current->process, handle, NULL, 0, 0,
+ DUP_HANDLE_MAKE_GLOBAL )))
+ {
+ close_handle( current->process, handle );
+ release_object( monitor );
+ return NULL;
+ }
+
+ monitor->monitor_rect = *monitor_rect;
+ monitor->work_rect = *work_rect;
+ release_object( monitor );
+ close_handle( current->process, handle );
+ list_add_tail( &monitor_list, &monitor->entry );
+ }
+ return monitor;
+}
+
+static void monitor_dump( struct object *obj, int verbose )
+{
+ struct monitor *monitor = (struct monitor *)obj;
+ assert( obj->ops == &monitor_ops );
+ fprintf( stderr, "Monitor handle=%#x ", monitor->handle);
+ fprintf( stderr, "monitor_rect=(%d, %d, %d, %d) ", monitor->monitor_rect.left,
+ monitor->monitor_rect.top, monitor->monitor_rect.right, monitor->monitor_rect.bottom );
+ fprintf( stderr, "work_rect=(%d, %d, %d, %d) ", monitor->work_rect.left, monitor->work_rect.top,
+ monitor->work_rect.right, monitor->work_rect.bottom );
+ fprintf( stderr, "adapter_name=\"");
+ dump_strW( monitor->adapter_name, monitor->adapter_name_len, stderr, "\"\"" );
+ fprintf( stderr, "\"\n" );
+}
+
+static void monitor_destroy( struct object *obj )
+{
+ struct monitor *monitor = (struct monitor *)obj;
+
+ if (monitor->adapter_name)
+ free( monitor->adapter_name );
+ list_remove( &monitor->entry );
+}
+
+/* create a monitor */
+DECL_HANDLER(create_monitor)
+{
+ struct unicode_str adapter_name;
+ struct monitor *monitor;
+
+ adapter_name = get_req_unicode_str();
+ if ((monitor = create_monitor( &req->monitor_rect, &req->work_rect, &adapter_name )))
+ {
+ reply->handle = monitor->handle;
+ clear_error();
+ }
+}
+
+/* get information about a monitor */
+DECL_HANDLER(get_monitor_info)
+{
+ struct monitor *monitor;
+ struct object *obj;
+
+ if (!(obj = get_handle_obj( current->process, req->handle, 0, &monitor_ops )))
+ return;
+
+ monitor = (struct monitor *)obj;
+ reply->monitor_rect = monitor->monitor_rect;
+ reply->work_rect = monitor->work_rect;
+ set_reply_data( monitor->adapter_name, min(monitor->adapter_name_len, get_reply_max_size()) );
+ release_object( monitor );
+ clear_error();
+ return;
+}
+
+/* enumerate monitors */
+DECL_HANDLER(enum_monitor)
+{
+ struct monitor *monitor;
+ unsigned int index = 0;
+
+ LIST_FOR_EACH_ENTRY( monitor, &monitor_list, struct monitor, entry )
+ {
+ if (req->index > index++)
+ continue;
+
+ reply->handle = monitor->handle;
+ reply->monitor_rect = monitor->monitor_rect;
+ clear_error();
+ return;
+ }
+ set_error( STATUS_NO_MORE_ENTRIES );
+}
+
+/* destroy a monitor */
+DECL_HANDLER(destroy_monitor)
+{
+ struct object *obj;
+
+ if ((obj = get_handle_obj( current->process, req->handle, 0, &monitor_ops )))
+ {
+ close_handle( current->process, req->handle );
+ release_object( obj );
+ clear_error();
+ }
+}
diff --git a/server/protocol.def b/server/protocol.def
index 846d2e15602..93b8e783f85 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2667,6 +2667,41 @@ enum coords_relative
#define SET_USER_OBJECT_GET_FULL_NAME 2
+/* Create a monitor */
+(a)REQ(create_monitor)
+ rectangle_t monitor_rect; /* monitor rectangle */
+ rectangle_t work_rect; /* monitor work area rectangle */
+ VARARG(adapter,unicode_str); /* adapter name */
+(a)REPLY
+ obj_handle_t handle; /* handle to the object */
+(a)END
+
+
+/* Get monitor information */
+(a)REQ(get_monitor_info)
+ obj_handle_t handle; /* handle to the object */
+(a)REPLY
+ rectangle_t monitor_rect; /* monitor rectangle */
+ rectangle_t work_rect; /* monitor work area rectangle */
+ VARARG(adapter,unicode_str); /* adapter name */
+(a)END
+
+
+/* Enumerate monitors */
+(a)REQ(enum_monitor)
+ unsigned int index; /* current index */
+(a)REPLY
+ obj_handle_t handle; /* handle to the object */
+ rectangle_t monitor_rect; /* monitor rectangle */
+(a)END
+
+
+/* Destroy a monitor */
+(a)REQ(destroy_monitor)
+ obj_handle_t handle; /* handle to the monitor */
+(a)END
+
+
/* Register a hotkey */
@REQ(register_hotkey)
user_handle_t window; /* handle to the window */
diff --git a/server/user.h b/server/user.h
index 6267f3e2881..f986dcc3d58 100644
--- a/server/user.h
+++ b/server/user.h
@@ -79,6 +79,17 @@ struct desktop
unsigned char keystate[256]; /* asynchronous key state */
};
+struct monitor
+{
+ struct object obj; /* object header */
+ obj_handle_t handle; /* object handle */
+ struct list entry; /* entry in global monitor list */
+ rectangle_t monitor_rect; /* monitor rectangle */
+ rectangle_t work_rect; /* monitor work area rectangle */
+ WCHAR *adapter_name; /* adapter name */
+ data_size_t adapter_name_len; /* adapter name length */
+};
+
/* user handles functions */
extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
--
2.27.0
2
1
Oct. 28, 2020
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/wrap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 046a7fd5423..75bbb2c05c5 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -886,7 +886,7 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
linespace = ME_GetParaLineSpace( c, para );
ME_BeginRow( &wc );
- run = &ME_FindItemFwd( para_get_di( para ), diRun )->member.run;
+ run = para_first_run( para );
while (run)
{
run = ME_WrapHandleRun( &wc, run );
--
2.23.0
1
0
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/undo.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index 72e3b74f4c8..d9c5d28d6dc 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -335,13 +335,11 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
case undo_set_para_fmt:
{
ME_Cursor tmp;
- ME_DisplayItem *para;
cursor_from_char_ofs( editor, undo->u.set_para_fmt.pos, &tmp );
- para = ME_FindItemBack(tmp.pRun, diParagraph);
- add_undo_set_para_fmt( editor, ¶->member.para );
- para->member.para.fmt = undo->u.set_para_fmt.fmt;
- para->member.para.border = undo->u.set_para_fmt.border;
- para_mark_rewrap( editor, ¶->member.para );
+ add_undo_set_para_fmt( editor, &tmp.pPara->member.para );
+ tmp.pPara->member.para.fmt = undo->u.set_para_fmt.fmt;
+ tmp.pPara->member.para.border = undo->u.set_para_fmt.border;
+ para_mark_rewrap( editor, &tmp.pPara->member.para );
break;
}
case undo_set_char_fmt:
--
2.23.0
1
0