Skip to content

Commit

Permalink
win32u: Support QDC_VIRTUAL_MODE_AWARE in NtUserGetDisplayConfigBuffe…
Browse files Browse the repository at this point in the history
…rSizes().

CW-Bug-Id: #24333
  • Loading branch information
Paul Gofman authored and ivyl committed Oct 2, 2024
1 parent 68460d3 commit 1a1f136
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dlls/user32/tests/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ static void test_GetDisplayConfigBufferSizes(void)

paths = modes = 0;
ret = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS | QDC_VIRTUAL_MODE_AWARE, &paths, &modes);
todo_wine ok(!ret || broken(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED) /* before Win10 */, "got %ld\n", ret);
ok(!ret || broken(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED) /* before Win10 */, "got %ld\n", ret);
if (!ret)
ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
}
Expand Down
14 changes: 12 additions & 2 deletions dlls/win32u/sysparams.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ static const WCHAR guid_devinterface_monitorW[] =
{'{','E','6','F','0','7','B','5','F','-','E','E','9','7','-','4','A','9','0','-',
'B','0','7','6','-','3','3','F','5','7','B','F','4','E','A','A','7','}',0};

static const UINT32 qdc_retrieve_flags_mask = QDC_ALL_PATHS | QDC_ONLY_ACTIVE_PATHS | QDC_DATABASE_CURRENT;

#define NEXT_DEVMODEW(mode) ((DEVMODEW *)((char *)((mode) + 1) + (mode)->dmDriverExtra))

/* Cached display device information */
Expand Down Expand Up @@ -2442,7 +2444,7 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in
skip_update = TRUE;
}

switch (flags)
switch (flags & qdc_retrieve_flags_mask)
{
case QDC_ALL_PATHS:
case QDC_ONLY_ACTIVE_PATHS:
Expand All @@ -2452,8 +2454,14 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in
return ERROR_INVALID_PARAMETER;
}

if ((flags & ~(qdc_retrieve_flags_mask | QDC_VIRTUAL_MODE_AWARE)))
{
FIXME( "unsupported flags %#x.\n", flags );
return ERROR_INVALID_PARAMETER;
}

/* FIXME: semi-stub */
if (flags != QDC_ONLY_ACTIVE_PATHS)
if ((flags & qdc_retrieve_flags_mask) != QDC_ONLY_ACTIVE_PATHS)
FIXME( "only returning active paths\n" );

/* NtUserGetDisplayConfigBufferSizes() is called by display drivers to trigger display settings update. */
Expand All @@ -2473,6 +2481,8 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in

*num_path_info = count;
*num_mode_info = count * 2;
if (flags & QDC_VIRTUAL_MODE_AWARE)
*num_mode_info += count;
TRACE( "returning %u paths %u modes\n", *num_path_info, *num_mode_info );
return ERROR_SUCCESS;
}
Expand Down

0 comments on commit 1a1f136

Please sign in to comment.