24#define WIN32_NO_STATUS
46typedef struct DISPLAYCONFIG_GET_SOURCE_DPI_SCALE
49 int minRelativeScaleStep;
50 int curRelativeScaleStep;
51 int maxRelativeScaleStep;
52} DISPLAYCONFIG_GET_SOURCE_DPI_SCALE;
53typedef struct DISPLAYCONFIG_SET_SOURCE_DPI_SCALE
56 int relativeScaleStep;
57} DISPLAYCONFIG_SET_SOURCE_DPI_SCALE;
60DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1);
61DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 2);
78static NTSTATUS (
WINAPI *pD3DKMTOpenAdapterFromGdiDisplayName)(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME*);
85#define GET_PROC(module, func) \
86 p##func = (void *)GetProcAddress(module, #func); \
88 trace("GetProcAddress(%s, %s) failed.\n", #module, #func);
95 GET_PROC(user32, SetThreadDpiAwarenessContext)
96 GET_PROC(user32, GetThreadDpiAwarenessContext)
100 GET_PROC(user32, LogicalToPhysicalPointForPerMonitorDPI)
101 GET_PROC(user32, PhysicalToLogicalPointForPerMonitorDPI)
129 UINT dpi_x = 0, dpi_y = 0;
133 if (!pSetThreadDpiAwarenessContext || !pGetDpiForMonitorInternal)
138 pGetDpiForMonitorInternal(monitor, 0, &dpi_x, &dpi_y);
139 pSetThreadDpiAwarenessContext(old_context);
145 return ((
width *
bpp + 15) >> 3) & ~1;
170 ok(
sscanf(
device->DeviceKey,
"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\%[^\\]\\%04d",
buffer, &
number) == 2,
171 "#%d: wrong DeviceKey %s\n",
index,
device->DeviceKey);
175 *
device->DeviceString,
"#%d: expect DeviceString not empty\n",
index);
190 if (
flags & EDD_GET_DEVICE_INTERFACE_NAME)
192 sscanf(
device->DeviceID,
"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X",
193 &vendor_id, &device_id, &subsys_id, &revision_id) == 4,
198 sscanf(
device->DeviceID,
"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X", &vendor_id, &device_id, &subsys_id,
199 &revision_id) == 4,
"#%d: wrong DeviceID %s\n",
index,
device->DeviceID);
206 static const char device_key_prefix[] =
"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class"
207 "\\{4d36e96e-e325-11ce-bfc1-08002be10318}\\";
208 char monitor_name[32];
215 lstrcpyA(monitor_name, adapter_name);
216 sprintf(monitor_name +
strlen(monitor_name),
"\\Monitor%d", monitor_index);
217 ok(!
strcmp(monitor_name,
device->DeviceName),
"#%d: expect %s, got %s\n", monitor_index, monitor_name,
device->DeviceName);
220 ok(*
device->DeviceString,
"#%d: expect DeviceString not empty\n", monitor_index);
223 ok(
device->StateFlags <= (DISPLAY_DEVICE_ATTACHED | DISPLAY_DEVICE_ACTIVE),
224 "#%d wrong state %#lx\n", monitor_index,
device->StateFlags);
228 if (
flags & EDD_GET_DEVICE_INTERFACE_NAME)
233 sscanf(
device->DeviceID,
"\\\\?\\display#%[^#]#%[^#]#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}",
buffer,
buffer) == 2 ||
235 "#%d: wrong DeviceID : %s\n", monitor_index,
device->DeviceID);
242 "#%d: wrong DeviceID : %s\n", monitor_index,
device->DeviceID);
249 "#%d wrong DeviceKey : %s\n", monitor_index,
device->DeviceKey);
254 static const DWORD flags[] = {0, EDD_GET_DEVICE_INTERFACE_NAME};
256 char adapter_name[32];
266 ok(!
ret,
"Expect failure\n");
274 if (
sscanf(adapter_name,
"\\\\.\\DISPLAYV%d", &
number) == 1)
327#define expect_dm(a, b, c) _expect_dm(__LINE__, a, b, c)
333 memset(&dm, 0,
sizeof(dm));
353 "Device %s test %ld expect dmDisplayFrequency %lu, got %lu\n",
device,
test,
expected->dmDisplayFrequency,
357 "Device %s test %ld expect dmDisplayOrientation %ld, got %ld\n",
device,
test,
expected->dmDisplayOrientation,
361#define wait_for_dm(a, b, c) wait_for_dm_(__LINE__, a, b, c)
368 for (
i = 0;
i < 50; ++
i)
370 memset(&dm, 0,
sizeof(dm));
383 "Device %s expect dmPelsWidth %lu, got %lu\n",
device, expected_width, dm.
dmPelsWidth);
385 "Device %s expect dmPelsHeight %lu, got %lu\n",
device, expected_height, dm.
dmPelsHeight);
390 static const char *cds_event_name =
"test_child_process_cds_event";
399 ok(!!cds_event,
"CreateEventA failed, error %#lx\n",
GetLastError());
405 cds_event_name, exit_event_name);
407 ok(
res,
"CreateProcessA returned unexpected %ld\n",
res);
409 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
414 return info.hProcess;
421 static const char *exit_event0_name =
"test_cds_exit_event0";
422 static const char *exit_event1_name =
"test_cds_exit_event1";
423 static const DWORD depths[] = {8, 16, 32};
426 HANDLE exit_event0, exit_event1;
427 UINT device_size, device_count;
441 memset(&dm, 0,
sizeof(dm));
456 memset(&dm, 0,
sizeof(dm));
461 memset(&dmW, 0,
sizeof(dmW));
470 ok(dm.
dmDriverExtra == 0,
"ChangeDisplaySettingsA didn't reset dmDriverExtra to 0\n");
475 ok(dmW.
dmDriverExtra == 0,
"ChangeDisplaySettingsW didn't reset dmDriverExtra to 0\n");
481 ok(dm.
dmDriverExtra == 1,
"ChangeDisplaySettingsExA shouldn't change dmDriverExtra\n");
486 ok(dmW.
dmDriverExtra == 1,
"ChangeDisplaySettingsExW shouldn't change dmDriverExtra\n");
490 memset(&dm, 0,
sizeof(dm));
504 memset(&dmW, 0,
sizeof(dmW));
528 if (pSetThreadDpiAwarenessContext)
530 memset(&dm, 0,
sizeof(dm));
545 "Unexpected ChangeDisplaySettingsExA() return code for vid_modes_test[%d]: %ld\n",
i,
res);
586 if (pSetThreadDpiAwarenessContext &&
context)
587 pSetThreadDpiAwarenessContext(
context);
596 memset(&dd, 0,
sizeof(dd));
610 primary = device_count;
612 if (device_count >= device_size)
622 devices[device_count].original_mode.dmSize =
sizeof(
devices[device_count].original_mode);
639 if (device_count == 1)
643 memset(&dm, 0,
sizeof(dm));
652 "ChangeDisplaySettingsExA %s returned unexpected %ld\n",
devices[0].
name,
res);
661 ok(
count == old_count,
"Expect monitor count %d, got %d\n", old_count,
count);
669 "ChangeDisplaySettingsExA %s returned unexpected %ld\n",
devices[0].
name,
res);
673 if (device_count >= 2)
681 memset(&dm, 0,
sizeof(dm));
696 ok(
count == old_count,
"Expect monitor count %d, got %d\n", old_count,
count);
705 memset(&dm, 0,
sizeof(dm));
706 memset(&dm2, 0,
sizeof(dm2));
721 memset(&dm2, 0,
sizeof(dm2));
737 memset(&dm3, 0,
sizeof(dm3));
774 memset(&dm, 0,
sizeof(dm));
789 memset(&dm, 0,
sizeof(dm));
798 "Device %s expect dmPelsWidth %lu, got %lu.\n",
801 "Device %s expect dmPelsHeight %lu, got %lu.\n",
811 memset(&dm, 0,
sizeof(dm));
826 ok(
count == old_count - 1,
"Expect monitor count %d, got %d\n", old_count - 1,
count);
834 memset(&dm, 0,
sizeof(dm));
909 memset(&dm, 0,
sizeof(dm));
927 memset(&dm, 0,
sizeof(dm));
934 memset(&dm, 0,
sizeof(dm));
941 memset(&dm2, 0,
sizeof(dm2));
975 memset(&dm, 0,
sizeof(dm));
987 ok((dm.
dmFields & registry_fields) == registry_fields,
"Got unexpected dmFields %#lx.\n", dm.
dmFields);
1008 ok((dm.
dmFields & registry_fields) == registry_fields,
"Got unexpected dmFields %#lx.\n", dm.
dmFields);
1022 if (device_count >= 3)
1026 memset(&dm, 0,
sizeof(dm));
1041 if (device_count >= 2)
1044 memset(&dm, 0,
sizeof(dm));
1052 memset(&dm2, 0,
sizeof(dm2));
1053 dm2.
dmSize =
sizeof(dm2);
1074 memset(&dm2, 0,
sizeof(dm2));
1075 dm2.
dmSize =
sizeof(dm2);
1153 memset(&dm2, 0,
sizeof(dm2));
1154 dm2.
dmSize =
sizeof(dm2);
1168 memset(&dm2, 0,
sizeof(dm2));
1169 dm2.
dmSize =
sizeof(dm2);
1177 win_skip(
"EnumDisplaySettingsA failed\n");
1184 memset(&dm, 0,
sizeof(dm));
1189 memset(&dm2, 0,
sizeof(dm2));
1190 dm2.
dmSize =
sizeof(dm2);
1216 memset(&dm3, 0,
sizeof(dm3));
1217 dm3.
dmSize =
sizeof(dm3);
1221 "Expected %s display mode %d orientation %ld, got %ld.\n",
1224 ok(
i > 0,
"Expected at least one display mode found.\n");
1234 if (device_count == 1)
1242 ok(
mode > 0,
"Expected at least one display mode found.\n");
1249 "ChangeDisplaySettingsExA returned unexpected %ld\n",
res);
1253 win_skip(
"Failed to restore dispay mode.\n");
1255 else if (!device_count)
1257 win_skip(
"No suitable devices found.\n");
1261 memset(&dm, 0,
sizeof(dm));
1266 ok(!!exit_event0,
"CreateEventA failed, error %#lx\n",
GetLastError());
1268 ok(!!exit_event1,
"CreateEventA failed, error %#lx\n",
GetLastError());
1288 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1298 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1312 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1318 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1330 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1340 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1358 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1368 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1379 if (device_count < 2)
1381 skip(
"Only one device found.\n");
1397 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
1421 "ChangeDisplaySettingsExA returned unexpected %ld\n",
res);
1430 HMONITOR monitor, primary, nearest;
1449 {0xdeadbeef,
FALSE},
1457 {0xdeadbeef,
FALSE},
1465 {0xdeadbeef,
FALSE},
1470 ok( primary != 0,
"couldn't get primary monitor\n" );
1473 ok( !monitor,
"got %p, should not get a monitor for an invalid window\n", monitor );
1475 ok( monitor == primary,
"got %p, should get primary %p for MONITOR_DEFAULTTOPRIMARY\n", monitor, primary );
1477 ok( monitor == primary,
"got %p, should get primary %p for MONITOR_DEFAULTTONEAREST\n", monitor, primary );
1481 ok( monitor == primary,
"got %p, should get primary %p\n", monitor, primary );
1484 ok( monitor == primary,
"got %p, should get primary %p\n", monitor, primary );
1487 ok( monitor == primary,
"got %p, should get primary %p\n", monitor, primary );
1492 ok( monitor == primary,
"got %p, should get primary %p\n", monitor, primary );
1497 ok( monitor == primary,
"got %p, should get primary %p\n", monitor, primary );
1502 ok( monitor != primary,
"got primary %p\n", monitor );
1508 while (monitor !=
NULL)
1510 ok( monitor != primary,
"got primary %p\n", monitor );
1514 ok(
ret,
"GetMonitorInfo failed\n" );
1526 ok(
ret == testdatami[
i].
ret,
"GetMonitorInfo returned wrong value\n" );
1528 ok( (
mi.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag isn't set\n" );
1530 ok( !(
mi.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag is set\n" );
1532 memset( &miexw, 0,
sizeof(miexw) );
1533 miexw.
cbSize = testdatamiexw[
i].cbSize;
1535 ok(
ret == testdatamiexw[
i].
ret,
"GetMonitorInfo returned wrong value\n" );
1537 ok( (miexw.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag isn't set\n" );
1539 ok( !(miexw.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag is set\n" );
1545 memset( &miexa, 0,
sizeof(miexa) );
1546 miexa.
cbSize = testdatamiexa[
i].cbSize;
1548 ok(
ret == testdatamiexa[
i].
ret,
"GetMonitorInfo returned wrong value\n" );
1550 ok( (miexa.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag isn't set\n" );
1552 ok( !(miexa.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag is set\n" );
1558 memset( &miexw, 0,
sizeof(miexw) );
1559 miexw.
cbSize = testdatamiexw[
i].cbSize;
1561 ok(
ret == testdatamiexw[
i].
ret,
"GetMonitorInfo returned wrong value\n" );
1563 ok( (miexw.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag isn't set\n" );
1565 ok( !(miexw.
dwFlags & MONITORINFOF_PRIMARY),
"MONITORINFOF_PRIMARY flag is set\n" );
1571 ok( monitor ==
NULL,
"got %p\n", monitor );
1574 ok( monitor == primary,
"got %p, should get primary %p\n", monitor, primary );
1577 ok( monitor == nearest,
"got %p, should get nearest %p\n", monitor, nearest );
1587 ok(
ret,
"GetMonitorInfo failed\n");
1600 RECT rc_work, rc_normal;
1607 ok(!
ret &&
hmon != 0,
"Failed to find primary monitor\n");
1613 ok(
mi.
dwFlags & MONITORINFOF_PRIMARY,
"not a primary monitor\n");
1622 hwnd =
CreateWindowExA(0,
"static",
NULL,
WS_OVERLAPPEDWINDOW|
WS_VISIBLE,100,100,10,10,0,0,0,
NULL);
1623 ok(
hwnd != 0,
"CreateWindowEx failed\n");
1626 ok(
ret,
"GetWindowRect failed\n");
1631 ok(
ret,
"GetWindowPlacement failed\n");
1645 ok(
ret,
"GetWindowPlacement failed\n");
1669 ok(modes == 100,
"got %u\n", modes);
1671 ret = pGetDisplayConfigBufferSizes(0,
NULL,
NULL);
1680 ret = pGetDisplayConfigBufferSizes(0,
NULL, &modes);
1682 ok(modes == 100,
"got %u\n", modes);
1685 paths = modes = 100;
1686 ret = pGetDisplayConfigBufferSizes(0, &
paths, &modes);
1688 ok((modes == 0 || modes == 100) &&
paths == 0,
"got %u, %u\n", modes,
paths);
1690 paths = modes = 100;
1691 ret = pGetDisplayConfigBufferSizes(0xFF, &
paths, &modes);
1693 ok((modes == 0 || modes == 100) &&
paths == 0,
"got %u, %u\n", modes,
paths);
1699 ok(
paths > 0 && modes > 0,
"got %u, %u\n",
paths, modes);
1704 ret = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &
paths, &modes);
1706 ok(
paths > 0 && modes > 0,
"got %u, %u\n",
paths, modes);
1711 ret = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, &
paths, &modes);
1713 ok(
paths > 0 && modes > 0,
"got %u, %u\n",
paths, modes);
1718 ret = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS | QDC_VIRTUAL_MODE_AWARE, &
paths, &modes);
1721 ok(
paths > 0 && modes > 0,
"got %u, %u\n",
paths, modes);
1759 if (!(
mi.
dwFlags & MONITORINFOF_PRIMARY))
1764 memset(&old_dm, 0,
sizeof(old_dm));
1765 old_dm.
dmSize =
sizeof(old_dm);
1770 memset(&dm, 0,
sizeof(dm));
1786 skip(
"Failed to detach %s.\n",
mi.szDevice);
1792 mi2.
cbSize =
sizeof(mi2);
1795 ok(!
ret,
"GetMonitorInfoA succeeded.\n");
1825 HWINSTA winstation, old_winstation;
1826 HDESK desktop, old_desktop;
1838 ok(!
ret,
"EnumDisplayMonitors succeeded.\n");
1839 ok(
error == 0xdeadbeef,
"Expected error %#x, got %#lx.\n", 0xdeadbeef,
error);
1848 ok(
ret,
"EnumDisplayMonitors failed.\n");
1849 ok(
error == 0xdeadbeef,
"Expected error %#x, got %#lx.\n", 0xdeadbeef,
error);
1859 ok(
count == old_count,
"Expected %d, got %d.\n", old_count,
count);
1862 ok(!!winstation && winstation != old_winstation,
"CreateWindowStationW failed, error %#lx.\n",
GetLastError());
1874 ok(!!desktop && desktop != old_desktop,
"CreateDesktopW failed, error %#lx.\n",
GetLastError());
1881 ok(
count == old_count,
"Expected %d, got %d.\n", old_count,
count);
1885 ok(
count == old_count,
"Expected %d, got %d.\n", old_count,
count);
1900 skip(
"FIXME: check_device_path() cannot be built until we add new functions to setupapi\n");
1914 iface_data->
cbSize =
sizeof(*iface_data);
1923 sizeof(iface_detail_buffer),
NULL, &device_data);
1926 ret = SetupDiGetDevicePropertyW(
set, &device_data, &DEVPROPKEY_MONITOR_GPU_LUID, &
type,
1927 (
BYTE *)&luid,
sizeof(luid),
NULL, 0);
1932 win_skip(
"DEVPROPKEY_MONITOR_GPU_LUID is not found, skipping device path check.\n");
1936 ret = SetupDiGetDevicePropertyW(
set, &device_data, &DEVPROPKEY_MONITOR_OUTPUT_ID,
1937 &
type, (
BYTE *)&output_id,
sizeof(output_id),
NULL, 0);
1947 ok(found,
"device_path %s not found, luid %04lx:%04lx.\n",
debugstr_w(device_path), adapter_id->
HighPart,
1955 DISPLAYCONFIG_TARGET_PREFERRED_MODE mode2;
1970 skip(
"Current display mode is already 1024x768, skipping test.\n");
1973 if (
mode->width == 1024 &&
mode->height == 768)
1975 skip(
"Preferred display mode is 1024x768, skipping test.\n");
1979 memset(&dm2, 0,
sizeof(dm2));
1980 dm2.
dmSize =
sizeof(dm2);
1987 skip(
"Can't change display settings, skipping test.\n");
1991 memset(&mode2, 0,
sizeof(mode2));
1992 mode2.header =
mode->header;
1994 lret = pDisplayConfigGetDeviceInfo(&mode2.header);
1995 ok(!lret,
"got %ld\n", lret);
1996 ok(mode2.width ==
mode->width,
"got %u, expected %u.\n", mode2.width,
mode->width);
1997 ok(mode2.height ==
mode->height,
"got %u, expected %u.\n", mode2.height,
mode->height);
2006 UINT32 i, src_mode_idx, tgt_mode_idx;
2008 DISPLAYCONFIG_SOURCE_DEVICE_NAME source_name;
2009 DISPLAYCONFIG_TARGET_DEVICE_NAME target_name;
2010 DISPLAYCONFIG_TARGET_PREFERRED_MODE preferred_mode;
2011 DISPLAYCONFIG_ADAPTER_NAME adapter_name;
2017 source_name.header.size =
sizeof(source_name);
2018 source_name.header.adapterId =
pi[
i].sourceInfo.adapterId;
2019 source_name.header.id =
pi[
i].sourceInfo.id;
2020 source_name.viewGdiDeviceName[0] =
'\0';
2021 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2025 ok(source_name.viewGdiDeviceName[0] !=
'\0',
"Expected GDI device name, got empty string\n");
2027 ok(!
ret,
"Expected 0, got %ld\n",
ret);
2028 ok(source_name.viewGdiDeviceName[0] !=
'\0',
"Expected GDI device name, got empty string\n");
2033 source_name.header.size =
sizeof(source_name);
2034 source_name.header.adapterId.LowPart = 0xFFFF;
2035 source_name.header.adapterId.HighPart = 0xFFFF;
2036 source_name.header.id =
pi[
i].sourceInfo.id;
2037 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2041 target_name.header.size =
sizeof(target_name);
2042 target_name.header.adapterId =
pi[
i].targetInfo.adapterId;
2043 target_name.header.id =
pi[
i].targetInfo.id;
2044 target_name.monitorDevicePath[0] =
'\0';
2045 ret = pDisplayConfigGetDeviceInfo(&target_name.header);
2049 ok(!
ret,
"Expected 0, got %ld\n",
ret);
2051 check_device_path(target_name.monitorDevicePath, &target_name.header.adapterId, target_name.header.id);
2054 preferred_mode.header.size =
sizeof(preferred_mode);
2055 preferred_mode.header.adapterId =
pi[
i].targetInfo.adapterId;
2056 preferred_mode.header.id =
pi[
i].targetInfo.id;
2057 preferred_mode.width = preferred_mode.height = 0;
2058 ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
2062 ok(preferred_mode.width > 0 && preferred_mode.height > 0,
"Expected non-zero height/width, got %ux%u\n",
2063 preferred_mode.width, preferred_mode.height);
2065 ok(!
ret,
"Expected 0, got %ld\n",
ret);
2066 ok(preferred_mode.width > 0 && preferred_mode.height > 0,
"Expected non-zero height/width, got %ux%u\n",
2067 preferred_mode.width, preferred_mode.height);
2073 adapter_name.header.size =
sizeof(adapter_name);
2074 adapter_name.header.adapterId =
pi[
i].sourceInfo.adapterId;
2075 adapter_name.adapterDevicePath[0] =
'\0';
2076 ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
2080 ok(adapter_name.adapterDevicePath[0] !=
'\0',
"Expected adapter device path, got empty string\n");
2082 ok(!
ret,
"Expected 0, got %ld\n",
ret);
2083 ok(adapter_name.adapterDevicePath[0] !=
'\0',
"Expected adapter device path, got empty string\n");
2088 if (
flags & QDC_VIRTUAL_MODE_AWARE)
2090 src_mode_idx =
pi[
i].sourceInfo.sourceModeInfoIdx;
2091 if (src_mode_idx == DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID)
2093 ok(
pi[
i].sourceInfo.cloneGroupId != DISPLAYCONFIG_PATH_CLONE_GROUP_INVALID,
"got cloneGroupId %#x.\n",
2094 pi[
i].sourceInfo.cloneGroupId);
2095 skip(
"Path doesn't contain source modeInfoIdx\n");
2098 ok(
pi[
i].sourceInfo.cloneGroupId == DISPLAYCONFIG_PATH_CLONE_GROUP_INVALID,
"got cloneGroupId %#x.\n",
2099 pi[
i].sourceInfo.cloneGroupId);
2103 src_mode_idx =
pi[
i].sourceInfo.modeInfoIdx;
2104 if (src_mode_idx == DISPLAYCONFIG_PATH_MODE_IDX_INVALID)
2106 skip(
"Path doesn't contain source modeInfoIdx\n");
2110 ok(src_mode_idx < modes,
"Expected index <%d, got %d\n", modes, src_mode_idx);
2111 if (src_mode_idx >= modes)
2116 ok(
pi[
i].sourceInfo.id ==
mi[src_mode_idx].id,
"Expected id %u, got %u\n",
2117 pi[
i].sourceInfo.id,
mi[src_mode_idx].id);
2118 ok(
pi[
i].sourceInfo.adapterId.HighPart ==
mi[src_mode_idx].adapterId.HighPart &&
2119 pi[
i].sourceInfo.adapterId.LowPart ==
mi[src_mode_idx].adapterId.LowPart,
2120 "Expected LUID %08lx:%08lx, got %08lx:%08lx\n",
2121 pi[
i].sourceInfo.adapterId.HighPart,
pi[
i].sourceInfo.adapterId.LowPart,
2122 mi[src_mode_idx].adapterId.HighPart,
mi[src_mode_idx].adapterId.LowPart);
2123 ok(
mi[src_mode_idx].sourceMode.width > 0 &&
mi[src_mode_idx].sourceMode.height > 0,
2124 "Expected non-zero height/width, got %ux%u\n",
2125 mi[src_mode_idx].sourceMode.width,
mi[src_mode_idx].sourceMode.height);
2128 if (
flags & QDC_VIRTUAL_MODE_AWARE)
2130 tgt_mode_idx =
pi[
i].targetInfo.targetModeInfoIdx;
2131 if (tgt_mode_idx == DISPLAYCONFIG_PATH_TARGET_MODE_IDX_INVALID)
2133 skip(
"Path doesn't contain target modeInfoIdx\n");
2139 tgt_mode_idx =
pi[
i].targetInfo.modeInfoIdx;
2140 if (tgt_mode_idx == DISPLAYCONFIG_PATH_MODE_IDX_INVALID)
2142 skip(
"Path doesn't contain target modeInfoIdx\n");
2146 ok(tgt_mode_idx < modes,
"Expected index <%d, got %d\n", modes, tgt_mode_idx);
2147 if (tgt_mode_idx >= modes)
2152 ok(
pi[
i].targetInfo.id ==
mi[tgt_mode_idx].id,
"Expected id %u, got %u\n",
2153 pi[
i].targetInfo.id,
mi[tgt_mode_idx].id);
2154 ok(
pi[
i].targetInfo.adapterId.HighPart ==
mi[tgt_mode_idx].adapterId.HighPart &&
2155 pi[
i].targetInfo.adapterId.LowPart ==
mi[tgt_mode_idx].adapterId.LowPart,
2156 "Expected LUID %08lx:%08lx, got %08lx:%08lx\n",
2157 pi[
i].targetInfo.adapterId.HighPart,
pi[
i].targetInfo.adapterId.LowPart,
2158 mi[tgt_mode_idx].adapterId.HighPart,
mi[tgt_mode_idx].adapterId.LowPart);
2159 ok(
mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.activeSize.cx > 0 &&
2160 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.activeSize.cy > 0,
2161 "Expected non-zero height/width, got %ux%u\n",
2162 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.activeSize.cx,
2163 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.activeSize.cy);
2165 if (
flags == QDC_DATABASE_CURRENT)
2166 ok(
mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cx == 0 &&
2167 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cy == 0,
2168 "Expected zero height/width, got %ux%u\n",
2169 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cx,
2170 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cy);
2172 ok(
mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cx > 0 &&
2173 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cy > 0,
2174 "Expected non-zero height/width, got %ux%u\n",
2175 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cx,
2176 mi[tgt_mode_idx].targetMode.targetVideoSignalInfo.totalSize.cy);
2177 if (
flags & QDC_VIRTUAL_MODE_AWARE)
2179 tgt_mode_idx =
pi[
i].targetInfo.desktopModeInfoIdx;
2180 if (tgt_mode_idx == DISPLAYCONFIG_PATH_DESKTOP_IMAGE_IDX_INVALID)
2182 ok(!(
pi[
i].
flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE),
"got path flags %#x.\n",
pi[
i].
flags);
2183 skip(
"Path doesn't contain target desktopModeInfoIdx.\n");
2186 ok(
pi[
i].
flags & DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE,
"got path flags %#x.\n",
pi[
i].
flags);
2195 ok(
pi[
i].targetInfo.id ==
mi[tgt_mode_idx].id,
"Expected id %u, got %u\n",
2196 pi[
i].targetInfo.id,
mi[tgt_mode_idx].id);
2197 ok(
pi[
i].targetInfo.adapterId.HighPart ==
mi[tgt_mode_idx].adapterId.HighPart &&
2198 pi[
i].targetInfo.adapterId.LowPart ==
mi[tgt_mode_idx].adapterId.LowPart,
2199 "Expected LUID %08lx:%08lx, got %08lx:%08lx\n",
2200 pi[
i].targetInfo.adapterId.HighPart,
pi[
i].targetInfo.adapterId.LowPart,
2201 mi[tgt_mode_idx].adapterId.HighPart,
mi[tgt_mode_idx].adapterId.LowPart);
2202 di = &
mi[tgt_mode_idx].desktopImageInfo;
2204 "Expected zero left/top, got %lux%lu\n",
2208 "Expected non-zero height/width, got %lux%lu\n",
2212 "Expected zero left/top, got %lux%lu\n",
2216 "Expected non-zero height/width, got %lux%lu\n",
2220 "Expected non-zero x/y, got %lux%lu\n",
2258 ok (modes == 1,
"got %u\n", modes);
2279 ret = pQueryDisplayConfig(QDC_DATABASE_CURRENT, &
paths,
pi, &modes,
mi,
NULL);
2294 win_skip(
"QueryDisplayConfig() functionality is unsupported\n");
2299 ok (modes == 1,
"got %u\n", modes);
2305 ret = pQueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &
paths,
pi, &modes,
mi,
NULL);
2307 ok(
paths > 0 && modes > 0,
"got %u, %u\n",
paths, modes);
2308 if (!
ret &&
paths > 0 && modes > 0)
2316 ret = pQueryDisplayConfig(QDC_DATABASE_CURRENT, &
paths,
pi, &modes,
mi, &topologyid);
2318 ok(topologyid != 0xFF,
"expected topologyid to be set, got %d\n", topologyid);
2319 if (!
ret &&
paths > 0 && modes > 0)
2326 ret = pQueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS | QDC_VIRTUAL_MODE_AWARE, &
paths,
pi, &modes,
mi,
NULL);
2329 ok(
paths > 0 && modes > 0,
"got %u, %u\n",
paths, modes);
2330 if (!
ret &&
paths > 0 && modes > 0)
2337 DISPLAYCONFIG_SOURCE_DEVICE_NAME source_name;
2338 DISPLAYCONFIG_TARGET_DEVICE_NAME target_name;
2339 DISPLAYCONFIG_TARGET_PREFERRED_MODE preferred_mode;
2340 DISPLAYCONFIG_ADAPTER_NAME adapter_name;
2342 ret = pDisplayConfigGetDeviceInfo(
NULL);
2345 source_name.header.type = 0xFFFF;
2346 source_name.header.size = 0;
2347 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2351 source_name.header.size = 0;
2352 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2355 source_name.header.type = 0xFFFF;
2356 source_name.header.size =
sizeof(source_name.header);
2357 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2365 source_name.header.size =
sizeof(source_name.header);
2366 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2373 source_name.header.type = 0xFFFF;
2374 source_name.header.size =
sizeof(source_name);
2375 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2383 source_name.header.size =
sizeof(source_name) - 1;
2384 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2392 source_name.header.size =
sizeof(source_name);
2393 source_name.header.adapterId.LowPart = 0xFFFF;
2394 source_name.header.adapterId.HighPart = 0xFFFF;
2395 source_name.header.id = 0;
2396 ret = pDisplayConfigGetDeviceInfo(&source_name.header);
2400 target_name.header.size =
sizeof(target_name) - 1;
2401 ret = pDisplayConfigGetDeviceInfo(&target_name.header);
2409 target_name.header.size =
sizeof(target_name);
2410 target_name.header.adapterId.LowPart = 0xFFFF;
2411 target_name.header.adapterId.HighPart = 0xFFFF;
2412 target_name.header.id = 0;
2413 ret = pDisplayConfigGetDeviceInfo(&target_name.header);
2417 preferred_mode.header.size =
sizeof(preferred_mode) - 1;
2418 ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
2426 preferred_mode.header.size =
sizeof(preferred_mode);
2427 preferred_mode.header.adapterId.LowPart = 0xFFFF;
2428 preferred_mode.header.adapterId.HighPart = 0xFFFF;
2429 preferred_mode.header.id = 0;
2430 ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
2434 adapter_name.header.size =
sizeof(adapter_name) - 1;
2435 ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
2443 adapter_name.header.size =
sizeof(adapter_name);
2444 adapter_name.header.adapterId.LowPart = 0xFFFF;
2445 adapter_name.header.adapterId.HighPart = 0xFFFF;
2446 ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
2452 if (!pGetDisplayConfigBufferSizes ||
2453 !pQueryDisplayConfig ||
2454 !pDisplayConfigGetDeviceInfo)
2456 win_skip(
"DisplayConfig APIs are not supported\n");
2467 static const unsigned int scales[] = {100, 125, 150, 175, 200, 225, 250, 300, 350, 400, 450, 500};
2469 int current_scale, current_scale_idx, recommended_scale_idx, step,
dpi, old_dpi;
2470 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_gdi_desc;
2471 DISPLAYCONFIG_GET_SOURCE_DPI_SCALE get_scale_req;
2472 DISPLAYCONFIG_SET_SOURCE_DPI_SCALE set_scale_req;
2473 D3DKMT_CLOSEADAPTER close_adapter_desc;
2478#define CHECK_FUNC(func) \
2481 win_skip("%s() is unavailable.\n", #func); \
2496 lstrcpyW(open_adapter_gdi_desc.DeviceName,
L"\\\\.\\DISPLAY1");
2497 status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
2500 get_scale_req.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_DPI_SCALE;
2501 get_scale_req.header.size =
sizeof(get_scale_req);
2502 get_scale_req.header.adapterId = open_adapter_gdi_desc.AdapterLuid;
2503 get_scale_req.header.id = open_adapter_gdi_desc.VidPnSourceId;
2504 ret = pDisplayConfigGetDeviceInfo(&get_scale_req.header);
2507 skip(
"DisplayConfigGetDeviceInfo failed, returned %ld.\n",
ret);
2519 current_scale =
dpi * 100 / 96;
2520 for (current_scale_idx = 0; current_scale_idx <
ARRAY_SIZE(scales); ++current_scale_idx)
2522 if (scales[current_scale_idx] == current_scale)
2525 ok(scales[current_scale_idx] == current_scale,
"Failed to find current scale.\n");
2526 recommended_scale_idx = current_scale_idx - get_scale_req.curRelativeScaleStep;
2528 set_scale_req.header.type = DISPLAYCONFIG_DEVICE_INFO_SET_SOURCE_DPI_SCALE;
2529 set_scale_req.header.size =
sizeof(set_scale_req);
2530 set_scale_req.header.adapterId = open_adapter_gdi_desc.AdapterLuid;
2531 set_scale_req.header.id = open_adapter_gdi_desc.VidPnSourceId;
2532 for (step = get_scale_req.minRelativeScaleStep; step <= get_scale_req.maxRelativeScaleStep; ++step)
2534 set_scale_req.relativeScaleStep = step;
2535 ret = pDisplayConfigSetDeviceInfo(&set_scale_req.header);
2536 ok(
ret ==
NO_ERROR,
"DisplayConfigSetDeviceInfo failed, returned %ld.\n",
ret);
2538 dpi = scales[step + recommended_scale_idx] * 96 / 100;
2543 set_scale_req.relativeScaleStep = get_scale_req.curRelativeScaleStep;
2544 ret = pDisplayConfigSetDeviceInfo(&set_scale_req.header);
2545 ok(
ret ==
NO_ERROR,
"DisplayConfigSetDeviceInfo failed, returned %ld.\n",
ret);
2553 close_adapter_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
2554 status = pD3DKMTCloseAdapter(&close_adapter_desc);
2566 monitor = full_monitor;
2593 ok(!
ret,
"GetMonitorInfoW succeeded.\n");
2600 ok(!
ret,
"GetMonitorInfoW succeeded.\n");
2605 monitor = full_monitor;
2621 ok(!
ret,
"GetMonitorInfoW succeeded.\n");
2638#define check_display_dc(a, b, c) _check_display_dc(__LINE__, a, b, c)
2641#if defined(__REACTOS__) && defined(_MSC_VER)
2705 ok_(__FILE__,
line)(
bitmap.bmType == 0,
"Expected bmType %d, got %d.\n", 0,
bitmap.bmType);
2710 ok_(__FILE__,
line)(
bitmap.bmBitsPixel == 32,
"Expected bmBitsPixel %d, got %d.\n", 32,
2715 ok_(__FILE__,
line)(
bitmap.bmPlanes == 1,
"Expected bmPlanes %d, got %d.\n", 1,
bitmap.bmPlanes);
2722 static const INT bpps[] = {1, 4, 8, 16, 24, 32};
2727 DWORD device_idx, mode_idx;
2745 ok(!!
hdc,
"CreateDCA failed.\n");
2747 memset(&dm, 0,
sizeof(dm));
2750 ok(
ret,
"EnumDisplaySettingsA failed.\n");
2775 if (bpps[
i] != 1 && bpps[
i] != display_bpp)
2777 if (bpps[
i] != 1 && bpps[
i] != 32)
2779 ok(!old_hbitmap,
"Selecting bitmap succeeded.\n");
2781 ok(!!old_hbitmap,
"Failed to select bitmap.\n");
2806 ok(!!old_hbitmap,
"Failed to select bitmap.\n");
2810 ok(
value == display_bpp,
"Expected %d, got %d.\n", display_bpp,
value);
2830 ok(
ret,
"EnumDisplaySettingsA failed.\n");
2837 memset(&dm2, 0,
sizeof(dm2));
2838 dm2.
dmSize =
sizeof(dm2);
2846 skip(
"%d-bit display mode not found.\n", bpps[
i]);
2854 "ChangeDisplaySettingsExA returned unexpected %ld.\n",
res);
2860 ok(
value == (bpps[
i] == 4 ? 1 : bpps[
i]),
"Expected %d, got %d.\n",
2861 (bpps[
i] == 4 ? 1 : bpps[
i]),
value);
2873 ok(
value == 1 << bpps[
i],
"Expected %d, got %d.\n", 1 << bpps[
i],
value);
2880 "ChangeDisplaySettingsExA returned unexpected %ld.\n",
res);
2884 ok(
ret,
"EnumDisplaySettingsA failed.\n");
2894 ok(!!old_hbitmap,
"Failed to select bitmap.\n");
2902 ok(!!
hdc2,
"CreateDCA failed.\n");
2904 ok(hbitmap2 == old_hbitmap,
"Expected the same bitmap handle.\n");
2907 memset(&dm2, 0,
sizeof(dm2));
2908 dm2.
dmSize =
sizeof(dm2);
2919 "ChangeDisplaySettingsExA returned unexpected %ld.\n",
res);
2926 ok(hbitmap2 != old_hbitmap,
"Expected a different bitmap handle.\n");
2938 win_skip(
"Failed to find a different resolution.\n");
2943 memset(&dm2, 0,
sizeof(dm2));
2944 dm2.
dmSize =
sizeof(dm2);
2956 "ChangeDisplaySettingsExA returned unexpected %ld.\n",
res);
2974 ok(!!old_hbitmap,
"Failed to select bitmap.\n");
2996 if (bpps[
i] != 1 && bpps[
i] != 32)
2998 ok(!old_hbitmap ||
broken(!!old_hbitmap) ,
2999 "Selecting bitmap succeeded.\n");
3001 ok(!!old_hbitmap ||
broken(!old_hbitmap) ,
3002 "Failed to select bitmap.\n");
3018 win_skip(
"Failed to find a required display mode.\n");
3032 memset(&dm, 0,
sizeof(dm));
3043 memset(&dm2, 0,
sizeof(dm2));
3044 dm2.
dmSize =
sizeof(dm2);
3051 "Failed to find a different resolution for %s.\n", dd.
DeviceName);
3055 "ChangeDisplaySettingsExA %s returned unexpected %ld.\n", dd.
DeviceName,
res);
3066 memset(&dm2, 0,
sizeof(dm2));
3067 dm2.
dmSize =
sizeof(dm2);
3096 memset(&dm3, 0,
sizeof(dm3));
3097 dm3.
dmSize =
sizeof(dm3);
3112 ok(
count == old_count - 1,
"Expected monitor count %d, got %d.\n", old_count - 1,
count);
3138 (
info.dwFlags & MONITORINFOF_PRIMARY) ?
"primary" :
"",
3156 ok(0,
"too few arguments.\n");
3161 ok(
res == 1,
"sscanf returned unexpected %ld.\n",
res);
3168 memset(&dm, 0,
sizeof(dm));
3175 "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
argv[3],
res);
3181 ok(wait_result ==
WAIT_OBJECT_0,
"WaitForSingleObject returned %lx.\n", wait_result);
3185#if !defined(__REACTOS__) || DLL_EXPORT_VERSION >= 0x600
3188 DISPLAYCONFIG_GET_SOURCE_DPI_SCALE req = {.header = {.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_DPI_SCALE, .size =
sizeof(req)}};
3190 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_desc = {{0}};
3191 D3DKMT_CLOSEADAPTER close_desc = {0};
3198 wcscpy( open_desc.DeviceName,
info.szDevice );
3200 ok( !
status,
"D3DKMTOpenAdapterFromGdiDisplayName returned %#lx\n",
status );
3202 req.header.adapterId = open_desc.AdapterLuid;
3203 req.header.id = open_desc.VidPnSourceId;
3204 ret = pDisplayConfigGetDeviceInfo( &req.header );
3206 *
min = req.minRelativeScaleStep;
3207 *
cur = req.curRelativeScaleStep;
3208 *
max = req.maxRelativeScaleStep;
3210 close_desc.hAdapter = open_desc.hAdapter;
3211 status = D3DKMTCloseAdapter( &close_desc );
3217 DISPLAYCONFIG_SET_SOURCE_DPI_SCALE req = {.header = {.type = DISPLAYCONFIG_DEVICE_INFO_SET_SOURCE_DPI_SCALE, .size =
sizeof(req)}};
3219 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_desc = {{0}};
3220 D3DKMT_CLOSEADAPTER close_desc = {0};
3224 if (!pDisplayConfigSetDeviceInfo)
return;
3229 wcscpy( open_desc.DeviceName,
info.szDevice );
3231 ok( !
status,
"D3DKMTOpenAdapterFromGdiDisplayName returned %#lx\n",
status );
3233 req.header.adapterId = open_desc.AdapterLuid;
3234 req.header.id = open_desc.VidPnSourceId;
3235 req.relativeScaleStep =
scale;
3236 ret = pDisplayConfigSetDeviceInfo( &req.header );
3239 close_desc.hAdapter = open_desc.hAdapter;
3240 status = D3DKMTCloseAdapter( &close_desc );
3252#if !defined(__REACTOS__) || DLL_EXPORT_VERSION >= 0x600
3260#define check_physical_dpi(a,b,c,d,e,f) check_physical_dpi_(__LINE__,a,b,c,d,e,f,FALSE)
3263 POINT log = {log_x, log_y}, phy = {phy_x, phy_y},
pt;
3267 ret = pLogicalToPhysicalPointForPerMonitorDPI(
hwnd, &
pt );
3269 ok_(__FILE__,
line)(
ret == expect_ret,
"LogicalToPhysicalPointForPerMonitorDPI returned %u\n",
ret );
3273#define check_logical_dpi(a,b,c,d,e,f) check_logical_dpi_(__LINE__,a,b,c,d,e,f,FALSE)
3276 POINT log = {log_x, log_y}, phy = {phy_x, phy_y},
pt;
3280 ret = pPhysicalToLogicalPointForPerMonitorDPI(
hwnd, &
pt );
3282 ok_(__FILE__,
line)(
ret == expect_ret,
"PhysicalToLogicalPointForPerMonitorDPI returned %u\n",
ret );
3286#define check_logical_physical_dpi(a,b,c,d,e,f) check_logical_physical_dpi_(__LINE__,a,b,c,d,e,f,FALSE)
3296 static const unsigned int scales[] = {100, 125, 150, 175, 200, 225, 250, 300, 350, 400, 450, 500};
3307 RECT virtual = {0}, scaled_virtual = {0}, monitor = {0}, scaled = {0}, primary = {0},
rect,
expect_rect;
3309 UINT ret,
i,
x,
y, expect_width, expect_height;
3310 HWND unaware_hwnd, aware_hwnd, primary_hwnd;
3313 float scale = scales[step], scale_x, scale_y;
3326 scaled = monitor = infos[
i].
rect;
3327 scaled.
right = scaled.left +
MulDiv( scaled.right - scaled.left, 100,
scale );
3328 scaled.bottom = scaled.top +
MulDiv( scaled.bottom - scaled.top, 100,
scale );
3329 UnionRect( &scaled_virtual, &scaled_virtual, &scaled );
3338 ctx = pGetWindowDpiAwarenessContext( unaware_hwnd );
3340 ret = pGetDpiForWindow( unaware_hwnd );
3341 ok(
ret == 96,
"GetDpiForWindow returned %u\n",
ret );
3348 SetRect( &
expect_rect, monitor.left + 100, monitor.top + 100, monitor.left + 200, monitor.top + 200 );
3354 monitor.left + 99, monitor.top + 99,
FALSE );
3362 monitor.left + 201, monitor.top + 201,
FALSE );
3373 if (
tests[
i]) old_ctx = pSetThreadDpiAwarenessContext(
tests[
i] );
3374 cur_ctx = pGetThreadDpiAwarenessContext();
3379 ok(
ret ==
virtual.
left,
"got SM_XVIRTUALSCREEN %d\n",
ret );
3381 ok(
ret ==
virtual.
top,
"got SM_YVIRTUALSCREEN %d\n",
ret );
3385 expect_width =
virtual.right -
virtual.left;
3386 expect_height =
virtual.bottom -
virtual.top;
3390 expect_width = scaled_virtual.right - scaled_virtual.left;
3391 expect_height = scaled_virtual.bottom - scaled_virtual.top;
3394 ok(
ret == expect_width,
"got SM_CXVIRTUALSCREEN %d\n",
ret );
3396 ok(
ret == expect_height,
"got SM_CYVIRTUALSCREEN %d\n",
ret );
3398 if (monitor.left || monitor.top)
3400 expect_width = primary.right - primary.left;
3401 expect_height = primary.bottom - primary.top;
3403 else if (monitor_aware)
3405 expect_width = monitor.right - monitor.left;
3406 expect_height = monitor.bottom - monitor.top;
3410 expect_width = scaled.right - scaled.left;
3411 expect_height = scaled.bottom - scaled.top;
3414 ok(
ret == expect_width,
"got SM_CXSCREEN %d\n",
ret );
3416 ok(
ret == expect_height,
"got SM_CYSCREEN %d\n",
ret );
3419 ok( !!
hdc,
"GetDC failed\n" );
3421 ok(
ret == system_dpi,
"got LOGPIXELSX %d\n",
ret );
3423 ok(
ret == system_dpi,
"got LOGPIXELSY %d\n",
ret );
3425 ok(
ret == expect_width,
"got HORZRES %u\n",
ret );
3427 ok(
ret == expect_height,
"got VERTRES %u\n",
ret );
3432 ok(
mi.
dwFlags == (monitor.left || monitor.top ? 0 : MONITORINFOF_PRIMARY),
"got dwFlags %#lx\n",
mi.
dwFlags );
3447 ok(
x ==
MulDiv( system_dpi,
scale, 100 ),
"got MDT_EFFECTIVE_DPI x %d\n",
x );
3448 ok(
y ==
MulDiv( system_dpi,
scale, 100 ),
"got MDT_EFFECTIVE_DPI y %d\n",
y );
3452 ok(
x == system_dpi,
"got MDT_EFFECTIVE_DPI x %d\n",
x );
3453 ok(
y == system_dpi,
"got MDT_EFFECTIVE_DPI y %d\n",
y );
3458 if (monitor_aware && !is_virtual)
3460 ok(
x == phys->
ang_x,
"got MDT_ANGULAR_DPI x %u\n",
x );
3461 ok(
y == phys->
ang_y,
"got MDT_ANGULAR_DPI y %u\n",
y );
3463 else if (monitor_aware)
3465 todo_wine ok(
fabs(
x - system_dpi * scale_x ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI x %u\n",
x );
3466 todo_wine ok(
fabs(
y - system_dpi * scale_y ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI y %u\n",
y );
3468 else if (!is_virtual)
3475 todo_wine ok(
fabs(
x - system_dpi * scale_x * 100 /
scale ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI x %d\n",
x );
3476 todo_wine ok(
fabs(
y - system_dpi * scale_y * 100 /
scale ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI y %d\n",
y );
3483 ok(
x == 0,
"got MDT_RAW_DPI x %u\n",
x );
3484 ok(
y == 0,
"got MDT_RAW_DPI y %u\n",
y );
3486 else if (monitor_aware && !is_virtual)
3488 ok(
x == phys->
raw_x,
"got MDT_RAW_DPI x %u\n",
x );
3489 ok(
y == phys->
raw_y,
"got MDT_RAW_DPI y %u\n",
y );
3491 else if (monitor_aware)
3493 todo_wine ok(
fabs(
x - system_dpi * scale_x ) < system_dpi * 0.05,
"got MDT_RAW_DPI x %u\n",
x );
3494 todo_wine ok(
fabs(
y - system_dpi * scale_y ) < system_dpi * 0.05,
"got MDT_RAW_DPI y %u\n",
y );
3496 else if (!is_virtual)
3503 todo_wine ok(
fabs(
x - system_dpi * scale_x * 100 /
scale ) < system_dpi * 0.05,
"got MDT_RAW_DPI x %d\n",
x );
3504 todo_wine ok(
fabs(
y - system_dpi * scale_y * 100 /
scale ) < system_dpi * 0.05,
"got MDT_RAW_DPI y %d\n",
y );
3508 ctx = pGetWindowDpiAwarenessContext( unaware_hwnd );
3510 ret = pGetDpiForWindow( unaware_hwnd );
3511 ok(
ret == 96,
"GetDpiForWindow returned %u\n",
ret );
3520 else SetRect( &
expect_rect, monitor.left + 100, monitor.top + 100, monitor.left + 200, monitor.top + 200 );
3530 ctx = pGetWindowDpiAwarenessContext( aware_hwnd );
3532 ok(
ctx == cur_ctx,
"GetWindowDpiAwarenessContext returned %p vs %p\n",
ctx, cur_ctx );
3533 ret = pGetDpiForWindow( aware_hwnd );
3534 if (monitor_aware)
ok(
ret ==
MulDiv( 96,
scale, 100 ),
"GetDpiForWindow returned %u\n",
ret );
3535 else ok(
ret == 96,
"GetDpiForWindow returned %u\n",
ret );
3552 ctx = pGetWindowDpiAwarenessContext( primary_hwnd );
3554 ok(
ctx == cur_ctx,
"GetWindowDpiAwarenessContext returned %#Ix\n", (
UINT_PTR)
ctx );
3555 ret = pGetDpiForWindow( primary_hwnd );
3556 if (!monitor_aware)
ok(
ret == 96,
"GetDpiForWindow returned %u\n",
ret );
3558 else ok(
ret == 96,
"GetDpiForWindow returned %u\n",
ret );
3565 SetRect( &
expect_rect, primary.left + 300, primary.top + 300, primary.left + 400, primary.top + 400 );
3572 monitor.left + 99, monitor.top + 99,
FALSE );
3576 monitor.left + 100, monitor.top + 100,
FALSE,
TRUE );
3593 monitor.left + 201, monitor.top + 201,
FALSE );
3630 primary.left + 299, primary.top + 299,
FALSE );
3631 if (monitor_aware || !
EqualRect( &monitor, &primary ))
3634 primary.left + 300, primary.top + 300,
TRUE );
3636 primary.left + 400, primary.top + 400,
TRUE );
3638 primary.left + 401, primary.top + 401,
FALSE );
3647 check_physical_dpi( primary_hwnd, primary.left + 401, primary.top + 401, primary.left + 401, primary.top + 401,
FALSE );
3658 if (
tests[
i]) pSetThreadDpiAwarenessContext( old_ctx );
3689 ok(
ret,
"EnumDisplayMonitors failed\n" );
3702 mode.dmBitsPerPel = 32;
3722 float scale_x, scale_y;
3725 if (!pGetDpiForMonitorInternal || !pSetThreadDpiAwarenessContext)
3727 win_skip(
"GetDpiForMonitorInternal / SetThreadDpiAwarenessContext not found, skipping tests\n" );
3732 system_dpi = pGetDpiForSystem();
3735 ok(
count > 0,
"Found zero monitors\n" );
3739 memcpy( phys_infos, infos,
sizeof(infos) );
3742 is_virtual =
abs( (
int)infos[0].ang_x - (
int)system_dpi ) < system_dpi * 0.05 &&
3743 abs( (
int)infos[0].ang_y - (
int)system_dpi ) < system_dpi * 0.05 &&
3744 abs( (
int)infos[0].raw_x - (
int)system_dpi ) < system_dpi * 0.05 &&
3745 abs( (
int)infos[0].raw_y - (
int)system_dpi ) < system_dpi * 0.05;
3754 scale_x = (infos[
i].
rect.
right - infos[
i].
rect.
left) / (
float)(phys_infos[
i].rect.right - phys_infos[
i].rect.left);
3755 scale_y = (infos[
i].
rect.
bottom - infos[
i].
rect.
top) / (
float)(phys_infos[
i].rect.bottom - phys_infos[
i].rect.top);
3759 ok( dpi_x == system_dpi,
"got MDT_EFFECTIVE_DPI x %u\n", dpi_x );
3760 ok( dpi_y == system_dpi,
"got MDT_EFFECTIVE_DPI y %u\n", dpi_y );
3765 ok( dpi_x == phys_infos[
i].ang_x,
"got MDT_ANGULAR_DPI x %u\n", dpi_x );
3766 ok( dpi_y == phys_infos[
i].ang_y,
"got MDT_ANGULAR_DPI y %u\n", dpi_y );
3771 ok(
fabs( dpi_x - system_dpi * scale_x ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI x %u\n", dpi_x );
3773 ok(
fabs( dpi_y - system_dpi * scale_y ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI y %u\n", dpi_y );
3779 ok( dpi_x == 0,
"got MDT_RAW_DPI x %u\n", dpi_x );
3780 ok( dpi_y == 0,
"got MDT_RAW_DPI y %u\n", dpi_y );
3782 else if (!is_virtual)
3784 ok( dpi_x == phys_infos[
i].raw_x,
"got MDT_RAW_DPI x %u\n", dpi_x );
3785 ok( dpi_y == phys_infos[
i].raw_y,
"got MDT_RAW_DPI y %u\n", dpi_y );
3790 ok(
fabs( dpi_x - system_dpi * scale_x ) < system_dpi * 0.05,
"got MDT_RAW_DPI x %u\n", dpi_x );
3792 ok(
fabs( dpi_y - system_dpi * scale_y ) < system_dpi * 0.05,
"got MDT_RAW_DPI y %u\n", dpi_y );
3799 ok( dpi_x == system_dpi,
"got MDT_EFFECTIVE_DPI x %u\n", dpi_x );
3800 ok( dpi_y == system_dpi,
"got MDT_EFFECTIVE_DPI y %u\n", dpi_y );
3805 ok( dpi_x == phys_infos[
i].ang_x,
"got MDT_ANGULAR_DPI x %u\n", dpi_x );
3806 ok( dpi_y == phys_infos[
i].ang_y,
"got MDT_ANGULAR_DPI y %u\n", dpi_y );
3811 ok(
fabs( dpi_x - system_dpi * scale_x ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI x %u\n", dpi_x );
3813 ok(
fabs( dpi_y - system_dpi * scale_y ) < system_dpi * 0.05,
"got MDT_ANGULAR_DPI y %u\n", dpi_y );
3819 ok( dpi_x == 0,
"got MDT_RAW_DPI x %u\n", dpi_x );
3820 ok( dpi_y == 0,
"got MDT_RAW_DPI y %u\n", dpi_y );
3822 else if (!is_virtual)
3824 ok( dpi_x == phys_infos[
i].raw_x,
"got MDT_RAW_DPI x %u\n", dpi_x );
3825 ok( dpi_y == phys_infos[
i].raw_y,
"got MDT_RAW_DPI y %u\n", dpi_y );
3830 ok(
fabs( dpi_x - system_dpi * scale_x ) < system_dpi * 0.05,
"got MDT_RAW_DPI x %u\n", dpi_x );
3832 ok(
fabs( dpi_y - system_dpi * scale_y ) < system_dpi * 0.05,
"got MDT_RAW_DPI y %u\n", dpi_y );
3835 pSetThreadDpiAwarenessContext( old_ctx );
3840 pSetThreadDpiAwarenessContext( old_ctx );
3842#if !defined(__REACTOS__) || DLL_EXPORT_VERSION >= 0x600
3853 skip(
"Cannot change monitor %p dpi, skipping tests\n", infos[
i].
handle );
3877 printf(
"Monitor information:\n");
static void startup(void)
static const char * wine_dbgstr_point(const POINT *ppt)
static const char * wine_dbgstr_rect(const RECT *prc)
#define RegCloseKey(hKey)
#define ERROR_INSUFFICIENT_BUFFER
#define DEFINE_DEVPROPKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid)
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define ERROR_NOT_SUPPORTED
#define ERROR_INVALID_HANDLE
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
LPSTR WINAPI CharLowerA(char *str)
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
DWORD WINAPI GetVersion(void)
_ACRTIMP double __cdecl fabs(double)
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
BOOL WINAPI GetDpiForMonitorInternal(_In_ HMONITOR monitor, _In_ UINT type, _Out_ UINT *x, _Out_ UINT *y)
UINT WINAPI GetDpiForWindow(_In_ HWND hWnd)
UINT WINAPI GetDpiForSystem(VOID)
static struct all_devices * devices
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(_Inout_ D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *unnamedParam1)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLenum GLenum GLenum GLenum scale
GLdouble GLdouble GLdouble GLdouble top
GLsizei const GLuint * paths
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
#define todo_wine_if(is_todo)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
#define memcpy(s1, s2, n)
static struct test_info tests[]
#define DESKTOP_ALL_ACCESS
#define expect_rect(r, _left, _top, _right, _bottom)
static unsigned int number
static PROCESS_INFORMATION pi
UINT WINAPI process1(MSIHANDLE hinst)
#define check_logical_physical_dpi(a, b, c, d, e, f)
static BOOL CALLBACK find_primary_mon(HMONITOR hmon, HDC hdc, LPRECT rc, LPARAM lp)
BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
static void test_enumdisplaydevices(void)
static BOOL CALLBACK test_EnumDisplayMonitors_return_false_cb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam)
static void check_physical_dpi_(int line, HWND hwnd, UINT log_x, UINT log_y, UINT phy_x, UINT phy_y, BOOL expect_ret, BOOL todo_ret)
static void _expect_dm(INT line, const DEVMODEA *expected, const CHAR *device, DWORD test)
static BOOL CALLBACK test_EnumDisplayMonitors_count(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam)
static void test_enumdisplaydevices_monitor(int monitor_index, const char *adapter_name, DISPLAY_DEVICEA *device, DWORD flags)
static void init_function_pointers(void)
static void check_device_path(const WCHAR *device_path, const LUID *adapter_id, DWORD id)
#define check_display_dc(a, b, c)
static BOOL CALLBACK enum_monitor_rect(HMONITOR handle, HDC hdc, RECT *rect, LPARAM lparam)
static unsigned int get_primary_dpi(void)
static int get_bitmap_stride(int width, int bpp)
static void test_display_dc(void)
static void test_monitor_dpi(void)
#define expect_dm(a, b, c)
#define wait_for_dm(a, b, c)
static void test_monitors(void)
#define check_physical_dpi(a, b, c, d, e, f)
static void get_monitor_infos(struct monitor_info *infos)
static const struct vid_mode vid_modes_test[]
static void flush_events(void)
static void test_monitor_dpi_awareness(const struct monitor_info *infos, UINT count, int step, UINT system_dpi, const struct monitor_info *info, struct monitor_info *phys, BOOL is_virtual)
static void set_monitor_dpi_scale(HMONITOR monitor, int scale)
static BOOL CALLBACK test_EnumDisplayMonitors_normal_cb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam)
static BOOL CALLBACK test_handle_proc(HMONITOR full_monitor, HDC hdc, LPRECT rect, LPARAM lparam)
static void test_DisplayConfigGetDeviceInfo(void)
static BOOL set_display_settings(HMONITOR monitor, UINT width, UINT height)
static BOOL CALLBACK enum_monitor_infos(HMONITOR handle, HDC hdc, RECT *rect, LPARAM lparam)
static void test_QueryDisplayConfig(void)
static void test_ChangeDisplaySettingsEx(int argc, char **argv)
static UINT32 UINT32 *static UINT
static void check_logical_dpi_(int line, HWND hwnd, UINT phy_x, UINT phy_y, UINT log_x, UINT log_y, BOOL expect_ret, BOOL todo_ret)
static void test_DisplayConfigSetDeviceInfo(void)
static void get_monitor_dpi_scale(HMONITOR monitor, int *min, int *cur, int *max)
static void wait_for_dm_(int line, const char *device, DWORD expected_width, DWORD expected_height)
static BOOL CALLBACK test_EnumDisplayMonitors_invalid_handle_cb(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam)
static void test_display_config(void)
static void test_GetDisplayConfigBufferSizes(void)
static void test_enumdisplaydevices_adapter(int index, const DISPLAY_DEVICEA *device, DWORD flags)
static void check_preferred_mode(const DISPLAYCONFIG_TARGET_PREFERRED_MODE *mode, const WCHAR *gdi_device_name)
static void test_work_area(void)
#define GET_PROC(module, func)
static HANDLE test_child_process_ChangeDisplaySettingsEx(const char *argv0, const char *device, DWORD flags, const char *exit_event_name)
static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_todo)
static void test_QueryDisplayConfig_result(UINT32 flags, UINT32 paths, const DISPLAYCONFIG_PATH_INFO *pi, UINT32 modes, const DISPLAYCONFIG_MODE_INFO *mi)
static void test_handles(void)
static void test_EnumDisplayMonitors(void)
static void check_logical_physical_dpi_(int line, HWND hwnd, UINT log_x, UINT log_y, UINT phy_x, UINT phy_y, BOOL expect_ret, BOOL todo_ret)
static DPI_AWARENESS_CONTEXT
static void test_fullscreen(void)
unsigned __int3264 UINT_PTR
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
HMONITOR WINAPI MonitorFromPoint(POINT, DWORD)
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
static HANDLE ULONG_PTR dwData
#define WS_OVERLAPPEDWINDOW
int winetest_get_mainargs(char ***pargv)
int winetest_platform_is_wine
#define DIGCF_DEVICEINTERFACE
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
static char argv0[MAX_PATH]
WCHAR DevicePath[ANYSIZE_ARRAY]
DWORD dmDisplayOrientation
BITMAPINFOHEADER bmiHeader
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
#define FIELD_OFFSET(t, f)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode, DWORD dwFlags)
LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
BOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEA lpDisplayDevice, DWORD dwFlags)
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
BOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode, DWORD dwflags)
LONG WINAPI ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
LONG WINAPI ChangeDisplaySettingsA(LPDEVMODEA lpDevMode, DWORD dwflags)
LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numPathArrayElements, DISPLAYCONFIG_PATH_INFO *pathArray, UINT32 *numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO *modeInfoArray, DISPLAYCONFIG_TOPOLOGY_ID *currentTopologyId)
LONG WINAPI DisplayConfigSetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet)
DISPLAYCONFIG_TOPOLOGY_ID
LONG WINAPI DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet)
@ DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME
@ DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME
@ DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME
@ DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE
@ DISPLAYCONFIG_MODE_INFO_TYPE_TARGET
@ DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE
@ DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE
LONG WINAPI GetDisplayConfigBufferSizes(UINT32 flags, UINT32 *numPathArrayElements, UINT32 *numModeInfoArrayElements)
DPI_AWARENESS_CONTEXT WINAPI GetWindowDpiAwarenessContext(HWND hwnd)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentThreadId(void)
#define EVENT_MODIFY_STATE
HWINSTA WINAPI GetProcessWindowStation(void)
#define DPI_AWARENESS_CONTEXT_UNAWARE
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED
#define ERROR_GEN_FAILURE
#define ERROR_INVALID_MONITOR_HANDLE
#define DM_DISPLAYFREQUENCY
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
struct _devicemodeW DEVMODEW
#define DISPLAY_DEVICE_PRIMARY_DEVICE
#define DM_DISPLAYORIENTATION
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
BOOL WINAPI DeleteDC(_In_ HDC)
#define HKEY_CURRENT_USER
HDESK WINAPI GetThreadDesktop(_In_ DWORD)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define SM_CYVIRTUALSCREEN
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI GetClipCursor(_Out_ LPRECT)
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
HWINSTA WINAPI CreateWindowStationW(_In_opt_ LPCWSTR lpwinsta, _In_ DWORD dwFlags, _In_ ACCESS_MASK dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define DISP_CHANGE_BADMODE
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
#define DISP_CHANGE_SUCCESSFUL
struct tagMONITORINFOEXA MONITORINFOEXA
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define ENUM_REGISTRY_SETTINGS
BOOL WINAPI EnumDisplayMonitors(_In_opt_ HDC, _In_opt_ LPCRECT, _In_ MONITORENUMPROC, _In_ LPARAM)
BOOL WINAPI CloseWindowStation(_In_ HWINSTA)
#define DISP_CHANGE_BADPARAM
struct tagMONITORINFOEXW MONITORINFOEXW
#define CDS_UPDATEREGISTRY
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
BOOL WINAPI SetProcessWindowStation(_In_ HWINSTA)
#define DISP_CHANGE_BADFLAGS
#define DISP_CHANGE_FAILED
#define SM_CXVIRTUALSCREEN
#define WINSTA_ALL_ACCESS
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define ENUM_CURRENT_SETTINGS
BOOL WINAPI GetMonitorInfoA(_In_ HMONITOR, _Inout_ LPMONITORINFO)
HDC WINAPI GetDC(_In_opt_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
struct tagMONITORINFO MONITORINFO
BOOL WINAPI SystemParametersInfoA(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define SM_XVIRTUALSCREEN
BOOL WINAPI CloseDesktop(_In_ HDESK)
#define DISP_CHANGE_RESTART
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetUserObjectInformationW(_In_ HANDLE hObj, _In_ int nIndex, _In_reads_bytes_(nLength) PVOID pvInfo, _In_ DWORD nLength)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)
#define SM_YVIRTUALSCREEN
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define RtlEqualLuid(Luid1, Luid2)