user32: Handle NULL device and not NULL mode parameters in ChangeDisplaySettingsExW().

This makes sure that user graphics drivers has a valid device name when a
DEVMODE is specified.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-02-11 16:08:59 +08:00 committed by Alexandre Julliard
parent 12fa0ccea5
commit ae157bec34
1 changed files with 9 additions and 0 deletions

View File

@ -3293,12 +3293,21 @@ static void trace_devmode(const DEVMODEW *devmode)
LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
DWORD flags, LPVOID lparam )
{
WCHAR primary_adapter[CCHDEVICENAME];
BOOL def_mode = TRUE;
DEVMODEW dm;
TRACE("%s %p %p %#x %p\n", debugstr_w(devname), devmode, hwnd, flags, lparam);
TRACE("flags=%s\n", _CDS_flags(flags));
if (!devname && devmode)
{
if (!get_primary_adapter(primary_adapter))
return DISP_CHANGE_FAILED;
devname = primary_adapter;
}
if (devmode)
{
trace_devmode(devmode);