Improve GetSystemMetrics.

This commit is contained in:
Michael Müller 2014-08-02 05:37:29 +02:00
parent 1ff09d87c5
commit 281bf873aa
4 changed files with 114 additions and 0 deletions

View File

@ -26,6 +26,7 @@ Wine-Compholio contains fixes for the following Wine bugs:
* GetSecurityInfo returns NULL DACL for process object ([Wine Bug #15980](http://bugs.winehq.org/show_bug.cgi?id=15980 "Rhapsody 2 crashes on startup (GetSecurityInfo returns NULL DACL for process object)"))
* Implement a Microsoft Yahei replacement font ([Wine Bug #13829](http://bugs.winehq.org/show_bug.cgi?id=13829 "Wine does not have CJK fonts"))
* Implement an Arial replacement font ([Wine Bug #32323](http://bugs.winehq.org/show_bug.cgi?id=32323 "Netflix (Silverlight 4.x) and several .NET Framework 3.x/4.0 WPF apps require either Arial or Verdana to be installed"))
* Make it possible to change media center / tablet pc status ([Wine Bug #18732](http://bugs.winehq.org/show_bug.cgi?id=18732 "Microsoft Experience Pack for Tablet PC 1 refuses to install"))
* Need for Speed 3 installer requires devices in HKEY_DYN_DATA ([Wine Bug #7115](http://bugs.winehq.org/show_bug.cgi?id=7115 "Need for Speed III installer fails in Win9X mode, reporting \"Could not get 'HardWareKey' value\" (active PnP device keys in 'HKEY_DYN_DATA\\\\Config Manager\\\\Enum' missing)"))
* Old games cannot locate software-only renderer ([Wine Bug #32581](http://bugs.winehq.org/show_bug.cgi?id=32581 "Invalid dwFlags of reference rasterizer's HAL D3DDEVICEDESC"))
* Return correct IMediaSeeking stream positions in quartz ([Wine Bug #23174](http://bugs.winehq.org/show_bug.cgi?id=23174 "Fallout 3: Diologue and Video/sound issues"))

View File

@ -32,6 +32,7 @@ PATCHLIST := Miscellaneous.ok \
shell32-SHCreateSessionKey.ok \
shlwapi-UrlCombine.ok \
strmbase-Lock_Race_Conditions.ok \
user32-GetSystemMetrics.ok \
user32-GetTipText.ok \
wineboot-HKEY_DYN_DATA.ok \
winepulse-PulseAudio_Support.ok \
@ -580,6 +581,24 @@ strmbase-Lock_Race_Conditions.ok:
echo '+ { "strmbase-Lock_Race_Conditions", "Erich E. Hoover", "Fix possible race conditions in strmbase/quartz." },'; \
) > strmbase-Lock_Race_Conditions.ok
# Patchset user32-GetSystemMetrics
# |
# | Included patches:
# | * Allow changing the tablet / media center status via wine registry key. [by Michael Müller]
# |
# | This patchset fixes the following Wine bugs:
# | * [#18732] Microsoft Experience Pack for Tablet PC 1 refuses to install
# |
# | Modified files:
# | * dlls/user32/sysparams.c
# |
.INTERMEDIATE: user32-GetSystemMetrics.ok
user32-GetSystemMetrics.ok:
$(PATCH) < user32-GetSystemMetrics/0001-user32-Allow-changing-the-tablet-media-center-status.patch
@( \
echo '+ { "user32-GetSystemMetrics", "Michael Müller", "Allow changing the tablet / media center status via wine registry key." },'; \
) > user32-GetSystemMetrics.ok
# Patchset user32-GetTipText
# |
# | Included patches:

View File

@ -0,0 +1,90 @@
From 9dadbe379e5ff4d5806f95c23579cc4ec65109ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Aug 2014 05:24:51 +0200
Subject: user32: Allow changing the tablet / media center status via wine
registry key.
---
dlls/user32/sysparams.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 9944119..2569ef3 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -2343,6 +2343,49 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
return ret;
}
+/******************************************************************************
+ * Get the default and the app-specific config keys.
+ */
+BOOL get_app_key(HKEY *defkey, HKEY *appkey)
+{
+ char buffer[MAX_PATH+16];
+ DWORD len;
+
+ *appkey = 0;
+
+ /* @@ Wine registry key: HKCU\Software\Wine\System */
+ if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\System", defkey))
+ *defkey = 0;
+
+ len = GetModuleFileNameA(0, buffer, MAX_PATH);
+ if (len && len < MAX_PATH)
+ {
+ HKEY tmpkey;
+
+ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\System */
+ if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey))
+ {
+ char *p, *appname = buffer;
+ if ((p = strrchr(appname, '/'))) appname = p + 1;
+ if ((p = strrchr(appname, '\\'))) appname = p + 1;
+ strcat(appname, "\\System");
+
+ if (RegOpenKeyA(tmpkey, appname, appkey)) *appkey = 0;
+ RegCloseKey(tmpkey);
+ }
+ }
+
+ return *defkey || *appkey;
+}
+
+static DWORD get_config_key_dword(HKEY defkey, HKEY appkey, const char *name, DWORD *data)
+{
+ DWORD type;
+ DWORD size = sizeof(DWORD);
+ if (appkey && !RegQueryValueExA(appkey, name, 0, &type, (BYTE *)data, &size) && (type == REG_DWORD)) return 0;
+ if (defkey && !RegQueryValueExA(defkey, name, 0, &type, (BYTE *)data, &size) && (type == REG_DWORD)) return 0;
+ return ERROR_FILE_NOT_FOUND;
+}
/***********************************************************************
* GetSystemMetrics (USER32.@)
@@ -2570,7 +2613,21 @@ INT WINAPI GetSystemMetrics( INT index )
return 1;
case SM_TABLETPC:
case SM_MEDIACENTER:
- return 0;
+ {
+ const char *name = (index == SM_TABLETPC) ? "TabletPC" : "MediaCenter";
+ HKEY defkey, appkey;
+ DWORD value;
+
+ if (!get_app_key(&defkey, &appkey))
+ return 0;
+
+ if (get_config_key_dword(defkey, appkey, name, &value))
+ value = 0;
+
+ if (appkey) RegCloseKey( appkey );
+ if (defkey) RegCloseKey( defkey );
+ return value;
+ }
case SM_CMETRICS:
return SM_CMETRICS;
default:
--
1.8.3.2

View File

@ -0,0 +1,4 @@
Author: Michael Müller
Subject: Allow changing the tablet / media center status via wine registry key.
Revision: 1
Fixes: [18732] Make it possible to change media center / tablet pc status