Nikolay Sivov : user32: Added a GetDisplayConfigBufferSizes stub.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 26 09:58:33 CDT 2015


Module: wine
Branch: master
Commit: 8b353f5409c205d4643ece3a42fcd9aa47460566
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8b353f5409c205d4643ece3a42fcd9aa47460566

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Oct 23 21:40:50 2015 +0300

user32: Added a GetDisplayConfigBufferSizes stub.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/misc.c          | 14 ++++++++++++
 dlls/user32/tests/monitor.c | 55 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/user32/user32.spec     |  1 +
 include/wingdi.h            |  5 +++++
 include/winuser.h           |  1 +
 5 files changed, 76 insertions(+)

diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index d2b4b73..33016a1 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -757,6 +757,20 @@ BOOL WINAPI IsWindowRedirectedForPrint( HWND hwnd )
     return FALSE;
 }
 
+/**********************************************************************
+ * GetDisplayConfigBufferSizes [USER32.@]
+ */
+LONG WINAPI GetDisplayConfigBufferSizes(UINT32 flags, UINT32 *num_path_info, UINT32 *num_mode_info)
+{
+    FIXME("(0x%x %p %p): stub\n", flags, num_path_info, num_mode_info);
+
+    if (!num_path_info || !num_mode_info)
+        return ERROR_INVALID_PARAMETER;
+
+    *num_path_info = 0;
+    *num_mode_info = 0;
+    return ERROR_NOT_SUPPORTED;
+}
 
 static const WCHAR imeW[] = {'I','M','E',0};
 const struct builtin_class_descr IME_builtin_class =
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 42ae883..864eb85 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -34,6 +34,7 @@ static BOOL (WINAPI *pGetMonitorInfoW)(HMONITOR,LPMONITORINFO);
 static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
 static HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT,DWORD);
 static HMONITOR (WINAPI *pMonitorFromWindow)(HWND,DWORD);
+static LONG (WINAPI *pGetDisplayConfigBufferSizes)(UINT32,UINT32*,UINT32*);
 
 static void init_function_pointers(void)
 {
@@ -48,6 +49,7 @@ static void init_function_pointers(void)
     GET_PROC(ChangeDisplaySettingsExW)
     GET_PROC(EnumDisplayDevicesA)
     GET_PROC(EnumDisplayMonitors)
+    GET_PROC(GetDisplayConfigBufferSizes)
     GET_PROC(GetMonitorInfoA)
     GET_PROC(GetMonitorInfoW)
     GET_PROC(MonitorFromPoint)
@@ -543,6 +545,58 @@ static void test_work_area(void)
     DestroyWindow(hwnd);
 }
 
+static void test_display_config(void)
+{
+    UINT32 paths, modes;
+    LONG ret;
+
+    if (!pGetDisplayConfigBufferSizes)
+    {
+        win_skip("GetDisplayConfigBufferSizes is not supported\n");
+        return;
+    }
+
+    ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, NULL, NULL);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+
+    paths = 100;
+    ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, &paths, NULL);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(paths == 100, "got %u\n", paths);
+
+    modes = 100;
+    ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, NULL, &modes);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(modes == 100, "got %u\n", modes);
+
+    paths = modes = 0;
+    ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, &paths, &modes);
+    if (!ret)
+        ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
+    else
+        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+
+    /* Invalid flags, non-zero invalid flags validation is version (or driver?) dependent,
+       it's unreliable to use in tests. */
+    ret = pGetDisplayConfigBufferSizes(0, NULL, NULL);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+
+    paths = 100;
+    ret = pGetDisplayConfigBufferSizes(0, &paths, NULL);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(paths == 100, "got %u\n", paths);
+
+    modes = 100;
+    ret = pGetDisplayConfigBufferSizes(0, NULL, &modes);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(modes == 100, "got %u\n", modes);
+
+    paths = modes = 100;
+    ret = pGetDisplayConfigBufferSizes(0, &paths, &modes);
+    ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(modes == 0 && paths == 0, "got %u, %u\n", modes, paths);
+}
+
 START_TEST(monitor)
 {
     init_function_pointers();
@@ -550,4 +604,5 @@ START_TEST(monitor)
     test_ChangeDisplaySettingsEx();
     test_monitors();
     test_work_area();
+    test_display_config();
 }
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index f0e541f..9b409df 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -281,6 +281,7 @@
 @ stdcall GetDCEx(long long long)
 @ stdcall GetDesktopWindow()
 @ stdcall GetDialogBaseUnits()
+@ stdcall GetDisplayConfigBufferSizes(long ptr ptr)
 @ stdcall GetDlgCtrlID(long)
 @ stdcall GetDlgItem(long long)
 @ stdcall GetDlgItemInt(long long ptr long)
diff --git a/include/wingdi.h b/include/wingdi.h
index e860f2c..f6fd6fe 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -3306,6 +3306,11 @@ DECL_WINELIB_TYPE_AW(LPDISPLAY_DEVICE)
 #define	DISPLAY_DEVICE_MIRRORING_DRIVER		0x00000008
 #define	DISPLAY_DEVICE_VGA_COMPATIBLE		0x00000010
 
+/* For GetDisplayConfigBufferSizes */
+#define QDC_ALL_PATHS                           0x00000001
+#define QDC_ONLY_ACTIVE_PATHS                   0x00000002
+#define QDC_DATABASE_CURRENT                    0x00000004
+
 #define GDI_ERROR                               (~0u)
 #define HGDI_ERROR                              ((HANDLE)~(ULONG_PTR)0)
 
diff --git a/include/winuser.h b/include/winuser.h
index 06ca054..1d3759a 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -3267,6 +3267,7 @@ WINUSERAPI BOOL        WINAPI EnumDisplaySettingsW(LPCWSTR,DWORD,LPDEVMODEW);
 WINUSERAPI BOOL        WINAPI EnumDisplaySettingsExA(LPCSTR,DWORD,LPDEVMODEA,DWORD);
 WINUSERAPI BOOL        WINAPI EnumDisplaySettingsExW(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
 #define                       EnumDisplaySettingsEx WINELIB_NAME_AW(EnumDisplaySettingsEx)
+WINUSERAPI LONG        WINAPI GetDisplayConfigBufferSizes(UINT32,UINT32*,UINT32*);
 WINUSERAPI BOOL        WINAPI UpdateLayeredWindow(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
 WINUSERAPI BOOL        WINAPI UpdateLayeredWindowIndirect(HWND,UPDATELAYEREDWINDOWINFO const*);
 #endif /* defined(_WINGDI_) && !defined(NOGDI) */




More information about the wine-cvs mailing list