Zhiyi Zhang (@zhiyi) commented about dlls/user32/tests/monitor.c:
+ process0 = test_child_process_ChangeDisplaySettingsEx(argv[0], devices[0].name, CDS_FULLSCREEN, exit_event0_name); + + SetEvent(exit_event0); + wait_result = WaitForSingleObject(process0, 5000); + ok(wait_result == WAIT_OBJECT_0, "WaitForSingleObject returned %lx.\n", wait_result); + + wait_for_dm(devices[0].name, 800, 600, TRUE); + wait_for_dm(devices[1].name, 800, 600, TRUE); + + CloseHandle(process0); + } + + CloseHandle(exit_event1); + CloseHandle(exit_event0); + + /* Restore all adapters to their original settings */ You're duplicating this part of the display setting restoration code. Usually, a ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL); is enough for getting rid of test failures. Could you try and see if that's enough? If it still doesn't work, then we could keep it.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5060#note_66097