From: Ken Thomases Subject: [PATCH 4/6] winemac: Make GetMonitorInfo() give a different device name (\\.\DISPLAY) to each monitor. Message-Id: <69B94E27-B950-4CA3-8468-601112123FB1@codeweavers.com> Date: Thu, 27 Mar 2014 18:18:46 -0500 --- dlls/winemac.drv/display.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 6c79299..4484edf 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -25,6 +25,7 @@ #include "winuser.h" #include "winreg.h" #include "ddrawi.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(display); @@ -795,7 +796,7 @@ done: */ BOOL CDECL macdrv_GetMonitorInfo(HMONITOR monitor, LPMONITORINFO info) { - static const WCHAR adapter_name[] = { '\\','\\','.','\\','D','I','S','P','L','A','Y','1',0 }; + static const WCHAR adapter_name[] = { '\\','\\','.','\\','D','I','S','P','L','A','Y','%','d',0 }; struct macdrv_display *displays; int num_displays; CGDirectDisplayID display_id; @@ -825,10 +826,12 @@ BOOL CDECL macdrv_GetMonitorInfo(HMONITOR monitor, LPMONITORINFO info) info->dwFlags = (i == 0) ? MONITORINFOF_PRIMARY : 0; if (info->cbSize >= sizeof(MONITORINFOEXW)) - lstrcpyW(((MONITORINFOEXW*)info)->szDevice, adapter_name); + snprintfW(((MONITORINFOEXW*)info)->szDevice, sizeof(((MONITORINFOEXW*)info)->szDevice) / sizeof(WCHAR), + adapter_name, i + 1); - TRACE(" -> rcMonitor %s rcWork %s dwFlags %08x\n", wine_dbgstr_rect(&info->rcMonitor), - wine_dbgstr_rect(&info->rcWork), info->dwFlags); + TRACE(" -> rcMonitor %s rcWork %s dwFlags %08x szDevice %s\n", wine_dbgstr_rect(&info->rcMonitor), + wine_dbgstr_rect(&info->rcWork), info->dwFlags, + info->cbSize >= sizeof(MONITORINFOEXW) ? debugstr_w(((MONITORINFOEXW*)info)->szDevice) : "n/a"); } else {