[PATCH v2 2/4] shcore: Implement semi-stub for GetDpiForMonitor

Alex Henrie alexhenrie24 at gmail.com
Wed Jan 24 02:19:04 CST 2018


From: Sebastian Lackner <sebastian at fds-team.de>

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
Patch adapted from Wine Staging.

Fixes https://bugs.winehq.org/show_bug.cgi?id=44035

 .../api-ms-win-shcore-scaling-l1-1-1.spec                |  2 +-
 dlls/shcore/Makefile.in                                  |  1 +
 dlls/shcore/main.c                                       | 16 ++++++++++++++++
 dlls/shcore/shcore.spec                                  |  2 +-
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/api-ms-win-shcore-scaling-l1-1-1/api-ms-win-shcore-scaling-l1-1-1.spec b/dlls/api-ms-win-shcore-scaling-l1-1-1/api-ms-win-shcore-scaling-l1-1-1.spec
index 2c4ab9e27c..81b76eb45d 100644
--- a/dlls/api-ms-win-shcore-scaling-l1-1-1/api-ms-win-shcore-scaling-l1-1-1.spec
+++ b/dlls/api-ms-win-shcore-scaling-l1-1-1/api-ms-win-shcore-scaling-l1-1-1.spec
@@ -1,4 +1,4 @@
-@ stub GetDpiForMonitor
+@ stdcall GetDpiForMonitor(long long ptr ptr) shcore.GetDpiForMonitor
 @ stub GetProcessDpiAwareness
 @ stub GetScaleFactorForDevice
 @ stub GetScaleFactorForMonitor
diff --git a/dlls/shcore/Makefile.in b/dlls/shcore/Makefile.in
index ec2e95f526..0b172fc9a1 100644
--- a/dlls/shcore/Makefile.in
+++ b/dlls/shcore/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = shcore.dll
+IMPORTS   = gdi32 user32
 
 C_SRCS = \
 	main.c
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c
index 9075a38e1b..9073bd1238 100644
--- a/dlls/shcore/main.c
+++ b/dlls/shcore/main.c
@@ -21,6 +21,8 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
 #include "shellscalingapi.h"
 #include "wine/debug.h"
 
@@ -48,3 +50,17 @@ HRESULT WINAPI GetProcessDpiAwareness(HANDLE process, PROCESS_DPI_AWARENESS *val
     if (value) *value = PROCESS_DPI_UNAWARE;
     return S_OK;
 }
+
+HRESULT WINAPI GetDpiForMonitor(HMONITOR monitor, MONITOR_DPI_TYPE type, UINT *x, UINT *y)
+{
+    HDC hDC;
+
+    FIXME("(%p, %u, %p, %p): semi-stub\n", monitor, type, x, y);
+
+    hDC = GetDC(0);
+    if (x) *x = GetDeviceCaps(hDC, LOGPIXELSX);
+    if (y) *y = GetDeviceCaps(hDC, LOGPIXELSY);
+    ReleaseDC(0, hDC);
+
+    return S_OK;
+}
diff --git a/dlls/shcore/shcore.spec b/dlls/shcore/shcore.spec
index ae647a5598..2970fc00c5 100644
--- a/dlls/shcore/shcore.spec
+++ b/dlls/shcore/shcore.spec
@@ -6,7 +6,7 @@
 @ stub DllGetActivationFactory
 @ stdcall -private DllGetClassObject(ptr ptr ptr) shell32.DllGetClassObject
 @ stdcall GetCurrentProcessExplicitAppUserModelID(ptr) shell32.GetCurrentProcessExplicitAppUserModelID
-@ stub GetDpiForMonitor
+@ stdcall GetDpiForMonitor(long long ptr ptr)
 @ stub GetDpiForShellUIComponent
 @ stdcall GetProcessDpiAwareness(long ptr)
 @ stub GetProcessReference
-- 
2.16.1




More information about the wine-devel mailing list