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 --- dlls/user32/sysparams.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index e3919ad1b1..c5c98a7ea1 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -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);