[PATCH v2 1/3] user32: Move EnumDisplayDevicesW stub to nulldrv.

Zhiyi Zhang zzhang at codeweavers.com
Wed Mar 6 01:04:18 CST 2019


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/user32/driver.c       | 37 +++++++++++++++++++++++++++++++++++++
 dlls/user32/misc.c         | 26 +-------------------------
 dlls/user32/user_private.h |  1 +
 3 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 5b2929245c..483d5552bf 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -125,6 +125,7 @@ static const USER_DRIVER *load_driver(void)
         GET_USER_FUNC(ClipCursor);
         GET_USER_FUNC(UpdateClipboard);
         GET_USER_FUNC(ChangeDisplaySettingsEx);
+        GET_USER_FUNC(EnumDisplayDevicesW);
         GET_USER_FUNC(EnumDisplayMonitors);
         GET_USER_FUNC(EnumDisplaySettingsEx);
         GET_USER_FUNC(GetMonitorInfo);
@@ -354,6 +355,35 @@ static LONG CDECL nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode
     return DISP_CHANGE_FAILED;
 }
 
+static BOOL CDECL nulldrv_EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags )
+{
+    static const WCHAR primary_device_name[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
+    static const WCHAR primary_device_string[] = {'X','1','1',' ','W','i','n','d','o','w','i','n','g',' ',
+                                                  'S','y','s','t','e','m',0};
+    static const WCHAR primary_device_deviceid[] = {'P','C','I','\\','V','E','N','_','0','0','0','0','&',
+                                                    'D','E','V','_','0','0','0','0',0};
+
+    FIXME("(%s,%d,%p,0x%08x), stub!\n", debugstr_w(lpDevice), i, lpDisplayDevice, dwFlags);
+
+    if (i)
+        return FALSE;
+
+    memcpy(lpDisplayDevice->DeviceName, primary_device_name, sizeof(primary_device_name));
+    memcpy(lpDisplayDevice->DeviceString, primary_device_string, sizeof(primary_device_string));
+
+    lpDisplayDevice->StateFlags =
+        DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
+        DISPLAY_DEVICE_PRIMARY_DEVICE |
+        DISPLAY_DEVICE_VGA_COMPATIBLE;
+
+    if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(lpDisplayDevice->DeviceID))
+        memcpy(lpDisplayDevice->DeviceID, primary_device_deviceid, sizeof(primary_device_deviceid));
+    if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(lpDisplayDevice->DeviceKey))
+        lpDisplayDevice->DeviceKey[0] = 0;
+
+    return TRUE;
+}
+
 static BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
 {
     RECT r = {0, 0, 640, 480};
@@ -549,6 +579,7 @@ static USER_DRIVER null_driver =
     nulldrv_UpdateClipboard,
     /* display modes */
     nulldrv_ChangeDisplaySettingsEx,
+    nulldrv_EnumDisplayDevicesW,
     nulldrv_EnumDisplayMonitors,
     nulldrv_EnumDisplaySettingsEx,
     nulldrv_GetMonitorInfo,
@@ -691,6 +722,11 @@ static LONG CDECL loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mo
     return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
 }
 
+static BOOL CDECL loaderdrv_EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags )
+{
+    return load_driver()->pEnumDisplayDevicesW( lpDevice, i, lpDisplayDevice, dwFlags );
+}
+
 static BOOL CDECL loaderdrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
 {
     return load_driver()->pEnumDisplayMonitors( hdc, rect, proc, lp );
@@ -770,6 +806,7 @@ static USER_DRIVER lazy_load_driver =
     loaderdrv_UpdateClipboard,
     /* display modes */
     loaderdrv_ChangeDisplaySettingsEx,
+    loaderdrv_EnumDisplayDevicesW,
     loaderdrv_EnumDisplayMonitors,
     loaderdrv_EnumDisplaySettingsEx,
     loaderdrv_GetMonitorInfo,
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index d28cd9fd05..1a45e1c882 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -243,12 +243,6 @@ DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd)
     return 1;
 }
 
-static const WCHAR primary_device_name[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
-static const WCHAR primary_device_string[] = {'X','1','1',' ','W','i','n','d','o','w','i','n','g',' ',
-                                              'S','y','s','t','e','m',0};
-static const WCHAR primary_device_deviceid[] = {'P','C','I','\\','V','E','N','_','0','0','0','0','&',
-                                                'D','E','V','_','0','0','0','0',0};
-
 /***********************************************************************
  *		EnumDisplayDevicesA (USER32.@)
  */
@@ -288,25 +282,7 @@ BOOL WINAPI EnumDisplayDevicesA( LPCSTR lpDevice, DWORD i, LPDISPLAY_DEVICEA lpD
 BOOL WINAPI EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD i, LPDISPLAY_DEVICEW lpDisplayDevice,
                                  DWORD dwFlags )
 {
-    FIXME("(%s,%d,%p,0x%08x), stub!\n",debugstr_w(lpDevice),i,lpDisplayDevice,dwFlags);
-
-    if (i)
-        return FALSE;
-
-    memcpy(lpDisplayDevice->DeviceName, primary_device_name, sizeof(primary_device_name));
-    memcpy(lpDisplayDevice->DeviceString, primary_device_string, sizeof(primary_device_string));
-  
-    lpDisplayDevice->StateFlags =
-        DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
-        DISPLAY_DEVICE_PRIMARY_DEVICE |
-        DISPLAY_DEVICE_VGA_COMPATIBLE;
-
-    if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(lpDisplayDevice->DeviceID))
-        memcpy(lpDisplayDevice->DeviceID, primary_device_deviceid, sizeof(primary_device_deviceid));
-    if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(lpDisplayDevice->DeviceKey))
-        lpDisplayDevice->DeviceKey[0] = 0;
-
-    return TRUE;
+    return USER_Driver->pEnumDisplayDevicesW(lpDevice, i, lpDisplayDevice, dwFlags);
 }
 
 /***********************************************************************
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 514cf6753f..51b60a4b5c 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -86,6 +86,7 @@ typedef struct tagUSER_DRIVER {
     void   (CDECL *pUpdateClipboard)(void);
     /* display modes */
     LONG   (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
+    BOOL   (CDECL *pEnumDisplayDevicesW)(LPCWSTR,DWORD,LPDISPLAY_DEVICEW,DWORD);
     BOOL   (CDECL *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
     BOOL   (CDECL *pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
     BOOL   (CDECL *pGetMonitorInfo)(HMONITOR,MONITORINFO*);
-- 
2.20.1





More information about the wine-devel mailing list