Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- include/wingdi.h | 112 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+)
diff --git a/include/wingdi.h b/include/wingdi.h index 0a456f8230..de028f5212 100644 --- a/include/wingdi.h +++ b/include/wingdi.h @@ -3293,6 +3293,9 @@ typedef enum { DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6, DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION = 7, DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION = 8, + DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO = 9, + DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE = 10, + DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL = 11, DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xffffffff } DISPLAYCONFIG_DEVICE_INFO_TYPE;
@@ -3429,6 +3432,16 @@ typedef enum DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32 = (int) 0xffffffff } DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY;
+typedef enum +{ + DISPLAYCONFIG_COLOR_ENCODING_RGB = 0, + DISPLAYCONFIG_COLOR_ENCODING_YCBCR444 = 1, + DISPLAYCONFIG_COLOR_ENCODING_YCBCR422 = 2, + DISPLAYCONFIG_COLOR_ENCODING_YCBCR420 = 3, + DISPLAYCONFIG_COLOR_ENCODING_INTENSITY = 4, + DISPLAYCONFIG_COLOR_ENCODING_FORCE_UINT32 = 0xffffffff +} DISPLAYCONFIG_COLOR_ENCODING; + typedef struct DISPLAYCONFIG_2DREGION { UINT32 cx; @@ -3525,6 +3538,105 @@ typedef struct DISPLAYCONFIG_MODE_INFO } DUMMYUNIONNAME; } DISPLAYCONFIG_MODE_INFO;
+typedef struct DISPLAYCONFIG_SOURCE_DEVICE_NAME { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + WCHAR viewGdiDeviceName[CCHDEVICENAME]; +} DISPLAYCONFIG_SOURCE_DEVICE_NAME; + +typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS { + union { + struct { + UINT32 friendlyNameFromEdid :1; + UINT32 friendlyNameForced :1; + UINT32 edidIdsValid :1; + UINT32 reserved :29; + } DUMMYSTRUCTNAME; + UINT32 value; + } DUMMYUNIONNAME; +} DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS; + +typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS flags; + DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY outputTechnology; + UINT16 edidManufactureId; + UINT16 edidProductCodeId; + UINT32 connectorInstance; + WCHAR monitorFriendlyDeviceName[64]; + WCHAR monitorDevicePath[128]; +} DISPLAYCONFIG_TARGET_DEVICE_NAME; + +typedef struct DISPLAYCONFIG_TARGET_PREFERRED_MODE { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + UINT32 width; + UINT32 height; + DISPLAYCONFIG_TARGET_MODE targetMode; +} DISPLAYCONFIG_TARGET_PREFERRED_MODE; + +typedef struct DISPLAYCONFIG_ADAPTER_NAME { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + WCHAR adapterDevicePath[128]; +} DISPLAYCONFIG_ADAPTER_NAME; + +typedef struct DISPLAYCONFIG_SET_TARGET_PERSISTENCE { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + union { + struct { + UINT32 bootPersistenceOn :1; + UINT32 reserved :31; + } DUMMYSTRUCTNAME; + UINT32 value; + } DUMMYUNIONNAME; +} DISPLAYCONFIG_SET_TARGET_PERSISTENCE; + +typedef struct DISPLAYCONFIG_TARGET_BASE_TYPE { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY baseOutputTechnology; +} DISPLAYCONFIG_TARGET_BASE_TYPE; + +typedef struct DISPLAYCONFIG_SUPPORT_VIRTUAL_RESOLUTION { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + union { + struct { + UINT32 disableMonitorVirtualResolution :1; + UINT32 reserved :31; + } DUMMYSTRUCTNAME; + UINT32 value; + } DUMMYUNIONNAME; +} DISPLAYCONFIG_SUPPORT_VIRTUAL_RESOLUTION; + +typedef struct DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + union { + struct { + UINT32 advancedColorSupported :1; + UINT32 advancedColorEnabled :1; + UINT32 wideColorEnforced :1; + UINT32 advancedColorForceDisabled :1; + UINT32 reserved :28; + } DUMMYSTRUCTNAME; + UINT32 value; + } DUMMYUNIONNAME; + DISPLAYCONFIG_COLOR_ENCODING colorEncoding; + UINT32 bitsPerColorChannel; +} DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO; + +typedef struct DISPLAYCONFIG_SET_ADVANCED_COLOR_STATE { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + union { + struct { + UINT32 enableAdvancedColor :1; + UINT32 reserved :31; + } DUMMYSTRUCTNAME; + UINT32 value; + } DUMMYUNIONNAME; +} DISPLAYCONFIG_SET_ADVANCED_COLOR_STATE; + +typedef struct DISPLAYCONFIG_SDR_WHITE_LEVEL { + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + ULONG SDRWhiteLevel; +} DISPLAYCONFIG_SDR_WHITE_LEVEL; + /* For GetDisplayConfigBufferSizes */ #define QDC_ALL_PATHS 0x00000001 #define QDC_ONLY_ACTIVE_PATHS 0x00000002
Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/user32/misc.c | 26 ------------------------ dlls/user32/sysparams.c | 44 ++++++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c index bed5812a47..6e1f60612b 100644 --- a/dlls/user32/misc.c +++ b/dlls/user32/misc.c @@ -240,17 +240,6 @@ DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd) return 1; }
-/*********************************************************************** - * QueryDisplayConfig (USER32.@) - */ -LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCONFIG_PATH_INFO *pathinfo, - UINT32 *numinfoelements, DISPLAYCONFIG_MODE_INFO *modeinfo, - DISPLAYCONFIG_TOPOLOGY_ID *topologyid) -{ - FIXME("(%08x %p %p %p %p %p)\n", flags, numpathelements, pathinfo, numinfoelements, modeinfo, topologyid); - return ERROR_CALL_NOT_IMPLEMENTED; -} - /*********************************************************************** * RegisterSystemThread (USER32.@) */ @@ -545,21 +534,6 @@ 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; -} - /********************************************************************** * RegisterPointerDeviceNotifications [USER32.@] */ diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index ab386a074e..a3071912f8 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -3345,15 +3345,6 @@ LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND }
-/*********************************************************************** - * DisplayConfigGetDeviceInfo (USER32.@) - */ -LONG WINAPI DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet) -{ - FIXME("stub: %p\n", packet); - return ERROR_NOT_SUPPORTED; -} - /*********************************************************************** * EnumDisplaySettingsW (USER32.@) * @@ -4488,3 +4479,38 @@ BOOL WINAPI PhysicalToLogicalPoint( HWND hwnd, POINT *point ) { return TRUE; } + +/********************************************************************** + * 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; +} + +/*********************************************************************** + * QueryDisplayConfig (USER32.@) + */ +LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCONFIG_PATH_INFO *pathinfo, + UINT32 *numinfoelements, DISPLAYCONFIG_MODE_INFO *modeinfo, + DISPLAYCONFIG_TOPOLOGY_ID *topologyid) +{ + FIXME("(%08x %p %p %p %p %p)\n", flags, numpathelements, pathinfo, numinfoelements, modeinfo, topologyid); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/*********************************************************************** + * DisplayConfigGetDeviceInfo (USER32.@) + */ +LONG WINAPI DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet) +{ + FIXME("stub: %p\n", packet); + return ERROR_NOT_SUPPORTED; +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71149
Your paranoid android.
=== debiant (32 bit WoW report) ===
user32: win.c:10139: Test failed: Expected foreground window 000D0120, got 00E300D4 win.c:10141: Test failed: GetActiveWindow() = 00000000 win.c:10141: Test failed: GetFocus() = 00000000 win.c:10142: Test failed: Received WM_ACTIVATEAPP(1), did not expect it. win.c:10143: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10151: Test failed: Expected foreground window 000D0120, got 00000000 win.c:10153: Test failed: GetActiveWindow() = 00000000 win.c:10153: Test failed: GetFocus() = 00000000 win.c:10158: Test failed: Expected foreground window 000D0120, got 00E300D4 win.c:10161: Test failed: Received WM_ACTIVATEAPP(1), did not expect it. win.c:10173: Test failed: GetActiveWindow() = 000D0120 win.c:10173: Test failed: GetFocus() = 000D0120 win.c:10184: Test failed: Expected WM_ACTIVATEAPP(1), did not receive it. win.c:10185: Test succeeded inside todo block: Expected WM_ACTIVATEAPP(0), did not receive it.
Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/user32/tests/monitor.c | 181 ++++++++++++++++++++++++++++++++++-- 1 file changed, 174 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index e669b2b82e..a986879293 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -29,6 +29,9 @@
static HMODULE hdll; static LONG (WINAPI *pGetDisplayConfigBufferSizes)(UINT32,UINT32*,UINT32*); +static LONG (WINAPI *pQueryDisplayConfig)(UINT32,UINT32*,DISPLAYCONFIG_PATH_INFO*,UINT32*, + DISPLAYCONFIG_MODE_INFO*,DISPLAYCONFIG_TOPOLOGY_ID*); +static LONG (WINAPI *pDisplayConfigGetDeviceInfo)(DISPLAYCONFIG_DEVICE_INFO_HEADER*); static DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
static void init_function_pointers(void) @@ -41,6 +44,8 @@ static void init_function_pointers(void) trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(GetDisplayConfigBufferSizes) + GET_PROC(QueryDisplayConfig) + GET_PROC(DisplayConfigGetDeviceInfo) GET_PROC(SetThreadDpiAwarenessContext)
#undef GET_PROC @@ -1096,17 +1101,11 @@ static void test_work_area(void) DestroyWindow(hwnd); }
-static void test_display_config(void) +static void test_get_display_config_buffer_sizes(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);
@@ -1148,6 +1147,174 @@ static void test_display_config(void) ok((modes == 0 || modes == 100) && paths == 0, "got %u, %u\n", modes, paths); }
+static void test_query_display_config(void) +{ + UINT32 paths, modes; + DISPLAYCONFIG_PATH_INFO pi[10]; + DISPLAYCONFIG_MODE_INFO mi[20]; + LONG ret; + + todo_wine + { + ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, NULL, NULL, NULL, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + paths = modes = 0; + ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, NULL, &modes, NULL, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + paths = modes = 0; + ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, NULL, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + paths = modes = 0; + ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, NULL, &modes, mi, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + paths = modes = 0; + ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + paths = 0; + modes = 1; + ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + ok (paths == 0, "got %u\n", paths); + ok (modes == 1, "got %u\n", modes); + + /* Crashes on Windows 10 */ + if (0) + { + ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, pi, NULL, mi, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, pi, &modes, mi, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + } + + paths = modes = 1; + ret = pQueryDisplayConfig(0, &paths, pi, &modes, mi, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + paths = modes = 1; + memset(pi, 0xFF, sizeof(pi[0])); + memset(mi, 0xFF, sizeof(mi[0])); + ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL); + ok(ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret); + ok (paths == 1, "got %u\n", paths); + ok (modes == 1, "got %u\n", modes); + } +} + +static void test_display_config_get_device_info(void) +{ + LONG ret; + DISPLAYCONFIG_SOURCE_DEVICE_NAME source_name; + DISPLAYCONFIG_TARGET_DEVICE_NAME target_name; + DISPLAYCONFIG_TARGET_PREFERRED_MODE preferred_mode; + DISPLAYCONFIG_ADAPTER_NAME adapter_name; + + todo_wine + { + ret = pDisplayConfigGetDeviceInfo(NULL); + ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret); + + source_name.header.type = 0xFFFF; + source_name.header.size = 0; + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret); + + source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; + source_name.header.size = 0; + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret); + + source_name.header.type = 0xFFFF; + source_name.header.size = sizeof(source_name.header); + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; + source_name.header.size = sizeof(source_name.header); + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + source_name.header.type = 0xFFFF; + source_name.header.size = sizeof(source_name); + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; + source_name.header.size = sizeof(source_name) - 1; + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + } + + source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; + source_name.header.size = sizeof(source_name); + source_name.header.adapterId.LowPart = 0xFFFF; + source_name.header.adapterId.HighPart = 0xFFFF; + source_name.header.id = 0; + ret = pDisplayConfigGetDeviceInfo(&source_name.header); + ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret); + + target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; + target_name.header.size = sizeof(target_name) - 1; + ret = pDisplayConfigGetDeviceInfo(&target_name.header); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; + target_name.header.size = sizeof(target_name); + target_name.header.adapterId.LowPart = 0xFFFF; + target_name.header.adapterId.HighPart = 0xFFFF; + target_name.header.id = 0; + ret = pDisplayConfigGetDeviceInfo(&target_name.header); + ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret); + + preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE; + preferred_mode.header.size = sizeof(preferred_mode) - 1; + ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE; + preferred_mode.header.size = sizeof(preferred_mode); + preferred_mode.header.adapterId.LowPart = 0xFFFF; + preferred_mode.header.adapterId.HighPart = 0xFFFF; + preferred_mode.header.id = 0; + ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header); + ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret); + + adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME; + adapter_name.header.size = sizeof(adapter_name) - 1; + ret = pDisplayConfigGetDeviceInfo(&adapter_name.header); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); + + adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME; + adapter_name.header.size = sizeof(adapter_name); + adapter_name.header.adapterId.LowPart = 0xFFFF; + adapter_name.header.adapterId.HighPart = 0xFFFF; + ret = pDisplayConfigGetDeviceInfo(&adapter_name.header); + ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret); +} + +static void test_display_config(void) +{ + if (!pGetDisplayConfigBufferSizes || + !pQueryDisplayConfig || + !pDisplayConfigGetDeviceInfo) + { + win_skip("DisplayConfig APIs are not supported\n"); + return; + } + + test_get_display_config_buffer_sizes(); + test_query_display_config(); + test_display_config_get_device_info(); +} + START_TEST(monitor) { init_function_pointers();
On 5/5/20 9:08 AM, Brendan Shanks wrote:
Signed-off-by: Brendan Shanks bshanks@codeweavers.com
dlls/user32/tests/monitor.c | 181 ++++++++++++++++++++++++++++++++++-- 1 file changed, 174 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index e669b2b82e..a986879293 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -29,6 +29,9 @@
static HMODULE hdll; static LONG (WINAPI *pGetDisplayConfigBufferSizes)(UINT32,UINT32*,UINT32*); +static LONG (WINAPI *pQueryDisplayConfig)(UINT32,UINT32*,DISPLAYCONFIG_PATH_INFO*,UINT32*,
DISPLAYCONFIG_MODE_INFO*,DISPLAYCONFIG_TOPOLOGY_ID*);
+static LONG (WINAPI *pDisplayConfigGetDeviceInfo)(DISPLAYCONFIG_DEVICE_INFO_HEADER*); static DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
static void init_function_pointers(void) @@ -41,6 +44,8 @@ static void init_function_pointers(void) trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(GetDisplayConfigBufferSizes)
- GET_PROC(QueryDisplayConfig)
- GET_PROC(DisplayConfigGetDeviceInfo) GET_PROC(SetThreadDpiAwarenessContext)
#undef GET_PROC @@ -1096,17 +1101,11 @@ static void test_work_area(void) DestroyWindow(hwnd); }
-static void test_display_config(void) +static void test_get_display_config_buffer_sizes(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);
@@ -1148,6 +1147,174 @@ static void test_display_config(void) ok((modes == 0 || modes == 100) && paths == 0, "got %u, %u\n", modes, paths); }
+static void test_query_display_config(void) +{
- UINT32 paths, modes;
- DISPLAYCONFIG_PATH_INFO pi[10];
- DISPLAYCONFIG_MODE_INFO mi[20];
You are only using one of these array elements.
- LONG ret;
- todo_wine
- {
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, NULL, NULL, NULL, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
Personally I prefer "Expected %d, got %d.\n"
- paths = modes = 0;
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, NULL, &modes, NULL, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- paths = modes = 0;
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, NULL, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- paths = modes = 0;
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, NULL, &modes, mi, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- paths = modes = 0;
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- paths = 0;
- modes = 1;
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- ok (paths == 0, "got %u\n", paths);
- ok (modes == 1, "got %u\n", modes);
- /* Crashes on Windows 10 */
- if (0)
- {
ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, pi, NULL, mi, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, pi, &modes, mi, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- }
- paths = modes = 1;
- ret = pQueryDisplayConfig(0, &paths, pi, &modes, mi, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- paths = modes = 1;
- memset(pi, 0xFF, sizeof(pi[0]));
- memset(mi, 0xFF, sizeof(mi[0]));
- ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL);
- ok(ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
- ok (paths == 1, "got %u\n", paths);
- ok (modes == 1, "got %u\n", modes);
- }
+}
+static void test_display_config_get_device_info(void) +{
- LONG ret;
- DISPLAYCONFIG_SOURCE_DEVICE_NAME source_name;
- DISPLAYCONFIG_TARGET_DEVICE_NAME target_name;
- DISPLAYCONFIG_TARGET_PREFERRED_MODE preferred_mode;
- DISPLAYCONFIG_ADAPTER_NAME adapter_name;
- todo_wine
- {
- ret = pDisplayConfigGetDeviceInfo(NULL);
- ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
- source_name.header.type = 0xFFFF;
- source_name.header.size = 0;
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
- source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
- source_name.header.size = 0;
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
- source_name.header.type = 0xFFFF;
- source_name.header.size = sizeof(source_name.header);
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
- source_name.header.size = sizeof(source_name.header);
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- source_name.header.type = 0xFFFF;
- source_name.header.size = sizeof(source_name);
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
- source_name.header.size = sizeof(source_name) - 1;
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- }
- source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
- source_name.header.size = sizeof(source_name);
- source_name.header.adapterId.LowPart = 0xFFFF;
- source_name.header.adapterId.HighPart = 0xFFFF;
- source_name.header.id = 0;
- ret = pDisplayConfigGetDeviceInfo(&source_name.header);
- ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
- target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
- target_name.header.size = sizeof(target_name) - 1;
- ret = pDisplayConfigGetDeviceInfo(&target_name.header);
- todo_wine
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
- target_name.header.size = sizeof(target_name);
- target_name.header.adapterId.LowPart = 0xFFFF;
- target_name.header.adapterId.HighPart = 0xFFFF;
- target_name.header.id = 0;
- ret = pDisplayConfigGetDeviceInfo(&target_name.header);
- ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
- preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE;
- preferred_mode.header.size = sizeof(preferred_mode) - 1;
- ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
- todo_wine
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE;
- preferred_mode.header.size = sizeof(preferred_mode);
- preferred_mode.header.adapterId.LowPart = 0xFFFF;
- preferred_mode.header.adapterId.HighPart = 0xFFFF;
- preferred_mode.header.id = 0;
- ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
- ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
- adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;
- adapter_name.header.size = sizeof(adapter_name) - 1;
- ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
- todo_wine
- ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
- adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;
- adapter_name.header.size = sizeof(adapter_name);
- adapter_name.header.adapterId.LowPart = 0xFFFF;
- adapter_name.header.adapterId.HighPart = 0xFFFF;
- ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
- ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
Could you add tests for the cases that return success as well? You can get adapter LUID from D3DKMTOpenAdapterFromGdiDisplayName().
+}
+static void test_display_config(void) +{
- if (!pGetDisplayConfigBufferSizes ||
!pQueryDisplayConfig ||
!pDisplayConfigGetDeviceInfo)
- {
win_skip("DisplayConfig APIs are not supported\n");
return;
- }
- test_get_display_config_buffer_sizes();
- test_query_display_config();
- test_display_config_get_device_info();
I think it would be better to split this patch and test each function separately. And let's use test_GetDisplayConfigBufferSizes() for example when testing a particular function for a consistent style.
+}
START_TEST(monitor) { init_function_pointers();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71150
Your paranoid android.
=== w1064v1809_2scr (32 bit report) ===
user32: monitor.c:843: Test failed: ChangeDisplaySettingsExA \.\DISPLAY1 returned unexpected -1 monitor.c:851: Test failed: Expect dmPosition.x 1024, got 0
=== debiant (32 bit report) ===
user32: monitor.c:1182: Test succeeded inside todo block: got 0 monitor.c:1183: Test succeeded inside todo block: got 1 monitor.c:1204: Test succeeded inside todo block: got 1 monitor.c:1205: Test succeeded inside todo block: got 1
=== debiant (32 bit French report) ===
user32: monitor.c:1182: Test succeeded inside todo block: got 0 monitor.c:1183: Test succeeded inside todo block: got 1 monitor.c:1204: Test succeeded inside todo block: got 1 monitor.c:1205: Test succeeded inside todo block: got 1
=== debiant (32 bit Japanese:Japan report) ===
user32: monitor.c:1182: Test succeeded inside todo block: got 0 monitor.c:1183: Test succeeded inside todo block: got 1 monitor.c:1204: Test succeeded inside todo block: got 1 monitor.c:1205: Test succeeded inside todo block: got 1
=== debiant (32 bit Chinese:China report) ===
user32: monitor.c:1182: Test succeeded inside todo block: got 0 monitor.c:1183: Test succeeded inside todo block: got 1 monitor.c:1204: Test succeeded inside todo block: got 1 monitor.c:1205: Test succeeded inside todo block: got 1
=== debiant (32 bit WoW report) ===
user32: monitor.c:1182: Test succeeded inside todo block: got 0 monitor.c:1183: Test succeeded inside todo block: got 1 monitor.c:1204: Test succeeded inside todo block: got 1 monitor.c:1205: Test succeeded inside todo block: got 1
=== debiant (64 bit WoW report) ===
user32: monitor.c:1182: Test succeeded inside todo block: got 0 monitor.c:1183: Test succeeded inside todo block: got 1 monitor.c:1204: Test succeeded inside todo block: got 1 monitor.c:1205: Test succeeded inside todo block: got 1
Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/user32/sysparams.c | 12 +++++++++++- dlls/user32/tests/monitor.c | 3 --- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index a3071912f8..82d7877f3e 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -4503,7 +4503,17 @@ LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCON DISPLAYCONFIG_TOPOLOGY_ID *topologyid) { FIXME("(%08x %p %p %p %p %p)\n", flags, numpathelements, pathinfo, numinfoelements, modeinfo, topologyid); - return ERROR_CALL_NOT_IMPLEMENTED; + + if (!numpathelements || !numinfoelements) + return ERROR_INVALID_PARAMETER; + + if (!*numpathelements || !*numinfoelements) + return ERROR_INVALID_PARAMETER; + + if (!flags) + return ERROR_INVALID_PARAMETER; + + return ERROR_NOT_SUPPORTED; }
/*********************************************************************** diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index a986879293..2dd642f58f 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -1154,8 +1154,6 @@ static void test_query_display_config(void) DISPLAYCONFIG_MODE_INFO mi[20]; LONG ret;
- todo_wine - { ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, NULL, NULL, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
@@ -1203,7 +1201,6 @@ static void test_query_display_config(void) ok(ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret); ok (paths == 1, "got %u\n", paths); ok (modes == 1, "got %u\n", modes); - } }
static void test_display_config_get_device_info(void)
Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/user32/sysparams.c | 50 ++++++++++++++++++++++++++++++++++++- dlls/user32/tests/monitor.c | 6 ----- 2 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 82d7877f3e..20128ec7d8 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -4522,5 +4522,53 @@ LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCON LONG WINAPI DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet) { FIXME("stub: %p\n", packet); - return ERROR_NOT_SUPPORTED; + + if (!packet || packet->size < sizeof(*packet)) + return ERROR_GEN_FAILURE; + + switch (packet->type) + { + case DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME: + { + DISPLAYCONFIG_SOURCE_DEVICE_NAME *source_name = (DISPLAYCONFIG_SOURCE_DEVICE_NAME *)packet; + if (packet->size < sizeof(*source_name)) + return ERROR_INVALID_PARAMETER; + + return ERROR_NOT_SUPPORTED; + } + case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME: + { + DISPLAYCONFIG_TARGET_DEVICE_NAME *target_name = (DISPLAYCONFIG_TARGET_DEVICE_NAME *)packet; + if (packet->size < sizeof(*target_name)) + return ERROR_INVALID_PARAMETER; + + return ERROR_NOT_SUPPORTED; + } + case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE: + { + DISPLAYCONFIG_TARGET_PREFERRED_MODE *preferred_mode = (DISPLAYCONFIG_TARGET_PREFERRED_MODE *)packet; + if (packet->size < sizeof(*preferred_mode)) + return ERROR_INVALID_PARAMETER; + + return ERROR_NOT_SUPPORTED; + } + case DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME: + { + DISPLAYCONFIG_ADAPTER_NAME *adapter_name = (DISPLAYCONFIG_ADAPTER_NAME *)packet; + if (packet->size < sizeof(*adapter_name)) + return ERROR_INVALID_PARAMETER; + + return ERROR_NOT_SUPPORTED; + } + case DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE: + case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE: + case DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION: + case DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION: + case DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO: + case DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE: + case DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL: + default: + FIXME("Unimplemented packet type: %u\n", packet->type); + return ERROR_INVALID_PARAMETER; + } } diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 2dd642f58f..0a086f9e10 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -1211,8 +1211,6 @@ static void test_display_config_get_device_info(void) DISPLAYCONFIG_TARGET_PREFERRED_MODE preferred_mode; DISPLAYCONFIG_ADAPTER_NAME adapter_name;
- todo_wine - { ret = pDisplayConfigGetDeviceInfo(NULL); ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
@@ -1245,7 +1243,6 @@ static void test_display_config_get_device_info(void) source_name.header.size = sizeof(source_name) - 1; ret = pDisplayConfigGetDeviceInfo(&source_name.header); ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret); - }
source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; source_name.header.size = sizeof(source_name); @@ -1258,7 +1255,6 @@ static void test_display_config_get_device_info(void) target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; target_name.header.size = sizeof(target_name) - 1; ret = pDisplayConfigGetDeviceInfo(&target_name.header); - todo_wine ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; @@ -1272,7 +1268,6 @@ static void test_display_config_get_device_info(void) preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE; preferred_mode.header.size = sizeof(preferred_mode) - 1; ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header); - todo_wine ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE; @@ -1286,7 +1281,6 @@ static void test_display_config_get_device_info(void) adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME; adapter_name.header.size = sizeof(adapter_name) - 1; ret = pDisplayConfigGetDeviceInfo(&adapter_name.header); - todo_wine ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;