Rémi Bernon (@rbernon) commented about dlls/win32u/sysparams.c:
monitor.rc_work.bottom = mode.dmPelsHeight; add_monitor( &monitor, &ctx );
for (i = 0; i < ARRAY_SIZE(modes); ++i) add_mode( modes + i, &ctx );
for (i = 0; i < ARRAY_SIZE(modes); ++i) add_mode( modes + i, FALSE, &ctx );
I'd use the new parameter here, to set the current mode for nulldrv, removing the `write_adapter_mode` above. It would make sure the code can be executed.
Also you could take that opportunity to introduce a `is_same_devmode` that you can then copy and use in the drivers to avoid the large if conditionals.
```suggestion:-12+0 if (!read_adapter_mode( ctx.adapter_key, ENUM_CURRENT_SETTINGS, &mode )) { mode = modes[2]; mode.dmFields |= DM_POSITION; } monitor.rc_monitor.right = mode.dmPelsWidth; monitor.rc_monitor.bottom = mode.dmPelsHeight; monitor.rc_work.right = mode.dmPelsWidth; monitor.rc_work.bottom = mode.dmPelsHeight;
add_monitor( &monitor, &ctx ); for (i = 0; i < ARRAY_SIZE(modes); ++i) { if (is_same_devmode( modes + i, &mode )) add_mode( &mode, TRUE, &ctx ); else add_mode( modes + i, FALSE, &ctx ); } ```